" indent depending on filetype filetype on set autoindent " fix different locale settings when ssh'ing set encoding=utf-8 " syntax on syntax on " remove trailing spaces on save autocmd BufWritePre * :%s/\s\+$//e " make vim save and load the folding of the document each time it loads " also places the cursor in the last place that it was left " python specific settings au BufWinLeave *.py mkview au BufWinEnter *.py silent loadview au BufNewFile,BufRead *.py; \ set tabstop=4 \ set softtabstop=4 \ set shiftwidth=4 \ set textwidth=79 \ set expandtab \ set autoindent \ set fileformat=unix " fold methods based on indents " zo to open folds, zc to close set foldmethod=indent set foldlevel=20 " search down into subfolders " provides tab-completion for all file-related tasks set path+=** " display all matching files when we tab complete set wildmenu " use normal backspace behavior set backspace=2 " disable background color erase set t_ut= " colorscheme colorscheme despacio " automatically source vimrc on save. autocmd! bufwritepost $MYVIMRC source $MYVIMRC " line numbers set number " changes to current directory when creating new files set autochdir " higlhight search set hls " search as characters are entered set incsearch " line for linewrapping set colorcolumn=80 " remove temporary swap file set nobackup set noswapfile " wrap text instead of being on one line set lbr " default Colors for CursorLine set cursorline highlight CursorLine cterm=none " activate statusbar set laststatus=2 set statusline=\ %F\ %m%r%w\ %=\ %{hostname()}\ \ \ %{strlen(&ft)?&ft:'none'}\ %{(&bomb?\",BOM\":\"\")}\ %{&ff}\ \ %l/%L\ \ %c\ %P " netrw options function! ToggleVExplorer() if exists("t:expl_buf_num") let expl_win_num = bufwinnr(t:expl_buf_num) if expl_win_num != -1 let cur_win_nr = winnr() exec expl_win_num . 'wincmd w' close exec cur_win_nr . 'wincmd w' unlet t:expl_buf_num else unlet t:expl_buf_num endif else exec '1wincmd w' Vexplore let t:expl_buf_num = bufnr("%") endif endfunction " netrw settings let g:netrw_banner = 0 let g:netrw_winsize = -30 let g:netrw_browse_split = 4 let g:netrw_liststyle = 3 " tab autocompletion function! Tab_Or_Complete() if col('.')>1 && strpart( getline('.'), col('.')-2, 3 ) =~ '^\w' return "\" else return "\" endif endfunction " ------------ Keybindings ---------------- " paste mode toggle set pastetoggle= " reload file map :e " open netrw browser map :call ToggleVExplorer() " tab for completion inoremap =Tab_Or_Complete()