Tech Tip: Some Useful Vim Options
Vim is one the more popular choices of text editors for Linux. For vim, there are a few non-default options that may be useful whether editing config files or writing scripts in your favorite language.
Global options for vim are enabled in the vimrc file, which may be located in /etc or /etc/vim, depending on the distribution you are using. Note that the vimrc file uses a double quotation mark (") to start a comment.
You may find some or all of the following options useful, simply copy and paste them into your vimrc file:
syntax on " Turn on syntax highlighting " (makes code and config files more readable) set background=dark " If using a dark background, instead of the " usual white background in Terminal " (makes darker colors brighter) set incsearch " Used for incremental searching " (useful when searching large text files) set hlsearch " Turns on highlighting for matched search patterns " (use :nohlsearch inside vim to turn off highlights " after a search) set tabstop=4 " Sets the tab size to 4 " (tabs are usually 8 spaces) set expandtab " Tab key inserts spaces instead of tabs set shiftwidth=4 " Sets spaces used for (auto)indent set shiftround " Indent to nearest tabstop set autoindent " Carries over previous indent to the next line
Feel free to leave a comment with your own useful vim options and macros.
Webinar: 8 Signs You’re Beyond Cron
11am CDT, April 29th
Join Linux Journal and Pat Cameron, Director of Automation Technology at HelpSystems, as they discuss the eight primary advantages of moving beyond cron job scheduling. In this webinar, you’ll learn about integrating cron with an enterprise scheduler.Join us!
- DevOps: Better Than the Sum of Its Parts
- Return of the Mac
- Drupageddon: SQL Injection, Database Abstraction and Hundreds of Thousands of Web Sites
- Play for Me, Jarvis
- Non-Linux FOSS: .NET?
- Not So Dynamic Updates
- Designing Foils with XFLR5
- Users, Permissions and Multitenant Sites
- diff -u: What's New in Kernel Development