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