6

Manually toggling :set paste/:set nopaste as suggested by francois P is cumbersome, and resetting the TERM variable as evaristegd suggests is a very bad idea as explained in the comments (which hint at the better solution below). The best solutions that I could find are explained here, and I'll briefly repeat them below. Background The central concept for ...


4

You can specify commands to be run using the -c argument. Therefore, this should work for you: vim -c 'terminal ++curwin' -c 'vertical terminal' If your goal is just to have two terminal windows side-by-side, there are also non-vim solutions to this which may be more appropriate depending on your use case e.g. GNU screen, tmux.


3

Short answer: use :terminal {command} for interactive stuff. Long answer: neovim’s :! actually communicates via subprocesses and the commands are not directly interactive due to the way the IO streams are handled. :terminal is envisioned as the replacement for this, since it does use a TTY and is interactive.


3

Not 100% sure if this is what you mean, but for me, when I'm running in the Linux console, $TERM is set to linux, and when I'm running in a terminal emulator it's set to e.g. xterm. (In GUI Vim it's entirely empty.) So: if $TERM == 'linux' set background=dark endif


3

This appears to be a genuine bug in vim, which was fixed by the patch 8.2.2428. Both the Arch and Debian packages have now been updated to include this patch, so pacman -Syu or apt-get upgrade (respectively) will fix the problem. The escape sequence terminal emulators send when they gain focus is \<Esc>[I. When the ttymouse vim option has been cleared, ...


3

You can't change colorscheme for a single window in vim (and probably in neovim too). But if you speak about different colors of regular neovim windows and built-in terminals, you can play around g:terminal_color_0..15. Usually modern colorschemes use them to set terminal colors to match colorscheme, e.g.: let g:terminal_color_0 = '#1c1c1c' let g:...


3

Is there a reason you open each file in a different tab with -p? The standard way to open multiple files is to open them in different buffers. See this answer for more about buffers vs windows vs tabs. You can cycle through the buffer displayed in the top window with :bnext and similar. The workflow I would suggest to achieve what you want would be ...


3

I know this is a few years late, but you can use nmap <Down> <C-e> nmap <Up> <C-y> This worked for me.


3

vim built with gui support allows ":tab drop " even in terminal mode, for example the ubuntu vim-gtk3 package supports it.


2

:hide enew is what the OP asked for. This will hide - not destroy - whatever is in the current buffer of the current window and open a new NO-FILE in-memory-only buffer.


2

:terminal spawns a new shell in a Vim window, so you can see a program compiling or producing some output at the same time you edit another normal buffer. Also, by pressing <CTRL-W>N, Vim can operate on the read-only terminal buffer, with yanking, Vim navigation, etc. :shell also spawns a new shell, but this is a full terminal window shell (it is not ...


2

Section :help terminal-api includes a thorough description of the API and also an example function: function Tapi_Impression(bufnum, arglist) if len(a:arglist) == 2 echomsg "impression " . a:arglist[0] echomsg "count " . a:arglist[1] endif endfunc Then inside a :term you can call this function by sending a special sequence ...


2

You need to pass :term the ++shell option. From :help :term: ++shell: Instead of executing {command} directly, use a shell, like with :!command. This should work: function! TryF() terminal ++rows=10 ++shell cd %:h && ls endfunction


2

:! runs the command in a (usually non-interactive) shell. See chapter 21 of the user manual and :h :! for more information. This is different to :term which runs an interactive terminal in a vim window. This is a relative new feature which vim needs to have been compiled with, the details of which can be found at :h terminal. If you want to type in the ...


2

As per Neovim issue #14543 this appears to be a consequence of using Flatpak. after installing the flatpak io.neovim.nvim you can't run e.g. :terminal or say !latexmk as /usr/bin and there a like are not accessible from within the flatpak. I switched back to the regular dnf package for Neovim and the problem goes away.


2

I too had encountered a similar problem. In my case, there was a missing (external) executable, leading to an error in Vim on startup, thus preventing lightline from loading correctly. I found that switching windows and opening a new split 'fixed' the issue, ie. adding/moving between splits resulted in lightline updating the statusline correctly. Poking ...


2

It is actually the expected behavior, although that is clearly not what was intended. The key is that 'termwinsize' is "local to window", whereas 'buftype' is "local to buffer". There is a slight --- but important --- distinction between "window" and "buffer". :h windows.txt explains this distinction in great detail. ...


2

EDIT: user Christian Brabandt points out that v:progpath will still only contain /usr/bin/vim when invoked through git-for-windows, so this solution will not work. Maybe something along these lines? if v:progpath =~ "git" colorscheme default endif The variable v:progpath should contain a path to the running vim executable, and (assuming that ...


2

There are several ways Vim can recognize mouse events in the Terminal, this is why the --version has a whole bunch of flags starting with mouse: mouse_dec, mouse_xterm, mouse_urxvt, etc. There are all sorts of historical reasons for this. Judging from this issue, this issue, and several others it seems that Vim doesn't detect the correct method for ...


2

If you run vim -Nu NONE in cmd.exe you have mouse=a and that is why you can change split sizes with your mouse. Try to set mouse= and resize a split, it wouldn't work. On my linux box mouse is empty by default so I can't resize splits with a mouse. Help topic :h 'mouse' tells exactly this: 'mouse' string (default "", "a" for GUI ...


2

You can open the terminal (or create a map) with :exe 'ter'|se nornu nonu Or create an auto-command in .vimrc: autocmd TerminalOpen * set nonu nornu


1

The feature that makes key combinations such as the ones you mentioned is called modifyOtherKeys and it's provided by some terminals like xterm. It lets Vim distinguish various keys, like <C-i> from <Tab>, which used to be impossible. Support for this feature was first introduced in Vim 8.1.2134, and the feature was enabled by default in version ...


1

The new behavior you're seeing is due to the new modifyOtherKeys feature, which has applications such as Vim announce to the terminal that they would like to receive extended and expanded escape sequences for keypresses with modifier keys (Ctrl, Alt, Shift, etc.) For example, this allows Vim to differentiate Ctrl+I from Tab, or Ctrl+[ from Esc, but it also ...


1

See :h confirm(). " prefer console dialogs in GVim too "set guioptions+=c let text =<< trim END W11: Warning: File "~/.vimrc" has changed since editing started See ":help W11" for more info. END echo confirm(join(text, "\n"), "&OK\n&Load File", 1, "Warning")


1

The lazy way is to put hi SpecialKey ctermbg=NONE in your .vimrc after calling in your favorite colorscheme. Else you can read this gist and learn some true vim wizardry : https://gist.github.com/romainl/379904f91fa40533175dfaec4c833f2f Why SpecialKey ? The answer resides at the end of the :help 'listchars' section of the help pages.


1

If that needs to be done before vim is started what about using a bash alias? In your ~/.bash_alias file (or ~/.bashrc or ~/.zshrc) you could add the following: alias vimsn='vim-with-servername' vim-with-servername() { # Check we have one argument and it ends with .tex if [ "$#" -ne 1 ] || [[ ! "$1" =~ "\.tex$" ]]; then ...


1

If you have the window ID then win_execute({winid}, {command}) should be useful. It is like execute() but operates in the context of the specified window. Something like: :call win_execute({winid}, '$') $ is the EX command equivalent of the Normal mode command G, i.e. move the cursor to the end of the buffer. Give that a try. Oh, ran a little test and ...


1

Check if your vim supports + register, :version output should include +clipboard. I would suggest to use other registers for that. Your normal command is wrong. Try smth like: function! CopyRun(start,stop) " This would still not work as normal commands do not take range as ex commands... exe "normal! " . a:start . "," . a:...


1

This is just normal. %f stands for current buffer's name (:h bufname()) and it gets inserted as is, i.e. !cat vimrc, plus status, i.e. [finished]. To change terminal's buffer name call term_start('cat vimrc', {'term_name': 'foobar'}) To setup status line for terminal windows only augroup test | au! autocmd TerminalWinOpen * setlocal statusline=foobar ...


1

patch 8.2.1978 provide special key <cmd> to avoid mode changes.


Only top voted, non community-wiki answers of a minimum length are eligible