mirror of
https://github.com/nmasur/dotfiles
synced 2024-11-22 19:15:37 +00:00
play around with completion
This commit is contained in:
parent
54f4062872
commit
a310556308
@ -94,6 +94,11 @@ nnoremap <silent> <leader>z :ZoomToggle<CR>
|
|||||||
" Exit terminal mode
|
" Exit terminal mode
|
||||||
tnoremap <A-CR> <C-\><C-n>
|
tnoremap <A-CR> <C-\><C-n>
|
||||||
|
|
||||||
|
lua << EOF
|
||||||
|
-- Y yank until the end of line
|
||||||
|
vim.api.nvim_set_keymap('n', 'Y', 'y$', { noremap = true})
|
||||||
|
EOF
|
||||||
|
|
||||||
" Reload Vimrc settings
|
" Reload Vimrc settings
|
||||||
nnoremap <Leader>rr :Refresh<cr>
|
nnoremap <Leader>rr :Refresh<cr>
|
||||||
nnoremap <Leader>rp :Refresh<cr> :PlugInstall<cr>
|
nnoremap <Leader>rp :Refresh<cr> :PlugInstall<cr>
|
||||||
|
@ -6,10 +6,9 @@ let g:lightline = {
|
|||||||
\ 'active': {
|
\ 'active': {
|
||||||
\ 'right': [[ 'lineinfo' ]],
|
\ 'right': [[ 'lineinfo' ]],
|
||||||
\ 'left': [[ 'mode', 'paste' ],
|
\ 'left': [[ 'mode', 'paste' ],
|
||||||
\ [ 'cocstatus', 'readonly', 'relativepath', 'gitbranch', 'modified' ]]
|
\ [ 'readonly', 'relativepath', 'gitbranch', 'modified' ]]
|
||||||
\ },
|
\ },
|
||||||
\ 'component_function': {
|
\ 'component_function': {
|
||||||
\ 'gitbranch': 'fugitive#head',
|
\ 'gitbranch': 'fugitive#head'
|
||||||
\ 'cocstatus': 'coc#status'
|
|
||||||
\ },
|
\ },
|
||||||
\ }
|
\ }
|
||||||
|
@ -23,7 +23,11 @@ Plug 'tpope/vim-commentary' " Use gc or gcc to comment
|
|||||||
Plug 'phaazon/hop.nvim' " Quick jump around the buffer
|
Plug 'phaazon/hop.nvim' " Quick jump around the buffer
|
||||||
Plug 'neovim/nvim-lspconfig' " Language server linting
|
Plug 'neovim/nvim-lspconfig' " Language server linting
|
||||||
Plug 'jiangmiao/auto-pairs' " Parentheses
|
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 'hrsh7th/nvim-compe' " Auto-complete
|
||||||
|
Plug 'tpope/vim-repeat' " Actually repeat using .
|
||||||
|
|
||||||
" Ancillary plugins
|
" Ancillary plugins
|
||||||
Plug 'godlygeek/tabular' " Spacing and alignment
|
Plug 'godlygeek/tabular' " Spacing and alignment
|
||||||
@ -52,3 +56,50 @@ require'compe'.setup({
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
EOF
|
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 "<C-n>"
|
||||||
|
elseif vim.fn.call("vsnip#available", {1}) == 1 then
|
||||||
|
return t "<Plug>(vsnip-expand-or-jump)"
|
||||||
|
elseif check_back_space() then
|
||||||
|
return t "<Tab>"
|
||||||
|
else
|
||||||
|
return vim.fn['compe#complete']()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
_G.s_tab_complete = function()
|
||||||
|
if vim.fn.pumvisible() == 1 then
|
||||||
|
return t "<C-p>"
|
||||||
|
elseif vim.fn.call("vsnip#jumpable", {-1}) == 1 then
|
||||||
|
return t "<Plug>(vsnip-jump-prev)"
|
||||||
|
else
|
||||||
|
return t "<S-Tab>"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
_G.cr_complete = function()
|
||||||
|
-- if vim.fn.pumvisible() == 1
|
||||||
|
end
|
||||||
|
|
||||||
|
vim.api.nvim_set_keymap("i", "<Tab>", "v:lua.tab_complete()", {expr = true})
|
||||||
|
vim.api.nvim_set_keymap("s", "<Tab>", "v:lua.tab_complete()", {expr = true})
|
||||||
|
vim.api.nvim_set_keymap("i", "<S-Tab>", "v:lua.s_tab_complete()", {expr = true})
|
||||||
|
vim.api.nvim_set_keymap("s", "<S-Tab>", "v:lua.s_tab_complete()", {expr = true})
|
||||||
|
EOF
|
||||||
|
Loading…
Reference in New Issue
Block a user