Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
home_server:home_server_setup:other_services:vim [2023-08-26 Sat wk34 12:00] – [Requires More Research] baumkphome_server:home_server_setup:other_services:vim [2024-03-24 Sun wk12 14:04] (current) – [nocompatible] baumkp
Line 1: Line 1:
-{{tag>vim neovim command linux debian ubuntu text editor setup customise customisation cheatsheet}}+{{tag>vim neovim command linux debian text editor setup customise customisation cheatsheet}} 
 +======VIM Editor====== 
 +When using ''sudo vim'' consider ''sudo -E''. The ''-E'' flag to retain the user environment variables for vim.
 =====VIM Customisation===== =====VIM Customisation=====
 +++++~/.vimrc| 
 +<code bash>colorscheme desert 
 +set nocompatible 
 +syntax on 
 +set number relativenumber 
 +set autoindent expandtab tabstop=2 shiftwidth=2 
 +filetype plugin on 
 +filetype indent on 
 +set cursorline 
 +set cursorcolumn 
 +set shiftwidth=2 
 +set tabstop=2 
 +set expandtab</code> 
 +++++
 ====vim color scheme==== ====vim color scheme====
 I use the VI (or VIM) editor. It comes standard on most Linux and UNIX distributions, or can otherwise be installed. A key feature I configure is the VIM colour scheme, as the standard colour scheme does not work well with black background terminal windows I prefer to use. Simply create the file on home directory, ".vimrc" (''vim ~/.vimrc'') and add the line '':colorscheme desert''. I use the VI (or VIM) editor. It comes standard on most Linux and UNIX distributions, or can otherwise be installed. A key feature I configure is the VIM colour scheme, as the standard colour scheme does not work well with black background terminal windows I prefer to use. Simply create the file on home directory, ".vimrc" (''vim ~/.vimrc'') and add the line '':colorscheme desert''.
  
 The different VIM colour scheme definition files are located at ''/usr/share/vim/vim90/colors''. The different VIM colour scheme definition files are located at ''/usr/share/vim/vim90/colors''.
 +====nocompatible==== 
 +Original vi had some strange key bindings, e.g. the cursor keys did not function. the ''nocompatible'' flag tends to resolve this.  When using the ''.vimrc'' configuration file the ''nocompatible'' flag is reportedly set automatically.  Nevertheless it is worthwhile setting this.
 ====vim syntax color==== ====vim syntax color====
 If syntax color is not working in the file ''.vimrc'' (''vim ~/.vimrc''), add the following line ''syntax on''. If syntax color is not working in the file ''.vimrc'' (''vim ~/.vimrc''), add the following line ''syntax on''.
  
 ====vim line numbers==== ====vim line numbers====
 +In .vimrc, add ''set number relativenumber'' other options include:
 +  * ''set number'' sequentially numbers from top at 1 to bottom.
 +  * ''set relativenumber'' sets current line at 0 and numbers sequentially from 1 above and below
 +  * ''set number relativenumber'' sets current line at actual line number and numbers sequentially from 1 above and below
 +  * ''set nonumber'' set numbering off
 +In visual mode '':set number!'' toggles the current number setting.  Probably can not use this one in ''.vimrc''.
 +
 ====VIM Text Editor==== ====VIM Text Editor====
  
Line 67: Line 90:
 |  Ctrl + o  | Move backward through the jump history  | |  Ctrl + o  | Move backward through the jump history  |
 |  Ctrl + i  | Move forward through the jump history  | |  Ctrl + i  | Move forward through the jump history  |
 +|  gg  | Move to top of file |
 +|  Shift + g  | move to end of file |
 |  w  | Move to next word | |  w  | Move to next word |
 |  W  | Move to next blank delimited word  | |  W  | Move to next blank delimited word  |
Line 357: Line 382:
   *[[https://web.archive.org/web/20190515212443/http://unix.stackexchange.com/questions/12535/how-to-copy-text-from-vim-to-an-external-program|How to copy text from vim to an external program?]]   *[[https://web.archive.org/web/20190515212443/http://unix.stackexchange.com/questions/12535/how-to-copy-text-from-vim-to-an-external-program|How to copy text from vim to an external program?]]
   *[[https://web.archive.org/web/20230509142719/http://www.terminally-incoherent.com/blog/reference/vim-cheat-sheet/|Another Vim Cheat Sheet]]   *[[https://web.archive.org/web/20230509142719/http://www.terminally-incoherent.com/blog/reference/vim-cheat-sheet/|Another Vim Cheat Sheet]]
 +  *[[https://web.archive.org/web/20211208001807/https://petro.tanrei.ca/2010/8/working-with-vim-and-ipython.html|Working with Vim and IPython]]
 ====Requires More Research==== ====Requires More Research====
  
Line 368: Line 393:
   *[[https://github.com/davidhalter/jedi-vim|check out Jedi for auto completion]]   *[[https://github.com/davidhalter/jedi-vim|check out Jedi for auto completion]]
   *[[http://j605.wordpress.com/2011/10/08/a-python-debugger-for-vim/|A python debugger for vim]]   *[[http://j605.wordpress.com/2011/10/08/a-python-debugger-for-vim/|A python debugger for vim]]
-   
   *[[http://github.com/ivanov/vim-ipython|vim-ipython - A two-way integration between Vim and IPython]]   *[[http://github.com/ivanov/vim-ipython|vim-ipython - A two-way integration between Vim and IPython]]
-  *[[http://appsweets.net/wasavi/|wasavi (VI editor for any web page)]] 
   *[[http://codemirror.net/|CodeMirror]]   *[[http://codemirror.net/|CodeMirror]]
-  *[[http://lalashan.mcmaster.ca/theobio/projects/index.php/TextAid|TextAid]] 
   *[[http://www.catonmat.net/blog/bash-vi-editing-mode-cheat-sheet/|Working Productively in Bash's Vi Command Line Editing Mode (with Cheat Sheet)]]   *[[http://www.catonmat.net/blog/bash-vi-editing-mode-cheat-sheet/|Working Productively in Bash's Vi Command Line Editing Mode (with Cheat Sheet)]]
   *[[http://hackaday.com/2017/06/21/vim-normalization/|VIM Normalization]]   *[[http://hackaday.com/2017/06/21/vim-normalization/|VIM Normalization]]
   *[[https://opensource.com/article/17/2/vim-plugins-writers?sc_cid=70160000001206xAAA|Awesome vim plugins for writers]]   *[[https://opensource.com/article/17/2/vim-plugins-writers?sc_cid=70160000001206xAAA|Awesome vim plugins for writers]]
-  *[[https://soledadpenades.com/2013/02/24/using-syntastic-jshint-for-javascript-syntax-checking-on-vim/|Using Syntastic+JSHint for Javascript syntax checking on Vim]]+  *[[https://soledadpenades.com/posts/2013/using-syntastic-jshint-for-javascript-syntax-checking-on-vim/|Using Syntastic+JSHint for Javascript syntax checking on Vim]]
  
 ---- ----