User:Int 80h/files/.vimrc
Appearance
< User:Int 80h | files
.vimrc
[edit]" Vim rc file
"
" Maintainer: Szymon 'Polemon' Bereziak <polemon@polemon.org>
" Last Change: 2012-06-29
" URL: http://polemon.org
" Version: 0.10
"
" * General
set nocompatible " Vim, not vi
set novisualbell " deactivate flash
" have command-line completion <Tab> (for filenames, help topics, option names)
" first list the available options and complete the longest common part, then
" have further <Tab>s cycle through the possibilities:
set wildmode=list:longest,full " completion mode
set wildmenu " command completion
set laststatus=2 " always display statusline
set showmode " display current working mode
set showcmd " display partially typed command in status
set ruler " enable line and column display
set number " enable line numbers
let fortran_free_source=1
syntax on " enable syntax highlighting
" when using list, keep tabs at their full width and display `arrows':
execute 'set listchars+=tab:' . nr2char(187) . nr2char(183)
" (Character 187 is a right double-chevron, and 183 a mid-dot.)
set nowrap " no wrapped display
set formatoptions-=t " ensure no wrap around using textwidth
set mouse=a " enable mous on all times
set nocp bs=2 " enable backspace in INSERT mode
set sidescroll=2 " smooth but reasonably fast side scrolling
set shortmess+=r " use "[RO]" for "[readonly]" to save space in the message line
set shortmess+=I " get rid of splashscreen
" possible values are: indent, eol, start
"set backspace=indent " backspace set to indent delete
" * Search
set incsearch " search while typing:
set hlsearch " highlight search results:
set wrapscan " restart search from top when bottom hit
set ignorecase " case insesitive search
set smartcase " case sensitive search when searching with upperase letters
set gdefault " imply /g when s///
set magic " ^ and $ are special symbols
" backslash suspends search highlight
nnoremap <silent>\ :nohlsearch<CR>
" enable modelines (vim:)
set modeline
" disable code folding
set nofoldenable
" manual code folding (zf command)
set foldmethod=syntax
" toggle foldcolumn with foldenablhe
function Foldtoggle()
if &foldenable
set nofoldenable
set foldcolumn=0
else
set foldenable
set foldcolumn=2
endif
endfunction
" zi toggles fold columns
nnoremap <silent>zi :call Foldtoggle()<CR>
function Jumplast()
if line("'\"") > 1 && line("'\"") <= line("$")
exe "normal! g'\""
endif
endfunction
" *** File specific stuff ***
" try jumping to last known position
autocmd BufReadPost * call Jumplast()
" generaly prefer indentation of four, all spaces:
set tabstop=8 " width ot TAB character
set shiftwidth=4 " indentation step
set softtabstop=4 " TAB key step
set expandtab " expand tabs to spaces
set smarttab " smarter tab
colorscheme polemon " colorscheme polemon.vim (http://wiki.riteme.site/wiki/User:Polemon/files/polemon.vim>
" enable filetype detection:
filetype on
filetype plugin on
filetype indent on " file type based indentation
" recognize anything in my .Postponed directory as a news article, and anything
" at all with a .txt extension as being human-language text [this clobbers the
" `help' filetype, but that doesn't seem to prevent help from working
" properly]:
augroup filetype
autocmd BufNewFile,BufRead */.Postponed/* set filetype=mail
autocmd BufNewFile,BufRead *.txt set filetype=human
augroup END
autocmd FileType mail set formatoptions+=t textwidth=72 " enable wrapping in mail
autocmd FileType human set formatoptions-=t textwidth=0 " disable wrapping in txt
" for C-like programming where comments have explicit end
" characters, if starting a new line in the middle of a comment automatically
" insert the comment leader characters:
autocmd FileType c,cpp,java set formatoptions+=ro
autocmd FileType c set omnifunc=ccomplete#Complete
" fixed indentation should be OK for XML and CSS. People have fast internet
" anyway. Indentation set to 2.
autocmd FileType html,xhtml,css,xml,xslt set shiftwidth=2 softtabstop=2
" two space indentation for some files
autocmd FileType vim,lua,nginx set shiftwidth=2 softtabstop=2
" for CSS, also have things in braces indented:
autocmd FileType css set omnifunc=csscomplete#CompleteCSS
" add completion for xHTML
autocmd FileType xhtml,html set omnifunc=htmlcomplete#CompleteTags
" add completion for XML
autocmd FileType xml set omnifunc=xmlcomplete#CompleteTags
" in makefiles, don't expand tabs to spaces, since actual tab characters are
" needed, and have indentation at 8 chars to be sure that all indents are tabs
" (despite the mappings later):
autocmd FileType make set noexpandtab shiftwidth=8 softtabstop=0
" ensure normal tabs in assembly files
" and set to NASM syntax highlighting
autocmd FileType asm set noexpandtab shiftwidth=8 softtabstop=0 syntax=nasm
" *** Plugin Settings ***
" indent-guides
" indentation width
let g:indent_guides_guide_size = 1
" start at first level
let g:indent_guides_start_level = 2
" enable by default
let g:indent_guides_enable_on_vim_startup = 1