52

That's how I do it on Linux or Cygwin: First check what chars are send 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 ...


37

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


35

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 ^[, ...


27

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


24

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.


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


19

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


15

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


15

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

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


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


11

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


11

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


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

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


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

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


9

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


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


8

Besides reset, you can try: stty sane which should also make your terminal usable again. See here for explanations. And somehow this can be considered a vim misbehavior, at least Neovim doesn't have this issue at the moment.


8

That line: n indent on means "open the file called indent that is at the root of the working directory". Basically, you tell Vim to do something silly and… it does just that. It should be: filetype plugin indent on Be more careful about what you copy and paste.


8

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


7

It's definitely not supported in GUI Vim, and I'd be surprised if there were more than handful of terminal emulators that support proportional fonts in the way that you're hoping for: it would break too many of the standard things for which terminals are used. As so many parts of Unix and other command-line environments presume monospaced fonts, this type of ...


7

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.


7

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


7

As of November 2017, all the terminals you are using support the same DECSCUSR escape sequences for changing the cursor shape1. So you don't need to test for the different terminals. As such, the only thing that requires different treatment is tmux, which will only forward escape sequences on to the terminal when surrounded by a DCS sequence. You already ...


7

Assuming your terminal emulator doesn't claim to support 256 colors ($ echo $TERM should output a string that doesn't contain 256color) and you didn't lie to Vim about that (:echo &t_Co should output 8 or 16), Vim should honor the "ANSI" colors you defined in your terminal emulator. The built-in colorschemes all use those "ANSI" colors — either by name ...


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