diff --git a/.vimrc b/.vimrc index ac9617b..aea0f77 100644 --- a/.vimrc +++ b/.vimrc @@ -5,14 +5,6 @@ endif set nocompatible " Be IMproved -" Recognize file types by extension -autocmd BufEnter *.php set filetype=php -autocmd BufEnter *.less set filetype=less -autocmd BufEnter *.js set filetype=javascript -autocmd BufEnter *.json set filetype=javascript -autocmd BufEnter *.ejs set filetype=html -autocmd BufEnter *.go set filetype=go - " Vundle filetype off " Required by Vundle set rtp+=~/.vim/bundle/vundle/ @@ -32,7 +24,6 @@ Bundle 'fatih/vim-go' Bundle 'othree/html5.vim' Bundle 'StanAngeloff/php.vim' Bundle 'tomasr/molokai' -Bundle 'jelera/vim-nazca-colorscheme' Bundle 'nanotech/jellybeans.vim' " Automatically install bundles on first run @@ -41,27 +32,58 @@ if !isdirectory(expand("~/.vim/bundle/vim-airline")) execute 'silent q' endif -colorscheme nazca " Colors! -let g:slime_target = "tmux" " Use tmux for slime -filetype plugin indent on " Sets indent mode based on filetype syntax on " Syntax highlighting +filetype plugin indent on " Sets indent mode based on filetype +colorscheme jellybeans " Default color scheme + +set clipboard=unnamed " Share OS clipboard +set encoding=utf-8 " default character encoding +set hidden " do not unload buffers that get hidden + +set nowrap " Do not wrap lines visually +set number " Show line numbers +set scrolloff=3 " keep minimal number of lines above/below cursor +set splitright " open vertical split right of current window +set sidescroll=3 " scroll sideways 3 characters at a time +set textwidth=80 " Maximum line text width + +set showcmd " Show command line at bottom of screen +set laststatus=2 " Show last status +set visualbell " use visual bell instead of beeping + set autoindent " Indent automatically +set cindent " Syntax aware auto-indent +set nofoldenable " Do not fold code set backspace=indent,eol,start " Set backspace to work for all characters set list " Default indentation and whitespace display -set expandtab " Spaces for tabs -set tabstop=2 " 2 spaces for each tab -set shiftwidth=2 " 2 spaces for indentation set listchars=tab:▸▸,trail:¬ " Show tab character and trailing characters -let g:is_chicken=1 " enable chicken scheme mode -let mapleader = "," " Leader key -set clipboard=unnamed " Share OS clipboard +set expandtab " Spaces for tabs +set smarttab " deletes a shiftwidth worth of space +set tabstop=4 " 2 spaces for each tab in file +set softtabstop=4 " 2 spaces for pressing tab key +set shiftwidth=4 " 2 spaces for indentation + +" Smaller indents on css and html files +autocmd! Syntax css,html,htmldjango,js setlocal shiftwidth=2 tabstop=2 softtabstop=2 + +" Leader key +let mapleader = "," +let g:mapleader = "," +let g:user_emmet_leader_key = '' + set mouse=a " Allow mouse usage in terminal -set laststatus=2 " Show last status -set number " Show line numbers -set nofoldenable " Do not fold code -set textwidth=80 " Maximum line text width -set wrap " Wrap lines visually -set ruler " Always show line/column number + +set showmatch " Briefly jump to matching bracket +set ignorecase " Ignore case when pattern matching +set smartcase " Only if all characters are lower case +set incsearch " Highlight matches while typing search +set hlsearch " Keep previous search highlighted + +" Turn off highlighting of previous search +noremap :nohlsearch + +let g:slime_target = "tmux" " Use tmux for slime +let g:is_chicken=1 " enable chicken scheme mode " Do not create swap files set nobackup @@ -75,3 +97,49 @@ set wildignore+=build,public/build,.git,node_modules,*/deps/go/* set runtimepath^=~/.vim/bundle/ctrlp.vim let g:ctrlp_working_path_mode = '' nmap p :CtrlP + +" Font +set guioptions= +set guifont=Menlo:h14 + +" Git/fugitive shortcuts +nnoremap gs :Gstatus +nnoremap gd :Gdiff +nnoremap gf hczR +nnoremap gp :Git push + +" Mappings for misc plugins +map (easymotion-s2) +map a (EasyAlign) + +" Airline customizations +if !exists("g:airline_symbols") + let g:airline_symbols = {} +endif +let g:airline_left_sep = '⮀' +let g:airline_left_alt_sep = '⮁' +let g:airline_right_sep = '⮂' +let g:airline_right_alt_sep = '⮃' +let g:airline_symbols.branch = '⎇' +let g:airline_symbols.whitespace = 'Ξ' +let g:airline_section_y = airline#section#create(['%p', '%%']) +let g:airline_section_z = airline#section#create_right(['%l', '%c']) + +" Closetag settings +let g:closetag_html_style=1 +autocmd! FileType html,htmldjango source ~/.vim/bundle/closetag.vim/plugin/closetag.vim + +" Highlight characters when lines get too long +autocmd! BufWinEnter *.py,*.vim,vimrc match ErrorMsg '\%>79v.\+' +autocmd! BufWinEnter *.html match ErrorMsg '\%>100v.\+' + +" Automatically wrap text while typing in Markdown and rST documents +autocmd! BufNewFile,BufReadPost *.md set filetype=markdown +autocmd! Filetype markdown,rst set textwidth=79 + +" Remove trailing whitespace and empty lines at end of file +augroup whitespace + autocmd! + autocmd BufWritePre * :%s/\s\+$//e + autocmd BufWritePre * :%s/\($\n\s*\)\+\%$//e +augroup END