Please bear with us as we work to restore functionality to dotfiles.org.
Long .vimrc (498 lines) with lot of comments
"""""""""""""""""""""""""""""""""""""""
" .vimrc configuration file
"
" Author: João Trindade
" WWW: http://joaotrindade.no-ip.org
" Email: trindade.joao@gmail.com
"""""""""""""""""""""""""""""""""""""""
" Heavily inspired in:
" http://amix.dk/vim/vimrc.html
"""""""""""""""""""""""""""""""""""""""
" Latest version, always available at:
" http://joaotrindade.no-ip.org/git/gitweb.cgi?p=vim/.git;a=summary
"""""""""""""""""""""""""""""""""""""""
" General{{{
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"Get out of VI's compatible mode..
set nocompatible
"Sets how many lines of history VIM har to remember
set history=500
"Enable filetype plugin. Required for latex.
filetype plugin on
filetype indent on
"Set to auto read when a file is changed from the outside
set autoread
"Have the mouse enabled all the time:
set mouse=a
"Set mapleader to '\'
let mapleader = "\\"
let g:mapleader = "\\"
"When .vimrc is edited, reload it
autocmd! bufwritepost .vimrc source ~/.vimrc
"Fast editing of .vimrc
map e :e! ~/.vimrc
"Switch to current dir
map CD :cd %:p:h
"Select all and copy to + buffer
map sa :%y +
" Nice window title
if has('title') && (has('gui_running') || &title)
set titlestring=
set titlestring+=%f\ " file name
set titlestring+=%h%m%r%w " flags
set titlestring+=\ -\ %{v:progname} " program name
endif
"restore your cursor position in a file over several editing sessions.
set viminfo='10,\"100,:20,%,n~/.viminfo
au BufReadPost * if line("'\"") > 0|if line("'\"") <= line("$")|exe("norm '\"")|else|exe "norm $"|endif|endif
"""""""""""""""""""""""""""""""""""""""""""""""""""""""}}}
" Colors and Fonts{{{
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"Enable syntax hl
syntax enable
"By far my favourite
color desert
"Set bg to dark
set background=dark
"Font type and size
"set gfn=Bitstream\ Vera\ Sans\ Mono\ 10
"set guifont=Terminus\ 8
set guifont=Monospace\ 10
"set the right enconding
set encoding=latin1
"set Pattern matching highlight
hi MatchParen guifg=#000000 guibg=#D0D090
if has("gui_running")
set guioptions-=T
endif
"Highlight current
if has("gui_running")
set cursorline
hi cursorline guibg=black
endif
"Highlight spaces at the end of lines
let c_space_errors=1
highlight WhitespaceEOL ctermbg=red guibg=red
match WhitespaceEOL /\s\+$/
"""""""""""""""""""""""""""""""""""""""""""}}}
" VIM userinterface{{{
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"When moving vertical, start scrolling 7 lines before reaching the extremity"{{{
set so=7
"Turn on WiLd menu - command-line completion operates in an enhanced mode.
set wildmenu
"Always show current position
set ruler
"The commandbar is 1 line high
set cmdheight=1
"Show line number
set nu
"Do not redraw, when running macros.. lazyredraw
set lz
"Change buffer - without saving
set hid
"Set backspace
set backspace=eol,start,indent
"Backspace and cursor keys wrap to
set whichwrap+=<,>,h,l
"Ignore case when searching
set ignorecase
"You will see results while you type
set incsearch
"Set magic on
set magic
"Use abreviation in the messages (like + instead of Modified)
set shortmess=at
"show matching bracets
"set showmatch
"How many tenths of a second to blink
set mat=2
"Highlight search things
set hlsearch
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""}}}
" Statusline (the bar at the bottom){{{
"""""""""""""""""""""""""""""""
"Use statusline in every window
set laststatus=2
"Format the statusline
set statusline=\ File:\ %F%m%r%h\ %w\ \ \ Current\ dir:\%r%{getcwd()}%h
""""""""""""""""""""""""""""""""""}}}
"}}}
" Moving around and tabs{{{
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"Map space to / and c-space to ?
map /
map ?
"Use the arrows to something usefull
map :bn
map :bp
"Move a line of text using control
nmap mz:m+`z
nmap mz:m-2`z
vmap :m'>+`mzgv`yo`z
vmap :m'<-2`>my`1 && strpart( getline('.'), col('.')-2, 3 ) =~ '^\w'
return "\"
else
return "\"
endif
endfunction
:inoremap =Mosh_Tab_Or_Complete()
"Set the style of the popup menu on autocomplete
set completeopt=menu
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""}}}
" Command-line config{{{
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"Bash like
cnoremap
cnoremap
cnoremap
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""}}}
" Usefull shortcuts{{{
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"Indent all lines
map ia mzggVG='z
"Switch to current dir
map CD :cd %:p:h
"Select all and copy to + buffer
map sa :%y +
" Buffer - "hide" :hide)
map mzggVGg?'z
"Explore Fast
map ee :Explore
"Paste toggle - when pasting something in, don't indent.
set pastetoggle=
"Quit fast
map q :qa
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""}}}
" Text options{{{
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"In Insert mode: Use the appropriate number of spaces to insert a
set expandtab
set shiftwidth=4
set softtabstop=4
set tabstop=4
"A in front of a line inserts blanks according to 'shiftwidth'.
set smarttab
"linebreak
set lbr
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""}}}
" Fold"{{{
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" if using a version 6 vim, enable folding
if version >= 600
set foldenable
set foldmethod=marker"
endif
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""}}}
" Vim Spell {{{
""""""""""""""""""""""""""""""
if version >= 700
"Portuguese dictionary
map lpt :setlocal spell spelllang=pt
"English dictionary
map len :setlocal spell spelllang=en_gb
" toggle spelling with F4 key
map lon :set spell!:echo "Spell Check: " . strpart("OffOn", 3 * &spell, 3)
"Turn off spelling
map lnon :setlocal nospell
"Goto the next work with an error
imap mn ]s
"Correct the work under the cursor
imap mm z=
"Add the current word to the dictionary
imap ma zg
" limit it to just the top 10 items
set sps=best,10
"Where it should get the dictionary files
let g:spellfile_URL = 'http://ftp.vim.org/vim/runtime/spell'
"Mark bad spelled words with red
highlight SpellErrors gui=underline ctermfg=Red guifg=Red
setlocal spell spelllang=pt
setlocal nospell
endif
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""}}}
" Files and backups{{{
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"Turn backup off
set nobackup
"Don't create a backup when overwriting a file
set nowb
set noswapfile
set noar
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""}}}
" Indent {{{
"""""""""""""""""""""""""""""""
"Auto indent
set ai
"Smart indet
set si
"C-style indeting
set cindent
"Wrap lines
"set wrap
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""}}}
" Plugin related {{{1
"#########################################
" Minibuffer{{{
""""""""""""""""""""""""""""""
"Show the miniBufExplorer from the start
let g:miniBufExplorerMoreThanOne = 0
"Not using because I don't use the vertival window
"Use a vertical windows
"let g:miniBufExplVSplit = 5
"Put the miniBufExplorer windows at the right
"let g:miniBufExplSplitBelow=1
"Maximum size of the mini buffer explorer window
"let g:miniBufExplMaxSize = 15
"Still haven't discovered what it does
"let g:miniBufExplMapWindowNavArrows = 1
"let g:miniBufExplMapCTabSwitchBufs = 1
"let g:miniBufExplUseSingleClick = 1
"let g:miniBufExplMapWindowNavVim = 1
"
" make tabs show complete (no broken on two lines)
let g:miniBufExplTabWrap = 1
" If you use other explorers like TagList you can (As of 6.2.8) set it at 1:
let g:miniBufExplModSelTarget = 1
" If you would like to single click on tabs rather than double clicking on them to goto the selected buffer.
let g:miniBufExplUseSingleClick = 1
"for buffers that have NOT CHANGED and are NOT VISIBLE.
highlight MBENormal guifg=LightBlue
" for buffers that HAVE CHANGED and are NOT VISIBLE
highlight MBEChanged guifg=Red
" buffers that have NOT CHANGED and are VISIBLE
highlight MBEVisibleNormal term=bold cterm=bold gui=bold guifg=Green
" buffers that have CHANGED and are VISIBLE
highlight MBEVisibleChanged term=bold cterm=bold gui=bold guifg=Green
let g:bufExplorerSortBy = "name"
autocmd BufRead,BufNew :call UMiniBufExplorer
"""""""""""""""""""""""""""""""""""
" Stolen from http://dev.gentoo.org/~bass/configs/vimrc.html
"
" Adapt the status line accourding to the window
"""""""""""""""""""""""""""""""""""
if has("autocmd")
au FileType qf
\ if &buftype == "quickfix" |
\ setlocal statusline=%2*%-3.3n%0* |
\ setlocal statusline+=\ \[Compiler\ Messages\] |
\ setlocal statusline+=%=%2*\ %<%P |
\ endif
fun! FixMiniBufExplorerTitle()
if "-MiniBufExplorer-" == bufname("%")
setlocal statusline=%2*%-3.3n%0*
setlocal statusline+=\[Buffers\]
setlocal statusline+=%=%2*\ %<%P
endif
endfun
au BufWinEnter *
\ let oldwinnr=winnr() |
\ windo call FixMiniBufExplorerTitle() |
\ exec oldwinnr . " wincmd w"
endif
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""}}}
" Showmarks {{{
""""""""""""""""""""""""""""""
if has("gui_running")
let g:showmarks_enable=1
else
let g:showmarks_enable=0
let loaded_showmarks=1
endif
let g:showmarks_include="abcdefghijklmnopqrstuvwxyz"
if has("autocmd")
fun! FixShowmarksColours()
if has('gui')
hi ShowMarksHLl gui=bold guifg=#a0a0e0 guibg=#2e2e2e
hi ShowMarksHLu gui=none guifg=#a0a0e0 guibg=#2e2e2e
hi ShowMarksHLo gui=none guifg=#a0a0e0 guibg=#2e2e2e
hi ShowMarksHLm gui=none guifg=#a0a0e0 guibg=#2e2e2e
hi SignColumn gui=none guifg=#f0f0f8 guibg=#2e2e2e
endif
endfun
if v:version >= 700
autocmd VimEnter,Syntax,ColorScheme * call FixShowmarksColours()
else
autocmd VimEnter,Syntax * call FixShowmarksColours()
endif
endif
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""}}}
" GIT{{{
""""""""""""""""""""""""""""""
nmap gita VCSAdd
nmap gitc VCSCommit
nmap gitl VCSLog
map gitr VCSRevert
nmap gitd VCSVimDiff
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""}}}
" Win Manager {{{
""""""""""""""""""""""""""""""
"Split vertically
let g:explVertical=1
let g:winManagerWidth=30
let g:defaultExplorer=0
let g:winManagerWindowLayout = 'FileExplorer,TagsExplorer'
"Hide some files
let g:explHideFiles='^\.,\.gz$,\.exe$,\.zip$'
"Hide the help thing..
let g:explDetailedHelp=0
map :WMToggle
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""}}}
" Latex related {{{
""""""""""""""""""""""""""""""""""""""
"IMPORTANT: grep will sometimes skip displaying the file name if you
" search in a singe file. This will confuse Latex-Suite. Set your grep
" program to always generate a file-name.
set grepprg=grep\ -nH\ $*
"To solve the propleme with vim-latexsuite has with ã and â
imap Tex_MathCal
imap Tex_MathBF
imap it Tex_InsertItemOnThisLine
imap Tex_InsertItem
"imap Tex_InsertItem
"imap Tex_InsertItemOnThisLine
imap \c Traditional
map é é
map á á
map ã ã
"imap ã Tex_MathCal
"imap é Traditional
"Ignore some warnings
let g:Tex_IgnoredWarnings="Font""\n"
"Shortcut to Begin{itemize}
map bi o\begin{itemize}
"shortcut to End {itemize}
map ei o\end{itemize}
" Create PDFs
let g:Tex_DefaultTargetFormat = "pdf"
let g:Tex_ViewerCwindowHeight = 6
"Use \ll to create the pdf
"Use \lv to see the pdf
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""}}}
"######################################### End of Plugin related1}}}
"-----------------------------------------------------------------------
" vim: set shiftwidth=4 softtabstop=4 expandtab tw=72 :