Page 1 of 1

Pimp vim for coding

Posted: Mon Feb 27, 2012 3:46 pm
by ^rooker
Here are a few tips for configuring VIM to be more comfortable for programmer's needs.

1) Changes within "/etc/vim/vimrc":

*) tab-free indent with reasonable width:

Code: Select all

" Make it comfortable for coding and editing config files:
set shiftwidth=4
set tabstop=4
set expandtab
set tabpagemax=20

Different settings. Temporary.

Posted: Tue Sep 03, 2013 12:34 pm
by ^rooker
If you happen to contribute to, or edit code from someone else, who has different indentation width, here's a one-liner for adjusting vim's settings temporarily for all opened tabs.
For example, if you want to indent only 2 characters (instead of the globally configured "4"), you can type:

Code: Select all

:tabdo set shiftwidth=2 || set tabstop=2 || set expandtab

Syntax highligh: Markdown instead of Modula2

Posted: Thu Sep 07, 2017 3:36 pm
by peter_b
By default, many vim installations assume ".md" files to be "Modula2" sourcecode instead of Markdown.
Add this line to your /etc/vim/vimrc (or the one in your user's home) to change that:

Code: Select all

" Markdown syntax (instead of modula2):
autocmd BufNewFile,BufRead *.md set filetype=markdown
:D

Re: Pimp vim for coding

Posted: Fri Apr 09, 2021 10:02 pm
by peter_b
Simply copy/paste/save the following to "/etc/vim/vimrc.local":
(Attached is a copy of that configfile ready-to-use. Just remove the ".txt" (forum security rules))

Code: Select all

" Generally useful:
syntax on
set background=dark
set ignorecase     " Do case insensitive matching
set mouse=
set ttymouse=

" Make it comfortable for coding and editing config files:
set shiftwidth=4
set tabstop=4
set expandtab
set tabpagemax=20

" Tab completion for filenames more bash-style:
set wildmode=longest,list,full
set wildmenu
Update 2024-01: The "wildmode" settings are now like this:

1st tab: complete as much characters as it can;
2nd tab: show a list of possible candidates.
3rd tab: cycle through the list of possible candidates