User talk:Andy: Difference between revisions

From KitwarePublic
Jump to navigationJump to search
m (→‎VIM is a great editor: Fix vim link)
(→‎VIM is a great editor: Move table to separate page and add my vimrc file)
Line 5: Line 5:
was mixing key strokes from Emacs and VIM.
was mixing key strokes from Emacs and VIM.


Here is a list of some usefull commands and settings from VIM:


{| border="1" cellpadding="2" cellspacing="0" width="60%"
* [[VIM Useful Commands|Some useful vim commands and settings]]
|- bgcolor="#abcdef"
 
!Key !! Value
=== My VIM Settings ===
|-
 
| v || Visual mode
set nocompatible " We use a vim
|-
set noautoindent
| gq || Word wrap - make text, comments look nicer
set tabstop=2      " Tabs are two characters
|-
  set shiftwidth=2    " Indents are two charactes too
| CTRL-ww || Switch window
set expandtab      " Do not use tabs
|-
"
| :bd || Close buffer
syntax on          " Turn on syntax hilighting
|-
"
| :ls || List buffers
set hlsearch       " Hilight the search results
|-
set incsearch       " Incrementally search. Like Emacs
| :b1 - :bn || Switch to buffer n - :b5 - switch to buffer 5
set matchpairs+=<:> " Also match <> when pressing %
|-
set showmatch
| :sbn || Same as :b1 - :bn, but split
set laststatus=2
|-
"
| :CTRL-w q || Close current buffer/window
" Minimalistic gui
|-
set guioptions-=T
| :on || Show only current buffer
set guioptions-=m
|-
set guioptions+=f
| :mkvimrc file || Save VIM settings
set guifont=Andale\ Mono\ 8
|-
"
| :new file || Open file in new window
colorscheme darkblue
|-
"
| :split || Split current window
" Add spell checking
|-
if exists("loaded_vimspell")
| set wildmode=longest || Tab clompletion behaves more like in emacs or zsh. To get the full list, press CTRL-D
  set spell_auto_type="tex,mail,text,html,sgml,otl"
|-
  :SpellAutoEnable
| set hlsearch || Hilight the search results
endif
|-
"
| set incsearch || Incrementally search (like emacs)
set wildmode=longest " Make tabcompletion behave correctly
|-
set selection=exclusive Only select up to not including last character
| set guioptions-=T || Remove toolbar
set ignorecase " Ignore case when searching lowercase
|-
set smartcase " Ignore case when searching lowercase
| set guioptions-=m || Remove menu
"
|-
"
| set guioptions+=f || When running gvim, it will stay in foreground.
set cinoptions={1s,:0,l1,g0,c0,(0,(s,m1 " VTK, ITK style indenting
|-
"
| colorscheme darkblue || Select "darkblue" as color scheme
" Fix for Makefiles do tabs
|-
:autocmd BufRead,BufNewFile [Mm]akefile :set noexpandtab
| set selection=exclusive || Only select up to (not including) the character where cursor is
highlight SpellErrors  guibg=Red guifg=Black
|-
| CTRL-^ || Switch buffer
|-
| CTRL-w CTRL-^ || Split and switch
|-
| set path=/some/path/** || Set internal find path to /some/path and all subdirectories
|-
| :find file || Search for file in the path
|-
| set smartcase || Search with regards to case like in emacs (type small case will search case independent, type mixed case will search exact case) - Has to be used with :set ignorecase
|-
| CTRL-a || Increment number under the cursor
|-
| CTRL-x || Decrement number under the cursor
|-
| CTRL-] || Jump to label
|-
| CTRL-T || Go back
|-
| ] CTRL-i || Jump to file under cursor
|-
| % || Jump to matching {}, (), [], ...
|-
| :make || Compile project
|-
| :make -C directorye || Compile project in specific directory (Only gmake)
|-
| :cc || Show current error (after :make)
|-
| :cn || Go to next error (after :make)
|-
| :cp || Go to previous error (after :make)
|-
| * || Search for word under the cursor
|-
| [ SHIFT-i || Display all occurances of the word under the cursor in the file
|}

Revision as of 20:25, 19 July 2004

VIM is a great editor

Ok, so I use VIM. I used to use Emacs, but I guess the starting time was bothering me. Also, for small sysadmin edits I used VIM already and I was mixing key strokes from Emacs and VIM.


My VIM Settings

set nocompatible " We use a vim
set noautoindent 
set tabstop=2       " Tabs are two characters
set shiftwidth=2    " Indents are two charactes too
set expandtab       " Do not use tabs
"
syntax on           " Turn on syntax hilighting
"
set hlsearch        " Hilight the search results
set incsearch       " Incrementally search. Like Emacs
set matchpairs+=<:> " Also match <> when pressing %
set showmatch
set laststatus=2
"
" Minimalistic gui
set guioptions-=T
set guioptions-=m
set guioptions+=f
set guifont=Andale\ Mono\ 8
"
colorscheme darkblue
"
" Add spell checking
if exists("loaded_vimspell")
  set spell_auto_type="tex,mail,text,html,sgml,otl"
  :SpellAutoEnable
endif
"
set wildmode=longest " Make tabcompletion behave correctly
set selection=exclusive "  Only select up to not including last character
set ignorecase " Ignore case when searching lowercase
set smartcase " Ignore case when searching lowercase
"
"
set cinoptions={1s,:0,l1,g0,c0,(0,(s,m1 " VTK, ITK style indenting
"
" Fix for Makefiles do tabs
:autocmd BufRead,BufNewFile [Mm]akefile :set noexpandtab
highlight SpellErrors  guibg=Red guifg=Black