diff options
author | Squibid <me@zacharyscheiman.com> | 2024-08-09 02:45:31 -0400 |
---|---|---|
committer | Squibid <me@zacharyscheiman.com> | 2024-08-09 02:45:31 -0400 |
commit | c489d393695e90d424f9ae51e35c4d42358e6a71 (patch) | |
tree | 12ea97ec4684fd82cd6b73dd127d0137b115837b /after/ftplugin/netrw.lua | |
parent | ad76983d969c318e6e234bc82384b4b025d70447 (diff) | |
download | nvim-c489d393695e90d424f9ae51e35c4d42358e6a71.tar.gz nvim-c489d393695e90d424f9ae51e35c4d42358e6a71.tar.bz2 nvim-c489d393695e90d424f9ae51e35c4d42358e6a71.zip |
yes there's a bit of java in my nvim config why do you ask?
Diffstat (limited to '')
-rw-r--r-- | after/ftplugin/netrw.lua | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/after/ftplugin/netrw.lua b/after/ftplugin/netrw.lua new file mode 100644 index 0000000..98d7dd7 --- /dev/null +++ b/after/ftplugin/netrw.lua @@ -0,0 +1,20 @@ +local misc = require("core.misc") +local map_local = misc.map_local + +map_local("n", "h", "-", { noremap = false, remap = true }) -- Go up a directory +map_local("n", "l", "<CR>", { noremap = false, remap = true }) -- Go down a directory / open a file +map_local("n", ".", "gh", { noremap = false, remap = true }) -- Toggle hidden files +map_local("n", "P", "<C-w>z", { noremap = false, remap = true }) -- Close preview window + +-- Close netrw only if it isn't the last window +map_local("n", "<esc>", function() + if #vim.api.nvim_tabpage_list_wins(0) > 1 then + vim.api.nvim_win_close(0, false) + end +end) + +-- change neovim root +map_local("n", "rt", function() + vim.api.nvim_set_current_dir(vim.b.netrw_curdir) + vim.notify("root dir updated: "..vim.b.netrw_curdir, vim.log.levels.LOW, { title = misc.appid }) +end) |