migrate to stow

This commit is contained in:
2022-03-20 00:37:41 +03:00
parent 8544e93367
commit 2ef5b95984
41 changed files with 351 additions and 93 deletions

View File

@@ -0,0 +1,74 @@
vim.g.nvim_tree_show_icons = {
git = 1,
files = 1,
folders = 1,
}
vim.g.nvim_tree_icons = {
default = "",
symlink = "",
git = {
unstaged = "U",
staged = "S",
unmerged = "M",
renamed = "R",
untracked = "N",
deleted = "D",
},
}
vim.g.nvim_tree_git_hl = 1
vim.g.nvim_tree_add_trailing = 1
vim.g.nvim_tree_indent_markers = 1
vim.g.nvim_tree_group_empty = 1
local function git_stage(node)
local cwd = vim.loop.cwd()
local relative_path = string.gsub(node.absolute_path, cwd .. "/", "")
local f = io.popen("git add " .. relative_path, "r")
f:close()
end
local function git_reset(node)
local cwd = vim.loop.cwd()
local relative_path = string.gsub(node.absolute_path, cwd .. "/", "")
local f = io.popen("git reset " .. relative_path, "r")
f:close()
end
-- TODO: add here keymap for git diff window
require("nvim-tree").setup({
disable_netrw = true,
hijack_netrw = true,
open_on_setup = true,
hijack_cursor = true,
open_on_tab = false,
update_cwd = true,
update_focused_file = {
enable = true,
},
view = {
width = 30,
side = "left",
auto_resize = true,
mappings = {
list = {
{ key = "tn", action = "tabnew" },
{ key = "gs", action = "git_stage", action_cb = git_stage },
{ key = "gr", action = "git_reset", action_cb = git_reset },
{ key = "l", action = "edit" },
{ key = "@", action = "cd" },
},
},
},
filters = {
custom = { ".git" },
},
git = {
ignore = true,
},
diagnostics = {
enable = true,
show_on_dirs = true,
icons = { hint = "", info = "", warning = "", error = "" },
},
})