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 bn = branch --no-merged
pl = pull pl = pull
pt = push origin --tags 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' - 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" bg = "!f() { git branch | grep $1; }; f"
delbr = "!f(){ git branch -D $(git branch | grep \"\b$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" }, "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" },
"conform.nvim": { "branch": "master", "commit": "192a6d2ddace343f1840a8f72efe2315bd392243" }, "conform.nvim": { "branch": "master", "commit": "192a6d2ddace343f1840a8f72efe2315bd392243" },
"dashboard-nvim": { "branch": "master", "commit": "413442b12d85315fc626c44a0ce4929b213ef604" }, "dashboard-nvim": { "branch": "master", "commit": "413442b12d85315fc626c44a0ce4929b213ef604" },
"diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" },
"dressing.nvim": { "branch": "master", "commit": "6f212262061a2120e42da0d1e87326e8a41c0478" }, "dressing.nvim": { "branch": "master", "commit": "6f212262061a2120e42da0d1e87326e8a41c0478" },
"flash.nvim": { "branch": "main", "commit": "48817af25f51c0590653bbc290866e4890fe1cbe" }, "flash.nvim": { "branch": "main", "commit": "48817af25f51c0590653bbc290866e4890fe1cbe" },
"friendly-snippets": { "branch": "main", "commit": "dcd4a586439a1c81357d5b9d26319ae218cc9479" }, "friendly-snippets": { "branch": "main", "commit": "dcd4a586439a1c81357d5b9d26319ae218cc9479" },
+3
View File
@@ -0,0 +1,3 @@
return {
"sindrets/diffview.nvim",
}
+14 -8
View File
@@ -4,16 +4,21 @@ return {
opts = { opts = {
signs = { signs = {
-- TODO add hl to colorscheme -- TODO add hl to colorscheme
add = {hl = 'GitSignsAdd' , text = '▎', numhl='GitSignsAddNr' , linehl='GitSignsAddLn'}, add = { hl = "GitSignsAdd", text = "▎", numhl = "GitSignsAddNr", linehl = "GitSignsAddLn" },
change = {hl = 'GitSignsChange', text = '▎', numhl='GitSignsChangeNr', linehl='GitSignsChangeLn'}, change = { hl = "GitSignsChange", text = "▎", numhl = "GitSignsChangeNr", linehl = "GitSignsChangeLn" },
delete = {hl = 'GitSignsDelete', text = '契', numhl='GitSignsDeleteNr', linehl='GitSignsDeleteLn'}, delete = { hl = "GitSignsDelete", text = "契", numhl = "GitSignsDeleteNr", linehl = "GitSignsDeleteLn" },
topdelete = {hl = 'GitSignsDelete', text = '契', numhl='GitSignsDeleteNr', linehl='GitSignsDeleteLn'}, topdelete = { hl = "GitSignsDelete", text = "契", numhl = "GitSignsDeleteNr", linehl = "GitSignsDeleteLn" },
changedelete = {hl = 'GitSignsChange', text = '▎', numhl='GitSignsChangeNr', linehl='GitSignsChangeLn'}, changedelete = {
hl = "GitSignsChange",
text = "▎",
numhl = "GitSignsChangeNr",
linehl = "GitSignsChangeLn",
},
}, },
numhl = false, numhl = false,
linehl = false, linehl = false,
watch_gitdir = { watch_gitdir = {
interval = 1000 interval = 1000,
}, },
sign_priority = 6, sign_priority = 6,
update_debounce = 200, update_debounce = 200,
@@ -39,6 +44,7 @@ return {
map("n", "<leader>ghD", function() gs.diffthis("~") end, "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") map({ "o", "x" }, "ih", ":<C-U>Gitsigns select_hunk<CR>", "GitSigns Select Hunk")
end, end,
},
},
} }
}
}
+6 -4
View File
@@ -6,12 +6,14 @@ return {
"stylua", "stylua",
"selene", "selene",
"luacheck", "luacheck",
"shellcheck", "bashls",
"shfmt", "shfmt",
"tailwindcss-language-server", "tailwindcss",
"typescript-language-server", "tsserver",
"css-lsp", "pylyzer",
"cssls",
}) })
end, end,
}, },
} }
+17 -16
View File
@@ -1,5 +1,5 @@
local function my_on_attach(bufnr) local function my_on_attach(bufnr)
local api = require "nvim-tree.api" local api = require("nvim-tree.api")
local function opts(desc) local function opts(desc)
return { desc = "nvim-tree: " .. desc, buffer = bufnr, noremap = true, silent = true, nowait = true } return { desc = "nvim-tree: " .. desc, buffer = bufnr, noremap = true, silent = true, nowait = true }
@@ -9,30 +9,30 @@ local function my_on_attach(bufnr)
api.config.mappings.default_on_attach(bufnr) api.config.mappings.default_on_attach(bufnr)
-- custom mappings -- custom mappings
vim.keymap.set('n', '<C-t>', api.tree.change_root_to_parent, opts('Up')) 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", "?", api.tree.toggle_help, opts("Help"))
vim.keymap.set('n', 'l', api.node.open.edit, opts('Edit')) 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", "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", "s", api.node.open.horizontal, opts("Horizontal Split"))
vim.keymap.set('n', 'v', api.node.open.vertical, opts('Vertical 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 end
vim.g.nvim_tree_indent_markers = 1 -- "0 by default, this option shows indent markers when folders are open 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 = { vim.g.nvim_tree_icons = {
default = '', default = "",
symlink = '', symlink = "",
git = { unstaged = "", staged = "✓", unmerged = "", renamed = "➜", untracked = "" }, git = { unstaged = "", staged = "✓", unmerged = "", renamed = "➜", untracked = "" },
folder = {default = "", open = "", empty = "", empty_open = "", symlink = ""} folder = { default = "", open = "", empty = "", empty_open = "", symlink = "" },
} }
return { return {
{ {
'nvim-tree/nvim-tree.lua', "nvim-tree/nvim-tree.lua",
dependencies = { dependencies = {
'nvim-tree/nvim-web-devicons', -- optional "nvim-tree/nvim-web-devicons", -- optional
}, },
opts = { opts = {
on_attach = my_on_attach, on_attach = my_on_attach,
@@ -41,7 +41,7 @@ return {
--auto_close = false, --auto_close = false,
filters = { filters = {
dotfiles = false, dotfiles = false,
custom = {} custom = {},
}, },
git = { git = {
enable = true, enable = true,
@@ -56,8 +56,9 @@ return {
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 -- 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 -- 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键为面板切换的上下左右键 # 绑定hjkl键为面板切换的上下左右键
bind k select-pane -U # 绑定k为↑ bind k select-pane -U # 绑定k为↑
bind j select-pane -D # 绑定j为↓ bind j select-pane -D # 绑定j为↓
bind h select-pane -L # 绑定h为← #bind h select-pane -L # 绑定h为←
bind l select-pane -R # 绑定l为→ #bind l select-pane -R # 绑定l为→
# 绑定Ctrl+hjkl键为面板上下左右调整边缘的快捷指令 # 绑定Ctrl+hjkl键为面板上下左右调整边缘的快捷指令
bind -r K resizep -U 10 # 绑定Ctrl+k为往↑调整面板边缘10个单元格 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 H resizep -L 10 # 绑定Ctrl+h为往←调整面板边缘10个单元格
bind -r L resizep -R 10 # 绑定Ctrl+l为往→调整面板边缘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编辑的时候 # 设置tmux的延迟,文档说当有干扰的时候可以设置这个参数,比如影响vim编辑的时候
set -s escape-time 1 set -s escape-time 1
# 返回上一个窗口 # 返回上一个窗口
bind g last-window bind L switch-client -l
# 设置窗口名为当前目录名 # 设置窗口名为当前目录名
set-option -g status-interval 10 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} - #{host}"
set-option -g set-titles-string "#{session_name}" set-option -g set-titles-string "#{session_name}"
# tmux resurrect # List of plugins
run-shell ~/.tmux/plugins/tmux-resurrect/resurrect.tmux 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'