neovim: add editorconfig.vim and spectre.nvim

This commit is contained in:
Hoang Nguyen 2021-09-05 01:08:00 +07:00
parent 58598d112d
commit b45c8f2541
No known key found for this signature in database
GPG Key ID: 813CF484F4993419
6 changed files with 45 additions and 6 deletions

View File

@ -57,6 +57,16 @@ end
-- Editor related groups
local function highlight_editors()
-- Color groups for other uses
hi('Red', c.red, '', '', '')
hi('Green', c.green, '', '', '')
hi('Yellow', c.yellow, '', '', '')
hi('Blue', c.blue, '', '', '')
hi('Purple', c.purple, '', '', '')
hi('Cyan', c.cyan, '', '', '')
hi('Orange', c.orange, '', '', '')
hi('White', c.fg, '', '', '')
-- Attributes
hi('Bold' , '', '', 'bold' , '')
hi('Italic' , '', '', 'italic' , '')

View File

@ -42,6 +42,7 @@ wk.register({
['<C-l>'] = {'<C-w>l', 'Go to the right window'},
['<C-j>'] = {'<C-w>j', 'Go to the down window'},
['<C-k>'] = {'<C-w>k', 'Go to the up window'},
['<C-q>'] = {'<C-w>q', 'Quit a window'},
-- Copy the whole buffer
['<C-a>'] = {'<Cmd>%y+<CR>', 'Copy whole buffer'},
@ -238,6 +239,13 @@ wk.register({
n = {':NnnPicker %:p:h<CR>', 'File picker'},
s = {
name = 'Find/Replace',
o = {':lua require("spectre").open()<CR>', 'Open spectre'},
p = {'viw:lua require("spectre").open_file_search()<CR>', 'Search in current file'},
w = {':lua require("spectre").open_visual({select_word = true})<CR>', 'Find/replace cursorword'},
},
-- Tab related
t = {
name = 'Tab',
@ -274,7 +282,9 @@ wk.register({
d = {':TransSelectDirection<CR>', 'Translate with direction'},
r = {'c<C-R>=system(\'trans -brief -no-ansi\', getreg(""))[:-2]<CR>', 'Translate and replace'},
c = {'c<C-R>=system(\'trans -brief -no-ansi :\', getreg(""))[:-2]<S-Left><S-Left><Right>', 'Translate and replace with direction'}
}
},
s = {':lua require("spectre").open_visual()<CR>', 'Find/Replace'}
}, {mode = 'v', prefix = '<leader>'})
------------------------

View File

@ -146,12 +146,12 @@ function M.snippets_conf()
ext_opts = {
[types.choiceNode] = {
active = {
virt_text = {{'', 'Number'}}
virt_text = {{'', 'Orange'}}
}
},
[types.insertNode] = {
active = {
virt_text = {{'', 'Keyword'}}
virt_text = {{'', 'Blue'}}
}
}
}

View File

@ -230,6 +230,11 @@ function M.lint_conf()
end
function M.dap_conf()
local dap = require('dap')
vim.fn.sign_define('DapBreakpoint', {text='', texthl='Red'})
vim.fn.sign_define('DapLogPoint', {text='', texthl='Red'})
vim.fn.sign_define('DapStopped', {text='', texthl='Red'})
vim.fn.sign_define('DapBreakpointRejected', {text='', texthl='Red'})
end
function M.dapui_conf()

View File

@ -156,6 +156,10 @@ end
function M.vimtex_conf()
end
function M.spectre_conf()
require('spectre').setup()
end
function M.translate_conf()
vim.g.trans_join_lines = 1
vim.g.trans_win_height = 15

View File

@ -131,6 +131,10 @@ return require('packer').startup(
keys = 'gc',
config = editor.comment_conf
}
use {
'editorconfig/editorconfig-vim',
ft = {'go', 'rust', 'python', 'c', 'cpp', 'javascript', 'typescript', 'vim', 'zig'}
}
---------
-- LSP --
@ -170,7 +174,7 @@ return require('packer').startup(
}
use { -- TODO: config, scripts to install/update dap servers
'rcarriga/nvim-dap-ui',
keys = '<Leader>d',
event = 'BufReadPre',
wants = 'nvim-dap',
requires = {{'mfussenegger/nvim-dap', config = lsp.dap_conf, opt = true}},
config = lsp.dapui_conf
@ -331,6 +335,12 @@ return require('packer').startup(
ft = 'tex',
setup = tools.vimtext_conf
}
use {
'windwp/nvim-spectre',
event = {'BufRead', 'BufNewFile'},
wants = 'plenary.nvim',
config = tools.spectre_conf
}
use {
'echuraev/translate-shell.vim',
cmd = {'Trans', 'TransSelectDirection'},
@ -368,7 +378,7 @@ return require('packer').startup(
}
use {'tweekmonster/startuptime.vim', cmd = 'StartupTime'} -- Just for benchmarking
-- TODO: rest.nvim, parinfer.nvim, editorconfig.nvim, conjure, nvim-spectre,
-- dial.nvim, hotpot.nvim, rust-tools.nvim, crates.nvim, go.nvim
-- TODO: rest.nvim, parinfer.nvim, conjure, dial.nvim, hotpot.nvim,
-- rust-tools.nvim, crates.nvim, go.nvim
end
)