From 7982e2fae5defeb296c210e2aae098a8a11df25a Mon Sep 17 00:00:00 2001 From: Ariel D'ALessandro Date: Mon, 26 Jul 2021 20:57:58 +0200 Subject: Initialization of the repository, copy from https://github.com/adalessa/dotfiles --- plugin/colors.vim | 29 ++++++++++++++++++++++ plugin/git.vim | 12 ++++++++++ plugin/lsp.vim | 66 +++++++++++++++++++++++++++++++++++++++++++++++++++ plugin/navigation.vim | 16 +++++++++++++ plugin/sets.vim | 29 ++++++++++++++++++++++ plugin/status.vim | 1 + plugin/telescope.vim | 26 ++++++++++++++++++++ plugin/test.vim | 5 ++++ plugin/vimspector.vim | 32 +++++++++++++++++++++++++ 9 files changed, 216 insertions(+) create mode 100644 plugin/colors.vim create mode 100644 plugin/git.vim create mode 100644 plugin/lsp.vim create mode 100644 plugin/navigation.vim create mode 100644 plugin/sets.vim create mode 100644 plugin/status.vim create mode 100644 plugin/telescope.vim create mode 100644 plugin/test.vim create mode 100644 plugin/vimspector.vim (limited to 'plugin') diff --git a/plugin/colors.vim b/plugin/colors.vim new file mode 100644 index 0000000..695fb91 --- /dev/null +++ b/plugin/colors.vim @@ -0,0 +1,29 @@ +fun! ColorMyPencils() + let g:gruvbox_contrast_dark = 'hard' + let g:gruvbox_bold = 0 + if exists('+termguicolors') + let &t_8f = "\[38;2;%lu;%lu;%lum" + let &t_8b = "\[48;2;%lu;%lu;%lum" + endif + let g:gruvbox_invert_selection = '0' + + set background=dark + colorscheme gruvbox + + " Transparency + highlight Normal ctermbg=NONE guibg=NONE + highlight EndOfBuffer ctermbg=NONE guibg=NONE + + highlight ColorColumn ctermbg=0 guibg=grey + " highlight Normal guibg=none + " highlight LineNr guifg=#ff8659 + " highlight LineNr guifg=#aed75f + highlight LineNr guifg=#5eacd3 + highlight netrwDir guifg=#5eacd3 + highlight qfFileName guifg=#aed75f + hi TelescopeBorder guifg=#5eacd +endfun + +call ColorMyPencils() + +nnoremap cc :call ColorMyPencils() diff --git a/plugin/git.vim b/plugin/git.vim new file mode 100644 index 0000000..21bcc9a --- /dev/null +++ b/plugin/git.vim @@ -0,0 +1,12 @@ +nmap ]h (GitGutterNextHunk) +nmap [h (GitGutterPrevHunk) + +nmap ghs (GitGutterStageHunk) +nmap ghu (GitGutterUndoHunk) + +" nmap gs :G +nmap gdh :diffget //2 +nmap gdl :diffget //3 + +nnoremap ga :Git fetch --all +nnoremap gl :Git pull diff --git a/plugin/lsp.vim b/plugin/lsp.vim new file mode 100644 index 0000000..02b57a1 --- /dev/null +++ b/plugin/lsp.vim @@ -0,0 +1,66 @@ +let g:compe = {} +let g:compe.enabled = v:true +let g:compe.autocomplete = v:true +let g:compe.debug = v:false +let g:compe.min_length = 1 +let g:compe.preselect = 'enable' +let g:compe.throttle_time = 80 +let g:compe.source_timeout = 200 +let g:compe.incomplete_delay = 400 +let g:compe.max_abbr_width = 100 +let g:compe.max_kind_width = 100 +let g:compe.max_menu_width = 100 +let g:compe.documentation = v:true + +let g:compe.source = {} +let g:compe.source.path = v:true +let g:compe.source.buffer = v:true +let g:compe.source.calc = v:true +let g:compe.source.nvim_lsp = v:true +let g:compe.source.nvim_lua = v:true +let g:compe.source.vsnip = v:true + +inoremap compe#complete() +inoremap compe#confirm('') +inoremap compe#close('') +inoremap compe#scroll({ 'delta': +4 }) +inoremap compe#scroll({ 'delta': -4 }) + +fun! LspLocationList() + lua vim.lsp.diagnostic.set_loclist({open_loclist = false}) +endfun + +augroup alpha_lsp + autocmd! + autocmd! BufWrite,BufEnter,InsertLeave * :call LspLocationList() +augroup END + +nnoremap vd :lua vim.lsp.buf.definition() +nnoremap vsh :lua vim.lsp.buf.signature_help() +nnoremap vh :lua vim.lsp.buf.hover() + +" to test +nnoremap vi :lua vim.lsp.buf.implementation() +nnoremap vrn :lua vim.lsp.buf.rename() +nnoremap vca :lua vim.lsp.buf.code_action() +nnoremap vsd :lua vim.lsp.util.show_line_diagnostics(); vim.lsp.util.show_line_diagnostics() +nnoremap vn :lua vim.lsp.diagnostic.goto_next() + +nnoremap vo :LspRestart + + +au Filetype php setl omnifunc=v:lua.vim.lsp.omnifunc +autocmd FileType go setlocal omnifunc=v:lua.vim.lsp.omnifunc + +let g:completion_matching_strategy_list = ['exact', 'substring', 'fuzzy'] + +lua << EOF + +local function on_attach() + vim.api.nvim_set_keymap('n', 'K', ':lua vim.lsp.buf.hover()', {noremap = true}) +end +require'lspconfig'.tsserver.setup{ on_attach=on_attach } +require'lspconfig'.intelephense.setup{ on_attach=on_attach } +require'lspconfig'.gopls.setup{ on_attach=on_attach } +require'lspconfig'.sumneko_lua.setup{ on_attach=on_attach } +EOF diff --git a/plugin/navigation.vim b/plugin/navigation.vim new file mode 100644 index 0000000..ff3c652 --- /dev/null +++ b/plugin/navigation.vim @@ -0,0 +1,16 @@ +nnoremap h :wincmd h +nnoremap j :wincmd j +nnoremap k :wincmd k +nnoremap l :wincmd l +nnoremap q :wincmd q + +nnoremap vsp :vsp +nnoremap sp :sp + +nnoremap :cnext +nnoremap :cprev + +nnoremap i :lnext +nnoremap o :lprev + +nnoremap bd :bd diff --git a/plugin/sets.vim b/plugin/sets.vim new file mode 100644 index 0000000..5a170a9 --- /dev/null +++ b/plugin/sets.vim @@ -0,0 +1,29 @@ +set nu +set relativenumber +set hidden +set expandtab +set tabstop=4 softtabstop=4 +set shiftwidth=4 +set smartindent +set noerrorbells +set nowrap +set noswapfile +set undofile +set undodir=~/.config/nvim/undodir +set nohlsearch +set incsearch +set termguicolors +set scrolloff=4 +set noshowmode +set clipboard+=unnamedplus +set completeopt=menuone,noinsert,noselect +set signcolumn=yes +set colorcolumn=80 +set splitbelow +set splitright +set autowrite + +set cmdheight=2 + +" improve user experience updating more frequently +set updatetime=50 diff --git a/plugin/status.vim b/plugin/status.vim new file mode 100644 index 0000000..9936f3e --- /dev/null +++ b/plugin/status.vim @@ -0,0 +1 @@ +lua require("alpha.status-line") diff --git a/plugin/telescope.vim b/plugin/telescope.vim new file mode 100644 index 0000000..e057d4c --- /dev/null +++ b/plugin/telescope.vim @@ -0,0 +1,26 @@ +lua require("alpha") + +let g:telescope_cache_results = 1 +let g:telescope_prime_fuzzy_find = 1 + +nnoremap ps :lua require('telescope.builtin').grep_string({ search = vim.fn.input("Grep For > ")}) +nnoremap pw :lua require('telescope.builtin').grep_string({ search = vim.fn.expand("")}) + +nnoremap pp :lua require('telescope.builtin').git_files() +nnoremap po :lua require('telescope.builtin').find_files() + +nnoremap pv :lua require('telescope.builtin').lsp_workspace_symbols({ query = vim.fn.input("Symbols > ")}) + +nnoremap pe :lua require('alpha.telescope').buffers() + +nnoremap bb :lua require('telescope.builtin').file_browser() + +nnoremap gc :lua require('telescope.builtin').git_branches() +nnoremap gs :lua require('telescope.builtin').git_status() + +nnoremap rc :lua require('alpha.telescope').search_config() + +nnoremap vrr :lua require('telescope.builtin').lsp_references() + +nnoremap vs :lua require('telescope.builtin').lsp_document_symbols() +nnoremap ve :lua require('telescope.builtin').lsp_document_diagnostics() diff --git a/plugin/test.vim b/plugin/test.vim new file mode 100644 index 0000000..0f0c85b --- /dev/null +++ b/plugin/test.vim @@ -0,0 +1,5 @@ +nmap t :TestNearest +nmap t :TestFile +nmap t :TestSuite +nmap t :TestLast +nmap t :TestVisit diff --git a/plugin/vimspector.vim b/plugin/vimspector.vim new file mode 100644 index 0000000..8223a38 --- /dev/null +++ b/plugin/vimspector.vim @@ -0,0 +1,32 @@ +" Debuggin config +fun! GotoWindow(id) + call win_gotoid(a:id) + MaximizerToggle +endfun + +let g:vimspector_enable_mappings = 'HUMAN' + +" Debugger remaps +nnoremap m :MaximizerToggle! +nnoremap dd :call vimspector#Launch() +nnoremap dc :call GotoWindow(g:vimspector_session_windows.code) +nnoremap dt :call GotoWindow(g:vimspector_session_windows.tagpage) +nnoremap dv :call GotoWindow(g:vimspector_session_windows.variables) +nnoremap dw :call GotoWindow(g:vimspector_session_windows.watches) +nnoremap ds :call GotoWindow(g:vimspector_session_windows.stack_trace) +nnoremap do :call GotoWindow(g:vimspector_session_windows.output) +nnoremap de :call vimspector#Reset() + +nnoremap dtcb :call vimspector#CleanLineBreakpoint() + +nmap dl VimspectorStepInto +nmap dj VimspectorStepOver +nmap dk VimspectorStepOut +nmap d_ VimspectorRestart +nnoremap d :call vimspector#Continue() + +nmap drc VimspectorRunToCursor +nmap dbp VimspectorToggleBreakpoint +nmap dcbp VimspectorToggleConditionalBreakpoint + +let g:vimspector_install_gadgets = [ 'vscode-go' ] -- cgit v1.2.3