79 votes
Accepted

Opening a vertical terminal in Vim 8.1

You can use the :vert[ical] command modifier: :vert term :vertical works with any command that splits a window, for example: :vert copen :vert help vert
Daniel Díaz Carrete's user avatar
20 votes
Accepted

Disabling vim visual mode in /etc/vim/vimrc does not work

Debian's /etc/vim/vimrc contains this comment: " Vim will load $VIMRUNTIME/defaults.vim if the user does not have a vimrc. " This happens after /etc/vim/vimrc(.local) are loaded, so it will override "...
muru's user avatar
  • 72.9k
15 votes

Powerline in vim errors setting up

I fixed it as follows: edit ~/.vimrc and changepython to python3 in each of the 3 lines in the original question above sudo apt-get install python3-pip pip3 install --user powerline-status
AnophelesGreyhoe's user avatar
14 votes
Accepted

Stop vim pasting selections as text!

Well after going through a LOT of web pages, many giving some hints that did not seem to work, I found a hint (extra text around a paste) that lead me to the cause and the solution to the problem. It ...
anthony's user avatar
  • 610
13 votes
Accepted

Configure shortcut on Vim to save file

Vim comes with a file providing some mappings intended to match Windows files. This is usually in $VIMRUNTIME/mswin.vim (run :echo $VIMRUNTIME to see what it is for you). You can just do: :source $...
muru's user avatar
  • 72.9k
12 votes
Accepted

Conflict Ctrl-I with TAB in normal mode

Terminal I/O applications just see the composed characters sent by the terminal, and cannot distinguish amongst specific key chords, while GUI applications can, because GUIs tend to operate in terms ...
JdeBP's user avatar
  • 68.8k
11 votes

Disable viminfo completely

Try invoking Vim with $ vim -i NONE From :help -i: -i {viminfo} The file "viminfo" is used instead of the default viminfo file. If the name "NONE" is used (all uppercase), no ...
Ingo Karkat's user avatar
  • 11.9k
11 votes
Accepted

Disable auto tabs when putting your first comment in a yaml files with VIM editor?

This is caused by 0# being part of the 'indentkeys' for the YAML filetype. You can disable this behaviour by adding the following to, say, ~/.vim/after/indent/yaml.vim: set indentkeys-=0#
muru's user avatar
  • 72.9k
10 votes

vimrc - how to block comment?

My solution is to wrap the code inside a function. This works well in vimrc, e.g., for in-place heredoc syntax highlighting tests, which also require real block comments without leading characters. ...
Juve's user avatar
  • 213
10 votes

Opening a vertical terminal in Vim 8.1

I'm not sure about regular vim, but the help says the ++curwin option doesn't split the current window. So you should be able to do something like: :vs|:term ++curwin Or you could use Neovim and ...
m0dular's user avatar
  • 1,261
8 votes

How do I highlight the current line and the cursor in .vimrc?

If you do not want to enter the command each time you start Vim, you have to put the commands in your .vimrc file. whereis vim *#type in your linux terminal* (you'll have a different location, ...
spinne's user avatar
  • 81
8 votes

Can I remap ctrl-j and ctrl-k in vim?

With those, you first need to unmap them: For example, for CTRL+J put the following line in the file '.vimrc': let g:BASH_Ctrl_j = 'off'
Flash Thunder's user avatar
7 votes

Disable viminfo completely

Hope it ain't too late, but I think I figured out how to disable this. Seems that Vim 8 is enabling the viminfo feature by default (maybe another features are enabled by default that were disabled on ...
acidrums4's user avatar
  • 171
6 votes
Accepted

Validate `~/.vimrc`

You can use a try-catch block to catch errors (which get converted to exceptions), and fail on any exception: $ cat vimrc-fail echoerr 'test' ...
Olorin's user avatar
  • 4,656
6 votes
Accepted

Difference beetwen default.vim and /etc/vim/vimrc

/etc/vim/vimrc is a system-wide default Vim configuration added by the corresponding package maintainers (e.g. the Debian folks for the vim-common APT package). It represents the opinion of the ...
Ingo Karkat's user avatar
  • 11.9k
