summaryrefslogtreecommitdiffstats
path: root/.config/nvim/plugin/50-netrw.lua
diff options
context:
space:
mode:
Diffstat (limited to '.config/nvim/plugin/50-netrw.lua')
-rw-r--r--.config/nvim/plugin/50-netrw.lua25
1 files changed, 25 insertions, 0 deletions
diff --git a/.config/nvim/plugin/50-netrw.lua b/.config/nvim/plugin/50-netrw.lua
new file mode 100644
index 0000000..4fdbfa6
--- /dev/null
+++ b/.config/nvim/plugin/50-netrw.lua
@@ -0,0 +1,25 @@
+--
+-- netrw plugin
+--
+
+local function explore()
+ local windows = vim.api.nvim_tabpage_list_wins(0)
+ for _, win in ipairs(windows) do
+ local buf = vim.api.nvim_win_get_buf(win)
+ local ft = vim.api.nvim_get_option_value("filetype", { buf = buf })
+ if ft == "netrw" then
+ if win ~= vim.api.nvim_get_current_win() then
+ vim.api.nvim_set_current_win(win)
+ return
+ end
+ break
+ end
+ end
+ vim.cmd.Lexplore()
+end
+
+vim.g.netrw_liststyle = 3 -- 3: list style
+vim.g.netrw_winsize = -30 -- 30 colums wide
+vim.g.netrw_banner = 0 -- No banner
+
+vim.api.nvim_create_user_command("GotoExplorer", explore, { desc = "Open/close/focus netrw window" })