mirror of
https://git.disroot.org/FollieHiyuki/dotfiles.git
synced 2024-11-24 16:28:22 -05:00
neovim: nvim-cmp: delete unused sources, add other
This commit is contained in:
parent
30ba9f6f1d
commit
2a2c753ffd
@ -1,3 +1,3 @@
|
||||
setlocal spell
|
||||
" setlocal spell
|
||||
setlocal wrap
|
||||
" setlocal nonumber norelativenumber
|
||||
setlocal nonumber norelativenumber
|
||||
|
@ -1,3 +1,3 @@
|
||||
setlocal spell
|
||||
" setlocal spell
|
||||
setlocal wrap
|
||||
" setlocal nonumber norelativenumber
|
||||
setlocal nonumber norelativenumber
|
||||
|
@ -25,6 +25,10 @@ api.nvim_set_keymap('t', '<Esc>', '<C-\\><C-n>', {noremap = true, silent = true}
|
||||
api.nvim_set_keymap('v', '<', '<gv', {noremap = true, silent = true})
|
||||
api.nvim_set_keymap('v', '>', '>gv', {noremap = true, silent = true})
|
||||
|
||||
-- Also move up/down virual lines (:set wrap)
|
||||
api.nvim_set_keymap('n', 'j', 'gj', {noremap = true, silent = true})
|
||||
api.nvim_set_keymap('n', 'k', 'gk', {noremap = true, silent = true})
|
||||
|
||||
-- winshift.nvim
|
||||
api.nvim_set_keymap('n', '<C-w><C-m>', ':WinShift<CR>', {noremap = true, silent = true})
|
||||
api.nvim_set_keymap('n', '<C-w>m', ':WinShift<CR>', {noremap = true, silent = true})
|
||||
@ -69,12 +73,12 @@ wk.register({
|
||||
vim.opt.expandtab = false
|
||||
vim.opt.smarttab = false
|
||||
vim.opt.softtabstop = 0 -- reset to default
|
||||
vim.notify('Switched to indent with tabs.', vim.log.levels.INFO)
|
||||
vim.notify('Indent with Tabs.', vim.log.levels.INFO)
|
||||
else
|
||||
vim.opt.expandtab = true
|
||||
vim.opt.smarttab = true
|
||||
vim.opt.softtabstop = -1 -- fallback to shiftwidth
|
||||
vim.notify('Switched to indent with spaces.', vim.log.levels.INFO)
|
||||
vim.notify('Indent with Spaces.', vim.log.levels.INFO)
|
||||
end
|
||||
end,
|
||||
'Switch indent style'
|
||||
@ -215,7 +219,7 @@ wk.register({
|
||||
name = 'Editor',
|
||||
a = {':EasyAlign<CR>', 'Align elements'},
|
||||
g = 'Generate annotations',
|
||||
h = {':TSHighlightCapturesUnderCursor<CR>', 'Syntax groups under cursor'},
|
||||
h = {':TSHighlightCapturesUnderCursor<CR>', 'Syntax under cursor'},
|
||||
s = {':ISwapWith<CR>', 'Swap elements'},
|
||||
t = {':Twilight<CR>', 'Twilight mode'},
|
||||
v = {
|
||||
@ -225,24 +229,27 @@ wk.register({
|
||||
vim.b.venn_enabled = true
|
||||
vim.api.nvim_command('setlocal virtualedit=all')
|
||||
-- Draw lines with HJKL keystroke
|
||||
vim.api.nvim_buf_set_keymap(0, 'n', '<Left>', '<C-v>h:VBox<CR>', {noremap = true, silent = true})
|
||||
vim.api.nvim_buf_set_keymap(0, 'n', '<Down>', '<C-v>j:VBox<CR>', {noremap = true, silent = true})
|
||||
vim.api.nvim_buf_set_keymap(0, 'n', '<Up>', '<C-v>k:VBox<CR>', {noremap = true, silent = true})
|
||||
vim.api.nvim_buf_set_keymap(0, 'n', '<Right>', '<C-v>l:VBox<CR>', {noremap = true, silent = true})
|
||||
vim.api.nvim_buf_set_keymap(0, 'n', 'H', '<C-v>h:VBox<CR>', {noremap = true, silent = true})
|
||||
vim.api.nvim_buf_set_keymap(0, 'n', 'J', '<C-v>j:VBox<CR>', {noremap = true, silent = true})
|
||||
vim.api.nvim_buf_set_keymap(0, 'n', 'K', '<C-v>k:VBox<CR>', {noremap = true, silent = true})
|
||||
vim.api.nvim_buf_set_keymap(0, 'n', 'L', '<C-v>l:VBox<CR>', {noremap = true, silent = true})
|
||||
-- Draw boxes by pressing 'f' with visual selection
|
||||
vim.api.nvim_buf_set_keymap(0, 'v', 'f', ':VBox<CR>', {noremap = true, silent = true})
|
||||
|
||||
vim.notify('Virtual box edit enabled.', vim.log.levels.INFO)
|
||||
else
|
||||
vim.b.venn_enabled = nil
|
||||
vim.api.nvim_command('setlocal virtualedit=block')
|
||||
-- vim.api.nvim_command('mapclear <buffer>') -- this also deletes buf keymap for lsp
|
||||
-- vim.api.nvim_command('mapclear <buffer>') -- quicker, but also deletes buf keymap for lsp
|
||||
vim.api.nvim_buf_del_keymap(0, 'v', 'f')
|
||||
vim.api.nvim_buf_del_keymap(0, 'n', '<Left>')
|
||||
vim.api.nvim_buf_del_keymap(0, 'n', '<Down>')
|
||||
vim.api.nvim_buf_del_keymap(0, 'n', '<Up>')
|
||||
vim.api.nvim_buf_del_keymap(0, 'n', '<Right>')
|
||||
|
||||
vim.api.nvim_buf_del_keymap(0, 'n', 'H')
|
||||
vim.api.nvim_buf_del_keymap(0, 'n', 'J')
|
||||
vim.api.nvim_buf_del_keymap(0, 'n', 'L')
|
||||
local present, _ = pcall(require, 'lspconfig') -- Check to re-enable buf keymap for hover
|
||||
if present then
|
||||
vim.api.nvim_buf_set_keymap(0, 'n', 'K', ':lua vim.lsp.buf.hover()<CR>', {noremap = true, silent = true})
|
||||
else
|
||||
vim.api.nvim_buf_del_keymap(0, 'n', 'K')
|
||||
end
|
||||
vim.notify('Virtual box edit disabled.', vim.log.levels.INFO)
|
||||
end
|
||||
end,
|
||||
|
@ -10,6 +10,18 @@ function M.cmp_conf()
|
||||
end
|
||||
|
||||
cmp.setup {
|
||||
sorting = {
|
||||
comparators = {
|
||||
cmp.config.compare.offset,
|
||||
cmp.config.compare.exact,
|
||||
cmp.config.compare.score,
|
||||
require('cmp-under-comparator').under,
|
||||
cmp.config.compare.kind,
|
||||
cmp.config.compare.sort_text,
|
||||
cmp.config.compare.length,
|
||||
cmp.config.compare.order
|
||||
}
|
||||
},
|
||||
formatting = {
|
||||
format = function(entry, vim_item)
|
||||
local lspkind_icons = {
|
||||
@ -47,14 +59,11 @@ function M.cmp_conf()
|
||||
path = '[PATH]',
|
||||
buffer = '[BUF]',
|
||||
-- calc = '[CALC]',
|
||||
-- nuspell = '[SPELL]',
|
||||
spell = '[SPELL]',
|
||||
emoji = '[EMOJI]',
|
||||
-- treesitter = '[TS]',
|
||||
dictionary = '[DICT]',
|
||||
treesitter = '[TS]',
|
||||
nvim_lsp = '[LSP]',
|
||||
-- cmp_tabnine = '[TN]',
|
||||
latex_symbols = '[TEX]',
|
||||
-- tmux = '[TMUX]',
|
||||
-- conjure = '[CJ]',
|
||||
orgmode = '[ORG]'
|
||||
})[entry.source.name]
|
||||
@ -119,18 +128,19 @@ function M.cmp_conf()
|
||||
{name = 'path'},
|
||||
{name = 'buffer'},
|
||||
-- {name = 'calc'},
|
||||
-- {name = 'nuspell'},
|
||||
{name = 'spell'},
|
||||
{name = 'emoji'},
|
||||
-- {name = 'treesitter'},
|
||||
{name = 'dictionary', keyword_length = 2},
|
||||
{name = 'treesitter'},
|
||||
{name = 'nvim_lsp'},
|
||||
-- {name = 'cmp_tabnine'},
|
||||
{name = 'latex_symbols'},
|
||||
-- {name = 'tmux'},
|
||||
-- {name = 'conjure'},
|
||||
{name = 'orgmode'}
|
||||
}
|
||||
}
|
||||
|
||||
-- Setup for cmp-dictionary
|
||||
-- TODO: do this on FileType * (cmp.setup.buffer) with custom dicts
|
||||
-- vim.opt.dictionary = {'/usr/share/dict/words'}
|
||||
end
|
||||
|
||||
-- function M.tabnine_conf()
|
||||
|
@ -236,16 +236,16 @@ function M.eft_conf()
|
||||
vim.g.eft_index_function = {all = function() return true end}
|
||||
|
||||
-- Mappings
|
||||
vim.api.nvim_set_keymap('n', 'f', '<Plug>(eft-f)', {})
|
||||
vim.api.nvim_set_keymap('x', 'f', '<Plug>(eft-f)', {})
|
||||
vim.api.nvim_set_keymap('n', 'F', '<Plug>(eft-F)', {})
|
||||
vim.api.nvim_set_keymap('x', 'F', '<Plug>(eft-F)', {})
|
||||
vim.api.nvim_set_keymap('n', 't', '<Plug>(eft-t)', {})
|
||||
vim.api.nvim_set_keymap('x', 't', '<Plug>(eft-t)', {})
|
||||
vim.api.nvim_set_keymap('n', 'T', '<Plug>(eft-T)', {})
|
||||
vim.api.nvim_set_keymap('x', 'T', '<Plug>(eft-T)', {})
|
||||
vim.api.nvim_set_keymap('n', ';', '<Plug>(eft-repeat)', {})
|
||||
vim.api.nvim_set_keymap('x', ';', '<Plug>(eft-repeat)', {})
|
||||
vim.api.nvim_set_keymap('n', 'f', '<Plug>(eft-f)', {silent = true})
|
||||
vim.api.nvim_set_keymap('x', 'f', '<Plug>(eft-f)', {silent = true})
|
||||
vim.api.nvim_set_keymap('n', 'F', '<Plug>(eft-F)', {silent = true})
|
||||
vim.api.nvim_set_keymap('x', 'F', '<Plug>(eft-F)', {silent = true})
|
||||
vim.api.nvim_set_keymap('n', 't', '<Plug>(eft-t)', {silent = true})
|
||||
vim.api.nvim_set_keymap('x', 't', '<Plug>(eft-t)', {silent = true})
|
||||
vim.api.nvim_set_keymap('n', 'T', '<Plug>(eft-T)', {silent = true})
|
||||
vim.api.nvim_set_keymap('x', 'T', '<Plug>(eft-T)', {silent = true})
|
||||
vim.api.nvim_set_keymap('n', ';', '<Plug>(eft-repeat)', {silent = true})
|
||||
vim.api.nvim_set_keymap('x', ';', '<Plug>(eft-repeat)', {silent = true})
|
||||
end
|
||||
|
||||
function M.dial_conf()
|
||||
@ -294,12 +294,12 @@ function M.dial_conf()
|
||||
}
|
||||
|
||||
-- Mappings
|
||||
vim.api.nvim_set_keymap('n', '<C-a>', '<Plug>(dial-increment)', {})
|
||||
vim.api.nvim_set_keymap('v', '<C-a>', '<Plug>(dial-increment)', {})
|
||||
vim.api.nvim_set_keymap('n', '<C-x>', '<Plug>(dial-decrement)', {})
|
||||
vim.api.nvim_set_keymap('v', '<C-x>', '<Plug>(dial-decrement)', {})
|
||||
vim.api.nvim_set_keymap('v', 'g<C-a>', '<Plug>(dial-increment-additional)', {})
|
||||
vim.api.nvim_set_keymap('v', 'g<C-x>', '<Plug>(dial-decrement-additional)', {})
|
||||
vim.api.nvim_set_keymap('n', '<C-a>', '<Plug>(dial-increment)', {silent = true})
|
||||
vim.api.nvim_set_keymap('v', '<C-a>', '<Plug>(dial-increment)', {silent = true})
|
||||
vim.api.nvim_set_keymap('n', '<C-x>', '<Plug>(dial-decrement)', {silent = true})
|
||||
vim.api.nvim_set_keymap('v', '<C-x>', '<Plug>(dial-decrement)', {silent = true})
|
||||
vim.api.nvim_set_keymap('v', 'g<C-a>', '<Plug>(dial-increment-additional)', {silent = true})
|
||||
vim.api.nvim_set_keymap('v', 'g<C-x>', '<Plug>(dial-decrement-additional)', {silent = true})
|
||||
end
|
||||
|
||||
function M.comment_conf()
|
||||
|
@ -173,7 +173,7 @@ return packer.startup(function(use)
|
||||
-- LSP --
|
||||
---------
|
||||
local lsp = require('modules.lsp')
|
||||
use {
|
||||
use { -- TODO: reconsider lspsaga for actions
|
||||
'neovim/nvim-lspconfig',
|
||||
event = 'BufReadPre',
|
||||
wants = {'lsp_signature.nvim', 'null-ls.nvim'},
|
||||
@ -232,24 +232,25 @@ return packer.startup(function(use)
|
||||
use {
|
||||
'hrsh7th/nvim-cmp',
|
||||
event = 'InsertEnter',
|
||||
wants = 'LuaSnip',
|
||||
requires = {{
|
||||
'L3MON4D3/LuaSnip',
|
||||
wants = 'friendly-snippets',
|
||||
requires = {{'rafamadriz/friendly-snippets', opt = true}},
|
||||
config = completion.snippets_conf,
|
||||
opt = true
|
||||
}},
|
||||
wants = {'LuaSnip', 'cmp-under-comparator'},
|
||||
requires = {
|
||||
{
|
||||
'L3MON4D3/LuaSnip',
|
||||
wants = 'friendly-snippets',
|
||||
requires = {{'rafamadriz/friendly-snippets', opt = true}},
|
||||
config = completion.snippets_conf,
|
||||
opt = true
|
||||
},
|
||||
{'lukas-reineke/cmp-under-comparator', opt = true}
|
||||
},
|
||||
config = completion.cmp_conf
|
||||
}
|
||||
use {'saadparwaiz1/cmp_luasnip', after = 'nvim-cmp'}
|
||||
use {'hrsh7th/cmp-path', after = 'nvim-cmp'}
|
||||
use {'hrsh7th/cmp-buffer', after = 'nvim-cmp'}
|
||||
-- use {'hrsh7th/cmp-calc', after = 'nvim-cmp'}
|
||||
-- use {'f3fora/cmp-nuspell', after = 'nvim-cmp', rocks={'lua-nuspell'}}
|
||||
use {'f3fora/cmp-spell', after = 'nvim-cmp'}
|
||||
use {'hrsh7th/cmp-emoji', after = 'nvim-cmp'}
|
||||
-- use {'ray-x/cmp-treesitter', after = {'nvim-cmp', 'nvim-treesitter'}}
|
||||
use {'uga-rosa/cmp-dictionary', after = 'nvim-cmp'} -- TODO: scripts to curl dicts from aspell.net
|
||||
use {'ray-x/cmp-treesitter', after = {'nvim-cmp', 'nvim-treesitter'}}
|
||||
use {'hrsh7th/cmp-nvim-lsp', after = {'nvim-cmp', 'nvim-lspconfig'}}
|
||||
-- use {
|
||||
-- 'tzachar/cmp-tabnine',
|
||||
@ -258,7 +259,6 @@ return packer.startup(function(use)
|
||||
-- config = completion.tabnine_conf
|
||||
-- }
|
||||
use {'kdheepak/cmp-latex-symbols', after = 'nvim-cmp'}
|
||||
-- use {'andersevenrud/compe-tmux', after = 'nvim-cmp', branch = 'cmp'}
|
||||
-- use {'PaterJason/cmp-conjure', after = {'conjure', 'nvim-cmp'}}
|
||||
use {
|
||||
'windwp/nvim-autopairs',
|
||||
@ -332,7 +332,7 @@ return packer.startup(function(use)
|
||||
opt = true
|
||||
}}
|
||||
}
|
||||
use {
|
||||
use { -- TODO: check out kat0h/bufpreview.vim
|
||||
'iamcco/markdown-preview.nvim',
|
||||
run = 'cd app && yarn install',
|
||||
ft = {'markdown', 'rmd'},
|
||||
|
Loading…
Reference in New Issue
Block a user