neovim: add undotree and vim-eft

Also fix some cursor highlight groups
This commit is contained in:
Hoang Nguyen 2021-09-04 17:00:25 +07:00
parent 09cef9c60a
commit af695b83db
No known key found for this signature in database
GPG Key ID: 813CF484F4993419
5 changed files with 48 additions and 6 deletions

View File

@ -65,7 +65,7 @@ local function highlight_editors()
-- Editor
hi('ColorColumn', '' , c.grey1, '', '')
hi('Cursor' , c.black , c.fg , '', '')
hi('CursorLine' , c.grey1 , '' , '', '')
hi('CursorLine' , '' , c.grey1, '', '')
hi('Error' , c.fg , c.red , '', '')
hi('iCursor' , c.black , c.fg , '', '')
hi('LineNr' , c.grey3 , '' , '', '')
@ -87,10 +87,10 @@ local function highlight_editors()
hi('healthError' , c.red , c.grey1, '', '')
hi('healthSuccess', c.green , c.grey1, '', '')
hi('healthWarning', c.yellow, c.grey1, '', '')
hi('TermCursorNC' , '' , c.grey2, '', '')
hi('TermCursorNC' , '' , c.grey1, '', '')
-- Gutter
hi('CursorColumn', c.grey1, '' , '', '')
hi('CursorColumn', '' , c.grey1, '', '')
hi('CursorLineNr', c.fg , '' , '', '')
hi('Folded' , c.grey3, c.grey1, '', '')
hi('FoldColumn' , c.grey3, c.black, '', '')
@ -294,6 +294,10 @@ local function highlight_plugins()
hi('HopNextKey2', c.dark_blue, '', '', '')
hi('HopUnmatched', c.grey3, '', '', '')
-- vim-eft
hi('EftChar' , c.orange, '', 'bold,underline', '')
hi('EftSubChar', c.grey3, '', 'bold,underline', '')
-- BufferLine
hi('BufferLineIndicatorSelected', c.cyan, '', '', '')
hi('BufferLineFill', c.grey1, c.grey1, '', '')

View File

@ -14,6 +14,18 @@ api.nvim_set_keymap('v', '>', '>gv', {noremap = true, silent = true})
-- Clear search results
-- api.nvim_set_keymap('n', '<Esc>', '<Cmd>noh<CR>', {noremap = true, silent = true})
-- vim-eft
api.nvim_set_keymap('n', 'f', '<Plug>(eft-f)', {})
api.nvim_set_keymap('x', 'f', '<Plug>(eft-f)', {})
api.nvim_set_keymap('n', 'F', '<Plug>(eft-F)', {})
api.nvim_set_keymap('x', 'F', '<Plug>(eft-F)', {})
api.nvim_set_keymap('n', 't', '<Plug>(eft-t)', {})
api.nvim_set_keymap('x', 't', '<Plug>(eft-t)', {})
api.nvim_set_keymap('n', 'T', '<Plug>(eft-T)', {})
api.nvim_set_keymap('x', 'T', '<Plug>(eft-T)', {})
api.nvim_set_keymap('n', ';', '<Plug>(eft-repeat)', {})
api.nvim_set_keymap('x', ';', '<Plug>(eft-repeat)', {})
-----------------
-- Normal mode --
-----------------
@ -111,11 +123,13 @@ wk.register({
wk.register({
b = {
name = 'Buffer',
a = {':EasyAlign<CR>', 'Easy align'},
c = {':ColorizerToggle<CR>', 'Colorizer'},
d = {':bdelete<CR>', 'Close buffer'},
j = {':BufferLineCyclePrev<CR>', 'Previous buffer'},
k = {':BufferLineCycleNext<CR>', 'Next buffer'},
n = {':DashboardNewFile<CR>', 'New file'},
u = {':UndotreeToggle<CR>', 'Undotree'},
z = {':ZenMode<CR>', 'Zen mode'}
},
@ -238,20 +252,22 @@ wk.register({
-- Visual mode (with leader key) --
-----------------------------------
wk.register({
-- DAP
b = {
name = 'Buffer',
a = {':EasyAlign<CR>', 'Range easy align'}
},
d = {
name = 'DAP',
e = {':lua require("dapui").eval()<CR>', 'Evaluate highlighted text'}
},
-- GitSigns
g = {
name = 'Git',
r = 'Reset hunk',
s = 'Stage hunk'
},
-- translate-shell.vim
j = {
name = 'Translate',
t = {':Trans<CR>', 'Translate'},

View File

@ -125,6 +125,10 @@ function M.hop_conf()
require('hop').setup{keys = 'etovxqpdygfblzhckisuran'}
end
function M.eft_conf()
vim.g.eft_index_function = {all = function() return true end}
end
function M.comment_conf()
require('nvim_comment').setup({comment_empty = false})
end

View File

@ -163,6 +163,14 @@ function M.translate_conf()
}
end
function M.undotree_conf()
vim.g.undotree_WindowLayout = 2
vim.g.undotree_SplitWidth = 30
vim.g.undotree_DiffpaneHeight = 10
vim.g.undotree_SetFocusWhenToggle = 1
vim.g.undotree_RelativeTimestamp = 1
end
function M.toggleterm_conf()
require('toggleterm').setup {
shade_terminals = false,

View File

@ -117,6 +117,11 @@ return require('packer').startup(
cmd = {'HopChar1', 'HopChar2', 'HopWord', 'HopPattern', 'HopLine'},
config = editor.hop_conf
}
use {
'hrsh7th/vim-eft',
event = {'BufRead', 'BufNewFile'},
setup = editor.eft_conf
}
use {
'junegunn/vim-easy-align',
cmd = 'EasyAlign'
@ -316,6 +321,11 @@ return require('packer').startup(
cmd = {'Trans', 'TransSelectDirection'},
config = tools.translate_conf
}
use {
'mbbill/undotree',
cmd = 'UndotreeToggle',
setup = tools.undotree_conf
}
use {
'akinsho/nvim-toggleterm.lua',
cmd = 'ToggleTerm',