nvim: better nvimtree keybinds

TODO: add a bind to open it
This commit is contained in:
PowerUser64 2021-10-06 23:24:33 -07:00
parent 3cec380a34
commit 53d7246381
3 changed files with 71 additions and 60 deletions

View file

@ -3,40 +3,76 @@ local M = {}
-- nvimtree >>> -- nvimtree >>>
M.nvimtree = function () M.nvimtree = function ()
local tree_cb = require'nvim-tree.config'.nvim_tree_callback local tree_cb = require'nvim-tree.config'.nvim_tree_callback
-- default mappings -- mappings
vim.g.nvim_tree_bindings = { -- [[
{ key = {"<CR>", "o", "<2-LeftMouse>"}, cb = tree_cb("edit") }, local list = {
{ key = {"<2-RightMouse>", "<C-]>"}, cb = tree_cb("cd") }, { key = {"<CR>", "<2-LeftMouse>", "zo", "l"}, cb = tree_cb("edit") },
{ key = "<C-v>", cb = tree_cb("vsplit") }, { key = "J", cb = tree_cb("cd") },
{ key = "<C-x>", cb = tree_cb("split") }, { key = "K", cb = tree_cb("dir_up") },
{ key = "<C-t>", cb = tree_cb("tabnew") }, { key = "vs", cb = tree_cb("vsplit") },
{ key = "<", cb = tree_cb("prev_sibling") }, { key = "sp", cb = tree_cb("split") },
{ key = ">", cb = tree_cb("next_sibling") }, { key = "<C-t>", cb = tree_cb("tabnew") },
{ key = "P", cb = tree_cb("parent_node") }, { key = "<", cb = tree_cb("prev_sibling") },
{ key = "<BS>", cb = tree_cb("close_node") }, { key = ">", cb = tree_cb("next_sibling") },
{ key = "<S-CR>", cb = tree_cb("close_node") }, { key = "<M-lt>", cb = tree_cb("first_sibling") },
{ key = "<Tab>", cb = tree_cb("preview") }, { key = "<M->>", cb = tree_cb("last_sibling") },
{ key = "K", cb = tree_cb("first_sibling") }, { key = "P", cb = tree_cb("parent_node") },
{ key = "J", cb = tree_cb("last_sibling") }, { key = {"<BS>", "h", "zc"}, cb = tree_cb("close_node") },
{ key = "I", cb = tree_cb("toggle_ignored") }, { key = "<S-CR>", cb = tree_cb("close_node") },
{ key = "H", cb = tree_cb("toggle_dotfiles") }, { key = "<Tab>", cb = tree_cb("preview") },
{ key = "R", cb = tree_cb("refresh") }, { key = "I", cb = tree_cb("toggle_ignored") },
{ key = "a", cb = tree_cb("create") }, { key = "H", cb = tree_cb("toggle_dotfiles") },
{ key = "d", cb = tree_cb("remove") }, { key = "R", cb = tree_cb("refresh") },
{ key = "r", cb = tree_cb("rename") }, { key = "o", cb = tree_cb("create") },
{ key = "<C-r>", cb = tree_cb("full_rename") }, { key = "d", cb = tree_cb("remove") },
{ key = "x", cb = tree_cb("cut") }, { key = "r", cb = tree_cb("rename") },
{ key = "c", cb = tree_cb("copy") }, { key = "<C-r>", cb = tree_cb("full_rename") },
{ key = "p", cb = tree_cb("paste") }, { key = "x", cb = tree_cb("cut") },
{ key = "y", cb = tree_cb("copy_name") }, { key = "c", cb = tree_cb("copy") },
{ key = "Y", cb = tree_cb("copy_path") }, { key = "p", cb = tree_cb("paste") },
{ key = "gy", cb = tree_cb("copy_absolute_path") }, { key = "y", cb = tree_cb("copy_name") },
{ key = "[c", cb = tree_cb("prev_git_item") }, { key = "Y", cb = tree_cb("copy_path") },
{ key = "]c", cb = tree_cb("next_git_item") }, { key = "gy", cb = tree_cb("copy_absolute_path") },
{ key = "-", cb = tree_cb("dir_up") }, { key = "g[", cb = tree_cb("prev_git_item") },
{ key = "s", cb = tree_cb("system_open") }, { key = "g]", cb = tree_cb("next_git_item") },
{ key = "q", cb = tree_cb("close") }, { key = "s", cb = tree_cb("system_open") },
{ key = "g?", cb = tree_cb("toggle_help") }, { 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 -- <<< end -- <<<
@ -186,26 +222,6 @@ M.autosession = function()
vim.cmd 'command! SessionRestore RestoreSession' vim.cmd 'command! SessionRestore RestoreSession'
end -- <<< 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 return M
-- vim:fdm=marker:fmr=>>>,<<<:expandtab:tabstop=3:sw=3 -- vim:fdm=marker:fmr=>>>,<<<:expandtab:tabstop=3:sw=3

View file

@ -183,12 +183,6 @@ return require('packer').startup(function()
use { -- tpope: Repeatability for various tpope plugins use { -- tpope: Repeatability for various tpope plugins
'tpope/vim-repeat', '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) end)

View file

@ -153,3 +153,4 @@ vim.cmd [[
au InsertLeave * match ExtraWhitespace /\s\+$/ au InsertLeave * match ExtraWhitespace /\s\+$/
au BufWinLeave * call clearmatches() au BufWinLeave * call clearmatches()
]] ]]