2022 Developer Survey is open! Take survey.

Questions tagged [vimrc]

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

Filter by
Sorted by
Tagged with
31 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
user avatar
10 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 ...
user avatar
  • 542
19 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 ...
user avatar
  • 411
1 vote
2 answers

Is there a sudoedit equivalent for vimdiff?

I'm trying to get into the habit of editing root-owned files with sudoedit, instead of sudo vim. This has a few advantages, one of which is that it uses my user's ~/.vimrc. Is there an equivalent, ...
user avatar
  • 18.1k
1 vote
2 answers

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

Example of text before changes: First line Second line Third line When you put a comment on a line it will auto tab once that line. This happens every time you switch from ESCAPE mode to INSERT mode ...
user avatar
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 ...
user avatar
  • 8,411
3 votes
1 answer

Saving with CTRL-s in vim

I have added this line in .vimrc so that pressing ctrl-s saves the current file :nmap <C-s> :w!<cr> :imap <C-s> <esc>:w!<cr> But this is not working. Any suggestions ...
user avatar
6 votes
4 answers

Naturally scroll past end of last line in vim

I'm a bit of a vim novice, but I'm having difficulty finding resources to help me with this problem. When I move my cursor to the bottom of my file, I want it to keep going past the final line, ...
user avatar
8 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 <c-j> <c-d> noremap <c-k> <c-u&...
user avatar
  • 1,739
2 votes
1 answer

Vim printoptions wont accept two options simultanenously

I want to print my code into a pdf file, and I found this answer very helpful. However, I want the generated pdf without header and with line number. From the comment and internet, I found I need to ...
user avatar
2 votes
1 answer

vim and tmux are conflicting. How can I fix this? [duplicate]

I'm having a painful experience with tmux. I'm using solarized in vim but when I run tmux then my vim configuration does not work. It's as if solarized is not configured in my .vimrc. Out of tmux ...
user avatar
  • 8,790