Pimp vim for coding

Step-by-Step descriptions of how to do things.

Pimp vim for coding

Postby ^rooker » Mon Feb 27, 2012 3:46 pm

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
  • 0

Jumping out of an airplane is not a basic instinct. Neither is breathing underwater. But put the two together and you're traveling through space!
User avatar
^rooker
Site Admin
 
Posts: 1444
Joined: Fri Aug 29, 2003 8:39 pm
Reputation: 0

Different settings. Temporary.

Postby ^rooker » Tue Sep 03, 2013 12:34 pm

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
  • 0

Jumping out of an airplane is not a basic instinct. Neither is breathing underwater. But put the two together and you're traveling through space!
User avatar
^rooker
Site Admin
 
Posts: 1444
Joined: Fri Aug 29, 2003 8:39 pm
Reputation: 0

Syntax highligh: Markdown instead of Modula2

Postby peter_b » Thu Sep 07, 2017 3:36 pm

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
  • 0

User avatar
peter_b
Chatterbox
 
Posts: 302
Joined: Tue Nov 12, 2013 2:05 am
Reputation: 3


Return to HowTo's

Who is online

Users browsing this forum: No registered users and 1 guest

Who is online over last 24 hours

Users browsed this forum in the last 24 hours: No registered users and 10 guests

cron
Reputation System ©'