This commit is contained in:
2024-06-22 00:09:57 +08:00
8 changed files with 100 additions and 58 deletions
+1
View File
@@ -40,6 +40,7 @@
bn = branch --no-merged
pl = pull
pt = push origin --tags
ph = push origin HEAD
merge2 = !sh -c '_CURRENT_BRANCH=$(git symbolic-ref --short HEAD) && git checkout $1 && git merge $_CURRENT_BRANCH && git checkout $_CURRENT_BRANCH' -
bg = "!f() { git branch | grep $1; }; f"
delbr = "!f(){ git branch -D $(git branch | grep \"\b$1\"); };f"
+1
View File
@@ -13,6 +13,7 @@
"cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" },
"conform.nvim": { "branch": "master", "commit": "192a6d2ddace343f1840a8f72efe2315bd392243" },
"dashboard-nvim": { "branch": "master", "commit": "413442b12d85315fc626c44a0ce4929b213ef604" },
"diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" },
"dressing.nvim": { "branch": "master", "commit": "6f212262061a2120e42da0d1e87326e8a41c0478" },
"flash.nvim": { "branch": "main", "commit": "48817af25f51c0590653bbc290866e4890fe1cbe" },
"friendly-snippets": { "branch": "main", "commit": "dcd4a586439a1c81357d5b9d26319ae218cc9479" },
+3
View File
@@ -0,0 +1,3 @@
return {
"sindrets/diffview.nvim",
}
+26 -20
View File
@@ -4,25 +4,30 @@ return {
opts = {
signs = {
-- TODO add hl to colorscheme
add = {hl = 'GitSignsAdd' , text = '▎', numhl='GitSignsAddNr' , linehl='GitSignsAddLn'},
change = {hl = 'GitSignsChange', text = '▎', numhl='GitSignsChangeNr', linehl='GitSignsChangeLn'},
delete = {hl = 'GitSignsDelete', text = '契', numhl='GitSignsDeleteNr', linehl='GitSignsDeleteLn'},
topdelete = {hl = 'GitSignsDelete', text = '契', numhl='GitSignsDeleteNr', linehl='GitSignsDeleteLn'},
changedelete = {hl = 'GitSignsChange', text = '▎', numhl='GitSignsChangeNr', linehl='GitSignsChangeLn'},
},
numhl = false,
linehl = false,
watch_gitdir = {
interval = 1000
},
sign_priority = 6,
update_debounce = 200,
status_formatter = nil, -- Use default
add = { hl = "GitSignsAdd", text = "▎", numhl = "GitSignsAddNr", linehl = "GitSignsAddLn" },
change = { hl = "GitSignsChange", text = "▎", numhl = "GitSignsChangeNr", linehl = "GitSignsChangeLn" },
delete = { hl = "GitSignsDelete", text = "契", numhl = "GitSignsDeleteNr", linehl = "GitSignsDeleteLn" },
topdelete = { hl = "GitSignsDelete", text = "契", numhl = "GitSignsDeleteNr", linehl = "GitSignsDeleteLn" },
changedelete = {
hl = "GitSignsChange",
text = "▎",
numhl = "GitSignsChangeNr",
linehl = "GitSignsChangeLn",
},
},
numhl = false,
linehl = false,
watch_gitdir = {
interval = 1000,
},
sign_priority = 6,
update_debounce = 200,
status_formatter = nil, -- Use default
on_attach = function(buffer)
local gs = package.loaded.gitsigns
local function map(mode, l, r, desc)
vim.keymap.set(mode, l, r, { buffer = buffer, desc = desc })
vim.keymap.set(mode, l, r, { buffer = buffer, desc = desc })
end
-- stylua: ignore start
@@ -38,7 +43,8 @@ return {
map("n", "<leader>ghd", gs.diffthis, "Diff This")
map("n", "<leader>ghD", function() gs.diffthis("~") end, "Diff This ~")
map({ "o", "x" }, "ih", ":<C-U>Gitsigns select_hunk<CR>", "GitSigns Select Hunk")
end,
}
}
}
end,
},
},
}
+7 -5
View File
@@ -6,12 +6,14 @@ return {
"stylua",
"selene",
"luacheck",
"shellcheck",
"bashls",
"shfmt",
"tailwindcss-language-server",
"typescript-language-server",
"css-lsp",
"tailwindcss",
"tsserver",
"pylyzer",
"cssls",
})
end,
},
}
}
+29 -28
View File
@@ -1,38 +1,38 @@
local function my_on_attach(bufnr)
local api = require "nvim-tree.api"
local api = require("nvim-tree.api")
local function opts(desc)
return { desc = "nvim-tree: " .. desc, buffer = bufnr, noremap = true, silent = true, nowait = true }
end
-- default mappings
api.config.mappings.default_on_attach(bufnr)
-- custom mappings
vim.keymap.set('n', '<C-t>', api.tree.change_root_to_parent, opts('Up'))
vim.keymap.set('n', '?', api.tree.toggle_help, opts('Help'))
vim.keymap.set('n', 'l', api.node.open.edit, opts('Edit'))
vim.keymap.set('n', 'h', api.node.navigate.parent_close, opts('Parent Close'))
vim.keymap.set('n', 's', api.node.open.horizontal, opts('Horizontal Split'))
vim.keymap.set('n', 'v', api.node.open.vertical, opts('Vertical Split'))
local function opts(desc)
return { desc = "nvim-tree: " .. desc, buffer = bufnr, noremap = true, silent = true, nowait = true }
end
-- default mappings
api.config.mappings.default_on_attach(bufnr)
-- custom mappings
vim.keymap.set("n", "<C-t>", api.tree.change_root_to_parent, opts("Up"))
vim.keymap.set("n", "?", api.tree.toggle_help, opts("Help"))
vim.keymap.set("n", "l", api.node.open.edit, opts("Edit"))
vim.keymap.set("n", "h", api.node.navigate.parent_close, opts("Parent Close"))
vim.keymap.set("n", "s", api.node.open.horizontal, opts("Horizontal Split"))
vim.keymap.set("n", "v", api.node.open.vertical, opts("Vertical Split"))
vim.keymap.set("n", "<S-r>", api.tree.reload, opts("Reload"))
end
vim.g.nvim_tree_indent_markers = 1 -- "0 by default, this option shows indent markers when folders are open
vim.g.nvim_tree_auto_ignore_ft = 'startify' --empty by default, don't auto open tree on specific filetypes.
vim.g.nvim_tree_auto_ignore_ft = "startify" --empty by default, don't auto open tree on specific filetypes.
vim.g.nvim_tree_icons = {
default = '',
symlink = '',
git = {unstaged = "", staged = "✓", unmerged = "", renamed = "➜", untracked = ""},
folder = {default = "", open = "", empty = "", empty_open = "", symlink = ""}
default = "",
symlink = "",
git = { unstaged = "", staged = "✓", unmerged = "", renamed = "➜", untracked = "" },
folder = { default = "", open = "", empty = "", empty_open = "", symlink = "" },
}
return {
{
'nvim-tree/nvim-tree.lua',
"nvim-tree/nvim-tree.lua",
dependencies = {
'nvim-tree/nvim-web-devicons', -- optional
"nvim-tree/nvim-web-devicons", -- optional
},
opts = {
on_attach = my_on_attach,
@@ -41,7 +41,7 @@ return {
--auto_close = false,
filters = {
dotfiles = false,
custom = {}
custom = {},
},
git = {
enable = true,
@@ -50,14 +50,15 @@ return {
},
update_focused_file = {
-- enables the feature
enable = true,
enable = true,
-- update the root directory of the tree to the one of the folder containing the file if the file is not under the current root directory
-- only relevant when `update_focused_file.enable` is true
update_cwd = false,
update_cwd = false,
-- list of buffer names / filetypes that will not update the cwd if the file isn't found under the current root directory
-- only relevant when `update_focused_file.update_cwd` is true and `update_focused_file.enable` is true
ignore_list = {}
ignore_list = {},
},
},
},
}
}
+20
View File
@@ -0,0 +1,20 @@
#/bin/bash
echo 'Init tmux config'
src=$HOME/.tmux.conf
if [ -e $src ]; then
mv $src $src.bak
fi
ln -s $HOME/.dotfile/tmux/.tmux.conf $src
echo 'Install tpm'
if [ ! -e ~/.tmux/plugins/tpm ]; then
git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
fi
echo 'Install tmux plugin by tpm'
$HOME/.tmux/plugins/tpm/bin/install_plugins
echo 'Reload tmux'
tmux source ~/.tmux.conf
+13 -5
View File
@@ -20,8 +20,8 @@ set-option -g mouse on
# 绑定hjkl键为面板切换的上下左右键
bind k select-pane -U # 绑定k为↑
bind j select-pane -D # 绑定j为↓
bind h select-pane -L # 绑定h为←
bind l select-pane -R # 绑定l为→
#bind h select-pane -L # 绑定h为←
#bind l select-pane -R # 绑定l为→
# 绑定Ctrl+hjkl键为面板上下左右调整边缘的快捷指令
bind -r K resizep -U 10 # 绑定Ctrl+k为往↑调整面板边缘10个单元格
@@ -29,11 +29,13 @@ bind -r J resizep -D 10 # 绑定Ctrl+j为往↓调整面板边缘10个单元格
bind -r H resizep -L 10 # 绑定Ctrl+h为往←调整面板边缘10个单元格
bind -r L resizep -R 10 # 绑定Ctrl+l为往→调整面板边缘10个单元格
bind -r j select-pane -t .+1 \; resize-pane -Z # prefix + j to switch pane in current window
# 设置tmux的延迟,文档说当有干扰的时候可以设置这个参数,比如影响vim编辑的时候
set -s escape-time 1
# 返回上一个窗口
bind g last-window
bind L switch-client -l
# 设置窗口名为当前目录名
set-option -g status-interval 10
@@ -44,5 +46,11 @@ set-option -g set-titles on
#set-option -g set-titles-string "#{session_name} - #{host}"
set-option -g set-titles-string "#{session_name}"
# tmux resurrect
run-shell ~/.tmux/plugins/tmux-resurrect/resurrect.tmux
# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'junegunn/fzf'
set -g @plugin 'tmux-plugins/tmux-fzf'
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'