diff --git a/vim/vimrc b/vim/vimrc new file mode 100644 index 0000000..02b1c4d --- /dev/null +++ b/vim/vimrc @@ -0,0 +1,178 @@ +execute pathogen#infect() + +set nocompatible +filetype indent plugin on + +set wildmenu +set showcmd +set hlsearch + +set ignorecase +set smartcase +set backspace=indent,eol,start +set autoindent +set nostartofline +set ruler +set laststatus=2 +set confirm +set mouse=a +set cmdheight=2 +set number +set pastetoggle= + +set softtabstop=4 +set shiftwidth=4 +set expandtab + +set autoread + +let mapleader = "," +let g:mapleader = "," + +nmap w :w! + +" Visual + +set so=7 +set wildignore=*.o,*~,*.pyc,*.jar +set hid +set whichwrap+=<,>,h,l +set incsearch +set lazyredraw +set magic +set showmatch +set mat=2 +set noerrorbells +set novisualbell +set t_vb= +set tm=500 + +" Color + +syntax on +colorscheme mmk2410 +set cursorline +if has("gui_running") + set guioptions-=T + set guioptions+=e + set t_Co=256 + set guitablabel=%M\ %t +endif +set encoding=utf-8 +set ffs=unix,dos,mac + +" Files, Backups and undo + +set nobackup +set nowb +set noswapfile + +set smarttab +set tabstop=4 +set ai +set si +set wrap + +map j gj +map k gk +map / +map ? +" Smart way to move between windows +map j +map k +map h +map lmap tn :tabnew +map to :tabonly +map tc :tabclose +map tm :tabmove +" Opens a new tab with the current buffer's path +" Super useful when editing files in the same directory +map te :tabedit =expand("%:p:h")/ +" +" " Switch CWD to the directory of the open buffer +map cd :cd %:p:h:pwd +" +" " Specify the behavior when switching between buffers +try + set switchbuf=useopen,usetab,newtab + set stal=2 +catch +endtry +" +" Return to last edit position when opening files (You want this!) +autocmd BufReadPost * + \ if line("'\"") > 0 && line("'\"") <= line("$") | + \ exe "normal! g`\"" | + \ endif +"Remember info about open buffers on close +set viminfo^=% + +map 0 ^ +" Move a line of text using ALT+[jk] or Comamnd+[jk] on mac +nmap mz:m+`z +nmap mz:m-2`z +vmap :m'>+`mzgv`yo`z +vmap :m'<-2`>my` + nmap + vmap + vmap +endif +" +" Delete trailing white space on save, useful for Python and +" CoffeeScript ;) +func! DeleteTrailingWS() + exe "normal mz" + %s/\s\+$//ge + exe "normal `z" +endfunc +autocmd BufWrite *.py :call DeleteTrailingWS() +autocmd BufWrite *.coffee :call DeleteTrailingWS() + +map ss :setlocal spell! + +" Shortcuts using +map sn ]s +map sp [s +map sa zg +map s? z= + +"Remove the Windows ^M - when the encodings gets messed up +noremap m mmHmt:%s///ge'tzt'm + +" Quickly open a buffer for scripbble +map q :e ~/buffer + +" Toggle paste mode on and off +map pp :setlocal paste! + +" My Changes + +inoremap jk +set listchars=tab:>-,trail:- +set list + +let g:airline_powerline_fonts = 1 +let g:airline#extensions#tabline#enabled = 1 +let g:airline_theme='luna' + +let g:syntastic_check_on_open = 1 +let g:syntastic_check_on_wq = 0 +let g:syntastic_python_python_exec = '/usr/bin/python3' + +set grepprg=grep\ -nH\ $* +let g:tex_flavor='latex' +let g:tex_fold_enabled=1 +let g:Tex_CompileRule_pdf = 'pdflatex --interaction=nonstopmode $*' + +" Powerline +"python from powerline.vim import setup as powerline_setup +"python powerline_setup() +"python del powerline_setup + +" Filetype specific settings +autocmd Filetype html setlocal ts=2 sts=2 sw=2 +autocmd Filetype javascript setlocal ts=2 sts=2 sw=2 +autocmd Filetype coffee setlocal ts=2 sts=2 sw=2