diff --git a/vim/.vimrc b/vim/.vimrc new file mode 100644 index 0000000..9edd9d2 --- /dev/null +++ b/vim/.vimrc @@ -0,0 +1,132 @@ +" This line should not be removed as it ensures that various options are +" properly set to work with the Vim-related packages. +runtime! archlinux.vim + +" If you prefer the old-style vim functionalty, add 'runtime! vimrc_example.vim' +" Or better yet, read /usr/share/vim/vim80/vimrc_example.vim or the vim manual +" and configure vim to your own liking! + +" Syntax highlighting +syntax on +set background=dark +let g:solarized_termcolors = 16 +colorscheme solarized + +" have Vim load indentation rules and plugins +" according to the detected filetype. +if has("autocmd") + filetype plugin indent on +endif + +set shell=sh +set showcmd " Show (partial) command in status line. +set showmatch " Show matching brackets. +"set ignorecase " Do case insensitive matching +"set smartcase " Do smart case matching +"set incsearch " Incremental search +"set autowrite " Automatically save before commands like :next and :make +set hidden " Hide buffers when they are abandoned +set mouse=a +set number +set expandtab "Use softtabstop spaces instead of tab characters for indentation +set shiftwidth=4 "Indent by 4 spaces when using >>, <<, == etc. +set softtabstop=4 "Indent by 4 spaces when pressing +set tabstop=4 +set autoindent "Keep indentation from previous line +set smartindent "Automatically inserts indentation in some cases +set nowrap +set laststatus=2 +let mapleader = "," +set backupdir=~/.vim/backup// +set directory=~/.vim/swap// +set undodir=~/.vim/undo// + +" flag lines wider than 80 char +highlight ColorColumn ctermbg=magenta +call matchadd('ColorColumn', '\%81v', 100) + + +if has("autocmd") + autocmd FileType yaml setlocal ts=2 sts=2 sw=2 expandtab + autocmd FileType html setlocal ts=2 sts=2 sw=2 expandtab + autocmd FileType css setlocal ts=2 sts=2 sw=2 expandtab + autocmd FileType javascript setlocal ts=2 sts=2 sw=2 expandtab + autocmd FileType xml setlocal ts=2 sts=2 sw=2 expandtab + autocmd FileType go setlocal ts=4 sts=4 sw=4 noexpandtab + autocmd FileType rst setlocal tw=80 ts=3 sts=3 sw=3 expandtab + autocmd FileType gitcommit setlocal tw=80 ts=2 sts=2 sw=2 expandtab +endif + +" Airline options +let g:airline_powerline_fonts = 1 +let g:airline_theme='solarized' +let g:airline#extensions#tabline#enabled = 1 + +" NERDTree options +" Automatically opens NERDTree +" autocmd vimenter * NERDTree + +" Close NERDTree if it is the last window +" autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif + +" Syntastic options +let g:syntastic_always_populate_loc_list = 1 +let g:syntastic_auto_loc_list = 1 +let g:syntastic_check_on_open = 1 +let g:syntastic_check_on_wq = 1 +let g:syntastic_aggregate_errors = 1 + +" Vim-go options +let g:go_fmt_command = "goimports" +let g:go_metalinter_autosave = 1 +let g:go_metalinter_enabled = ['vet', 'golint', 'errcheck', 'structcheck', 'deadcode', 'gocyclo', 'ineffassign', 'dupl', 'gotype', 'varcheck', 'interfacer', 'gosimple', 'staticcheck', 'misspell', 'gas'] +let g:go_get_update = 0 +let g:go_list_type = "quickfix" +let g:go_highlight_functions = 1 +let g:go_highlight_methods = 1 +let g:go_highlight_fields = 1 +let g:go_highlight_types = 1 +let g:go_highlight_operators = 1 +let g:go_highlight_build_constraints = 1 +if has("autocmd") + autocmd FileType go nmap b (go-build) + autocmd FileType go nmap r (go-run) + autocmd FileType go nmap t (go-test) + autocmd FileType go nmap T (go-test-func) + autocmd FileType go nmap c (go-cover) + autocmd FileType go nmap C (go-cover-clear) + autocmd FileType go nmap a (go-alternate) + autocmd FileType go nmap f (go-fmt) +endif + +" Syntastic options +" let g:syntastic_go_checkers = ['golint', 'govet', 'errcheck'] +" let g:syntastic_mode_map = { 'mode': 'active', 'passive_filetypes': ['go'] } +let g:syntastic_javascript_checkers = ['eslint'] + +" other plugins + +call plug#begin('~/.vim/plugged') + + Plug 'scrooloose/nerdtree' + Plug 'xuyuanp/nerdtree-git-plugin' + + Plug 'airblade/vim-gitgutter' + Plug 'bling/vim-airline' + Plug 'vim-airline/vim-airline-themes' + Plug 'tpope/vim-fugitive' + Plug 'kien/ctrlp.vim' + Plug 'valloric/youcompleteme' + Plug 'altercation/vim-colors-solarized' + + Plug 'fatih/vim-go' + Plug 'joukevandermaas/vim-ember-hbs' + + Plug 'scrooloose/syntastic' + Plug 'mtscout6/syntastic-local-eslint.vim' + +call plug#end() + + +" Other key mappings +map :NERDTreeToggle