diff --git a/nvim.configlink/settings/custom.vim b/nvim.configlink/settings/custom.vim index 87cd2ca..2758f21 100644 --- a/nvim.configlink/settings/custom.vim +++ b/nvim.configlink/settings/custom.vim @@ -94,6 +94,11 @@ nnoremap z :ZoomToggle " Exit terminal mode tnoremap +lua << EOF +-- Y yank until the end of line +vim.api.nvim_set_keymap('n', 'Y', 'y$', { noremap = true}) +EOF + " Reload Vimrc settings nnoremap rr :Refresh nnoremap rp :Refresh :PlugInstall diff --git a/nvim.configlink/settings/lightline.vim b/nvim.configlink/settings/lightline.vim index cc700a6..8de8a68 100644 --- a/nvim.configlink/settings/lightline.vim +++ b/nvim.configlink/settings/lightline.vim @@ -6,10 +6,9 @@ let g:lightline = { \ 'active': { \ 'right': [[ 'lineinfo' ]], \ 'left': [[ 'mode', 'paste' ], - \ [ 'cocstatus', 'readonly', 'relativepath', 'gitbranch', 'modified' ]] + \ [ 'readonly', 'relativepath', 'gitbranch', 'modified' ]] \ }, \ 'component_function': { - \ 'gitbranch': 'fugitive#head', - \ 'cocstatus': 'coc#status' + \ 'gitbranch': 'fugitive#head' \ }, \ } diff --git a/nvim.configlink/settings/plugins.vim b/nvim.configlink/settings/plugins.vim index 6d75a26..e914343 100644 --- a/nvim.configlink/settings/plugins.vim +++ b/nvim.configlink/settings/plugins.vim @@ -23,7 +23,11 @@ Plug 'tpope/vim-commentary' " Use gc or gcc to comment Plug 'phaazon/hop.nvim' " Quick jump around the buffer Plug 'neovim/nvim-lspconfig' " Language server linting Plug 'jiangmiao/auto-pairs' " Parentheses +Plug 'rafamadriz/friendly-snippets' +Plug 'hrsh7th/vim-vsnip' +Plug 'hrsh7th/vim-vsnip-integ' Plug 'hrsh7th/nvim-compe' " Auto-complete +Plug 'tpope/vim-repeat' " Actually repeat using . " Ancillary plugins Plug 'godlygeek/tabular' " Spacing and alignment @@ -52,3 +56,50 @@ require'compe'.setup({ }, }) EOF + +lua << EOF +local t = function(str) + return vim.api.nvim_replace_termcodes(str, true, true, true) +end + +local check_back_space = function() + local col = vim.fn.col('.') - 1 + if col == 0 or vim.fn.getline('.'):sub(col, col):match('%s') then + return true + else + return false + end +end + +-- Use (s-)tab to: +--- move to prev/next item in completion menuone +--- jump to prev/next snippet's placeholder +_G.tab_complete = function() + if vim.fn.pumvisible() == 1 then + return t "" + elseif vim.fn.call("vsnip#available", {1}) == 1 then + return t "(vsnip-expand-or-jump)" + elseif check_back_space() then + return t "" + else + return vim.fn['compe#complete']() + end +end +_G.s_tab_complete = function() + if vim.fn.pumvisible() == 1 then + return t "" + elseif vim.fn.call("vsnip#jumpable", {-1}) == 1 then + return t "(vsnip-jump-prev)" + else + return t "" + end +end +_G.cr_complete = function() + -- if vim.fn.pumvisible() == 1 +end + +vim.api.nvim_set_keymap("i", "", "v:lua.tab_complete()", {expr = true}) +vim.api.nvim_set_keymap("s", "", "v:lua.tab_complete()", {expr = true}) +vim.api.nvim_set_keymap("i", "", "v:lua.s_tab_complete()", {expr = true}) +vim.api.nvim_set_keymap("s", "", "v:lua.s_tab_complete()", {expr = true}) +EOF