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 ...


5

Regarding the two variables: $term is a variable from the environment. When you are on the terminal (without opening Vim), echo $term should echo the same as :echo $term from inside Vim. (I'm a little bit surprised that it is not upper case, like $TERM.) &term represents the option term (see :h 'term'). So the output from :echo &term is the same as ...


5

t_TI and t_TE are terminal options. You can set them with sequences which will be sent by Vim to the terminal when the latter is resp. put into "raw" mode, or when it's made to quit "raw" mode. Since the patch 8.1.2134, Vim supports a feature called modifyOtherKeys, provided by some terminals like xterm. It lets Vim distinguish various ...


4

This question is a couple of years old now but I found it when I was looking for a way to open a terminal inside vim below a bunch of vertical splits. What I want looks something like this: +----+----+----+ ¦ ¦ ¦ ¦ ¦ f1 ¦ f2 ¦ f3 ¦ +----+----+----+ ¦ terminal ¦ +--------------+ What you get with :below terminal or with :set splitbelow and then :...


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

Shortcuts from shell you don't "have to" use the arrow keys to use the history in shells like zsh. <c-p> previous history command. <c-n> next history command. <c-r> history search. or you can add some improvements: use fzf instead of regular history search. change fzf shortcuts. change zsh shortcuts if necessary (I only added &...


3

In modern vim/neovim there is :h g:terminal_ansi_colors (vim) or 16 of g:terminal_color_0 .. g:terminal_color_15 (neovim). If you open gruvbox colorscheme you use, you will find those definitions there (most probably). Basically: your whatever terminal can have palette of base 16 colors defined (there are defaults for each type of terminal, but you can ...


3

In GVim, you can control the 16 ANSI colors used by your terminal with the g:terminal_ansi_colors variable. See :help g:terminal_ansi_colors: In GUI mode or with 'termguicolors', the 16 ANSI colors used by default in new terminal windows may be configured using the variable g:terminal_ansi_colors, which should be a list of 16 color names or ...


3

I found it more intuitive (YMMV!) to create a bash script called :e, containing this: #!/bin/bash for f; do echo -e "\033]51;[\"drop\", \"$f\"]\007" done So :e file works both at the vim command line, as well as in a terminal-within-vim


3

You can do that using the :terminal mode in vim 8. My answer is a modification of this answer. Create a special function in your vimrc that's callable from terminal, its name must start with Tapi_. function! Tapi_vit(bufnum, arglist) let currfile = get(a:arglist, 0, '') if empty(currfile) return endif execute 'e' currfile endfunction ...


3

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


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

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

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

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


2

I got the same issue on Ubuntu 20.04 and VIM - Vi IMproved 8.2 and I am using gruvbox color scheme (I also have some other vim plugins like syntastic). After adding autocmd vimenter * colorscheme gruvbox in my .vimrc before the loading of my plugin manager (pathogen) this went off (I've also removed my previous colorscheme gruvbox command from my .vimrc of ...


2

:h termwinsize You need to set termwinsize option. It's argument like {row}x{columns}. So if you want your terminal appear 30 row and 200 column, you should use: :set termwinsize=30x200


2

I wanted a way to easily toggle a single terminal that would keep the same size and content. My solution lies in two functions: the main one controls whether a terminal should be opened, the second opens a terminal split where we want on the screen. If one or more terminal splits exist, they are hidden. Else, a terminal split is opened, either a new one or ...


2

gdb argument support is added at patch 8.0.1713: Termdebug [gdb-args] command command argument support is added at patch 8.0.1725: TermdebugCommand command [command-args] Additionally, once TermDebug is loaded you may also pass any command from Vim to GDB since patch 8.1.0071 using a function: call TermDebugSendCommand(gdb-command) Examples for each of ...


2

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


2

This was the color schemes defined in paper color theme. Just pasting this in the vimrc worked! let g:terminal_ansi_colors = [ \'#eeeeee', '#af0000', '#008700', '#5f8700', \'#0087af', '#878787', '#005f87', '#444444', \'#bcbcbc', '#d70000', '#d70087', '#8700af', \'#d75f00', '#d75f00', '#005faf', '#005f87' ]


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

First thing's first, let's make sure our definitions are in sync. Per, :h window: A buffer is the in-memory text of a file. A window is a viewport on a buffer. (And for the sake of completeness) A tab page is a collection of windows. Above these things are your terminal window or your GUI window which contain Vim. Vim has no direct control over these kinds ...


2

I agree with B Layer's comment: It fails because cd is a builtin command in most modern systems. That means it does not exist as a standalone command such as /bin/echo and /usr/bin/gcc. Then, a workaround is to invoke the shell to execute the command. :ter sh -c "cd /home/me/folder;sh" If sh does not resolve to your preferred shell, substitute it ...


2

To add to the existing answer: For shell specifically: I use vi keys in bash (set -o vi) and zsh (bindkey -v with some extra goodies), so I don’t touch arrows that much (Escape + jk works) Also, the Ctrl-r reverse incremental search is good Heavy use of tmux, with more vi-like bindings For vim: Easy mapping to run :suspend Easy mapping to run :terminal (...


2

There are a few concepts you should know about to understand what is going on here. Also, some of these get a bit complicated, so I might end up simplifying it a bit and not going into all the details in this answer. Terminals (going back to a lineage tracing back to the original xterm) typically support 16 colors, from a palette mapping numbers 0 to 15 to ...


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 ...


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