Initial nvim config, derived from kickstart.nvim.
This commit is contained in:
parent
09be919865
commit
39536754b3
38 changed files with 479 additions and 338 deletions
23
.config/nvim/lua/utils/close_buffer.lua
Normal file
23
.config/nvim/lua/utils/close_buffer.lua
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
local M = { }
|
||||
|
||||
function M.close_buffer()
|
||||
local try_quit = function(command)
|
||||
local success, errorMsg = pcall(vim.api.nvim_command, command)
|
||||
if not success then
|
||||
print("Failed to quit: " .. errorMsg)
|
||||
end
|
||||
end
|
||||
|
||||
local tree = require("nvim-tree.api").tree
|
||||
local buffer_count = #vim.fn.filter(vim.fn.range(1, vim.fn.bufnr '$'), 'buflisted(v:val)')
|
||||
|
||||
if buffer_count ~= 1 then
|
||||
tree.toggle({ focus = false })
|
||||
try_quit("bd")
|
||||
tree.toggle({ focus = false })
|
||||
else
|
||||
try_quit("qa")
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
||||
4
.config/nvim/lua/utils/init.lua
Normal file
4
.config/nvim/lua/utils/init.lua
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
return {
|
||||
require("utils.lazy"),
|
||||
require("utils.close_buffer"),
|
||||
}
|
||||
18
.config/nvim/lua/utils/lazy.lua
Normal file
18
.config/nvim/lua/utils/lazy.lua
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
local M = { }
|
||||
|
||||
function M.lazy_init()
|
||||
local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim'
|
||||
if not vim.loop.fs_stat(lazypath) then
|
||||
vim.fn.system {
|
||||
'git',
|
||||
'clone',
|
||||
'--filter=blob:none',
|
||||
'https://github.com/folke/lazy.nvim.git',
|
||||
'--branch=stable', -- latest stable release
|
||||
lazypath,
|
||||
}
|
||||
end
|
||||
vim.opt.rtp:prepend(lazypath)
|
||||
end
|
||||
|
||||
return M
|
||||
Loading…
Add table
Add a link
Reference in a new issue