nvim: better nvimtree keybinds
TODO: add a bind to open it
This commit is contained in:
parent
3cec380a34
commit
53d7246381
3 changed files with 71 additions and 60 deletions
|
@ -3,25 +3,27 @@ local M = {}
|
|||
-- nvimtree >>>
|
||||
M.nvimtree = function ()
|
||||
local tree_cb = require'nvim-tree.config'.nvim_tree_callback
|
||||
-- default mappings
|
||||
vim.g.nvim_tree_bindings = {
|
||||
{ key = {"<CR>", "o", "<2-LeftMouse>"}, cb = tree_cb("edit") },
|
||||
{ key = {"<2-RightMouse>", "<C-]>"}, cb = tree_cb("cd") },
|
||||
{ key = "<C-v>", cb = tree_cb("vsplit") },
|
||||
{ key = "<C-x>", cb = tree_cb("split") },
|
||||
-- mappings
|
||||
-- [[
|
||||
local list = {
|
||||
{ key = {"<CR>", "<2-LeftMouse>", "zo", "l"}, cb = tree_cb("edit") },
|
||||
{ key = "J", cb = tree_cb("cd") },
|
||||
{ key = "K", cb = tree_cb("dir_up") },
|
||||
{ key = "vs", cb = tree_cb("vsplit") },
|
||||
{ key = "sp", cb = tree_cb("split") },
|
||||
{ key = "<C-t>", cb = tree_cb("tabnew") },
|
||||
{ key = "<", cb = tree_cb("prev_sibling") },
|
||||
{ key = ">", cb = tree_cb("next_sibling") },
|
||||
{ key = "<M-lt>", cb = tree_cb("first_sibling") },
|
||||
{ key = "<M->>", cb = tree_cb("last_sibling") },
|
||||
{ key = "P", cb = tree_cb("parent_node") },
|
||||
{ key = "<BS>", cb = tree_cb("close_node") },
|
||||
{ key = {"<BS>", "h", "zc"}, cb = tree_cb("close_node") },
|
||||
{ key = "<S-CR>", cb = tree_cb("close_node") },
|
||||
{ key = "<Tab>", cb = tree_cb("preview") },
|
||||
{ key = "K", cb = tree_cb("first_sibling") },
|
||||
{ key = "J", cb = tree_cb("last_sibling") },
|
||||
{ key = "I", cb = tree_cb("toggle_ignored") },
|
||||
{ key = "H", cb = tree_cb("toggle_dotfiles") },
|
||||
{ key = "R", cb = tree_cb("refresh") },
|
||||
{ key = "a", cb = tree_cb("create") },
|
||||
{ key = "o", cb = tree_cb("create") },
|
||||
{ key = "d", cb = tree_cb("remove") },
|
||||
{ key = "r", cb = tree_cb("rename") },
|
||||
{ key = "<C-r>", cb = tree_cb("full_rename") },
|
||||
|
@ -31,13 +33,47 @@ M.nvimtree = function ()
|
|||
{ key = "y", cb = tree_cb("copy_name") },
|
||||
{ key = "Y", cb = tree_cb("copy_path") },
|
||||
{ key = "gy", cb = tree_cb("copy_absolute_path") },
|
||||
{ key = "[c", cb = tree_cb("prev_git_item") },
|
||||
{ key = "]c", cb = tree_cb("next_git_item") },
|
||||
{ key = "-", cb = tree_cb("dir_up") },
|
||||
{ key = "g[", cb = tree_cb("prev_git_item") },
|
||||
{ key = "g]", cb = tree_cb("next_git_item") },
|
||||
{ key = "s", cb = tree_cb("system_open") },
|
||||
{ key = "q", cb = tree_cb("close") },
|
||||
{ key = "g?", cb = tree_cb("toggle_help") },
|
||||
}
|
||||
-- ]]
|
||||
require'nvim-tree'.setup {
|
||||
disable_netrw = true,
|
||||
hijack_netrw = true,
|
||||
open_on_setup = false,
|
||||
ignore_ft_on_setup = {},
|
||||
update_to_buf_dir = {
|
||||
enable = true,
|
||||
auto_open = true,
|
||||
},
|
||||
auto_close = false,
|
||||
open_on_tab = false,
|
||||
hijack_cursor = false,
|
||||
update_cwd = false,
|
||||
lsp_diagnostics = false,
|
||||
update_focused_file = {
|
||||
enable = false,
|
||||
update_cwd = false,
|
||||
ignore_list = {}
|
||||
},
|
||||
system_open = {
|
||||
cmd = nil,
|
||||
args = {}
|
||||
},
|
||||
view = {
|
||||
width = 30,
|
||||
height = 30,
|
||||
side = 'left',
|
||||
auto_resize = false,
|
||||
mappings = {
|
||||
custom_only = false,
|
||||
list = {}
|
||||
}
|
||||
}
|
||||
}
|
||||
end -- <<<
|
||||
|
||||
-- toggleterm >>>
|
||||
|
@ -186,26 +222,6 @@ M.autosession = function()
|
|||
vim.cmd 'command! SessionRestore RestoreSession'
|
||||
end -- <<<
|
||||
|
||||
-- due: TODAY >>>
|
||||
M.due = function()
|
||||
require('due_nvim').setup {
|
||||
prescript = 'due: ', -- prescript to due data
|
||||
prescript_hi = 'Comment', -- highlight group of it
|
||||
due_hi = 'String', -- highlight group of the data itself
|
||||
ft = '*.sh', -- filename template to apply aucmds :)
|
||||
today = 'TODAY', -- text for today's due
|
||||
today_hi = 'Character', -- highlight group of today's due
|
||||
overdue = 'OVERDUE', -- text for overdued
|
||||
overdue_hi = 'Error', -- highlight group of overdued
|
||||
date_hi = 'Conceal', -- highlight group of date string
|
||||
pattern_start = '<', -- start for a date string pattern
|
||||
pattern_end = '>', -- end for a date string pattern
|
||||
use_clock_time = false, -- allow due.nvim to calculate hours, minutes, and seconds
|
||||
default_due_time = "midnight", -- if use_clock_time == true, calculate time until option on specified date.
|
||||
-- ^ Accepts "midnight", for 23:59:59, or noon, for 12:00:00
|
||||
}
|
||||
end -- <<<
|
||||
|
||||
return M
|
||||
|
||||
-- vim:fdm=marker:fmr=>>>,<<<:expandtab:tabstop=3:sw=3
|
||||
|
|
|
@ -183,12 +183,6 @@ return require('packer').startup(function()
|
|||
use { -- tpope: Repeatability for various tpope plugins
|
||||
'tpope/vim-repeat',
|
||||
}
|
||||
use { -- displays 'due: 2d 5h 3m' if there is a date (<12-25>) on the line
|
||||
'NFrid/due.nvim',
|
||||
config = function()
|
||||
require('blake.other').due()
|
||||
end
|
||||
}
|
||||
|
||||
end)
|
||||
|
||||
|
|
|
@ -153,3 +153,4 @@ vim.cmd [[
|
|||
au InsertLeave * match ExtraWhitespace /\s\+$/
|
||||
au BufWinLeave * call clearmatches()
|
||||
]]
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue