M vim/.config/nvim/init.vim => vim/.config/nvim/init.vim +2 -3
@@ 34,9 34,9 @@ local on_attach = function(client, bufnr)
-- Set some keybinds conditional on server capabilities
if client.resolved_capabilities.document_formatting then
- buf_set_keymap("n", "<Leader>f", "<cmd>lua vim.lsp.buf.formatting()<CR>", opts)
+ buf_set_keymap("n", "<Leader>df", "<cmd>lua vim.lsp.buf.formatting()<CR>", opts)
elseif client.resolved_capabilities.document_range_formatting then
- buf_set_keymap("n", "<Leader>f", "<cmd>lua vim.lsp.buf.formatting()<CR>", opts)
+ buf_set_keymap("n", "<Leader>df", "<cmd>lua vim.lsp.buf.formatting()<CR>", opts)
end
-- Set autocommands conditional on server_capabilities
@@ 93,7 93,6 @@ EOF
nmap <Leader>ff <cmd>Telescope find_files<cr>
nmap <Leader>fg <cmd>Telescope live_grep<cr>
nmap <Leader>fb <cmd>Telescope buffers<cr>
-nmap <Leader>be <cmd>Telescope buffers<cr>
nmap <Leader>fh <cmd>Telescope help_tags<cr>
endif
M vim/.vimrc => vim/.vimrc +15 -6
@@ 19,8 19,6 @@ if has('nvim-0.5')
Plug 'neovim/nvim-lspconfig'
Plug 'nvim-telescope/telescope.nvim'
Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'}
-else
- " bufexplorer takes <Leader>be, so only install it if Telescope is not
Plug 'jlanzarotta/bufexplorer'
endif
call plug#end()
@@ 35,10 33,21 @@ nmap <Leader>nt :NERDTreeToggle<cr>
nmap <Leader>nf :NERDTreeFind<cr>
nmap <Leader>nh :set nohls<cr>
-au filetype go setlocal noexpandtab tabstop=4 shiftwidth=4
-au filetype html setlocal expandtab tabstop=2 shiftwidth=2
-au filetype json setlocal expandtab tabstop=2 shiftwidth=2
-au filetype javascript setlocal expandtab tabstop=4 shiftwidth=4
+au FileType go setlocal noexpandtab tabstop=4 shiftwidth=4
+au FileType go call s:set_make_go()
+au FileType go command! Imports call s:go_imports()
+au FileType html setlocal expandtab tabstop=2 shiftwidth=2
+au FileType json setlocal expandtab tabstop=2 shiftwidth=2
+au FileType javascript setlocal expandtab tabstop=4 shiftwidth=4
silent! colorscheme wasabi256
highlight! link NonText NONE
+
+function! s:set_make_go() abort
+ let l:dir = expand('%:p:h')
+ execute 'setlocal makeprg=go\ build\ '.l:dir
+endfunction
+
+function! s:go_imports() abort
+ execute '!goimports -w '.expand('%')
+endfunction