Browse Source

Add vim-go settings

Andrew Swistak 8 years ago
parent
commit
a388017691
1 changed files with 6 additions and 1 deletions
  1. 6 1
      vimrc

+ 6 - 1
vimrc

@@ -44,6 +44,8 @@ set splitright  " New window split settings
 set splitbelow  " New window split settings
 set viminfo^=%  " Remember buffer info on close
 
+set completeopt=menu
+
 """"""""""""""""""""""""""""
 " Keybinds
 """"""""""""""""""""""""""""
@@ -138,6 +140,7 @@ map <S-q> <nop>
 """"""""""""""""""""""""""""
 
 map <silent> <leader>t :call RunCurrentSpecFile()<CR>
+autocmd FileType go map <buffer> <silent> <leader>t :GoTest<CR>
 map <silent> <leader>a :call RunAllSpecs()<CR>
 map <silent> <leader>s :call RunNearestSpec()<CR>
 map <silent> <leader>k :call RunLastSpec()<CR>
@@ -317,6 +320,7 @@ function! DeleteTrailingWS()
   exe "normal `z"
 endfunction
 autocmd BufWrite * :call DeleteTrailingWS()
+autocmd BufWrite *.go :GoImports
 
 if !has("nvim")
   " Allow the use of ALT as a function key.
@@ -328,7 +332,8 @@ if !has("nvim")
   endw
 endif
 
-au BufRead,BufNewFile *.Dockerfile setfiletype dockerfile
+au BufRead,BufNewFile *.Dockerfile set filetype=dockerfile
+au BufRead,BufNewFile *.go set filetype=go
 
 " Close current window or quit vim if no active windows
 autocmd BufDelete * if len(filter(range(1, bufnr('$')), '!empty(bufname(v:val)) && buflisted(v:val)')) == 1 | q | endif