" Do everything in Unicode set encoding=utf-8 set guifontwide=-misc-fixed-iso10646-1 set bg=light " Some nice default settings set mousemodel=popup_setpos set mouse=a set viminfo=%,'20,<50,h set linebreak " break long lines on word boundaries set backspace=indent,eol,start " backspace through everything set textwidth=70 set ai " always set autoindenting on set nobackup " do not keep a backup file set history=50 " keep 50 lines of command line history set ruler " show the cursor position all the time set incsearch " incremental search set ignorecase set smartcase set foldcolumn=2 set fdm=marker set foldlevel=20 set autowrite set smartindent set vb " turn off bells completely by enabling visual bell set t_vb= " and then clear the visual bell code set nohlsearch " no search highlighting " Tab handling set tabstop=4 " tabstop every 4 'spaces' set shiftwidth=4 " shiftwidth the same as a single tabstop set softtabstop=4 set expandtab set nocompatible " turn off VI compatability setlocal spelllang=en " I usually type in English "set spell " press 'q' to rewrap the current paragraph map q gq} " press 't' to feed the entire file or the visual selection through tidy map t :%!tidy --tab-size 4 --indent-spaces 4 -asxhtml -quiet -indent -wrap 150 -clean -utf8 2>/dev/null vmap t :'<, '>!tidy --tab-size 4 --indent-spaces 4 -asxhtml -quiet -indent -wrap 150 -clean -utf8 2>/dev/null " press 'X' to reformat the entire file as XML map X :%!xmllint --format - vmap X :'<, '>!xmllint --format - " map to [set paste][paste][set nopaste] map :set paste"*p:set nopastea " switches to the next window and maximizes it nmap _ " LaTeX shortcuts " imap EQN \begin{eqnarray*}\end{eqnarray*} " imap EFI \begin{figure}\begin{center}\includegraphics[width=3in]{}\end{center}\label{fig:}\caption{}\end{figure} " Make p in Visual mode replace the selected text with the "" register. vnoremap p :let current_reg = @"gvdi=current_reg " switch syntax highlighting on when the terminal has colors if &t_Co > 2 || has("gui_running") syntax on endif filetype indent on filetype plugin on " Python files use special settings autocmd BufRead *.py set smartindent cinwords=if,elif,else,for,while,try,except,finally,def,class foldmethod=indent foldnestmax=2 autocmd FileType python set ts=4 " remove trailing spaces when saving Python files autocmd BufWritePre *.py normal m`:%s/\s\+$//e `` " change working directory to directory containing the read file autocmd BufRead * cd %:p:h " enable spell checking on LaTeX files. autocmd BufRead *.tex set spell " Use # without VIM moving it to the first column inoremap # X#