62

That's how I do it on Linux or Cygwin: First check what chars are sent by your terminal when you press ALT+J: In order to do this I go to console and run sed -n l (you can also use cat for it). Then I press ALT+J and see that the chars on the screen are ^[j . I replace ^[ with \e (because that's what is sent by my terminal when I press esc) and the final ...


39

There are various plugins which allow you to view ANSI colours through escape codes: AnsiEsc.vim – :AnsiEsc. Colorizer – :ColorToggle. If you want to remove all escape codes, you could use: :%s/<1b>\[[0-9;]*m//g Note: <1b> is not literal text, it is the escape character, use Ctrl+v followed by Esc to insert it (it may also show up as ^[, ...


38

You are wrong about tmux. Like every terminal-based program — including Vim — it only draws stuff inside cells. This means that Vim and tmux both use the same method to draw vertical borders: they just use a pipe-like character. Tmux uses │ (U+2502) by default while Vim uses | (U+007C). If you want the same separator in Vim, you can simply use the same ...


28

I found mlterm, which supports this. Aside from Emacs' built-in terminal (M-x term) this is the only terminal I've found that supports this (I've tried about 15-20 different ones). I've found that mlterm works better than Emacs due to the sceen ratio settings, and you also avoid having to run Vim inside an Emacs session (I'm not even sure that is legally ...


26

This happens when vim is invoked and it's connected to the previous pipeline's output, instead of the terminal and it's receiving different unexpected input (like NULs). The same happens when you run: vim < /dev/null, so reset command in this case helps. This is explained well by grawity at superuser. If you're using find to pass file names to edit, you ...


21

By default VIM, when terminating, sends the string configured with the option t_te to the hosting terminal to tell it to clear the screen. To avoid it just :set t_te= to send nothing to the terminal and avoid screen clearing. See :help term form more information about terminal capabilities.


20

There you go : autocmd BufReadPost,FileReadPost,BufNewFile,BufEnter * call system("tmux rename-window 'vim | " . expand("%:t") . "'") Decomposing : autocmd BufReadPost,FileReadPost,BufNewFile,BufEnter * call On buffer read, file read or buffer new file event (see :help autocmd-events) execute the next command : call system() Call a system function ...


19

You might try to add the following to your .vimrc. if &term =~ '256color' " disable Background Color Erase (BCE) set t_ut= endif The t_ut option (default = y) describes how vim handles what it wants as background colors compared to attempting to use the current background color. This snippet clears that option. If not, then you might try to set ...


18

With help of Carpetsmoker, it seems that Terminal wasn't configured to 'Use Alt/option as meta key' (this is especially common for GUI Terminals). For Terminal on OSX, it's in Preferences -> Settings -> Keyboard tab -> 'Use option as meta key'. Check: How can I change Terminal to use option as meta key? (Mavericks). For XTerm, check: Configuring ...


17

As @Doorknob said in his comment, :set mouse=a fixes the problem.


16

I compared the output of running env in a standard terminal to the output when running it within Neovim, and it looks like these variables are new: VIMRUNTIME=/usr/local/Cellar/neovim/HEAD/share/nvim/runtime VIM=/usr/local/Cellar/neovim/HEAD/share/nvim NVIM_LISTEN_ADDRESS=/var/folders/_8/sy7jjpw55mbgn2prml0fbsgc0000gn/T/nvimaLHjPR/0 (The vim I have also ...


14

Use the titleold setting: " Update term title but restore old title after leaving Vim set title set titleold= From :help 'titleold': This option will be used for the window title when exiting Vim if the original title cannot be restored. Only happens if 'title' is on or 'titlestring' is not empty.


13

Your terminal (PuTTY) is configured to send escape sequences for keypad keys, rather than digits. This is called “application keypad mode” in Unix terminal terminology. You can configure Vim to understand these escape sequences. Alternatively, you can configure PuTTY to send digits. In the configuration, in the Keyboard panel, turn off application keypad ...


13

Short answer Turn off “application keypad mode switching.” Terminal-specific instructions PuTTY (also here): Terminal > Features > uncheck Disable application keypad mode SecureCRT: Session Options > Terminal > Emulation > Modes > Mode switching > uncheck Enable keypad mode switching iTerm: Switch to iTerm2 or see general instructions ...


12

Workaround suggestion: use a buffer as a filesystem navigator Use the vim - command to read a list of paths from stdin. Vim's :help -- explains this:1 Start editing a new buffer, which is filled with text that is read from stdin. The commands that would normally be read from stdin will now be read from stderr. Example: find . -name "*.c" -print | ...


12

Did you try something like this? $ echo "foo, bar, baz, and qux" | vim - Or like that? $ vim -c "put='foo, bar, baz, and qux'"


11

Aside from alxndr's example, you can set one yourself with: :let $IN_NEOVIM = "yes" :terminal $ env | grep NEOVIM IN_NEOVIM=yes This is especially useful as a simple way to pass information to the shell; for example: :let $NEOVIM_FILETYPE = &filetype :terminal $ env | grep NEOVIM NEOVIM_FILETYPE=python


10

There's two reasons why I think this may be happening: The solarized color scheme you are using does not declare ctermfg and ctermbg for any of the features you want to highlight. Try out this color scheme, should look essentially the same both inside your terminal and gvim, if this is the case then you may need to look into using a color scheme that ...


10

Running a terminal inside Vim allows you to use Vim commands on the input and output to the programs that you run in that terminal. You get search, copy-paste, macros, syntax coloring, etc. Using :read !{command} and :write !{command} gives you that for one-shot commands, but asynchronous input/output becomes useful when you want to submit input to an ...


10

Here is a solution using Vim's term_sendkeys() open a vim terminal and start the REPL check which buffer the terminal is in with :ls this example assumes the terminal is in buffer 2 cmd to copy the content to the " register (the unamed register) and paste/run in the terminal :%y | call term_sendkeys(2, @") The command can then be mapped like ...


10

You can paste Vim's builtin termcap database in the current buffer with the following command: put =execute('set termcap') In it, you should find the text t_ku <Up> ^[OA, which means that when you press Up, the terminal will send Esc O A. Or you could just execute :echo &t_ku, to get the value of the terminal option 't_ku' (see :h t_ku). It ...


10

In your ~/.vimrc add the line set splitbelow This will cause all splits to happen below (including terminal). To change the height of the terminal (row x col) set termsize=10x0


10

Thanks to Christian Brabandt, :ter ++curwin was the thing that I want.


9

If you have a sufficiently modern vim that has the +terminal feature, you can do :term cat somefile and you'll get a buffer with all the terminal codes interpreted. This might work better on large files than e.g. Colorizer, which made my vim unusably slow when I let it loose on a 6000-line file.


9

To ensure that this workaround runs even when Vim is started by a separate tool (such as git), I have this in my ~/.vimrc: " Allow us to use Ctrl-s and Ctrl-q as keybinds silent !stty -ixon " Restore default behaviour when leaving Vim. autocmd VimLeave * silent !stty ixon This has been working for me on Linux, GVim, Mac OS X and MacVim. Caveats: ...


9

This works as designed, and is documented under :help :silent: ":silent" will also avoid the hit-enter prompt. When using this for an external command, this may cause the screen to be messed up. Use |CTRL-L| to clean it up then. You can also use the :redraw command.


9

You can use if exists(':terminal') to check for existence of the terminal command. This works in both vim and neovim.


9

Create a special function in your vimrc that's callable from terminal, its name must start with Tapi_. " arglist : [ cwd ] " change window local working directory function! Tapi_lcd(bufnum, arglist) let winid = bufwinid(a:bufnum) let cwd = get(a:arglist, 0, '') if winid == -1 || empty(cwd) return endif call win_execute(winid, 'lcd ' . cwd) ...


9

You can set 'termwinkey' to a sequence other than <C-W> to use a different keystroke to access the special sequences on the terminal. For example: set termwinkey=<C-X> Or: set termwinkey=<F1> See also :help terminal-typing.


8

Similar to Kossak's answer but a bit simpler, by mapping literal key presses. Either in normal mode after pressing :, or inserted into your .vimrc, map the input directly by starting the mapping: nnoremap then hitting Ctrl + V then the keystroke to record, e.g. Alt + ←. This will show as something like this: nnoremap ^[[1;3D but each ^[ is a single, ...


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