Skip to main content
83 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
  • 77.9k
13 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
  • 77.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
  • 71.9k
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,321
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,729
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
  • 12.2k
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
  • 12.2k
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
  • 77.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,981
5 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
  • 22.6k
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
  • 636
4 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,293
4 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
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

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

$ cat >.vimrc source $VIMRUNTIME/defaults.vim set mouse= ^D $
James Bowery's user avatar
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
  • 356k
3 votes
Accepted

Neovim colour scheme in Urxvt not rendering correctly

This turned out to be me misunderstanding what the termguicolors option entails in Vim. The ayu colour theme actually requires Truecolor support, which Urxvt does not have. There is a good ...
CraigFe's user avatar
  • 59
3 votes

Any way to provide a separate vimrc file just for 1 session

If you store your Vim config directory under Git (I hope so) - you can use different branches, and checkout between them.
Vitaly Zdanevich's user avatar
3 votes
Accepted

Make the Shebang of a script different color than comment lines for vim

Commands to execute in vim: :hi xShebang ctermfg=red ctermbg=blue :syntax match xShebang /#!.*/ It makes the script Shebang line red text on blue background. Depending on your vim configuration and ...
Yurko's user avatar
  • 738
3 votes

Vim is displaying medium dash as �~@~S and long dash as �~@~R

Okay, I think the solution is to change the Vim's encoding by opening .vimrc, entering set encoding=utf-8 set fileencoding=utf-8 and then saving the file.
Paul Jones's user avatar
3 votes

Vim: run commands depending on file directory

Based on @muru’s answer and further testing, the final code would be: if expand('%:h') =~ 'some/path/here' autocmd <whatever> set <whatever> endif expand('%:h') gives the directory’s ...
user137369's user avatar
3 votes

What's overriding my .vimrc tabstop size setting for CMake files?

To see in which startup files an option was set, use :verbose set <option>?. From :help :verbose-cmd: When 'verbose' is non-zero, listing the value of a Vim option or a key map or an ...
muru's user avatar
  • 77.9k
2 votes

What's a smart way to use/maintain two separate bash_profile's and vimrc's

I'm developing a tool, shprofile, that helps you to manage a set of shell profiles. Each profile defines a set of scripts that can be loaded at any time within the current shell session. To solve ...
Aurélien Bourdon's user avatar
2 votes

Naturally scroll past end of last line in vim

You could also move the current cursor line to particular place on the screen. I use <Ctrl-E> to shift the current line up by one line. You could also do zt to move the current line to the top ...
g.delgado's user avatar
  • 121
2 votes

How to customize vim windows for python development?

There are some plugins that try to do this, but I've never really found one that works for me. If you can, I would suggest using a terminal multiplexer like tmux (or screen). That way you could ...
resc's user avatar
  • 1,254
2 votes
Accepted

What to do with corrupted vim display?

You have to have the correct terminal type in your TERM variable, and inform the remote host of your terminal size with stty rows <rows> columns <cols>. Nowadays, I only have to do this ...
Kaz's user avatar
  • 8,897
2 votes

Turning on colours in vim is not working for some files

If you want to treat files ending in .usr like some other type of file (e.g., like a vimrc file), then you can add this to your ~/.vimrc: autocmd BufNewFile,BufRead *.usr setlocal filetype=vim Then, ...
Andy Dalton's user avatar
  • 14.7k

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