dotfiles/vim/.vim/after/ftplugin/go.vim

22 lines
515 B
VimL
Raw Normal View History

2022-12-18 14:54:56 +01:00
compiler go
2023-11-12 20:17:05 +01:00
noremap <buffer> <space> :silent make <bar> redraw
2024-02-06 23:25:23 +01:00
let g:ale_linters = {
\ 'go': ['gopls'],
\}
" let g:ale_completion_enabled = 1
" Map <Leader>ee to insert Go error handling if condition
nnoremap <Leader>ee :call InsertGoErrorHandling()<CR>
function! InsertGoErrorHandling()
let err_handling = "if err != nil { \r return err \r}"
let save_cursor = getpos(".")
execute "normal! a" . err_handling
normal! jjj$
normal! $o
startinsert
endfunction