texstudio icon indicating copy to clipboard operation
texstudio copied to clipboard

vim editing

Open davidwbulger opened this issue 7 years ago • 15 comments

I would love to be able to use vim editing within TeXstudio. If that is already available, I have not found the right setting. But, just now, I tried to search the issue tracker for other vim requests, and accidentally searched the code as well, and saw this encouraging remark in qeditor.cpp: "QEditor can be given an InputBinding which can change the way it handle user inputs which enables such things as implementing emacs-like or Vi-like editing (almost) effortlessly." So is this in development?

Environment

  • TeXstudio: 2.12.6
  • Qt: 5.9.1
  • OS: Windows10
  • TeX distribution: miktex

davidwbulger avatar May 24 '18 02:05 davidwbulger

no plan for it, no work done If someone wants to provide code, it may be welcome.

sunderme avatar May 24 '18 06:05 sunderme

+1 !! I am sometimes thinking to switch to vim for tex editing (which now I use mainly for C/python coding), but then I think of the fantastic features of texstudio (e.g. pdf preview, code completion, \ref suggestions etc.) and all the time that I would need to set them up properly in vim... So, having vim keybindings and modes in texstudio would be agame changer!

francescoboc avatar Apr 17 '20 10:04 francescoboc

Duplicate of #53. If this is still open in 4 months I will do this myself.

ZirconCode avatar Jun 04 '20 21:06 ZirconCode

Wow, that would be awesome. I've ended up going very low-tech, the last couple of years, editing directly in vim, with this in my vimrc:

" HOMEBAKED LaTeX: PRESS F5 TO GET EITHER ERROR MESSAGES OR A PDF PREVIEW IN CHROME:
function! Pdflatexcurrentfile()
  if bufname("%") =~ ".tex$"
    update
    let texout=system("pdflatex -interaction=nonstopmode " . bufname("%"))
    if texout =~ "\n! "
      vsplit __pdflatex_error_messages__
      normal! 1GdG
      setlocal buftype=nofile
      call append(0, split(texout, '\v\n'))
    else
      let texout=system("pdflatex -interaction=nonstopmode " . bufname("%"))
      silent !start "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --incognito "%:p:r:s,$,.pdf,"
    endif
  else
    echo "Not a LaTeX file."
  endif
endfunction

nnoremap <F5> :call Pdflatexcurrentfile()<CR>

But vim bindings could totally tempt me back to texstudio.

davidwbulger avatar Jun 04 '20 23:06 davidwbulger

still no plans?

raffaem avatar Jun 06 '22 14:06 raffaem

nope

sunderme avatar Jun 06 '22 19:06 sunderme

Does anyone have any suggestions on how to go about adding this feature in TeXstudio? Like, initial pointers.

How to add a Vim option in Settings. How to add Command and Insert modes to TeXstudio. I believe the initial steps are the toughest. Navigation and basic shortcuts first. Interaction with other TeXstudio features second. Visual mode can be added later.

I'd really like to contribute, but I'm completely lost :/

Something like VSCode's or PyCharm's Vim extensions (maybe even Neovim) would be great.

bva99 avatar Oct 13 '23 13:10 bva99

I definetly support this effort :+1: I wonder if the editor is based on something existing that may already have some support for vim protocol? Something in Qt?

Edit: quick look, seems to be based on something called QCodeEdit. May be that the effort has been abandoned and is alive in TexStudio only?

jle1n0 avatar Oct 14 '23 07:10 jle1n0

nothing yet? :(

Ahmed-Zahran-AZ avatar Mar 21 '24 03:03 Ahmed-Zahran-AZ

I have found this . Maybe it can be used with the texstudio editor widget.

Ahmed-Zahran-AZ avatar Mar 25 '24 11:03 Ahmed-Zahran-AZ

if someone wants vim commands in txs, they have to implement it themselves. It is lots of work and no benefit for non-users.

sunderme avatar Mar 25 '24 11:03 sunderme