From 53d724638176d3db40e106c8ab39977a800a7842 Mon Sep 17 00:00:00 2001 From: PowerUser64 <blakelysnorth@gmail.com> Date: Wed, 6 Oct 2021 23:24:33 -0700 Subject: [PATCH] nvim: better nvimtree keybinds TODO: add a bind to open it --- .config/nvim/lua/blake/other.lua | 124 ++++++++++++++++------------ .config/nvim/lua/blake/plugins.lua | 6 -- .config/nvim/lua/blake/settings.lua | 1 + 3 files changed, 71 insertions(+), 60 deletions(-) diff --git a/.config/nvim/lua/blake/other.lua b/.config/nvim/lua/blake/other.lua index b78b1b5..78d47d4 100644 --- a/.config/nvim/lua/blake/other.lua +++ b/.config/nvim/lua/blake/other.lua @@ -3,40 +3,76 @@ 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") }, - { key = "<C-t>", cb = tree_cb("tabnew") }, - { key = "<", cb = tree_cb("prev_sibling") }, - { key = ">", cb = tree_cb("next_sibling") }, - { key = "P", cb = tree_cb("parent_node") }, - { key = "<BS>", 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 = "d", cb = tree_cb("remove") }, - { key = "r", cb = tree_cb("rename") }, - { key = "<C-r>", cb = tree_cb("full_rename") }, - { key = "x", cb = tree_cb("cut") }, - { key = "c", cb = tree_cb("copy") }, - { key = "p", cb = tree_cb("paste") }, - { 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 = "s", cb = tree_cb("system_open") }, - { key = "q", cb = tree_cb("close") }, - { key = "g?", cb = tree_cb("toggle_help") }, + -- 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>", "h", "zc"}, cb = tree_cb("close_node") }, + { key = "<S-CR>", cb = tree_cb("close_node") }, + { key = "<Tab>", cb = tree_cb("preview") }, + { key = "I", cb = tree_cb("toggle_ignored") }, + { key = "H", cb = tree_cb("toggle_dotfiles") }, + { key = "R", cb = tree_cb("refresh") }, + { 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") }, + { key = "x", cb = tree_cb("cut") }, + { key = "c", cb = tree_cb("copy") }, + { key = "p", cb = tree_cb("paste") }, + { key = "y", cb = tree_cb("copy_name") }, + { key = "Y", cb = tree_cb("copy_path") }, + { key = "gy", cb = tree_cb("copy_absolute_path") }, + { 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 -- <<< @@ -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 diff --git a/.config/nvim/lua/blake/plugins.lua b/.config/nvim/lua/blake/plugins.lua index 09e9a27..6b52cc9 100644 --- a/.config/nvim/lua/blake/plugins.lua +++ b/.config/nvim/lua/blake/plugins.lua @@ -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) diff --git a/.config/nvim/lua/blake/settings.lua b/.config/nvim/lua/blake/settings.lua index 37bca11..d084d61 100644 --- a/.config/nvim/lua/blake/settings.lua +++ b/.config/nvim/lua/blake/settings.lua @@ -153,3 +153,4 @@ vim.cmd [[ au InsertLeave * match ExtraWhitespace /\s\+$/ au BufWinLeave * call clearmatches() ]] +