mirror of
https://git.disroot.org/FollieHiyuki/dotfiles.git
synced 2024-11-25 00:38:23 -05:00
neovim: reconfigure nvim-cmp mappings + vim.cmd -> vim.api.nvim_command
Also delete `news` script
This commit is contained in:
parent
b45c8f2541
commit
fa5374bafe
@ -32,7 +32,7 @@ local function hi(group, guifg, guibg, attr, guisp)
|
||||
local sp = guisp ~= '' and 'guisp=' .. guisp or ''
|
||||
|
||||
local hl = 'hi ' .. group .. ' ' .. fg .. ' ' .. bg .. ' ' .. style .. ' ' .. sp
|
||||
vim.cmd(hl)
|
||||
vim.api.nvim_command(hl)
|
||||
end
|
||||
|
||||
-- Set terminal colors
|
||||
@ -172,14 +172,14 @@ local function highlight_syntax()
|
||||
hi('Todo', c.yellow, '', '', '')
|
||||
hi('Type', c.blue, '', '', '')
|
||||
hi('Typedef', c.blue, '', '', '')
|
||||
vim.cmd('hi! link Annotation Decorator')
|
||||
vim.cmd('hi! link Macro Define')
|
||||
vim.cmd('hi! link PreCondit PreProc')
|
||||
vim.cmd('hi! link Variable Identifier')
|
||||
vim.api.nvim_command('hi! link Annotation Decorator')
|
||||
vim.api.nvim_command('hi! link Macro Define')
|
||||
vim.api.nvim_command('hi! link PreCondit PreProc')
|
||||
vim.api.nvim_command('hi! link Variable Identifier')
|
||||
|
||||
-- sql
|
||||
vim.cmd('hi! link sqlKeyword Keyword')
|
||||
vim.cmd('hi! link sqlSpecial Keyword')
|
||||
vim.api.nvim_command('hi! link sqlKeyword Keyword')
|
||||
vim.api.nvim_command('hi! link sqlSpecial Keyword')
|
||||
|
||||
-- Diff
|
||||
hi('DiffAdd' , c.green , c.grey1, '', '')
|
||||
@ -192,9 +192,9 @@ local function highlight_syntax()
|
||||
hi('diffFile', c.cyan, c.grey1, '', '')
|
||||
hi('diffLine', c.purple, c.grey1, '', '')
|
||||
hi('diffIndexLine', c.fg, c.grey1, '', '')
|
||||
vim.cmd('hi! link diffAdded DiffAdd')
|
||||
vim.cmd('hi! link diffRemoved DiffDelete')
|
||||
vim.cmd('hi! link diffChanged DiffChange')
|
||||
vim.api.nvim_command('hi! link diffAdded DiffAdd')
|
||||
vim.api.nvim_command('hi! link diffRemoved DiffDelete')
|
||||
vim.api.nvim_command('hi! link diffChanged DiffChange')
|
||||
end
|
||||
|
||||
-- Treesitter
|
||||
@ -241,13 +241,13 @@ local function highlight_treesitter()
|
||||
hi('TSURI', c.fg, '', '', '')
|
||||
hi('TSTag', c.blue, '', '', '')
|
||||
hi('TSTagDelimiter', c.fg, '', '', '')
|
||||
vim.cmd('hi! link TSAnnotation Annotation')
|
||||
vim.cmd('hi! link TSConstructor Function')
|
||||
-- vim.cmd('hi! link TSError Error')
|
||||
vim.cmd('hi! link TSFuncBuiltin Function')
|
||||
vim.cmd('hi! link TSFunction Function')
|
||||
vim.cmd('hi! link TSFuncMacro Function')
|
||||
vim.cmd('hi! link TSVariable Variable')
|
||||
vim.api.nvim_command('hi! link TSAnnotation Annotation')
|
||||
vim.api.nvim_command('hi! link TSConstructor Function')
|
||||
-- vim.api.nvim_command('hi! link TSError Error')
|
||||
vim.api.nvim_command('hi! link TSFuncBuiltin Function')
|
||||
vim.api.nvim_command('hi! link TSFunction Function')
|
||||
vim.api.nvim_command('hi! link TSFuncMacro Function')
|
||||
vim.api.nvim_command('hi! link TSVariable Variable')
|
||||
end
|
||||
|
||||
-- LSP groups
|
||||
@ -279,7 +279,7 @@ local function highlight_lsp()
|
||||
hi('LspReferenceText', c.fg, c.grey_bright, '', '')
|
||||
hi('LspReferenceRead', c.fg, c.grey_bright, '', '')
|
||||
hi('LspReferenceWrite', c.fg, c.grey_bright, '', '')
|
||||
vim.cmd('hi! link LspCodeLens Comment')
|
||||
vim.api.nvim_command('hi! link LspCodeLens Comment')
|
||||
end
|
||||
|
||||
-- Specify groups for plugins
|
||||
@ -344,7 +344,7 @@ local function highlight_plugins()
|
||||
hi('IndentBlanklineContextChar', c.grey1, '', '', '')
|
||||
|
||||
-- vim-illuminate
|
||||
vim.cmd('hi! link illuminatedWord Underline')
|
||||
vim.api.nvim_command('hi! link illuminatedWord Underline')
|
||||
|
||||
-- trouble.nvim
|
||||
hi('LspTroubleText', c.blue, '', 'bold', '')
|
||||
@ -374,8 +374,8 @@ end
|
||||
-- Main function
|
||||
function M.highlight()
|
||||
-- Reset everything
|
||||
vim.cmd('hi clear')
|
||||
if vim.fn.exists('syntax_on') then vim.cmd('syntax reset') end
|
||||
vim.api.nvim_command('hi clear')
|
||||
if vim.fn.exists('syntax_on') then vim.api.nvim_command('syntax reset') end
|
||||
vim.o.background = 'dark'
|
||||
|
||||
-- Load highlight groups
|
||||
|
@ -7,7 +7,7 @@ local function hi(group, guifg, guibg, attr, guisp)
|
||||
local sp = guisp ~= '' and 'guisp=' .. guisp or ''
|
||||
|
||||
local hl = 'hi ' .. group .. ' ' .. fg .. ' ' .. bg .. ' ' .. style .. ' ' .. sp
|
||||
vim.cmd(hl)
|
||||
vim.api.nvim_command(hl)
|
||||
end
|
||||
|
||||
M.colors = {
|
||||
|
@ -66,14 +66,14 @@ wk.register({
|
||||
['<A-t>'] = {
|
||||
function()
|
||||
if vim.o.expandtab == true then
|
||||
vim.cmd('set noexpandtab nosmarttab softtabstop& shiftwidth&')
|
||||
vim.cmd('echomsg "Switched to indent with tabs"')
|
||||
vim.api.nvim_command('set noexpandtab nosmarttab softtabstop& shiftwidth&')
|
||||
vim.api.nvim_command('echomsg "Switched to indent with tabs"')
|
||||
else
|
||||
vim.opt.expandtab = true
|
||||
vim.opt.smarttab = true
|
||||
vim.opt.softtabstop = 4
|
||||
vim.opt.shiftwidth = 4
|
||||
vim.cmd('echomsg "Switched to indent with 4 spaces"')
|
||||
vim.api.nvim_command('echomsg "Switched to indent with 4 spaces"')
|
||||
end
|
||||
end,
|
||||
'Switch indent style'
|
||||
@ -290,11 +290,11 @@ wk.register({
|
||||
------------------------
|
||||
-- Filetype specified --
|
||||
------------------------
|
||||
vim.cmd(([[
|
||||
vim.api.nvim_command [[
|
||||
autocmd FileType org lua whichkeyOrg()
|
||||
autocmd FileType markdown lua whichkeyMarkdown()
|
||||
autocmd FileType html lua whichkeyHtml()
|
||||
]]))
|
||||
]]
|
||||
|
||||
_G.whichkeyOrg = function()
|
||||
wk.register({
|
||||
|
@ -4,13 +4,9 @@ function M.cmp_conf()
|
||||
local cmp = require('cmp')
|
||||
local luasnip = require('luasnip')
|
||||
|
||||
local check_back_space = function()
|
||||
local col = vim.fn.col '.' - 1
|
||||
return col == 0 or vim.fn.getline('.'):sub(col, col):match '%s' ~= nil
|
||||
end
|
||||
|
||||
local t = function(str)
|
||||
return vim.api.nvim_replace_termcodes(str, true, true, true)
|
||||
local has_words_before = function()
|
||||
local cursor = vim.api.nvim_win_get_cursor(0)
|
||||
return not vim.api.nvim_get_current_line():sub(1, cursor[2]):match('^%s$')
|
||||
end
|
||||
|
||||
cmp.setup {
|
||||
@ -73,14 +69,14 @@ function M.cmp_conf()
|
||||
-- Change choice nodes for luasnip
|
||||
['<C-h>'] = cmp.mapping(function(fallback)
|
||||
if luasnip.choice_active() then
|
||||
vim.fn.feedkeys(t('<Plug>luasnip-prev-choice'), '')
|
||||
vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes('<Plug>luasnip-prev-choice', true, true, true), '')
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, {'i', 's'}),
|
||||
['<C-l>'] = cmp.mapping(function(fallback)
|
||||
if luasnip.choice_active() then
|
||||
vim.fn.feedkeys(t('<Plug>luasnip-next-choice'), '')
|
||||
vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes('<Plug>luasnip-next-choice', true, true, true), '')
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
@ -88,20 +84,18 @@ function M.cmp_conf()
|
||||
-- supertab-like mapping
|
||||
['<Tab>'] = cmp.mapping(function(fallback)
|
||||
if vim.fn.pumvisible() == 1 then
|
||||
vim.fn.feedkeys(t('<C-n>'), 'n')
|
||||
elseif luasnip.expand_or_jumpable() then
|
||||
vim.fn.feedkeys(t('<Plug>luasnip-expand-or-jump'), '')
|
||||
elseif check_back_space() then
|
||||
vim.fn.feedkeys(t('<Tab>'), 'n')
|
||||
vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes('<C-n>', true, true, true), 'n', true)
|
||||
elseif has_words_before() and luasnip.expand_or_jumpable() then
|
||||
vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes('<Plug>luasnip-expand-or-jump', true, true, true), '')
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, {'i', 's'}),
|
||||
['<S-Tab>'] = cmp.mapping(function(fallback)
|
||||
if vim.fn.pumvisible() == 1 then
|
||||
vim.fn.feedkeys(t('<C-p>'), 'n')
|
||||
vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes('<C-p>', true, true, true), 'n', true)
|
||||
elseif luasnip.jumpable(-1) then
|
||||
vim.fn.feedkeys(t('<Plug>luasnip-jump-prev'), '')
|
||||
vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes('<Plug>luasnip-jump-prev', true, true, true), '', true)
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
|
@ -62,7 +62,7 @@ function M.blankline_conf()
|
||||
}
|
||||
|
||||
-- Refresh often, since it is lazy-loaded
|
||||
-- vim.cmd('autocmd CursorMoved * IndentBlanklineRefresh')
|
||||
-- vim.api.nvim_command('autocmd CursorMoved * IndentBlanklineRefresh')
|
||||
end
|
||||
|
||||
function M.treesitter_conf()
|
||||
|
@ -226,7 +226,7 @@ function M.lint_conf()
|
||||
}
|
||||
-- TODO: custom cmds for linters installed with pip (using virtualenv)
|
||||
-- vint, pylint, flake8, pycodestyle, codespell
|
||||
vim.cmd [[ au BufRead,BufWritePost * lua require('lint').try_lint() ]]
|
||||
vim.api.nvim_command [[ au BufRead,BufWritePost * lua require('lint').try_lint() ]]
|
||||
end
|
||||
|
||||
function M.dap_conf()
|
||||
|
@ -104,12 +104,12 @@ function M.zenmode_conf()
|
||||
}
|
||||
},
|
||||
on_open = function()
|
||||
vim.cmd('TSContextDisable')
|
||||
vim.cmd('IndentBlanklineDisable')
|
||||
vim.api.nvim_command('TSContextDisable')
|
||||
vim.api.nvim_command('IndentBlanklineDisable')
|
||||
end,
|
||||
on_close = function()
|
||||
vim.cmd('TSContextEnable')
|
||||
-- vim.cmd('IndentBlanklineEnable')
|
||||
vim.api.nvim_command('TSContextEnable')
|
||||
-- vim.api.nvim_command('IndentBlanklineEnable')
|
||||
end
|
||||
}
|
||||
end
|
||||
@ -202,11 +202,11 @@ function M.toggleterm_conf()
|
||||
end
|
||||
|
||||
function M.wilder_conf()
|
||||
vim.cmd [[ call wilder#setup({'modes': [':', '/', '?']}) ]]
|
||||
vim.api.nvim_command [[ call wilder#setup({'modes': [':', '/', '?']}) ]]
|
||||
|
||||
-- Doesn't work yet. Bugs in Neovim (see neovim/neovim#14809 and gelguy/wilder.nvim#53)
|
||||
-- so can't do multi-line config inside vim.cmd [[ ]] with \
|
||||
-- vim.cmd [[
|
||||
-- vim.api.nvim_command [[
|
||||
-- call wilder#set_option('renderer', wilder#renderer_mux({
|
||||
-- \ ':': wilder#popupmenu_renderer({
|
||||
-- \ 'highlighter': wilder#basic_highlighter(),
|
||||
@ -221,7 +221,7 @@ function M.wilder_conf()
|
||||
-- \ }))
|
||||
-- ]]
|
||||
|
||||
-- vim.cmd [[
|
||||
-- vim.api.nvim_command [[
|
||||
-- call wilder#set_option('pipeline', [
|
||||
-- \ wilder#branch(
|
||||
-- \ wilder#python_file_finder_pipeline({
|
||||
|
@ -7,7 +7,7 @@ if fn.empty(fn.glob(packer_dir)) > 0 then
|
||||
end
|
||||
|
||||
-- Require since we use 'packer' as opt
|
||||
vim.cmd [[packadd packer.nvim]]
|
||||
api.nvim_command [[packadd packer.nvim]]
|
||||
|
||||
return require('packer').startup(
|
||||
function(use)
|
||||
@ -46,7 +46,7 @@ return require('packer').startup(
|
||||
}
|
||||
use {
|
||||
'akinsho/nvim-bufferline.lua',
|
||||
event = 'BufRead',
|
||||
event = {'BufRead', 'BufNewFile'},
|
||||
config = ui.bufferline_conf
|
||||
}
|
||||
use {
|
||||
|
@ -1,3 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
curl "getnews.tech/$1"
|
Loading…
Reference in New Issue
Block a user