Questions tagged [vimrc]

.vimrc is the primary configuration file for the VIM text editor

173 questions
39
votes
3 answers

Opening a vertical terminal in Vim 8.1

Vim 8.1 added the :terminal command, which opens up a new bash terminal as a split. However, it always seems to be a horizontal split, and I prefer vertical splits. Is there a way to open a terminal as a vertical split without…
Schiem
  • 493
  • 1
  • 4
  • 5
33
votes
3 answers

How to automatically strip trailing spaces on save in Vi and Vim?

Is there a .vimrc setting to automatically remove trailing whitespace when saving a file? Ideally (to be safe) I would like to only have this functionality for certain files, e.g. *.rb
Michael Durrant
  • 41,213
  • 69
  • 165
  • 232
22
votes
2 answers

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

I'm setting up virtualized Linux boxes (as local development servers) for developers at a company that is primarily Windows-based, and some of developers make negative cracks about vim (among other things). (It seems to them to represent Linux/Unix…
iconoclast
  • 9,057
  • 12
  • 56
  • 95
21
votes
2 answers

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

I am trying to highlight the current line as well as the cursor position in Vim. Here's my .vimrc: set cursorline hi CursorLine ctermbg=8 ctermfg=15 "8 = dark gray, 15 = white hi Cursor ctermbg=15 ctermfg=8 The problem I'm experiencing is that the…
Big McLargeHuge
  • 3,044
  • 11
  • 35
  • 49
20
votes
5 answers

VIM commenting out what I paste

I got this when trying to copy this gist on vim: https://gist.github.com/w0ng/3278077 I notice the same behaviour everywhere: If I paste something that includes a comment, everything that follows the comment is pasted commented. Maybe it has…
jviotti
  • 421
  • 1
  • 3
  • 8
17
votes
5 answers

vimrc - how to block comment?

I don't want to comment lines of text in a text file or code. I am looking for inserting block comments in a .vimrc file. To insert a single line comment " is used, for example: " remove spaces and tabs as well at the end of line automatically…
mtk
  • 26,802
  • 35
  • 91
  • 130
17
votes
1 answer

Disable or remove default vim keybinding

Is there a way to disable or remove a default vim keybinding? For example, if I wanted (shift-k) to do nothing, how would I achieve this?
hlin117
  • 427
  • 2
  • 4
  • 10
14
votes
3 answers

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

I found plenty of questions regarding disabling visual mode in vim but none that tackles my particular problem: I added set mouse-=a to my /etc/vim/vimrc file to disable visual mode for good. Thing is: That seems to do nothing. However when I put…
Thorian93
  • 733
  • 2
  • 6
  • 17
13
votes
2 answers

Configure shortcut on Vim to save file

I was wondering is it possible to create a custom shortcut in vim or vi to save open file? For example, CtrlS instead of typing each time :w? Thanks!
fugitive
  • 1,543
  • 19
  • 33
13
votes
2 answers

Can .vimrc be divided into multiple files?

Say I have some hundred custom re-mappings with iab for Java and some other hundred or so re-mappings for Haskell, then I'd want do divide these into different files to make it more manageable. What I'm looking for is to create something like…
lindhe
  • 4,096
  • 3
  • 20
  • 34
11
votes
1 answer

Stop vim pasting selections as text!

I have been using VI and VIM for years (30 or more) (in xterms, not its own window, gvim) and I have a huge library of vim commands that I give vim using the mouse middle button as a selection. For example I would often do things like... vi…
anthony
  • 610
  • 6
  • 13
11
votes
4 answers

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

I would like to know, if there is a way in vim/vi to provide a different vimrc file. I am looking at managing 2 different vimrc files. For the contents I checkout/checkin in version control I want to use different set of commands and not the normal…
mtk
  • 26,802
  • 35
  • 91
  • 130
10
votes
2 answers

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

I would like to remap ctrl + j to ctrl + d, and ctrl + k to ctrl + u for moving half a page down and up in normal mode. I have tried with noremap noremap in my .vimrc, but the key function does not change. I read on the vim…
joelostblom
  • 1,889
  • 2
  • 19
  • 32
10
votes
3 answers

Can vim syntax highlight HTML color codes with their color?

It it possible to setup syntax highlighting in vim so that an html color sequence is colored in that color; e.g. #FF0000 would show up as red. I'd also be okay with it underlining the text that color like Visual Studio does. So basically I'd be…
Justin Dearing
  • 1,391
  • 3
  • 13
  • 26
9
votes
1 answer

Powerline in vim errors setting up

I installed powerline using pip install as per their installation recommendations. I have it working fine in both zsh as a prompt and tmux as a statusline yet I can't get it to work in vim. When I add the following to my vimrc: python from…
Jordan
  • 243
  • 2
  • 7
1
2 3
11 12