5 votes
Accepted

Delete to end of command line in Vim

alternative approach The :help command-line-window is one of the lesser-known features of Vim. You can enter it with <C-f> by default when you're already on the commandline, or q: from normal ...
Ingo Karkat's user avatar
  • 11.9k
5 votes
Accepted

vim find claims to have many files but it is not

The argument to :find is supposed to be a single, exact, filename. *.t is expanded, so the command is :find sdf.t t.t t1.t t2.t tt.t, which does, in fact, have too many file names. From :help :find: ...
muru's user avatar
  • 72.9k
5 votes

Disabling vim visual mode in /etc/vim/vimrc does not work

Instead of muru's answer, I just straight edited the default at /usr/share/vim/vim81/defaults.vim (or whatever your vim version is). Comment out set mouse=a by changing it to "set mouse=a " ...
georgiecasey's user avatar
  • 2,671
5 votes

Vim automatically clear the command line

The following autocommands may do what you want " Clear cmd line message function! s:empty_message(timer) if mode() ==# 'n' echon '' endif endfunction augroup cmd_msg_cls autocmd! ...
jdhao's user avatar
  • 606
4 votes

Is it possible to create and use menus in (terminal-based) vim?

I've had the problem myself that I can't remember all the commands and key combinations for plugins I am using. Plus, I wanted to have simple ways to quickly execute commands without having to set new ...
Otti's user avatar
  • 41
4 votes
Accepted

Vim printoptions wont accept two options simultanenously

This worked for me: set printoptions=header:0,number:y
Andy Gaskell's user avatar
4 votes

Configure shortcut on Vim to save file

To expound on @muru's caveat about ctrl+s being trapped by the terminal: By default, a number of terminal-clients (including Cygwin) bind ctrl+s to the freeze output signal, which affects a number of ...
koyae's user avatar
  • 294
4 votes

vimdiff - Weird Issue comparing 2 files

The data is clearly not the same in the two files. If you look at the first line flagged up as different, there is a difference. File 1 contains this line where File 2 does not: BILLINGS TEST,0212,...
Chris Davies's user avatar
4 votes

Difference beetwen default.vim and /etc/vim/vimrc

File /etc/vim/vimrc is the so-called "system" vimrc file (it should be listed as so in your :version output.) $VIMRUNTIME/defaults.vim is the "defaults" file, which was only introduced in Vim 8.0 (at ...
filbranden's user avatar
  • 21.8k
4 votes
Accepted

How can I make vim only write to file after buffer has been modified?

Get in the habit of doing Z Z (i.e., Shift+Z, Shift+Z).  If the buffer has been modified, this will do :wq.  If the buffer hasn't been modified, it will simply exit without saving.
G-Man Says 'Reinstate Monica''s user avatar
4 votes
Accepted

Vim does not display other files in the same folder when opening a file

What you are referring to is called the "wildcard menu". This shows the filnames that match the pattern under the cursor when you press Tab after :e. Since there is no pattern, all ...
Kusalananda's user avatar
  • 334k
3 votes

Can I remap ctrl-j and ctrl-k in vim?

Almost there. You need to add these lines to your .vimrc: nnoremap <C-j> <C-d> nnoremap <C-k> <C-u> When I want to know how vim works I find useful :help <command>.
andreatsh's user avatar
  • 2,035
3 votes

Disable viminfo completely

Add this line to your .vimrc: set viminfofile=NONE From the documentation (:help viminfo-file-name): - The "-i" Vim argument can be used to set another file name, |-i|. When the file ...
Nathan's user avatar
  • 1,243
3 votes

vimrc - how to block comment?

There is this life changing plugin by tpope called vim-commentary https://github.com/tpope/vim-commentary This plugin provides: Sanity Properly indented comments Does not comment out empty/...
Weston Ganger's user avatar
3 votes

Vim color scheme not being applied

I think you need to use 'colorscheme' rather than 'color' in your vimrc and place it in your local vimrc file (~/.vimrc). Also, you are testing this on python files and vim may need some settings to ...
Chris Elston's user avatar

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