We are still actively working on the spam issue.

Difference between revisions of "Vim"

From InstallGentoo Wiki
Jump to: navigation, search
m (Cleaned up a little)
m (removed daily vim tip bullet point since page was removed)
 
(11 intermediate revisions by 3 users not shown)
Line 3: Line 3:
  
 
[[File:Vim cheat sheet.png|200px|thumb|right|Vim Cheat Sheet for programmers]]
 
[[File:Vim cheat sheet.png|200px|thumb|right|Vim Cheat Sheet for programmers]]
 +
 +
[[File:Vim cheat sheet 2.png|200px|thumb|right|Vim Cheat Sheet for programmers]]
  
 
== Learning Vim ==
 
== Learning Vim ==
Line 30: Line 32:
 
=== Buffer Navigation ===
 
=== Buffer Navigation ===
  
[https://github.com/Lokaltog/vim-easymotion EasyMotion] - Spatial navigation, saves a lot of keystrokes.
+
* [https://github.com/majutsushi/tagbar Tagbar] - Tag navigation, requires a '''ctags''' package.
 
+
* [https://github.com/kien/ctrlp.vim CtrlP] - Fuzzy file, buffer, mru, tag, etc finder.
[https://github.com/majutsushi/tagbar Tagbar] - Tag navigation, requires a '''ctags''' package.
+
* [https://github.com/haya14busa/incsearch.vim Incsearch.vim] - futher expands the power of incremental-search in vim
 
+
* [https://github.com/Lokaltog/vim-easymotion EasyMotion] - Spatial navigation, saves a lot of keystrokes.
[https://github.com/kien/ctrlp.vim CtrlP] - Fuzzy file, buffer, mru, tag, etc finder.
+
* [https://github.com/wellle/targets.vim targets.vim] - adds extra motions to text objects
 
+
* [https://github.com/justinmk/vim-sneak Sneak] - maps the s command (and optionally t/T/f/F) to search line-wise (minimalistic alternative to easymotion)
[https://github.com/koron/minimap-vim Minimap] - Minimap implementation similar to the one found in Sublime Text
 
  
 
=== File Navigation ===
 
=== File Navigation ===
  
[https://github.com/scrooloose/nerdtree NERDTree] - Tree explorer plugin.
+
* [https://github.com/kien/ctrlp.vim CtrlP] - Fuzzy file, buffer, mru, tag, etc finder.
 
+
* [https://github.com/scrooloose/nerdtree NERDTree] - Tree explorer plugin.
[https://github.com/kien/ctrlp.vim CtrlP] - Fuzzy file, buffer, mru, tag, etc finder.
+
* [https://github.com/Shougo/vimfiler VimFiler] - similar to built-in netrw but with improvements and fixes
  
 
=== Task Automation ===
 
=== Task Automation ===
  
[https://github.com/Raimondi/delimitMate DelimitMate] - Auto-completes surroundings and provides bindings for navigating through them.
+
* [https://github.com/junegunn/vim-easy-align EasyAlign] - Tool for aligning multiple lines of text in columns.
 
+
* [https://github.com/Raimondi/delimitMate DelimitMate] - Auto-completes surroundings and provides bindings for navigating through them.
[https://github.com/tpope/vim-surround Vim-Surround] - Manipulates (insert, change, delete) pairs of surroundings.
+
* [https://github.com/tpope/vim-surround Vim-Surround] - Manipulates (insert, change, delete) pairs of surroundings.
 
+
* [https://github.com/scrooloose/nerdcommenter NERDCommenter] - Manipulates code comments according to the file type.
[https://github.com/scrooloose/nerdcommenter NERDCommenter] - Manipulates code comments according to the file type.
+
* [https://github.com/othree/vim-autocomplpop AutoComplPop] - Basic pop-up keyword-based completion.
 
+
* [https://github.com/mattn/emmet-vim Emmet] - Powerful text-expansion for HTML/XML markup
[https://github.com/othree/vim-autocomplpop AutoComplPop] - Basic pop-up keyword-based completion.
+
* [https://github.com/tpope/vim-repeat Vim-repeat] - expands the .(repeat) power of the command
  
 
=== Code Insertion/Completion ===
 
=== Code Insertion/Completion ===
  
[https://github.com/SirVer/ultisnips UltiSnips] - Customizable snippet engine for boilerplate code time-saving.
+
* [https://github.com/SirVer/ultisnips UltiSnips] - Customizable snippet engine for boilerplate code time-saving.
 
+
* [https://github.com/scrooloose/syntastic Syntastic] - Syntax checking.
[https://github.com/scrooloose/syntastic Syntastic] - Syntax checking.
+
* [https://github.com/Shougo/neocomplete.vim Neocomplete] - code completion engine with caching
 
+
* [https://github.com/Valloric/YouCompleteMe YouCompleteMe] - Advanced semantic code completion engine.
[https://github.com/Valloric/YouCompleteMe YouCompleteMe] - Advanced semantic code completion engine.
+
* [http://eclim.org/ Eclim] - Code completion making use of Eclipse's engine.
 
 
[http://eclim.org/ Eclim] - Code completion making use of Eclipse's engine.
 
  
 
=== Miscellaneous ===
 
=== Miscellaneous ===
  
[https://github.com/chrisbra/SudoEdit.vim SudoEdit] - Edit files using sudo or su or any other tool.
+
* [https://github.com/tpope/vim-sensible Vim-Sensible] - Provides a number of common and sane configurations.
 
+
* [https://github.com/tpope/vim-unimpaired vim-unimpaired] - Miscellaneous mappings for simple tasks
[https://github.com/terryma/vim-multiple-cursors Multiple Cursors] - Sublime Text style multiple selections
+
* [https://github.com/chrisbra/SudoEdit.vim SudoEdit] - Edit files using sudo or su or any other tool.
 +
* [https://github.com/terryma/vim-multiple-cursors Multiple Cursors] - Sublime Text style multiple selections
 +
* [https://github.com/koron/minimap-vim Minimap] - Minimap implementation similar to the one found in Sublime Text
  
 
=== Ricing ===
 
=== Ricing ===
  
[https://github.com/itchyny/lightline.vim LightLine] - Light and configurable statusline/tabline
+
* [https://github.com/bling/vim-airline AirLine] - Status line with many out-of-the-box features and integration with other plugins.
 
+
* [https://github.com/itchyny/lightline.vim LightLine] - Status line with emphasis on minimalism and customizability.
[http://bytefluent.com/vivify/ Vivify] - Color scheme editor for Vim
+
* [http://bytefluent.com/vivify/ Vivify] - Color scheme editor for Vim
  
 
== External Links ==
 
== External Links ==

Latest revision as of 03:00, 26 February 2016

Vim logo.

Vim (Vi IMproved) is a text editor based on the standard UNIX editor Vi. Its main feature is modal editing, which minimizes the amount of keystrokes needed for performing tasks, thus greatly reducing strain.

Vim Cheat Sheet for programmers
Vim Cheat Sheet for programmers

Learning Vim

General Advice

  • If you're interested in learning Vim, it is likely for the purpose of programming or markup. In this case, it is recommended to look up online exercises of a language you're familiar with, and write them with Vim.
  • It may be tempting to use the arrow, delete, backspace, home, pageup, pagedown, and end keys, but do not.
  • When performing a task, always think about how to minimize the amount of keystrokes for it. Research online.
  • Keep a cheat sheet, write down new commands you want to learn, keep only several or so commands at a time until you've learned them.

For Beginners

Configuration

All configuration is kept in the ~/.vimrc file, ~ being your home directory. It is advisable to look up existing online vimrc's but do not just copy them. In Vim, :h each entry, read the description and decide for yourself if you want them.

Well documented base to start out with: https://github.com/timss/vimconf

Plugins

Buffer Navigation

  • Tagbar - Tag navigation, requires a ctags package.
  • CtrlP - Fuzzy file, buffer, mru, tag, etc finder.
  • Incsearch.vim - futher expands the power of incremental-search in vim
  • EasyMotion - Spatial navigation, saves a lot of keystrokes.
  • targets.vim - adds extra motions to text objects
  • Sneak - maps the s command (and optionally t/T/f/F) to search line-wise (minimalistic alternative to easymotion)

File Navigation

  • CtrlP - Fuzzy file, buffer, mru, tag, etc finder.
  • NERDTree - Tree explorer plugin.
  • VimFiler - similar to built-in netrw but with improvements and fixes

Task Automation

  • EasyAlign - Tool for aligning multiple lines of text in columns.
  • DelimitMate - Auto-completes surroundings and provides bindings for navigating through them.
  • Vim-Surround - Manipulates (insert, change, delete) pairs of surroundings.
  • NERDCommenter - Manipulates code comments according to the file type.
  • AutoComplPop - Basic pop-up keyword-based completion.
  • Emmet - Powerful text-expansion for HTML/XML markup
  • Vim-repeat - expands the .(repeat) power of the command

Code Insertion/Completion

  • UltiSnips - Customizable snippet engine for boilerplate code time-saving.
  • Syntastic - Syntax checking.
  • Neocomplete - code completion engine with caching
  • YouCompleteMe - Advanced semantic code completion engine.
  • Eclim - Code completion making use of Eclipse's engine.

Miscellaneous

  • Vim-Sensible - Provides a number of common and sane configurations.
  • vim-unimpaired - Miscellaneous mappings for simple tasks
  • SudoEdit - Edit files using sudo or su or any other tool.
  • Multiple Cursors - Sublime Text style multiple selections
  • Minimap - Minimap implementation similar to the one found in Sublime Text

Ricing

  • AirLine - Status line with many out-of-the-box features and integration with other plugins.
  • LightLine - Status line with emphasis on minimalism and customizability.
  • Vivify - Color scheme editor for Vim

External Links