.vimrc 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. " Run the following git commands to get the plugins
  2. " Plugin manager
  3. if empty(glob('~/.vim/autoload/plug.vim'))
  4. silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
  5. \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
  6. autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
  7. endif
  8. " Pre-plugin calls
  9. let g:ale_completion_enabled = 1
  10. let g:ale_set_balloons = 1
  11. " Plugins
  12. call plug#begin('~/.vim/plugged')
  13. Plug 'preservim/nerdtree'
  14. Plug 'tpope/vim-fugitive'
  15. Plug 'tpope/vim-commentary'
  16. #Plug 'fatih/vim-go', { 'do': ':GoUpdateBinaries' }
  17. Plug 'itchyny/lightline.vim'
  18. Plug 'dikiaap/minimalist'
  19. Plug 'morhetz/gruvbox'
  20. Plug 'dense-analysis/ale'
  21. Plug 'maximbaz/lightline-ale'
  22. call plug#end()
  23. filetype plugin indent on
  24. syntax on
  25. set autoindent
  26. set backspace=2
  27. set background=dark
  28. set cursorcolumn
  29. set cursorline
  30. set expandtab
  31. set history=1000
  32. set hlsearch
  33. set incsearch
  34. set nowrap
  35. set number
  36. set numberwidth=4
  37. set pastetoggle=<F12> "Press <F12> when paste-alot
  38. set preserveindent
  39. set ruler
  40. set shiftround
  41. set shiftwidth=2
  42. set shortmess=atI
  43. set showcmd
  44. set showmatch
  45. set smartindent
  46. set smarttab
  47. set tabstop=2
  48. set whichwrap+=<,>,[,],h,l
  49. set undofile
  50. set undodir=~/.vim/undo
  51. " Gruvbox
  52. let g:gruvbox_italic = 1
  53. let g:gruvbox_bold = 1
  54. let g:gruvbox_transparent_bg = 1
  55. colorscheme gruvbox
  56. " ALE completion
  57. set omnifunc=ale#completion#OmniFunc
  58. let g:ale_completion_autoimport = 1
  59. " ALE navigation
  60. nmap <silent> <C-k> <Plug>(ale_previous_wrap)
  61. nmap <silent> <C-j> <Plug>(ale_next_wrap)
  62. " Lightline
  63. set laststatus=2
  64. set noshowmode
  65. let g:lightline = {
  66. \ 'colorscheme': 'gruvbox',
  67. \ 'active': {
  68. \ 'left': [
  69. \ [ 'mode', 'paste' ],
  70. \ [ 'gitbranch', 'readonly', 'filename', 'modified' ]
  71. \ ],
  72. \ 'right': [
  73. \ [ 'linter_checking', 'linter_errors', 'linter_warnings', 'linter_infos', 'linter_ok' ],
  74. \ [ 'percent', 'lineinfo', 'offset' ],
  75. \ [ 'fileformat', 'fileencoding', 'filetype' ]
  76. \ ]
  77. \ },
  78. \ 'component_function': {
  79. \ 'gitbranch': 'FugitiveHead',
  80. \ 'offset': 'FileOffset'
  81. \ },
  82. \ 'component_expand': {
  83. \ 'linter_checking': 'lightline#ale#checking',
  84. \ 'linter_infos': 'lightline#ale#infos',
  85. \ 'linter_warnings': 'lightline#ale#warnings',
  86. \ 'linter_errors': 'lightline#ale#errors',
  87. \ 'linter_ok': 'lightline#ale#ok'
  88. \ },
  89. \ 'component_type': {
  90. \ 'linter_checking': 'right',
  91. \ 'linter_infos': 'right',
  92. \ 'linter_warnings': 'warning',
  93. \ 'linter_errors': 'error',
  94. \ 'linter_ok': 'right'
  95. \ }
  96. \ }
  97. function! FileOffset()
  98. return line2byte(line('.')) + col('.') - 1
  99. endfunction
  100. " NERDtree
  101. " Start NERDTree if no file was specified
  102. autocmd StdinReadPre * let s:std_in=1
  103. autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif
  104. " Close NERDTree on opening file
  105. let NERDTreeQuitOnOpen=1
  106. " Show hidden files
  107. let NERDTreeShowHidden=1
  108. " Toggle NERDTree on <space>-o
  109. map <Space>o :NERDTreeToggle<CR>
  110. " " vim-go
  111. " let g:go_highlight_types = 1
  112. " let g:go_highlight_fields = 1
  113. " let g:go_highlight_functions = 1
  114. " let g:go_highlight_function_calls = 1
  115. " let g:go_highlight_operators = 1
  116. " let g:go_auto_type_info = 1
  117. " let g:go_fmt_command = "goimports"
  118. " let g:go_list_type = "quickfix"
  119. " map <C-g>v :GoVet<CR>
  120. " map <C-g>r :GoRun<CR>
  121. " map <C-g>b :GoBuild<CR>
  122. " Key mappings
  123. map <C-l>n :cnext<CR>
  124. map <C-l>p :cprevious<CR>
  125. nnoremap <C-l>c :cclose<CR>