From 24acdf848ae1d8d3380f44f5b546abea28e41161 Mon Sep 17 00:00:00 2001 From: Mariano Uvalle Date: Sun, 9 Jan 2022 13:58:55 -0800 Subject: [PATCH] Update gols. Update lsp-signature config. Adds smoth scrolling. Adds highlight for current word. --- init.lua | 2 +- lua/colorscheme.lua | 12 ++++++++---- lua/lsp/go-ls.lua | 8 ++++++-- lua/lsp_signature/init.lua | 9 --------- lua/plugins.lua | 5 +++++ lua/settings.lua | 27 ++++++++++++++++++++++++++- 6 files changed, 46 insertions(+), 17 deletions(-) delete mode 100644 lua/lsp_signature/init.lua diff --git a/init.lua b/init.lua index 6bde73c..458f18d 100644 --- a/init.lua +++ b/init.lua @@ -18,6 +18,6 @@ require('lsp.go-ls') require('nv-compe') -- Function signatures -require('lsp_signature') +-- require('lsp_signature') require('nv-prettier') diff --git a/lua/colorscheme.lua b/lua/colorscheme.lua index 0cc8bda..7e54c74 100644 --- a/lua/colorscheme.lua +++ b/lua/colorscheme.lua @@ -1,6 +1,10 @@ -vim.cmd("colorscheme palenight") -vim.g.lightline={ - colorscheme='palenight' -} vim.api.nvim_set_option('background', 'dark') vim.api.nvim_set_option('termguicolors', true) + +-- vim_current_word +vim.cmd([[ + colorscheme palenight + highlight ColorColumn ctermbg=0 guibg=grey + hi CurrentWord guibg=#444444 + hi CurrentWordTwins guibg=#606060 +]]) diff --git a/lua/lsp/go-ls.lua b/lua/lsp/go-ls.lua index 648defb..1ee9bd8 100644 --- a/lua/lsp/go-ls.lua +++ b/lua/lsp/go-ls.lua @@ -34,8 +34,12 @@ vim.g.go_code_completion_enabled = 0 -- Disable gopls for the same reasons as above. vim.g.go_gopls_enabled = 0 --- Use goimports for both formatting and imports. -vim.g.go_fmt_command = 'goimports' +-- Simplify code when formatting. +vim.g.go_fmt_command = 'gofmt' +vim.g.go_fmt_options = { + gofmt = '-s', +} + vim.g.go_imports_mode = 'goimports' -- Could confilg with lsp saga, should experiment. diff --git a/lua/lsp_signature/init.lua b/lua/lsp_signature/init.lua deleted file mode 100644 index 81aad02..0000000 --- a/lua/lsp_signature/init.lua +++ /dev/null @@ -1,9 +0,0 @@ -require'lsp_signature'.on_attach({ - bind = true, - floating_window = true, - hint_enable = true, - fix_pos = true, - handler_opts = { - border = "single" -- double, single, shadow, none - }, - }) diff --git a/lua/plugins.lua b/lua/plugins.lua index 9795b80..770ccb5 100644 --- a/lua/plugins.lua +++ b/lua/plugins.lua @@ -29,6 +29,7 @@ return require('packer').startup(function(use) use 'sheerun/vim-polyglot' use {'prettier/vim-prettier', run = "yarn install"} use {'styled-components/vim-styled-components', branch = "main"} + use 'dominikduda/vim_current_word' use 'airblade/vim-rooter' @@ -51,6 +52,7 @@ return require('packer').startup(function(use) use 'jiangmiao/auto-pairs' use 'itchyny/lightline.vim' + use 'itchyny/vim-gitbranch' -- Golang use 'fatih/vim-go' @@ -64,4 +66,7 @@ return require('packer').startup(function(use) -- Comments use 'tpope/vim-commentary' + -- Smooth scrolling + use 'psliwka/vim-smoothie' + end) diff --git a/lua/settings.lua b/lua/settings.lua index 86571d7..161a0a1 100644 --- a/lua/settings.lua +++ b/lua/settings.lua @@ -22,7 +22,6 @@ vim.o.updatetime = 300 -- Faster completion vim.o.timeoutlen = 500 -- By default timeoutlen is 1000 ms vim.cmd(":set number relativenumber") -vim.cmd("highlight ColorColumn ctermbg=0 guibg=grey") ------ Folding -- vim.o.foldlevel = 99 @@ -35,3 +34,29 @@ vim.cmd("highlight ColorColumn ctermbg=0 guibg=grey") -- autocmd BufWinEnter * silent! loadview -- augroup END -- ]]) + +-- Show full file path in lightline. +vim.cmd([[ +let g:lightline = { + \ 'colorscheme' : 'palenight', + \ 'active': { + \ 'left': [ [ 'mode', 'paste' ], + \ [ 'gitbranch', 'readonly', 'filename', 'modified' ] ] + \ }, + \ 'component_function': { + \ 'filename': 'FilenameForLightline', + \ 'gitbranch': 'gitbranch#name' + \ } + \ } + +function! FilenameForLightline() + let root = fnamemodify(get(b:, 'gitbranch_path'), ':h:h') + let path = expand('%:p') + if path[:len(root)-1] ==# root + return path[len(root)+1:] + endif + return expand('%') +endfunction +]]) + +