Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange
30

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


28

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


26

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


24

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


21

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


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

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


13

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.


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

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


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

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


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


10

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.


9

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

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


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

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.


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


6

This is not possible. In the terminal, no key code is generated for modifiers alone. Gvim also has no support for this, partly because there is no valid way to represent the key using the map commands.


6

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


6

Try: stty sane which should make your terminal usable again. And indeed this can be considered a vim bug, at least Neovim doesn't have this issue at the moment.


6

I think the option to create terminal-only mappings is valuable, and extends the options you've got in other terminal emulators, e.g. mapping t to run unittests with specific configuration, which you can only achieve through complex aliases or bash functions.


6

I do need to point out the elephant in the room: You shouldn't be navigating in insert mode. Insert mode is for inserting text. While many implementations of vi allow you to navigate (using the arrow keys) while in insert mode, the recommended, normal method of navigation is to navigate in normal mode. Normal mode should be the mode you are normally in, ...


6

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


6

See the option termwinscroll as documented at :help terminal-normal and :help termwinscroll. 'termwinscroll' 'twsl' number (default 10000) local to buffer {not in Vi} {not available when compiled without the |+terminal| feature} Number of scrollback lines to keep. When going over this limit the first 10% of the scrollback ...


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