1
0
mirror of https://github.com/jdhao/nvim-config.git synced 2025-06-08 14:14:33 +02:00

Compare commits

..

2 Commits

Author SHA1 Message Date
jdhao
8416508686 Enable nvim-tree to open dir during startup
Now when you open a directory when starting nvim, nvim-tree will be
opened to handle the directory correctly, see also issue #257.
2024-01-07 15:24:47 +01:00
jdhao
df9491b05b bump neovim version to 0.9.5 2024-01-07 14:45:29 +01:00
4 changed files with 25 additions and 5 deletions

View File

@ -13,7 +13,7 @@
<img alt="Latest release" src="https://img.shields.io/github/v/release/jdhao/nvim-config" /> <img alt="Latest release" src="https://img.shields.io/github/v/release/jdhao/nvim-config" />
</a> </a>
<a href="https://github.com/neovim/neovim/releases/tag/stable"> <a href="https://github.com/neovim/neovim/releases/tag/stable">
<img src="https://img.shields.io/badge/Neovim-0.9.2-blueviolet.svg?style=flat-square&logo=Neovim&logoColor=green" alt="Neovim minimum version"/> <img src="https://img.shields.io/badge/Neovim-0.9.5-blueviolet.svg?style=flat-square&logo=Neovim&logoColor=green" alt="Neovim minimum version"/>
</a> </a>
<a href="https://github.com/jdhao/nvim-config/search?l=vim-script"> <a href="https://github.com/jdhao/nvim-config/search?l=vim-script">
<img src="https://img.shields.io/github/languages/top/jdhao/nvim-config" alt="Top languages"/> <img src="https://img.shields.io/github/languages/top/jdhao/nvim-config" alt="Top languages"/>
@ -21,8 +21,8 @@
<a href="https://github.com/jdhao/nvim-config/graphs/commit-activity"> <a href="https://github.com/jdhao/nvim-config/graphs/commit-activity">
<img src="https://img.shields.io/github/commit-activity/m/jdhao/nvim-config?style=flat-square" /> <img src="https://img.shields.io/github/commit-activity/m/jdhao/nvim-config?style=flat-square" />
</a> </a>
<a href="https://github.com/jdhao/nvim-config/releases/tag/v0.9.2"> <a href="https://github.com/jdhao/nvim-config/releases/tag/v0.9.5">
<img src="https://img.shields.io/github/commits-since/jdhao/nvim-config/v0.9.2?style=flat-square" /> <img src="https://img.shields.io/github/commits-since/jdhao/nvim-config/v0.9.5?style=flat-square" />
</a> </a>
<a href="https://github.com/jdhao/nvim-config/graphs/contributors"> <a href="https://github.com/jdhao/nvim-config/graphs/contributors">
<img src="https://img.shields.io/github/contributors/jdhao/nvim-config?style=flat-square" /> <img src="https://img.shields.io/github/contributors/jdhao/nvim-config?style=flat-square" />

View File

@ -14,7 +14,7 @@ vim.loader.enable()
local version = vim.version local version = vim.version
-- check if we have the latest stable version of nvim -- check if we have the latest stable version of nvim
local expected_ver = "0.9.4" local expected_ver = "0.9.5"
local ev = version.parse(expected_ver) local ev = version.parse(expected_ver)
local actual_ver = version() local actual_ver = version()

View File

@ -4,8 +4,8 @@ local nvim_tree = require("nvim-tree")
nvim_tree.setup { nvim_tree.setup {
auto_reload_on_write = true, auto_reload_on_write = true,
disable_netrw = false, disable_netrw = false,
hijack_cursor = false,
hijack_netrw = true, hijack_netrw = true,
hijack_cursor = false,
hijack_unnamed_buffer_when_opening = false, hijack_unnamed_buffer_when_opening = false,
open_on_tab = false, open_on_tab = false,
sort_by = "name", sort_by = "name",

View File

@ -83,3 +83,23 @@ api.nvim_create_autocmd("VimResized", {
desc = "autoresize windows on resizing operation", desc = "autoresize windows on resizing operation",
command = "wincmd =", command = "wincmd =",
}) })
local function open_nvim_tree(data)
-- check if buffer is a directory
local directory = vim.fn.isdirectory(data.file) == 1
if not directory then
return
end
-- create a new, empty buffer
vim.cmd.enew()
-- wipe the directory buffer
vim.cmd.bw(data.buf)
-- open the tree
require("nvim-tree.api").tree.open()
end
vim.api.nvim_create_autocmd({ "VimEnter" }, { callback = open_nvim_tree })