Compare commits
36 Commits
afeac1bb77
...
43d42a685f
Author | SHA1 | Date | |
---|---|---|---|
43d42a685f | |||
8bb3783246 | |||
5e616bcd4f | |||
42f0328079 | |||
ee6816e276 | |||
79c2ae90c6 | |||
7e5a875405 | |||
b72c1af17b | |||
6456ddb4f9 | |||
ccdbc64be5 | |||
b3ef08caf3 | |||
3519892943 | |||
3863c62bdc | |||
33d18b82f2 | |||
5bdee7a33e | |||
795598954a | |||
a09c0a1096 | |||
216df53a1e | |||
7ad0d308e5 | |||
d19ffabaec | |||
1507861a34 | |||
2a76c55268 | |||
411722360d | |||
85138cdaa1 | |||
a8e4862e0b | |||
883103e2e6 | |||
09eff51488 | |||
818053f6f6 | |||
55a4f6ee14 | |||
2850e08c76 | |||
b45a8766b8 | |||
fb102108aa | |||
5c9b9fcb42 | |||
d93ab2d409 | |||
b8c2e2d874 | |||
89a00d03e8 |
@ -2,9 +2,6 @@
|
||||
{{- $email := promptStringOnce . "email" "輸入您的Email地址" -}}
|
||||
sourceDir = "~/.local/share/chezmoi"
|
||||
|
||||
[edit]
|
||||
command = "vim"
|
||||
|
||||
[data]
|
||||
name = {{ $name | quote }}
|
||||
email = {{ $email | quote }}
|
||||
|
81
.chezmoitemplates/common.sh.tmpl
Normal file
81
.chezmoitemplates/common.sh.tmpl
Normal file
@ -0,0 +1,81 @@
|
||||
{{/* 以下是套用到 ~/.zshrc ~/.bashrc 用的共通內容 */ -}}
|
||||
|
||||
|
||||
{{/* ---- 設定與修復PATH路徑對應 ------------------------------------------- */ -}}
|
||||
|
||||
# Created by `pipx` on 2023-01-30 19:57:14
|
||||
export PATH="$PATH:$HOME/.local/bin"
|
||||
|
||||
# GoLang Path
|
||||
export PATH="$PATH:$HOME/go/bin"
|
||||
|
||||
# Fix Python3 to python Path on macOS
|
||||
if [ "$(uname -s)" = 'Darwin' ]; then
|
||||
export PATH=/usr/local/opt/python/libexec/bin:$PATH
|
||||
fi
|
||||
|
||||
# Install ruby¬
|
||||
# Based on "`brew --prefix ruby`/bin"¬
|
||||
export PATH="/usr/local/opt/ruby/bin:$PATH"¬
|
||||
# Based on "`gem environment gemdir`/bin"¬
|
||||
export PATH="/usr/local/lib/ruby/gems/3.3.0/bin:$PATH"¬
|
||||
export PATH="$HOME/.local/share/gem/ruby/3.3.0/bin:$PATH"
|
||||
|
||||
{{/* ---- 設定環境變數 ---------------------------------------------------- */ -}}
|
||||
{{- /* 設定預設編輯器 */ -}}
|
||||
{{ if eq .chezmoi.os "linux" }}
|
||||
# linux config
|
||||
[ -n "$DISPLAY" ] && export EDITOR=kate|| export EDITOR=nvim
|
||||
{{ else }}
|
||||
export EDITOR=nvim
|
||||
# non-linux config
|
||||
{{ end }}
|
||||
|
||||
export VISUAL=nvim
|
||||
|
||||
{{/* ---- 設定ailas ------------------------------------------------------ */ -}}
|
||||
# alias
|
||||
alias gitu='git add . && git commit && git push'
|
||||
|
||||
{{/* ---- 擴充功能 ------------------------------------------------------- */ -}}
|
||||
# 圖片顯示
|
||||
# 既然即使加入判斷後還是「進入函數定義段落且噴錯」,那就代表:zsh 在解析 .zshrc 時,在到達 if 邏輯前,就已經知道 imgcat 是 alias,並因此直接報錯,這是因為:
|
||||
# ⚠️ 在 zsh 中,如果你寫 function_name() 這種形式,然後這個名稱之前被定義為 alias,會在 parse 階段直接錯誤,不會等到 if 判斷。
|
||||
# 解決方式:延遲定義(用 eval 避開 parser)
|
||||
# 你需要避免 zsh 在 parse 階段就看到 imgcat() 的寫法。可以這樣寫,透過 eval 延遲定義函數內容:
|
||||
if ! alias imgcat &>/dev/null && ! functions imgcat &>/dev/null && command -v magick &>/dev/null; then
|
||||
eval '
|
||||
imgcat() {
|
||||
if [[ -z "$1" ]]; then
|
||||
echo "❌ 請指定圖片檔案,例如:imgcat ~/Pictures/foo.png"
|
||||
return 1
|
||||
fi
|
||||
|
||||
magick "$1" -geometry 800x480 sixel:-
|
||||
}'
|
||||
fi
|
||||
|
||||
#
|
||||
# # ex - archive extractor
|
||||
# # usage: ex <file>
|
||||
ex ()
|
||||
{
|
||||
if [ -f $1 ] ; then
|
||||
case $1 in
|
||||
*.tar.bz2) tar xjf $1 ;;
|
||||
*.tar.gz) tar xzf $1 ;;
|
||||
*.bz2) bunzip2 $1 ;;
|
||||
*.rar) unrar x $1 ;;
|
||||
*.gz) gunzip $1 ;;
|
||||
*.tar) tar xf $1 ;;
|
||||
*.tbz2) tar xjf $1 ;;
|
||||
*.tgz) tar xzf $1 ;;
|
||||
*.zip) unzip $1 ;;
|
||||
*.Z) uncompress $1;;
|
||||
*.7z) 7z x $1 ;;
|
||||
*) echo "'$1' cannot be extracted via ex()" ;;
|
||||
esac
|
||||
else
|
||||
echo "'$1' is not a valid file"
|
||||
fi
|
||||
}
|
@ -8,6 +8,10 @@ end_of_line = lf
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[.chezmoitemplates/*]
|
||||
insert_final_newline = false
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[*.md]
|
||||
indent_size = 4
|
||||
indent_style = space
|
||||
|
@ -195,6 +195,7 @@ chezmoi apply ~/.zshrc
|
||||
|
||||
將單一檔案轉換成tmpl範本
|
||||
```
|
||||
chezmoi add --template ~/.bashrc
|
||||
chezmoi chattr +template ~/.config/iterm2/com.googlecode.iterm2.plist
|
||||
```
|
||||
|
||||
|
11
dot_bashrc.tmpl
Normal file
11
dot_bashrc.tmpl
Normal file
@ -0,0 +1,11 @@
|
||||
{{ if and (eq .chezmoi.os "darwin") (stat (print "/etc/bashrc")) }}
|
||||
# ----取自 /etc/bashrc 預設內容 ----------------------------------------------
|
||||
{{ include "/etc/bashrc" | trim }}
|
||||
{{ else if (stat (print "/etc/skel/.bashrc")) }}
|
||||
# ----取自 /etc/skel/.bashrc 預設內容 ----------------------------------------
|
||||
{{ include "/etc/skel/.bashrc" | trim }}
|
||||
{{ end }}
|
||||
|
||||
# ----以下是我的自訂內容 ------------------------------------------------------
|
||||
{{ template "common.sh.tmpl" . }}
|
||||
|
@ -15,6 +15,7 @@ Yuan Neovim 備忘
|
||||
* move cursor: <window>(方向鍵)
|
||||
|
||||
### 擴充自行設定的快速鍵
|
||||
* `<F6>` 可以回朔到開啟檔案以來的任何歷史,還會標出修改的地方
|
||||
* `<F8>`: NeoTree: 查看已經開啟的檔案
|
||||
* `<F9>`: NeoTree
|
||||
* `<F10>`: git status
|
||||
@ -22,7 +23,6 @@ Yuan Neovim 備忘
|
||||
* `<leader>fB`: 已開啟的檔案
|
||||
|
||||
#### 預計設定
|
||||
* <F6> 可以回朔到開啟檔案以來的任何歷史,還會標出修改的地方
|
||||
* <F7> 看看你設定了哪些變數、函數,也可以快速跳轉
|
||||
|
||||
### 編輯習慣(已經覆寫)
|
||||
|
@ -1,34 +1,46 @@
|
||||
-- 這個檔案是依據自己之前在vscode的編輯習慣,用來設定editor的鍵盤快捷鍵
|
||||
|
||||
local map = vim.keymap.set
|
||||
local neomap = vim.api.nvim_set_keymap
|
||||
|
||||
-- 處理剪貼簿習慣對應(在Insert模式可使用慣用的快速鍵)
|
||||
vim.opt.keymodel = "startsel" -- 啟用 Shift + 方向鍵選取功能
|
||||
vim.api.nvim_set_keymap('i', '<C-v>', '<Esc>"+pa', { noremap = true, silent = true }) -- Insert Mode 下的 Ctrl+V 貼上
|
||||
vim.api.nvim_set_keymap('v', '<C-c>', '"+y', { noremap = true, silent = true }) -- Visual Mode 下的 Ctrl+C 複製
|
||||
vim.api.nvim_set_keymap('v', '<C-x>', '"+d', { noremap = true, silent = true }) -- Visual Mode 下的 Ctrl+X 剪下
|
||||
vim.api.nvim_set_keymap('v', '<C-v>', '"+p', { noremap = true, silent = true }) -- Visual Mode 下的 Ctrl+V 貼上
|
||||
neomap('i', '<C-v>', '<Esc>"+pa', { noremap = true, silent = true }) -- Insert Mode 下的 Ctrl+V 貼上
|
||||
neomap('v', '<C-c>', '"+y', { noremap = true, silent = true }) -- Visual Mode 下的 Ctrl+C 複製
|
||||
neomap('v', '<C-x>', '"+d', { noremap = true, silent = true }) -- Visual Mode 下的 Ctrl+X 剪下
|
||||
neomap('v', '<C-v>', '"+p', { noremap = true, silent = true }) -- Visual Mode 下的 Ctrl+V 貼上
|
||||
|
||||
-- 單字的左右移動
|
||||
neomap('n', '<C-Right>', 'w', { noremap = true, silent = true })
|
||||
neomap('n', '<C-Left>', 'b', { noremap = true, silent = true })
|
||||
neomap('n', '<C-S-Right>', 'W', { noremap = true, silent = true })
|
||||
neomap('n', '<C-S-Left>', 'B', { noremap = true, silent = true })
|
||||
-- 在 Insert 模式下,Ctrl + Shift + 方向鍵移動並選取單詞
|
||||
vim.api.nvim_set_keymap('i', '<C-S-Right>', '<Esc>v<C-o>w<C-o>i', { noremap = true, silent = true })
|
||||
vim.api.nvim_set_keymap('i', '<C-S-Left>', '<Esc>v<C-o>b<C-o>i', { noremap = true, silent = true })
|
||||
|
||||
-- 整行移動的快速鍵
|
||||
vim.api.nvim_set_keymap('n', '<A-j>', ':m .+1<CR>==', { noremap = true, silent = true })
|
||||
vim.api.nvim_set_keymap('n', '<A-k>', ':m .-2<CR>==', { noremap = true, silent = true })
|
||||
vim.api.nvim_set_keymap('i', '<A-j>', '<Esc>:m .+1<CR>==gi', { noremap = true, silent = true })
|
||||
vim.api.nvim_set_keymap('i', '<A-k>', '<Esc>:m .-2<CR>==gi', { noremap = true, silent = true })
|
||||
vim.api.nvim_set_keymap('v', '<A-j>', ":m '>+1<CR>gv=gv", { noremap = true, silent = true })
|
||||
vim.api.nvim_set_keymap('v', '<A-k>', ":m '<-2<CR>gv=gv", { noremap = true, silent = true })
|
||||
neomap('n', '<A-j>', ':m .+1<CR>==', { noremap = true, silent = true })
|
||||
neomap('n', '<A-k>', ':m .-2<CR>==', { noremap = true, silent = true })
|
||||
neomap('i', '<A-j>', '<Esc>:m .+1<CR>==gi', { noremap = true, silent = true })
|
||||
neomap('i', '<A-k>', '<Esc>:m .-2<CR>==gi', { noremap = true, silent = true })
|
||||
neomap('v', '<A-j>', ":m '>+1<CR>gv=gv", { noremap = true, silent = true })
|
||||
neomap('v', '<A-k>', ":m '<-2<CR>gv=gv", { noremap = true, silent = true })
|
||||
-- 使用 Alt+方向鍵 移動整行
|
||||
vim.api.nvim_set_keymap('n', '<A-Down>', ':m .+1<CR>==', { noremap = true, silent = true })
|
||||
vim.api.nvim_set_keymap('n', '<A-Up>', ':m .-2<CR>==', { noremap = true, silent = true })
|
||||
vim.api.nvim_set_keymap('i', '<A-Down>', '<Esc>:m .+1<CR>==gi', { noremap = true, silent = true })
|
||||
vim.api.nvim_set_keymap('i', '<A-Up>', '<Esc>:m .-2<CR>==gi', { noremap = true, silent = true })
|
||||
vim.api.nvim_set_keymap('v', '<A-Down>', ":m '>+1<CR>gv=gv", { noremap = true, silent = true })
|
||||
vim.api.nvim_set_keymap('v', '<A-Up>', ":m '<-2<CR>gv=gv", { noremap = true, silent = true })
|
||||
neomap('n', '<A-Down>', ':m .+1<CR>==', { noremap = true, silent = true })
|
||||
neomap('n', '<A-Up>', ':m .-2<CR>==', { noremap = true, silent = true })
|
||||
neomap('i', '<A-Down>', '<Esc>:m .+1<CR>==gi', { noremap = true, silent = true })
|
||||
neomap('i', '<A-Up>', '<Esc>:m .-2<CR>==gi', { noremap = true, silent = true })
|
||||
neomap('v', '<A-Down>', ":m '>+1<CR>gv=gv", { noremap = true, silent = true })
|
||||
neomap('v', '<A-Up>', ":m '<-2<CR>gv=gv", { noremap = true, silent = true })
|
||||
-- Ctrl+Alt+Shift+j/k 複製整行並向下/向上貼上
|
||||
vim.api.nvim_set_keymap('n', '<C-A-S-j>', 'yyp', { noremap = true, silent = true })
|
||||
vim.api.nvim_set_keymap('n', '<C-A-S-k>', 'yyP', { noremap = true, silent = true })
|
||||
neomap('n', '<C-A-S-j>', 'yyp', { noremap = true, silent = true })
|
||||
neomap('n', '<C-A-S-k>', 'yyP', { noremap = true, silent = true })
|
||||
-- Ctrl+Alt+Shift+方向鍵 複製整行並向下/向上貼上
|
||||
vim.api.nvim_set_keymap('n', '<C-A-S-Down>', 'yyp', { noremap = true, silent = true })
|
||||
vim.api.nvim_set_keymap('n', '<C-A-S-Up>', 'yyP', { noremap = true, silent = true })
|
||||
vim.api.nvim_set_keymap('i', '<C-A-S-Down>', '<Esc>yypgi', { noremap = true, silent = true })
|
||||
vim.api.nvim_set_keymap('i', '<C-A-S-Up>', '<Esc>yyPgi', { noremap = true, silent = true })
|
||||
neomap('n', '<C-A-S-Down>', 'yyp', { noremap = true, silent = true })
|
||||
neomap('n', '<C-A-S-Up>', 'yyP', { noremap = true, silent = true })
|
||||
neomap('i', '<C-A-S-Down>', '<Esc>yypgi', { noremap = true, silent = true })
|
||||
neomap('i', '<C-A-S-Up>', '<Esc>yyPgi', { noremap = true, silent = true })
|
||||
|
||||
-- -- 處理不同終端的行為
|
||||
-- -- 在 Insert Mode 下的 Ctrl+Enter 在下一行插入新行並保持 Insert 模式
|
||||
@ -36,16 +48,16 @@ vim.api.nvim_set_keymap('i', '<C-A-S-Up>', '<Esc>yyPgi', { noremap = true, silen
|
||||
-- local term_program = vim.fn.getenv("TERM_PROGRAM")
|
||||
-- if term_program == "iTerm.app" then
|
||||
-- -- iTerm 的快捷鍵設置
|
||||
-- vim.api.nvim_set_keymap('i', '<C-CR>', '<Esc>o', { noremap = true, silent = true })
|
||||
-- vim.api.nvim_set_keymap('i', '<C-S-CR>', '<Esc>O', { noremap = true, silent = true })
|
||||
-- neomap('i', '<C-CR>', '<Esc>o', { noremap = true, silent = true })
|
||||
-- neomap('i', '<C-S-CR>', '<Esc>O', { noremap = true, silent = true })
|
||||
-- elseif term == "alacritty" then
|
||||
-- -- Alacritty 的快捷鍵設置
|
||||
-- vim.api.nvim_set_keymap('i', '<C-CR>', '<Esc>o', { noremap = true, silent = true })
|
||||
-- vim.api.nvim_set_keymap('i', '<C-S-CR>', '<Esc>O', { noremap = true, silent = true })
|
||||
-- neomap('i', '<C-CR>', '<Esc>o', { noremap = true, silent = true })
|
||||
-- neomap('i', '<C-S-CR>', '<Esc>O', { noremap = true, silent = true })
|
||||
-- elseif term == "xterm-256color" then
|
||||
-- -- xterm-256color 的快捷鍵設置
|
||||
-- vim.api.nvim_set_keymap('i', '<A-CR>', '<Esc>o', { noremap = true, silent = true })
|
||||
-- vim.api.nvim_set_keymap('i', '<A-S-CR>', '<Esc>O', { noremap = true, silent = true })
|
||||
-- neomap('i', '<A-CR>', '<Esc>o', { noremap = true, silent = true })
|
||||
-- neomap('i', '<A-S-CR>', '<Esc>O', { noremap = true, silent = true })
|
||||
-- end
|
||||
|
||||
-- 使用Ctrl(Alt)+Enter 在下一行插入新行並保持 Insert 模式
|
||||
@ -53,19 +65,19 @@ vim.api.nvim_set_keymap('i', '<C-A-S-Up>', '<Esc>yyPgi', { noremap = true, silen
|
||||
-- Alacritty, GUI(Neovide, Goneovim) 皆可
|
||||
-- xterm-256color採用程式: Konsole, iTerm2, gnome-terminal 會有按鍵吃不到的問題,詳下述註解:
|
||||
-- 使用Ctrl+Enter 在下一行插入新行並保持 Insert 模式(xterm-256color 吃不到)
|
||||
vim.api.nvim_set_keymap('i', '<C-CR>', '<Esc>o', { noremap = true, silent = true })
|
||||
vim.api.nvim_set_keymap('i', '<C-S-CR>', '<Esc>O', { noremap = true, silent = true })
|
||||
neomap('i', '<C-CR>', '<Esc>o', { noremap = true, silent = true })
|
||||
neomap('i', '<C-S-CR>', '<Esc>O', { noremap = true, silent = true })
|
||||
-- 使用Alt+Enter 在下一行插入新行並保持 Insert 模式
|
||||
vim.api.nvim_set_keymap('i', '<A-CR>', '<Esc>o', { noremap = true, silent = true })
|
||||
vim.api.nvim_set_keymap('i', '<A-S-CR>', '<Esc>O', { noremap = true, silent = true }) -- xterm-256color 吃不到shift
|
||||
neomap('i', '<A-CR>', '<Esc>o', { noremap = true, silent = true })
|
||||
neomap('i', '<A-S-CR>', '<Esc>O', { noremap = true, silent = true }) -- xterm-256color 吃不到shift
|
||||
|
||||
-- 啟用 Tab 縮排
|
||||
vim.api.nvim_set_keymap('n', '<TAB>', 'v>', { noremap = true, silent = true })
|
||||
vim.api.nvim_set_keymap('n', '<S-TAB>', 'v<', { noremap = true, silent = true })
|
||||
vim.api.nvim_set_keymap('v', '<TAB>', '>gv', { noremap = true, silent = true })
|
||||
vim.api.nvim_set_keymap('v', '<S-TAB>', '<gv', { noremap = true, silent = true })
|
||||
vim.api.nvim_set_keymap('i', '<S-TAB>', '<C-d>', { noremap = true, silent = true }) -- Insert Mode 下的 Shift+Tab 退縮排
|
||||
neomap('n', '<TAB>', 'v>', { noremap = true, silent = true })
|
||||
neomap('n', '<S-TAB>', 'v<', { noremap = true, silent = true })
|
||||
neomap('v', '<TAB>', '>gv', { noremap = true, silent = true })
|
||||
neomap('v', '<S-TAB>', '<gv', { noremap = true, silent = true })
|
||||
neomap('i', '<S-TAB>', '<C-d>', { noremap = true, silent = true }) -- Insert Mode 下的 Shift+Tab 退縮排
|
||||
|
||||
-- 透過 v 選取整行縮排後,不取消選取整行
|
||||
vim.api.nvim_set_keymap('v', '<', '<gv', { noremap = true, silent = true })
|
||||
vim.api.nvim_set_keymap('v', '>', '>gv', { noremap = true, silent = true })
|
||||
neomap('v', '<', '<gv', { noremap = true, silent = true })
|
||||
neomap('v', '>', '>gv', { noremap = true, silent = true })
|
||||
|
@ -17,14 +17,14 @@ map("i", "<C-s>", "<Esc><cmd>write<CR>a", { noremap = true, silent = true, desc
|
||||
-- vim.api.nvim_set_keymap('n', '<A-LEFT>', '<cmd>tabprevious<CR>', { noremap = true, silent = true })
|
||||
|
||||
-- Move to window using the <ctrl> hjkl keys
|
||||
map("n", "<C-h>", "<C-w>h", { desc = "Go to Left Window", remap = true })
|
||||
map("n", "<C-j>", "<C-w>j", { desc = "Go to Lower Window", remap = true })
|
||||
map("n", "<C-k>", "<C-w>k", { desc = "Go to Upper Window", remap = true })
|
||||
map("n", "<C-l>", "<C-w>l", { desc = "Go to Right Window", remap = true })
|
||||
map("n", "<C-Left>", "<C-w>h", { desc = "Go to Left Window", remap = true })
|
||||
map("n", "<C-Down>", "<C-w>j", { desc = "Go to Lower Window", remap = true })
|
||||
map("n", "<C-Up>", "<C-w>k", { desc = "Go to Upper Window", remap = true })
|
||||
map("n", "<C-Right>", "<C-w>l", { desc = "Go to Right Window", remap = true })
|
||||
map("n", "<C-A-h>", "<C-w>h", { desc = "Go to Left Window", remap = true })
|
||||
map("n", "<C-A-j>", "<C-w>j", { desc = "Go to Lower Window", remap = true })
|
||||
map("n", "<C-A-k>", "<C-w>k", { desc = "Go to Upper Window", remap = true })
|
||||
map("n", "<C-A-l>", "<C-w>l", { desc = "Go to Right Window", remap = true })
|
||||
map("n", "<C-A-Left>", "<C-w>h", { desc = "Go to Left Window", remap = true })
|
||||
map("n", "<C-A-Down>", "<C-w>j", { desc = "Go to Lower Window", remap = true })
|
||||
map("n", "<C-A-Up>", "<C-w>k", { desc = "Go to Upper Window", remap = true })
|
||||
map("n", "<C-A-Right>", "<C-w>l", { desc = "Go to Right Window", remap = true })
|
||||
|
||||
-- Clear search, diff update and redraw
|
||||
-- taken from runtime/lua/_editor.lua
|
||||
|
@ -44,8 +44,9 @@ require("lazy").setup({
|
||||
-- { import = "plugins.themes.github-theme" }, -- 自訂配色
|
||||
-- { import = "plugins.themes.onedark" }, -- 自訂配色
|
||||
|
||||
{ import = "plugins.components.buffer.barbar" }, -- 目前只有barbar處理Buffer是最好的
|
||||
{ import = "plugins.editor" },
|
||||
{ import = "plugins.components" },
|
||||
{ import = "plugins.components.buffer.barbar" }, -- 目前只有barbar處理Buffer是最好的
|
||||
{ import = "plugins.ui" },
|
||||
|
||||
-- 手動引入 o-plugins 資料夾中的插件
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
vim.opt.listchars = {
|
||||
trail = "-",
|
||||
eol = "↲",
|
||||
-- eol = "↲",
|
||||
tab = "» ",
|
||||
space = "·",
|
||||
-- space = "·",
|
||||
}
|
||||
|
@ -10,6 +10,8 @@ return {
|
||||
tab = "> ",
|
||||
trail = "-",
|
||||
nbsp = "+",
|
||||
eol = "↲",
|
||||
space = "·",
|
||||
},
|
||||
notifications = true, -- Enable or disable listchars notifications
|
||||
exclude_filetypes = {}, -- List of filetypes where `listchars` is disabled
|
||||
|
@ -2,7 +2,7 @@ return {
|
||||
{'romgrk/barbar.nvim',
|
||||
version = '^1.0.0', -- optional: only update when a new 1.x version is released
|
||||
dependencies = {
|
||||
'lewis6991/gitsigns.nvim', -- OPTIONAL: for git status
|
||||
-- 'lewis6991/gitsigns.nvim', -- OPTIONAL: for git status
|
||||
'nvim-tree/nvim-web-devicons', -- OPTIONAL: for file icons
|
||||
},
|
||||
init = function() vim.g.barbar_auto_setup = false end,
|
||||
@ -17,6 +17,10 @@ return {
|
||||
-- animation = false, -- 禁用動畫效果
|
||||
sidebar_filetypes = {
|
||||
['neo-tree'] = {event = 'BufWipeout'},
|
||||
undotree = {
|
||||
text = 'undotree',
|
||||
align = 'center', -- *optionally* specify an alignment (either 'left', 'center', or 'right')
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@ -37,6 +41,8 @@ return {
|
||||
vim.api.nvim_set_keymap('n', '<A-h>', '<cmd>BufferPrevious<CR>', { noremap = true, silent = true })
|
||||
vim.api.nvim_set_keymap('n', '<A-RIGHT>', '<cmd>BufferNext<CR>', { noremap = true, silent = true })
|
||||
vim.api.nvim_set_keymap('n', '<A-LEFT>', '<cmd>BufferPrevious<CR>', { noremap = true, silent = true })
|
||||
|
||||
vim.api.nvim_set_keymap('n', '<C-n>', '<cmd>enew<CR>', { noremap = true, silent = true })
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
@ -0,0 +1,19 @@
|
||||
-- if true then return {} end
|
||||
return {
|
||||
-- 會自動cd到專案目錄
|
||||
-- "ahmedkhalf/project.nvim",
|
||||
|
||||
-- 使用修改版的project.nvim
|
||||
-- 因為此套件會噴警告,原作者已經沒再維護了
|
||||
-- vim.lsp.buf_get_clients() is deprecated. Run ":checkhealth vim.deprecated" for more information
|
||||
"Spelis/project.nvim",
|
||||
branch = "patch-1",
|
||||
|
||||
config = function()
|
||||
require("project_nvim").setup {
|
||||
-- your configuration comes here
|
||||
-- or leave it empty to use the default settings
|
||||
-- refer to the configuration section below
|
||||
}
|
||||
end
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
return {
|
||||
"kdheepak/lazygit.nvim",
|
||||
lazy = true,
|
||||
cmd = {
|
||||
"LazyGit",
|
||||
"LazyGitConfig",
|
||||
"LazyGitCurrentFile",
|
||||
"LazyGitFilter",
|
||||
"LazyGitFilterCurrentFile",
|
||||
},
|
||||
-- optional for floating window border decoration
|
||||
dependencies = {
|
||||
"nvim-telescope/telescope.nvim",
|
||||
"nvim-lua/plenary.nvim",
|
||||
},
|
||||
-- setting the keybinding for LazyGit with 'keys' is recommended in
|
||||
-- order to load the plugin when the command is run for the first time
|
||||
keys = {
|
||||
{ "<F10>", "<cmd>LazyGit<cr>", desc = "LazyGit" },
|
||||
{ "<leader>lg", "<cmd>LazyGit<cr>", desc = "LazyGit" },
|
||||
},
|
||||
config = function()
|
||||
require("telescope").load_extension("lazygit")
|
||||
end,
|
||||
}
|
@ -0,0 +1,60 @@
|
||||
return {
|
||||
{
|
||||
"3rd/image.nvim",
|
||||
build = false, -- so that it doesn't build the rock https://github.com/3rd/image.nvim/issues/91#issuecomment-2453430239
|
||||
-- cond = not vim.g.neovide and not vim.fn.has("goneovim") == 1 and not vim.fn.has("gui_running") == 1,
|
||||
cond = function()
|
||||
-- 如果是在 GUI(如 NeoVide、Goneovim)中,則不啟用插件
|
||||
if vim.g.neovide or vim.fn.has("goneovim") == 1 or vim.fn.has("gui_running") == 1 then
|
||||
return false
|
||||
end
|
||||
|
||||
-- 獲取 TERM 環境變數
|
||||
local term = vim.fn.getenv("TERM")
|
||||
-- 檢查是否是常見的文字終端
|
||||
local is_terminal = term and (term:match("xterm") or term:match("screen") or term:match("tmux") or term:match("linux"))
|
||||
|
||||
-- 如果是文字終端,則啟用插件
|
||||
return is_terminal ~= nil
|
||||
end,
|
||||
lazy = false,
|
||||
opts = {
|
||||
backend = "ueberzug",
|
||||
processor = "magick_cli", -- or "magick_rock"
|
||||
integrations = {
|
||||
markdown = {
|
||||
enabled = true,
|
||||
clear_in_insert_mode = false,
|
||||
download_remote_images = true,
|
||||
only_render_image_at_cursor = false,
|
||||
only_render_image_at_cursor_mode = "popup",
|
||||
floating_windows = false, -- if true, images will be rendered in floating markdown windows
|
||||
filetypes = { "markdown", "vimwiki" }, -- markdown extensions (ie. quarto) can go here
|
||||
},
|
||||
neorg = {
|
||||
enabled = true,
|
||||
filetypes = { "norg" },
|
||||
},
|
||||
typst = {
|
||||
enabled = true,
|
||||
filetypes = { "typst" },
|
||||
},
|
||||
html = {
|
||||
enabled = false,
|
||||
},
|
||||
css = {
|
||||
enabled = false,
|
||||
},
|
||||
},
|
||||
max_width = nil,
|
||||
max_height = nil,
|
||||
max_width_window_percentage = nil,
|
||||
max_height_window_percentage = 50,
|
||||
window_overlap_clear_enabled = false, -- toggles images when windows are overlapped
|
||||
window_overlap_clear_ft_ignore = { "cmp_menu", "cmp_docs", "snacks_notif", "scrollview", "scrollview_sign" },
|
||||
editor_only_render_when_focused = false, -- auto show/hide images when the editor gains/looses focus
|
||||
tmux_show_only_in_active_window = false, -- auto show/hide images in the correct Tmux window (needs visual-activity off)
|
||||
hijack_file_patterns = { "*.png", "*.jpg", "*.jpeg", "*.gif", "*.webp", "*.avif" }, -- render image files as images when opened
|
||||
}
|
||||
}
|
||||
}
|
@ -20,6 +20,7 @@ return {
|
||||
"nvim-lua/plenary.nvim",
|
||||
"nvim-tree/nvim-web-devicons", -- not strictly required, but recommended
|
||||
"MunifTanjim/nui.nvim",
|
||||
-- "3rd/image.nvim",
|
||||
-- {"3rd/image.nvim",
|
||||
-- build = false,
|
||||
-- opts = {
|
||||
@ -71,15 +72,336 @@ return {
|
||||
{ "<leader>fT", "<cmd>Neotree float<cr>", desc = "NeoTree Float" },
|
||||
{ "<leader>fF", "<cmd>Neotree filesystem float<cr>", desc = "NeoTree Filesystem Float" },
|
||||
{ "<leader>fG", "<cmd>Neotree git_status float<cr>", desc = "NeoTree Git Status Float" },
|
||||
{ "<F10>", "<cmd>Neotree git_status float<cr>", desc = "NeoTree Git Status Float" },
|
||||
{ "<S-F9>", "<cmd>Neotree git_status float<cr>", desc = "NeoTree Git Status Float" }, --警告!在標準終端無法使用
|
||||
{ "<leader>fB", "<cmd>Neotree buffers float<cr>", desc = "NeoTree Buffers Float" },
|
||||
},
|
||||
lazy = false,
|
||||
-----Instead of using `config`, you can use `opts` instead, if you'd like:
|
||||
-----@module "neo-tree"
|
||||
-----@type neotree.Config
|
||||
--opts = {},
|
||||
config = function()
|
||||
opts = {
|
||||
close_if_last_window = true, -- Close Neo-tree if it is the last window left in the tab
|
||||
popup_border_style = "NC", -- or "" to use 'winborder' on Neovim v0.11+
|
||||
enable_git_status = true,
|
||||
enable_diagnostics = true,
|
||||
open_files_do_not_replace_types = { "terminal", "trouble", "qf" }, -- when opening files, do not use windows containing these filetypes or buftypes
|
||||
open_files_using_relative_paths = false,
|
||||
sort_case_insensitive = false, -- used when sorting files and directories in the tree
|
||||
sort_function = nil, -- use a custom function for sorting files and directories in the tree
|
||||
-- sort_function = function (a,b)
|
||||
-- if a.type == b.type then
|
||||
-- return a.path > b.path
|
||||
-- else
|
||||
-- return a.type > b.type
|
||||
-- end
|
||||
-- end , -- this sorts files and directories descendantly
|
||||
default_component_configs = {
|
||||
container = {
|
||||
enable_character_fade = true,
|
||||
},
|
||||
indent = {
|
||||
indent_size = 2,
|
||||
padding = 1, -- extra padding on left hand side
|
||||
-- indent guides
|
||||
with_markers = true,
|
||||
indent_marker = "│",
|
||||
last_indent_marker = "└",
|
||||
highlight = "NeoTreeIndentMarker",
|
||||
-- expander config, needed for nesting files
|
||||
with_expanders = nil, -- if nil and file nesting is enabled, will enable expanders
|
||||
expander_collapsed = "",
|
||||
expander_expanded = "",
|
||||
expander_highlight = "NeoTreeExpander",
|
||||
},
|
||||
icon = {
|
||||
folder_closed = "",
|
||||
folder_open = "",
|
||||
folder_empty = "",
|
||||
provider = function(icon, node, state) -- default icon provider utilizes nvim-web-devicons if available
|
||||
if node.type == "file" or node.type == "terminal" then
|
||||
local success, web_devicons = pcall(require, "nvim-web-devicons")
|
||||
local name = node.type == "terminal" and "terminal" or node.name
|
||||
if success then
|
||||
local devicon, hl = web_devicons.get_icon(name)
|
||||
icon.text = devicon or icon.text
|
||||
icon.highlight = hl or icon.highlight
|
||||
end
|
||||
end
|
||||
end,
|
||||
-- The next two settings are only a fallback, if you use nvim-web-devicons and configure default icons there
|
||||
-- then these will never be used.
|
||||
default = "*",
|
||||
highlight = "NeoTreeFileIcon",
|
||||
},
|
||||
modified = {
|
||||
symbol = "[+]",
|
||||
highlight = "NeoTreeModified",
|
||||
},
|
||||
name = {
|
||||
trailing_slash = false,
|
||||
use_git_status_colors = true,
|
||||
highlight = "NeoTreeFileName",
|
||||
},
|
||||
git_status = {
|
||||
symbols = {
|
||||
-- Change type
|
||||
added = "", -- or "✚", but this is redundant info if you use git_status_colors on the name
|
||||
modified = "", -- or "", but this is redundant info if you use git_status_colors on the name
|
||||
deleted = "✖", -- this can only be used in the git_status source
|
||||
renamed = "", -- this can only be used in the git_status source
|
||||
-- Status type
|
||||
untracked = "",
|
||||
ignored = "",
|
||||
unstaged = "",
|
||||
staged = "",
|
||||
conflict = "",
|
||||
},
|
||||
},
|
||||
-- If you don't want to use these columns, you can set `enabled = false` for each of them individually
|
||||
file_size = {
|
||||
enabled = true,
|
||||
width = 12, -- width of the column
|
||||
required_width = 64, -- min width of window required to show this column
|
||||
},
|
||||
type = {
|
||||
enabled = true,
|
||||
width = 10, -- width of the column
|
||||
required_width = 122, -- min width of window required to show this column
|
||||
},
|
||||
last_modified = {
|
||||
enabled = true,
|
||||
width = 20, -- width of the column
|
||||
required_width = 88, -- min width of window required to show this column
|
||||
},
|
||||
created = {
|
||||
enabled = true,
|
||||
width = 20, -- width of the column
|
||||
required_width = 110, -- min width of window required to show this column
|
||||
},
|
||||
symlink_target = {
|
||||
enabled = false,
|
||||
},
|
||||
},
|
||||
-- A list of functions, each representing a global custom command
|
||||
-- that will be available in all sources (if not overridden in `opts[source_name].commands`)
|
||||
-- see `:h neo-tree-custom-commands-global`
|
||||
commands = {},
|
||||
window = {
|
||||
position = "left",
|
||||
width = 40,
|
||||
mapping_options = {
|
||||
noremap = true,
|
||||
nowait = true,
|
||||
},
|
||||
mappings = {
|
||||
["<space>"] = {
|
||||
"toggle_node",
|
||||
nowait = false, -- disable `nowait` if you have existing combos starting with this char that you want to use
|
||||
},
|
||||
["<2-LeftMouse>"] = "open",
|
||||
["<cr>"] = "open",
|
||||
["<esc>"] = "cancel", -- close preview or floating neo-tree window
|
||||
["P"] = { "toggle_preview", config = { use_float = true, use_image_nvim = false } },
|
||||
-- Read `# Preview Mode` for more information
|
||||
["l"] = "focus_preview",
|
||||
["S"] = "open_split",
|
||||
["s"] = "open_vsplit",
|
||||
-- ["S"] = "split_with_window_picker",
|
||||
-- ["s"] = "vsplit_with_window_picker",
|
||||
["t"] = "open_tabnew",
|
||||
-- ["<cr>"] = "open_drop",
|
||||
-- ["t"] = "open_tab_drop",
|
||||
["w"] = "open_with_window_picker",
|
||||
--["P"] = "toggle_preview", -- enter preview mode, which shows the current node without focusing
|
||||
["C"] = "close_node",
|
||||
-- ['C'] = 'close_all_subnodes',
|
||||
["z"] = "close_all_nodes",
|
||||
--["Z"] = "expand_all_nodes",
|
||||
--["Z"] = "expand_all_subnodes",
|
||||
["a"] = {
|
||||
"add",
|
||||
-- this command supports BASH style brace expansion ("x{a,b,c}" -> xa,xb,xc). see `:h neo-tree-file-actions` for details
|
||||
-- some commands may take optional config options, see `:h neo-tree-mappings` for details
|
||||
config = {
|
||||
show_path = "none", -- "none", "relative", "absolute"
|
||||
},
|
||||
},
|
||||
["A"] = "add_directory", -- also accepts the optional config.show_path option like "add". this also supports BASH style brace expansion.
|
||||
["d"] = "delete",
|
||||
["r"] = "rename",
|
||||
["b"] = "rename_basename",
|
||||
["y"] = "copy_to_clipboard",
|
||||
["x"] = "cut_to_clipboard",
|
||||
["p"] = "paste_from_clipboard",
|
||||
["c"] = "copy", -- takes text input for destination, also accepts the optional config.show_path option like "add":
|
||||
-- ["c"] = {
|
||||
-- "copy",
|
||||
-- config = {
|
||||
-- show_path = "none" -- "none", "relative", "absolute"
|
||||
-- }
|
||||
--}
|
||||
["m"] = "move", -- takes text input for destination, also accepts the optional config.show_path option like "add".
|
||||
["q"] = "close_window",
|
||||
["R"] = "refresh",
|
||||
["?"] = "show_help",
|
||||
["<"] = "prev_source",
|
||||
[">"] = "next_source",
|
||||
["i"] = "show_file_details",
|
||||
-- ["i"] = {
|
||||
-- "show_file_details",
|
||||
-- -- format strings of the timestamps shown for date created and last modified (see `:h os.date()`)
|
||||
-- -- both options accept a string or a function that takes in the date in seconds and returns a string to display
|
||||
-- -- config = {
|
||||
-- -- created_format = "%Y-%m-%d %I:%M %p",
|
||||
-- -- modified_format = "relative", -- equivalent to the line below
|
||||
-- -- modified_format = function(seconds) return require('neo-tree.utils').relative_date(seconds) end
|
||||
-- -- }
|
||||
-- },
|
||||
},
|
||||
},
|
||||
nesting_rules = {},
|
||||
filesystem = {
|
||||
filtered_items = {
|
||||
visible = false, -- when true, they will just be displayed differently than normal items
|
||||
hide_dotfiles = false,
|
||||
hide_gitignored = true,
|
||||
hide_hidden = false, -- only works on Windows for hidden files/directories
|
||||
hide_by_name = {
|
||||
--"node_modules"
|
||||
},
|
||||
hide_by_pattern = { -- uses glob style patterns
|
||||
--"*.meta",
|
||||
--"*/src/*/tsconfig.json",
|
||||
},
|
||||
always_show = { -- remains visible even if other settings would normally hide it
|
||||
--".gitignored",
|
||||
},
|
||||
always_show_by_pattern = { -- uses glob style patterns
|
||||
--".env*",
|
||||
},
|
||||
never_show = { -- remains hidden even if visible is toggled to true, this overrides always_show
|
||||
".git",
|
||||
".DS_Store",
|
||||
".directory",
|
||||
"thumbs.db",
|
||||
},
|
||||
never_show_by_pattern = { -- uses glob style patterns
|
||||
--".null-ls_*",
|
||||
},
|
||||
},
|
||||
follow_current_file = {
|
||||
enabled = true, -- This will find and focus the file in the active buffer every time
|
||||
-- -- the current file is changed while the tree is open.
|
||||
leave_dirs_open = false, -- `false` closes auto expanded dirs, such as with `:Neotree reveal`
|
||||
},
|
||||
group_empty_dirs = false, -- when true, empty folders will be grouped together
|
||||
hijack_netrw_behavior = "open_default", -- netrw disabled, opening a directory opens neo-tree
|
||||
-- in whatever position is specified in window.position
|
||||
-- "open_current", -- netrw disabled, opening a directory opens within the
|
||||
-- window like netrw would, regardless of window.position
|
||||
-- "disabled", -- netrw left alone, neo-tree does not handle opening dirs
|
||||
use_libuv_file_watcher = false, -- This will use the OS level file watchers to detect changes
|
||||
-- instead of relying on nvim autocmd events.
|
||||
window = {
|
||||
mappings = {
|
||||
["<bs>"] = "navigate_up",
|
||||
["."] = "set_root",
|
||||
["H"] = "toggle_hidden",
|
||||
["/"] = "fuzzy_finder",
|
||||
["D"] = "fuzzy_finder_directory",
|
||||
["#"] = "fuzzy_sorter", -- fuzzy sorting using the fzy algorithm
|
||||
-- ["D"] = "fuzzy_sorter_directory",
|
||||
["f"] = "filter_on_submit",
|
||||
["<c-x>"] = "clear_filter",
|
||||
["[g"] = "prev_git_modified",
|
||||
["]g"] = "next_git_modified",
|
||||
["o"] = {
|
||||
"show_help",
|
||||
nowait = false,
|
||||
config = { title = "Order by", prefix_key = "o" },
|
||||
},
|
||||
["oc"] = { "order_by_created", nowait = false },
|
||||
["od"] = { "order_by_diagnostics", nowait = false },
|
||||
["og"] = { "order_by_git_status", nowait = false },
|
||||
["om"] = { "order_by_modified", nowait = false },
|
||||
["on"] = { "order_by_name", nowait = false },
|
||||
["os"] = { "order_by_size", nowait = false },
|
||||
["ot"] = { "order_by_type", nowait = false },
|
||||
-- ['<key>'] = function(state) ... end,
|
||||
},
|
||||
fuzzy_finder_mappings = { -- define keymaps for filter popup window in fuzzy_finder_mode
|
||||
["<down>"] = "move_cursor_down",
|
||||
["<C-n>"] = "move_cursor_down",
|
||||
["<up>"] = "move_cursor_up",
|
||||
["<C-p>"] = "move_cursor_up",
|
||||
["<esc>"] = "close",
|
||||
-- ['<key>'] = function(state, scroll_padding) ... end,
|
||||
},
|
||||
},
|
||||
|
||||
commands = {}, -- Add a custom command or override a global one using the same function name
|
||||
},
|
||||
buffers = {
|
||||
follow_current_file = {
|
||||
enabled = true, -- This will find and focus the file in the active buffer every time
|
||||
-- -- the current file is changed while the tree is open.
|
||||
leave_dirs_open = false, -- `false` closes auto expanded dirs, such as with `:Neotree reveal`
|
||||
},
|
||||
group_empty_dirs = true, -- when true, empty folders will be grouped together
|
||||
show_unloaded = true,
|
||||
window = {
|
||||
mappings = {
|
||||
["d"] = "buffer_delete",
|
||||
["bd"] = "buffer_delete",
|
||||
["<bs>"] = "navigate_up",
|
||||
["."] = "set_root",
|
||||
["o"] = {
|
||||
"show_help",
|
||||
nowait = false,
|
||||
config = { title = "Order by", prefix_key = "o" },
|
||||
},
|
||||
["oc"] = { "order_by_created", nowait = false },
|
||||
["od"] = { "order_by_diagnostics", nowait = false },
|
||||
["om"] = { "order_by_modified", nowait = false },
|
||||
["on"] = { "order_by_name", nowait = false },
|
||||
["os"] = { "order_by_size", nowait = false },
|
||||
["ot"] = { "order_by_type", nowait = false },
|
||||
},
|
||||
},
|
||||
},
|
||||
git_status = {
|
||||
window = {
|
||||
position = "float",
|
||||
mappings = {
|
||||
["A"] = "git_add_all",
|
||||
["gu"] = "git_unstage_file",
|
||||
["ga"] = "git_add_file",
|
||||
["gr"] = "git_revert_file",
|
||||
["gc"] = "git_commit",
|
||||
["gp"] = "git_push",
|
||||
["gg"] = "git_commit_and_push",
|
||||
["o"] = {
|
||||
"show_help",
|
||||
nowait = false,
|
||||
config = { title = "Order by", prefix_key = "o" },
|
||||
},
|
||||
["oc"] = { "order_by_created", nowait = false },
|
||||
["od"] = { "order_by_diagnostics", nowait = false },
|
||||
["om"] = { "order_by_modified", nowait = false },
|
||||
["on"] = { "order_by_name", nowait = false },
|
||||
["os"] = { "order_by_size", nowait = false },
|
||||
["ot"] = { "order_by_type", nowait = false },
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
-- 自行加入的
|
||||
source_selector = {
|
||||
winbar = false,
|
||||
statusline = false
|
||||
}
|
||||
},
|
||||
config = function(_, opts)
|
||||
-- If you want icons for diagnostic errors, you'll need to define them somewhere.
|
||||
-- In Neovim v0.10+, you can configure them in vim.diagnostic.config(), like:
|
||||
--
|
||||
@ -100,328 +422,7 @@ return {
|
||||
-- vim.fn.sign_define("DiagnosticSignInfo", { text = " ", texthl = "DiagnosticSignInfo" })
|
||||
-- vim.fn.sign_define("DiagnosticSignHint", { text = "", texthl = "DiagnosticSignHint" })
|
||||
|
||||
require("neo-tree").setup({
|
||||
close_if_last_window = true, -- Close Neo-tree if it is the last window left in the tab
|
||||
popup_border_style = "NC", -- or "" to use 'winborder' on Neovim v0.11+
|
||||
enable_git_status = true,
|
||||
enable_diagnostics = true,
|
||||
open_files_do_not_replace_types = { "terminal", "trouble", "qf" }, -- when opening files, do not use windows containing these filetypes or buftypes
|
||||
open_files_using_relative_paths = false,
|
||||
sort_case_insensitive = false, -- used when sorting files and directories in the tree
|
||||
sort_function = nil, -- use a custom function for sorting files and directories in the tree
|
||||
-- sort_function = function (a,b)
|
||||
-- if a.type == b.type then
|
||||
-- return a.path > b.path
|
||||
-- else
|
||||
-- return a.type > b.type
|
||||
-- end
|
||||
-- end , -- this sorts files and directories descendantly
|
||||
default_component_configs = {
|
||||
container = {
|
||||
enable_character_fade = true,
|
||||
},
|
||||
indent = {
|
||||
indent_size = 2,
|
||||
padding = 1, -- extra padding on left hand side
|
||||
-- indent guides
|
||||
with_markers = true,
|
||||
indent_marker = "│",
|
||||
last_indent_marker = "└",
|
||||
highlight = "NeoTreeIndentMarker",
|
||||
-- expander config, needed for nesting files
|
||||
with_expanders = nil, -- if nil and file nesting is enabled, will enable expanders
|
||||
expander_collapsed = "",
|
||||
expander_expanded = "",
|
||||
expander_highlight = "NeoTreeExpander",
|
||||
},
|
||||
icon = {
|
||||
folder_closed = "",
|
||||
folder_open = "",
|
||||
folder_empty = "",
|
||||
provider = function(icon, node, state) -- default icon provider utilizes nvim-web-devicons if available
|
||||
if node.type == "file" or node.type == "terminal" then
|
||||
local success, web_devicons = pcall(require, "nvim-web-devicons")
|
||||
local name = node.type == "terminal" and "terminal" or node.name
|
||||
if success then
|
||||
local devicon, hl = web_devicons.get_icon(name)
|
||||
icon.text = devicon or icon.text
|
||||
icon.highlight = hl or icon.highlight
|
||||
end
|
||||
end
|
||||
end,
|
||||
-- The next two settings are only a fallback, if you use nvim-web-devicons and configure default icons there
|
||||
-- then these will never be used.
|
||||
default = "*",
|
||||
highlight = "NeoTreeFileIcon",
|
||||
},
|
||||
modified = {
|
||||
symbol = "[+]",
|
||||
highlight = "NeoTreeModified",
|
||||
},
|
||||
name = {
|
||||
trailing_slash = false,
|
||||
use_git_status_colors = true,
|
||||
highlight = "NeoTreeFileName",
|
||||
},
|
||||
git_status = {
|
||||
symbols = {
|
||||
-- Change type
|
||||
added = "", -- or "✚", but this is redundant info if you use git_status_colors on the name
|
||||
modified = "", -- or "", but this is redundant info if you use git_status_colors on the name
|
||||
deleted = "✖", -- this can only be used in the git_status source
|
||||
renamed = "", -- this can only be used in the git_status source
|
||||
-- Status type
|
||||
untracked = "",
|
||||
ignored = "",
|
||||
unstaged = "",
|
||||
staged = "",
|
||||
conflict = "",
|
||||
},
|
||||
},
|
||||
-- If you don't want to use these columns, you can set `enabled = false` for each of them individually
|
||||
file_size = {
|
||||
enabled = true,
|
||||
width = 12, -- width of the column
|
||||
required_width = 64, -- min width of window required to show this column
|
||||
},
|
||||
type = {
|
||||
enabled = true,
|
||||
width = 10, -- width of the column
|
||||
required_width = 122, -- min width of window required to show this column
|
||||
},
|
||||
last_modified = {
|
||||
enabled = true,
|
||||
width = 20, -- width of the column
|
||||
required_width = 88, -- min width of window required to show this column
|
||||
},
|
||||
created = {
|
||||
enabled = true,
|
||||
width = 20, -- width of the column
|
||||
required_width = 110, -- min width of window required to show this column
|
||||
},
|
||||
symlink_target = {
|
||||
enabled = false,
|
||||
},
|
||||
},
|
||||
-- A list of functions, each representing a global custom command
|
||||
-- that will be available in all sources (if not overridden in `opts[source_name].commands`)
|
||||
-- see `:h neo-tree-custom-commands-global`
|
||||
commands = {},
|
||||
window = {
|
||||
position = "left",
|
||||
width = 40,
|
||||
mapping_options = {
|
||||
noremap = true,
|
||||
nowait = true,
|
||||
},
|
||||
mappings = {
|
||||
["<space>"] = {
|
||||
"toggle_node",
|
||||
nowait = false, -- disable `nowait` if you have existing combos starting with this char that you want to use
|
||||
},
|
||||
["<2-LeftMouse>"] = "open",
|
||||
["<cr>"] = "open",
|
||||
["<esc>"] = "cancel", -- close preview or floating neo-tree window
|
||||
["P"] = { "toggle_preview", config = { use_float = true, use_image_nvim = true } },
|
||||
-- Read `# Preview Mode` for more information
|
||||
["l"] = "focus_preview",
|
||||
["S"] = "open_split",
|
||||
["s"] = "open_vsplit",
|
||||
-- ["S"] = "split_with_window_picker",
|
||||
-- ["s"] = "vsplit_with_window_picker",
|
||||
["t"] = "open_tabnew",
|
||||
-- ["<cr>"] = "open_drop",
|
||||
-- ["t"] = "open_tab_drop",
|
||||
["w"] = "open_with_window_picker",
|
||||
--["P"] = "toggle_preview", -- enter preview mode, which shows the current node without focusing
|
||||
["C"] = "close_node",
|
||||
-- ['C'] = 'close_all_subnodes',
|
||||
["z"] = "close_all_nodes",
|
||||
--["Z"] = "expand_all_nodes",
|
||||
--["Z"] = "expand_all_subnodes",
|
||||
["a"] = {
|
||||
"add",
|
||||
-- this command supports BASH style brace expansion ("x{a,b,c}" -> xa,xb,xc). see `:h neo-tree-file-actions` for details
|
||||
-- some commands may take optional config options, see `:h neo-tree-mappings` for details
|
||||
config = {
|
||||
show_path = "none", -- "none", "relative", "absolute"
|
||||
},
|
||||
},
|
||||
["A"] = "add_directory", -- also accepts the optional config.show_path option like "add". this also supports BASH style brace expansion.
|
||||
["d"] = "delete",
|
||||
["r"] = "rename",
|
||||
["b"] = "rename_basename",
|
||||
["y"] = "copy_to_clipboard",
|
||||
["x"] = "cut_to_clipboard",
|
||||
["p"] = "paste_from_clipboard",
|
||||
["c"] = "copy", -- takes text input for destination, also accepts the optional config.show_path option like "add":
|
||||
-- ["c"] = {
|
||||
-- "copy",
|
||||
-- config = {
|
||||
-- show_path = "none" -- "none", "relative", "absolute"
|
||||
-- }
|
||||
--}
|
||||
["m"] = "move", -- takes text input for destination, also accepts the optional config.show_path option like "add".
|
||||
["q"] = "close_window",
|
||||
["R"] = "refresh",
|
||||
["?"] = "show_help",
|
||||
["<"] = "prev_source",
|
||||
[">"] = "next_source",
|
||||
["i"] = "show_file_details",
|
||||
-- ["i"] = {
|
||||
-- "show_file_details",
|
||||
-- -- format strings of the timestamps shown for date created and last modified (see `:h os.date()`)
|
||||
-- -- both options accept a string or a function that takes in the date in seconds and returns a string to display
|
||||
-- -- config = {
|
||||
-- -- created_format = "%Y-%m-%d %I:%M %p",
|
||||
-- -- modified_format = "relative", -- equivalent to the line below
|
||||
-- -- modified_format = function(seconds) return require('neo-tree.utils').relative_date(seconds) end
|
||||
-- -- }
|
||||
-- },
|
||||
},
|
||||
},
|
||||
nesting_rules = {},
|
||||
filesystem = {
|
||||
filtered_items = {
|
||||
visible = false, -- when true, they will just be displayed differently than normal items
|
||||
hide_dotfiles = false,
|
||||
hide_gitignored = true,
|
||||
hide_hidden = false, -- only works on Windows for hidden files/directories
|
||||
hide_by_name = {
|
||||
--"node_modules"
|
||||
},
|
||||
hide_by_pattern = { -- uses glob style patterns
|
||||
--"*.meta",
|
||||
--"*/src/*/tsconfig.json",
|
||||
},
|
||||
always_show = { -- remains visible even if other settings would normally hide it
|
||||
--".gitignored",
|
||||
},
|
||||
always_show_by_pattern = { -- uses glob style patterns
|
||||
--".env*",
|
||||
},
|
||||
never_show = { -- remains hidden even if visible is toggled to true, this overrides always_show
|
||||
".git",
|
||||
".DS_Store",
|
||||
".directory",
|
||||
"thumbs.db",
|
||||
},
|
||||
never_show_by_pattern = { -- uses glob style patterns
|
||||
--".null-ls_*",
|
||||
},
|
||||
},
|
||||
follow_current_file = {
|
||||
enabled = true, -- This will find and focus the file in the active buffer every time
|
||||
-- -- the current file is changed while the tree is open.
|
||||
leave_dirs_open = false, -- `false` closes auto expanded dirs, such as with `:Neotree reveal`
|
||||
},
|
||||
group_empty_dirs = false, -- when true, empty folders will be grouped together
|
||||
hijack_netrw_behavior = "open_default", -- netrw disabled, opening a directory opens neo-tree
|
||||
-- in whatever position is specified in window.position
|
||||
-- "open_current", -- netrw disabled, opening a directory opens within the
|
||||
-- window like netrw would, regardless of window.position
|
||||
-- "disabled", -- netrw left alone, neo-tree does not handle opening dirs
|
||||
use_libuv_file_watcher = false, -- This will use the OS level file watchers to detect changes
|
||||
-- instead of relying on nvim autocmd events.
|
||||
window = {
|
||||
mappings = {
|
||||
["<bs>"] = "navigate_up",
|
||||
["."] = "set_root",
|
||||
["H"] = "toggle_hidden",
|
||||
["/"] = "fuzzy_finder",
|
||||
["D"] = "fuzzy_finder_directory",
|
||||
["#"] = "fuzzy_sorter", -- fuzzy sorting using the fzy algorithm
|
||||
-- ["D"] = "fuzzy_sorter_directory",
|
||||
["f"] = "filter_on_submit",
|
||||
["<c-x>"] = "clear_filter",
|
||||
["[g"] = "prev_git_modified",
|
||||
["]g"] = "next_git_modified",
|
||||
["o"] = {
|
||||
"show_help",
|
||||
nowait = false,
|
||||
config = { title = "Order by", prefix_key = "o" },
|
||||
},
|
||||
["oc"] = { "order_by_created", nowait = false },
|
||||
["od"] = { "order_by_diagnostics", nowait = false },
|
||||
["og"] = { "order_by_git_status", nowait = false },
|
||||
["om"] = { "order_by_modified", nowait = false },
|
||||
["on"] = { "order_by_name", nowait = false },
|
||||
["os"] = { "order_by_size", nowait = false },
|
||||
["ot"] = { "order_by_type", nowait = false },
|
||||
-- ['<key>'] = function(state) ... end,
|
||||
},
|
||||
fuzzy_finder_mappings = { -- define keymaps for filter popup window in fuzzy_finder_mode
|
||||
["<down>"] = "move_cursor_down",
|
||||
["<C-n>"] = "move_cursor_down",
|
||||
["<up>"] = "move_cursor_up",
|
||||
["<C-p>"] = "move_cursor_up",
|
||||
["<esc>"] = "close",
|
||||
-- ['<key>'] = function(state, scroll_padding) ... end,
|
||||
},
|
||||
},
|
||||
|
||||
commands = {}, -- Add a custom command or override a global one using the same function name
|
||||
},
|
||||
buffers = {
|
||||
follow_current_file = {
|
||||
enabled = true, -- This will find and focus the file in the active buffer every time
|
||||
-- -- the current file is changed while the tree is open.
|
||||
leave_dirs_open = false, -- `false` closes auto expanded dirs, such as with `:Neotree reveal`
|
||||
},
|
||||
group_empty_dirs = true, -- when true, empty folders will be grouped together
|
||||
show_unloaded = true,
|
||||
window = {
|
||||
mappings = {
|
||||
["d"] = "buffer_delete",
|
||||
["bd"] = "buffer_delete",
|
||||
["<bs>"] = "navigate_up",
|
||||
["."] = "set_root",
|
||||
["o"] = {
|
||||
"show_help",
|
||||
nowait = false,
|
||||
config = { title = "Order by", prefix_key = "o" },
|
||||
},
|
||||
["oc"] = { "order_by_created", nowait = false },
|
||||
["od"] = { "order_by_diagnostics", nowait = false },
|
||||
["om"] = { "order_by_modified", nowait = false },
|
||||
["on"] = { "order_by_name", nowait = false },
|
||||
["os"] = { "order_by_size", nowait = false },
|
||||
["ot"] = { "order_by_type", nowait = false },
|
||||
},
|
||||
},
|
||||
},
|
||||
git_status = {
|
||||
window = {
|
||||
position = "float",
|
||||
mappings = {
|
||||
["A"] = "git_add_all",
|
||||
["gu"] = "git_unstage_file",
|
||||
["ga"] = "git_add_file",
|
||||
["gr"] = "git_revert_file",
|
||||
["gc"] = "git_commit",
|
||||
["gp"] = "git_push",
|
||||
["gg"] = "git_commit_and_push",
|
||||
["o"] = {
|
||||
"show_help",
|
||||
nowait = false,
|
||||
config = { title = "Order by", prefix_key = "o" },
|
||||
},
|
||||
["oc"] = { "order_by_created", nowait = false },
|
||||
["od"] = { "order_by_diagnostics", nowait = false },
|
||||
["om"] = { "order_by_modified", nowait = false },
|
||||
["on"] = { "order_by_name", nowait = false },
|
||||
["os"] = { "order_by_size", nowait = false },
|
||||
["ot"] = { "order_by_type", nowait = false },
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
-- 自行加入的
|
||||
source_selector = {
|
||||
winbar = false,
|
||||
statusline = false
|
||||
}
|
||||
})
|
||||
require("neo-tree").setup(opts)
|
||||
|
||||
-- vim.keymap.set("n", "<leader>e", "<Cmd>Neotree reveal<CR>")
|
||||
|
||||
|
@ -0,0 +1,8 @@
|
||||
return {
|
||||
"lambdalisue/suda.vim",
|
||||
lazy = false,
|
||||
cmd = { "SudaRead", "SudaWrite" },
|
||||
keys = {
|
||||
{ "<leader>e", "<cmd>SudaRead<cr>", desc = "Edit with sudo" },
|
||||
},
|
||||
}
|
@ -0,0 +1,89 @@
|
||||
-- if true then return {} end
|
||||
return {
|
||||
-- 'nvim-telescope/telescope.nvim', tag = '0.1.8',
|
||||
'nvim-telescope/telescope.nvim', branch = '0.1.x',
|
||||
dependencies = { 'nvim-lua/plenary.nvim' },
|
||||
|
||||
lazy = false,
|
||||
keys = {
|
||||
{ "<C-p>", "<cmd>Telescope find_files<cr>", desc = "Find files" },
|
||||
|
||||
{ "<leader>ff", "<cmd>Telescope find_files<cr>", desc = "Find files" },
|
||||
{ "<leader>fg", "<cmd>Telescope live_grep<cr>", desc = "Grep" },
|
||||
{ "<leader>fb", "<cmd>Telescope buffers<cr>", desc = "Buffers" },
|
||||
{ "<leader>fh", "<cmd>Telescope help_tags<cr>", desc = "Help tags" },
|
||||
{ "<leader>fk", "<cmd>Telescope keymaps<cr>", desc = "Keymaps" },
|
||||
},
|
||||
opts = function()
|
||||
local actions = require("telescope.actions")
|
||||
|
||||
local open_with_trouble = function(...)
|
||||
return require("trouble.sources.telescope").open(...)
|
||||
end
|
||||
local find_files_no_ignore = function()
|
||||
local action_state = require("telescope.actions.state")
|
||||
local line = action_state.get_current_line()
|
||||
LazyVim.pick("find_files", { no_ignore = true, default_text = line })()
|
||||
end
|
||||
local find_files_with_hidden = function()
|
||||
local action_state = require("telescope.actions.state")
|
||||
local line = action_state.get_current_line()
|
||||
LazyVim.pick("find_files", { hidden = true, default_text = line })()
|
||||
end
|
||||
|
||||
local function find_command()
|
||||
if 1 == vim.fn.executable("rg") then
|
||||
return { "rg", "--files", "--color", "never", "-g", "!.git" }
|
||||
elseif 1 == vim.fn.executable("fd") then
|
||||
return { "fd", "--type", "f", "--color", "never", "-E", ".git" }
|
||||
elseif 1 == vim.fn.executable("fdfind") then
|
||||
return { "fdfind", "--type", "f", "--color", "never", "-E", ".git" }
|
||||
elseif 1 == vim.fn.executable("find") and vim.fn.has("win32") == 0 then
|
||||
return { "find", ".", "-type", "f" }
|
||||
elseif 1 == vim.fn.executable("where") then
|
||||
return { "where", "/r", ".", "*" }
|
||||
end
|
||||
end
|
||||
|
||||
return {
|
||||
defaults = {
|
||||
prompt_prefix = " ",
|
||||
selection_caret = " ",
|
||||
-- open files in the first window that is an actual file.
|
||||
-- use the current window if no other window is available.
|
||||
get_selection_window = function()
|
||||
local wins = vim.api.nvim_list_wins()
|
||||
table.insert(wins, 1, vim.api.nvim_get_current_win())
|
||||
for _, win in ipairs(wins) do
|
||||
local buf = vim.api.nvim_win_get_buf(win)
|
||||
if vim.bo[buf].buftype == "" then
|
||||
return win
|
||||
end
|
||||
end
|
||||
return 0
|
||||
end,
|
||||
mappings = {
|
||||
i = {
|
||||
["<c-t>"] = open_with_trouble,
|
||||
["<a-t>"] = open_with_trouble,
|
||||
["<a-i>"] = find_files_no_ignore,
|
||||
["<a-h>"] = find_files_with_hidden,
|
||||
["<C-Down>"] = actions.cycle_history_next,
|
||||
["<C-Up>"] = actions.cycle_history_prev,
|
||||
["<C-f>"] = actions.preview_scrolling_down,
|
||||
["<C-b>"] = actions.preview_scrolling_up,
|
||||
},
|
||||
n = {
|
||||
["q"] = actions.close,
|
||||
},
|
||||
},
|
||||
},
|
||||
pickers = {
|
||||
find_files = {
|
||||
find_command = find_command,
|
||||
hidden = true,
|
||||
},
|
||||
},
|
||||
}
|
||||
end,
|
||||
}
|
@ -39,7 +39,10 @@ return {
|
||||
}
|
||||
|
||||
-- 添加第二個快捷鍵映射
|
||||
vim.api.nvim_set_keymap('n', '<A-\\>', '<cmd>ToggleTerm<CR>', { noremap = true, silent = true })
|
||||
vim.api.nvim_set_keymap('n', '<C-`>', '<cmd>ToggleTerm<CR>', { noremap = true, silent = true })
|
||||
vim.api.nvim_set_keymap('t', '<A-\\>', '<cmd>ToggleTerm<CR>', { noremap = true, silent = true })
|
||||
vim.api.nvim_set_keymap('t', '<C-`>', '<cmd>ToggleTerm<CR>', { noremap = true, silent = true })
|
||||
|
||||
-- 添加Alt+Esc鍵離開終端模式,回到Normal Mode
|
||||
vim.api.nvim_set_keymap('t', '<A-Esc>', [[<C-\><C-n>]], { noremap = true, silent = true })
|
||||
|
@ -0,0 +1,70 @@
|
||||
return {
|
||||
|
||||
{
|
||||
"mbbill/undotree",
|
||||
config = function()
|
||||
-- vim.g.mundo_preview_bottom = 1
|
||||
-- vim.g.mundo_auto_preview = 1
|
||||
-- vim.g.mundo_window_height = 20
|
||||
-- vim.g.mundo_window_width = 80
|
||||
-- vim.g.mundo_window_top = 0
|
||||
-- vim.g.mundo_window_left = 0
|
||||
|
||||
vim.keymap.set('n', '<F6>', vim.cmd.UndotreeToggle)
|
||||
vim.g.undotree_WindowLayout = 3
|
||||
|
||||
vim.cmd([[
|
||||
function g:Undotree_CustomMap()
|
||||
map <buffer> <s-DOWN> J
|
||||
map <buffer> <s-UP> K
|
||||
endfunction
|
||||
]])
|
||||
-- 使用 vim.cmd 執行 Vim 傳統語法
|
||||
-- vim.cmd([[
|
||||
-- nnoremap <F6> :UndotreeToggle<CR>
|
||||
-- if !exists('g:undotree_WindowLayout')
|
||||
-- let g:undotree_WindowLayout = 1
|
||||
-- endif
|
||||
-- ]])
|
||||
|
||||
end,
|
||||
}
|
||||
-- {
|
||||
-- "mbbill/undotree",
|
||||
-- dependencies = "nvim-lua/plenary.nvim",
|
||||
-- config = true,
|
||||
-- keys = { -- load the plugin only when using it's keybinding:
|
||||
-- { "<F6>", "<cmd>lua require('undotree').toggle()<cr>" },
|
||||
-- { "<leader>u", "<cmd>lua require('undotree').toggle()<cr>" },
|
||||
-- },
|
||||
-- }
|
||||
|
||||
-- {
|
||||
-- "jiaoshijie/undotree",
|
||||
-- dependencies = "nvim-lua/plenary.nvim",
|
||||
-- config = true,
|
||||
-- keys = { -- load the plugin only when using it's keybinding:
|
||||
-- { "<F6>", "<cmd>lua require('undotree').toggle()<cr>" },
|
||||
-- { "<leader>u", "<cmd>lua require('undotree').toggle()<cr>" },
|
||||
-- },
|
||||
-- opts = {
|
||||
-- float_diff = true, -- using float window previews diff, set this `true` will disable layout option
|
||||
-- layout = "left_bottom", -- "left_bottom", "left_left_bottom"
|
||||
-- position = "right", -- "left", "right", "bottom"
|
||||
-- ignore_filetype = { 'undotree', 'undotreeDiff', 'qf', 'TelescopePrompt', 'spectre_panel', 'tsplayground' },
|
||||
-- window = {
|
||||
-- winblend = 30,
|
||||
-- },
|
||||
-- keymaps = {
|
||||
-- ['j'] = "move_next",
|
||||
-- ['k'] = "move_prev",
|
||||
-- ['gj'] = "move2parent",
|
||||
-- ['J'] = "move_change_next",
|
||||
-- ['K'] = "move_change_prev",
|
||||
-- ['<cr>'] = "action_enter",
|
||||
-- ['p'] = "enter_diffbuf",
|
||||
-- ['q'] = "quit",
|
||||
-- },
|
||||
-- },
|
||||
-- }
|
||||
}
|
@ -0,0 +1,79 @@
|
||||
return {
|
||||
-- 單純顯示顏色
|
||||
-- 不過以下ccc.nvim與oklch-color-picker.nvim都有此功能,故關閉
|
||||
-- {
|
||||
-- 'norcalli/nvim-colorizer.lua',
|
||||
-- lazy = false,
|
||||
-- config = function()
|
||||
-- -- Attaches to every FileType mode
|
||||
-- require 'colorizer'.setup()
|
||||
|
||||
-- -- require("colorizer").setup({
|
||||
-- -- '*'; -- Highlight all files, but customize some others.
|
||||
-- -- '!vim'; -- Exclude vim from highlighting.
|
||||
-- -- '!markdown'; -- Exclude markdown from highlighting.
|
||||
-- -- '!text'; -- Exclude text from highlighting.
|
||||
-- -- '!html'; -- Exclude html from highlighting.
|
||||
-- -- '!css'; -- Exclude css from highlighting.
|
||||
-- -- '!javascript'; -- Exclude javascript from highlighting.
|
||||
-- -- '!typescript'; -- Exclude typescript from highlighting.
|
||||
-- -- }, {
|
||||
-- -- RGB = true; -- #RGB hex codes
|
||||
-- -- RRGGBB = true; -- #RRGGBB hex codes
|
||||
-- -- names = false; -- "Name" codes like Blue or blue
|
||||
-- -- RRGGBBAA = true; -- #RRGGBBAA hex codes
|
||||
-- -- rgb_fn = true; -- CSS rgb() and rgba() functions
|
||||
-- -- hsl_fn = true; -- CSS hsl() and hsla() functions
|
||||
-- -- })
|
||||
-- end,
|
||||
-- },
|
||||
|
||||
-- {
|
||||
-- "uga-rosa/ccc.nvim",
|
||||
-- lazy = false,
|
||||
-- cmd = "CccPick",
|
||||
-- keys = {
|
||||
-- {
|
||||
-- "<leader>v", "<cmd>CccPick<cr>", desc = "Color pick under cursor"
|
||||
-- },
|
||||
-- },
|
||||
-- config = function()
|
||||
-- -- Enable true color
|
||||
-- vim.opt.termguicolors = true
|
||||
--
|
||||
-- local ccc = require("ccc")
|
||||
-- local mapping = ccc.mapping
|
||||
--
|
||||
-- ccc.setup({
|
||||
-- -- Your preferred settings
|
||||
-- -- Example: enable highlighter
|
||||
-- highlighter = {
|
||||
-- auto_enable = true,
|
||||
-- lsp = true,
|
||||
-- },
|
||||
-- inputs = {
|
||||
-- ccc.input.rgb,
|
||||
-- ccc.input.hsl,
|
||||
-- ccc.input.cmyk,
|
||||
--
|
||||
-- }
|
||||
-- })
|
||||
-- end,
|
||||
-- }
|
||||
|
||||
{
|
||||
"eero-lehtinen/oklch-color-picker.nvim",
|
||||
event = "VeryLazy",
|
||||
version = "*",
|
||||
keys = {
|
||||
-- One handed keymap recommended, you will be using the mouse
|
||||
{
|
||||
"<leader>v",
|
||||
function() require("oklch-color-picker").pick_under_cursor() end,
|
||||
desc = "Color pick under cursor",
|
||||
},
|
||||
},
|
||||
---@type oklch.Opts
|
||||
opts = {},
|
||||
}
|
||||
}
|
@ -0,0 +1,64 @@
|
||||
-- if true then return {} end -- 暫時停用
|
||||
return {
|
||||
{
|
||||
"numToStr/Comment.nvim",
|
||||
opts = {
|
||||
padding = true,
|
||||
sticky = true,
|
||||
ignore = nil,
|
||||
toggler = { line = 'gcc', block = 'gbc' },
|
||||
opleader = { line = 'gc', block = 'gb' },
|
||||
extra = { above = 'gcO', below = 'gco', eol = 'gcA' },
|
||||
mappings = { basic = true, extra = true },
|
||||
pre_hook = nil,
|
||||
post_hook = nil,
|
||||
},
|
||||
config = function(_, opts)
|
||||
require("Comment").setup(opts)
|
||||
|
||||
local api = require('Comment.api')
|
||||
local config = require('Comment.config'):get()
|
||||
|
||||
-- api.toggle.linewise(motion, config?)
|
||||
-- api.toggle.linewise.current(motion?, config?)
|
||||
-- api.toggle.linewise.count(count, config?)
|
||||
|
||||
-- api.toggle.blockwise(motion, config?)
|
||||
-- api.toggle.blockwise.current(motion?, config?)
|
||||
-- api.toggle.blockwise.count(count, config?)
|
||||
|
||||
-- Toggle current line (linewise) using C-/
|
||||
vim.keymap.set('n', '<C-_>', api.toggle.linewise.current)
|
||||
|
||||
-- -- Toggle current line (blockwise) using C-\
|
||||
-- vim.keymap.set('n', '<C-\\>', api.toggle.blockwise.current)
|
||||
|
||||
-- Toggle lines (linewise) with dot-repeat support
|
||||
-- Example: <leader>gc3j will comment 4 lines
|
||||
vim.keymap.set(
|
||||
'n', '<leader>gc', api.call('toggle.linewise', 'g@'),
|
||||
{ expr = true }
|
||||
)
|
||||
|
||||
-- Toggle lines (blockwise) with dot-repeat support
|
||||
-- Example: <leader>gb3j will comment 4 lines
|
||||
vim.keymap.set(
|
||||
'n', '<leader>gb', api.call('toggle.blockwise', 'g@'),
|
||||
{ expr = true }
|
||||
)
|
||||
|
||||
local esc = vim.api.nvim_replace_termcodes(
|
||||
'<ESC>', true, false, true
|
||||
)
|
||||
|
||||
-- Toggle selection (linewise)
|
||||
-- vim.keymap.set('x', '<leader>c', function()
|
||||
vim.keymap.set('x', '<C-_>', function()
|
||||
vim.api.nvim_feedkeys(esc, 'nx', false)
|
||||
api.toggle.linewise(vim.fn.visualmode())
|
||||
end)
|
||||
|
||||
end,
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,99 @@
|
||||
return {
|
||||
"lewis6991/gitsigns.nvim",
|
||||
opts = {
|
||||
signs = {
|
||||
add = { text = "▎" },
|
||||
change = { text = "▎" },
|
||||
delete = { text = "" },
|
||||
topdelete = { text = "" },
|
||||
changedelete = { text = "▎" },
|
||||
untracked = { text = "▎" },
|
||||
},
|
||||
signs_staged = {
|
||||
add = { text = "▎" },
|
||||
change = { text = "▎" },
|
||||
delete = { text = "" },
|
||||
topdelete = { text = "" },
|
||||
changedelete = { text = "▎" },
|
||||
untracked = { text = "▎" },
|
||||
},
|
||||
signs_staged_enable = true,
|
||||
signcolumn = true, -- Toggle with `:Gitsigns toggle_signs`
|
||||
numhl = false, -- Toggle with `:Gitsigns toggle_numhl`
|
||||
linehl = false, -- Toggle with `:Gitsigns toggle_linehl`
|
||||
word_diff = true, -- Toggle with `:Gitsigns toggle_word_diff`
|
||||
watch_gitdir = {
|
||||
follow_files = true
|
||||
},
|
||||
auto_attach = true,
|
||||
attach_to_untracked = false,
|
||||
current_line_blame = true, -- Toggle with `:Gitsigns toggle_current_line_blame`
|
||||
current_line_blame_opts = {
|
||||
virt_text = true,
|
||||
virt_text_pos = 'eol', -- 'eol' | 'overlay' | 'right_align'
|
||||
delay = 1000,
|
||||
ignore_whitespace = false,
|
||||
virt_text_priority = 100,
|
||||
use_focus = true,
|
||||
},
|
||||
current_line_blame_formatter = ' <author>, <author_time:%R> - <summary>',
|
||||
sign_priority = 6,
|
||||
update_debounce = 100,
|
||||
status_formatter = nil, -- Use default
|
||||
max_file_length = 40000, -- Disable if file is longer than this (in lines)
|
||||
preview_config = {
|
||||
-- Options passed to nvim_open_win
|
||||
style = 'minimal',
|
||||
relative = 'cursor',
|
||||
row = 0,
|
||||
col = 1
|
||||
},
|
||||
on_attach = function(buffer)
|
||||
-- 處理無狀態時的佔位符號
|
||||
vim.wo.signcolumn = "yes"
|
||||
-- 添加一個空白占位符
|
||||
vim.fn.sign_define("GitSignsPlaceholder", { text = " ", texthl = "NonText" })
|
||||
-- 在沒有 Git 變更時手動放置占位符
|
||||
local line_count = vim.api.nvim_buf_line_count(buffer)
|
||||
for lnum = 1, line_count do
|
||||
vim.fn.sign_place(0, "GitSignsPlaceholderGroup", "GitSignsPlaceholder", buffer, { lnum = lnum })
|
||||
end
|
||||
|
||||
-- 其他預設動作
|
||||
local gs = package.loaded.gitsigns
|
||||
|
||||
local function map(mode, l, r, desc)
|
||||
vim.keymap.set(mode, l, r, { buffer = buffer, desc = desc })
|
||||
end
|
||||
|
||||
-- stylua: ignore start
|
||||
map("n", "]h", function()
|
||||
if vim.wo.diff then
|
||||
vim.cmd.normal({ "]c", bang = true })
|
||||
else
|
||||
gs.nav_hunk("next")
|
||||
end
|
||||
end, "Next Hunk")
|
||||
map("n", "[h", function()
|
||||
if vim.wo.diff then
|
||||
vim.cmd.normal({ "[c", bang = true })
|
||||
else
|
||||
gs.nav_hunk("prev")
|
||||
end
|
||||
end, "Prev Hunk")
|
||||
map("n", "]H", function() gs.nav_hunk("last") end, "Last Hunk")
|
||||
map("n", "[H", function() gs.nav_hunk("first") end, "First Hunk")
|
||||
map({ "n", "v" }, "<leader>ghs", ":Gitsigns stage_hunk<CR>", "Stage Hunk")
|
||||
map({ "n", "v" }, "<leader>ghr", ":Gitsigns reset_hunk<CR>", "Reset Hunk")
|
||||
map("n", "<leader>ghS", gs.stage_buffer, "Stage Buffer")
|
||||
map("n", "<leader>ghu", gs.undo_stage_hunk, "Undo Stage Hunk")
|
||||
map("n", "<leader>ghR", gs.reset_buffer, "Reset Buffer")
|
||||
map("n", "<leader>ghp", gs.preview_hunk_inline, "Preview Hunk Inline")
|
||||
map("n", "<leader>ghb", function() gs.blame_line({ full = true }) end, "Blame Line")
|
||||
map("n", "<leader>ghB", function() gs.blame() end, "Blame Buffer")
|
||||
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,
|
||||
},
|
||||
}
|
31
dot_config/nvim/exact_lua/exact_plugins/exact_editor/ime.lua
Normal file
31
dot_config/nvim/exact_lua/exact_plugins/exact_editor/ime.lua
Normal file
@ -0,0 +1,31 @@
|
||||
return {
|
||||
{
|
||||
"pysan3/fcitx5.nvim",
|
||||
cond = function()
|
||||
return vim.fn.executable("fcitx5-remote") == 1
|
||||
end,
|
||||
event = { "ModeChanged" }, -- 在模式改變時載入插件
|
||||
config = function()
|
||||
require("fcitx5").setup() -- 初始化插件
|
||||
|
||||
-- 以下是手動指定規則
|
||||
-- local en = "keyboard-us"
|
||||
-- local tw = "chewing"
|
||||
|
||||
-- require("fcitx5").setup({
|
||||
-- imname = {
|
||||
-- norm = en,
|
||||
-- ins = tw,
|
||||
-- cmd = en,
|
||||
-- },
|
||||
-- remember_prior = false,
|
||||
-- })
|
||||
|
||||
-- -- If you are using `jk` to escape, map 全角のjk.
|
||||
-- vim.cmd([[
|
||||
-- inoremap <silent> jk <Esc>
|
||||
-- tnoremap <silent> jk <Esc>
|
||||
-- ]])
|
||||
end,
|
||||
},
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
|
||||
return {
|
||||
{
|
||||
"lukas-reineke/indent-blankline.nvim",
|
||||
main = "ibl",
|
||||
---@module "ibl"
|
||||
---@type ibl.config
|
||||
-- opts = {},
|
||||
config = function(_, opts)
|
||||
-- require("ibl").setup(opts)
|
||||
|
||||
local highlight = {
|
||||
"RainbowRed",
|
||||
"RainbowYellow",
|
||||
"RainbowBlue",
|
||||
"RainbowOrange",
|
||||
"RainbowGreen",
|
||||
"RainbowViolet",
|
||||
"RainbowCyan",
|
||||
}
|
||||
local hooks = require "ibl.hooks"
|
||||
-- create the highlight groups in the highlight setup hook, so they are reset
|
||||
-- every time the colorscheme changes
|
||||
hooks.register(hooks.type.HIGHLIGHT_SETUP, function()
|
||||
vim.api.nvim_set_hl(0, "RainbowRed", { fg = "#E06C75" })
|
||||
vim.api.nvim_set_hl(0, "RainbowYellow", { fg = "#E5C07B" })
|
||||
vim.api.nvim_set_hl(0, "RainbowBlue", { fg = "#61AFEF" })
|
||||
vim.api.nvim_set_hl(0, "RainbowOrange", { fg = "#D19A66" })
|
||||
vim.api.nvim_set_hl(0, "RainbowGreen", { fg = "#98C379" })
|
||||
vim.api.nvim_set_hl(0, "RainbowViolet", { fg = "#C678DD" })
|
||||
vim.api.nvim_set_hl(0, "RainbowCyan", { fg = "#56B6C2" })
|
||||
end)
|
||||
|
||||
vim.g.rainbow_delimiters = { highlight = highlight }
|
||||
require("ibl").setup { scope = { highlight = highlight } }
|
||||
|
||||
hooks.register(hooks.type.SCOPE_HIGHLIGHT, hooks.builtin.scope_highlight_from_extmark)
|
||||
end,
|
||||
}
|
||||
}
|
@ -24,6 +24,21 @@ return {
|
||||
return "📍 " .. location -- 在字首添加 emoji
|
||||
end
|
||||
|
||||
-- Function to determine file permissions and appropriate background color
|
||||
local function get_permissions_color()
|
||||
local file = vim.fn.expand("%:p")
|
||||
|
||||
if file == "" or file == nil then
|
||||
return "No File", "#3B4252" -- Default blue for no or non-existing file
|
||||
else
|
||||
local permissions = vim.fn.getfperm(file)
|
||||
-- Check only the first three characters for 'rwx' to determine owner permissions
|
||||
local owner_permissions = permissions:sub(1, 3)
|
||||
-- Green for owner 'rwx', blue otherwise
|
||||
return permissions, owner_permissions == "rwx" and "#97C378" or "#3B4252"
|
||||
end
|
||||
end
|
||||
|
||||
return {
|
||||
options = {
|
||||
icons_enabled = true,
|
||||
@ -33,6 +48,7 @@ return {
|
||||
disabled_filetypes = {
|
||||
statusline = {},
|
||||
winbar = {},
|
||||
{'undotree'}
|
||||
},
|
||||
ignore_focus = {},
|
||||
always_divide_middle = true,
|
||||
@ -48,7 +64,28 @@ return {
|
||||
lualine_a = {'mode'},
|
||||
lualine_b = {'branch', 'diff', 'diagnostics'},
|
||||
lualine_c = {'filename'},
|
||||
lualine_x = {'encoding', 'fileformat', 'filetype'},
|
||||
lualine_x = {
|
||||
{
|
||||
function()
|
||||
local permissions, _ = get_permissions_color() -- Ignore bg_color here if unused
|
||||
return permissions
|
||||
end,
|
||||
color = function()
|
||||
local _, bg_color = get_permissions_color() -- Use bg_color for dynamic coloring
|
||||
return { fg = fg_color, bg = bg_color, gui = "bold" }
|
||||
end,
|
||||
-- separator = { left = "", right = "" },
|
||||
-- separator = { left = "", right = "" },
|
||||
-- separator = { left = "", right = "" },
|
||||
-- separator = { left = "", right = "" },
|
||||
-- separator = { left = "", right = "" },
|
||||
separator = { left = "", right = "" },
|
||||
-- separator = { left = "", right = "" },
|
||||
-- separator = { left = "", right = "" },
|
||||
padding = 1,
|
||||
},
|
||||
'encoding', 'fileformat', 'filetype'
|
||||
},
|
||||
lualine_y = {'progress'},
|
||||
lualine_z = {{ selectionCount }, { customLocation },}
|
||||
},
|
||||
|
@ -1,157 +1,175 @@
|
||||
if true then return {} end -- 先停用
|
||||
-- if true then return {} end -- 先停用
|
||||
|
||||
return {
|
||||
{ "petertriho/nvim-scrollbar",
|
||||
cond = true,
|
||||
config = function()
|
||||
require("scrollbar").setup({
|
||||
show = true,
|
||||
show_in_active_only = false,
|
||||
set_highlights = true,
|
||||
folds = 1000, -- handle folds, set to number to disable folds if no. of lines in buffer exceeds this
|
||||
max_lines = false, -- disables if no. of lines in buffer exceeds this
|
||||
hide_if_all_visible = false, -- Hides everything if all lines are visible
|
||||
throttle_ms = 100,
|
||||
handle = {
|
||||
text = " ",
|
||||
blend = 30, -- Integer between 0 and 100. 0 for fully opaque and 100 to full transparent. Defaults to 30.
|
||||
color = nil,
|
||||
color_nr = nil, -- cterm
|
||||
highlight = "CursorColumn",
|
||||
hide_if_all_visible = true, -- Hides handle if all lines are visible
|
||||
},
|
||||
marks = {
|
||||
Cursor = {
|
||||
text = "•",
|
||||
priority = 0,
|
||||
gui = nil,
|
||||
color = nil,
|
||||
cterm = nil,
|
||||
color_nr = nil, -- cterm
|
||||
highlight = "Normal",
|
||||
},
|
||||
Search = {
|
||||
text = { "-", "=" },
|
||||
priority = 1,
|
||||
gui = nil,
|
||||
color = nil,
|
||||
cterm = nil,
|
||||
color_nr = nil, -- cterm
|
||||
highlight = "Search",
|
||||
},
|
||||
Error = {
|
||||
text = { "-", "=" },
|
||||
priority = 2,
|
||||
gui = nil,
|
||||
color = nil,
|
||||
cterm = nil,
|
||||
color_nr = nil, -- cterm
|
||||
highlight = "DiagnosticVirtualTextError",
|
||||
},
|
||||
Warn = {
|
||||
text = { "-", "=" },
|
||||
priority = 3,
|
||||
gui = nil,
|
||||
color = nil,
|
||||
cterm = nil,
|
||||
color_nr = nil, -- cterm
|
||||
highlight = "DiagnosticVirtualTextWarn",
|
||||
},
|
||||
Info = {
|
||||
text = { "-", "=" },
|
||||
priority = 4,
|
||||
gui = nil,
|
||||
color = nil,
|
||||
cterm = nil,
|
||||
color_nr = nil, -- cterm
|
||||
highlight = "DiagnosticVirtualTextInfo",
|
||||
},
|
||||
Hint = {
|
||||
text = { "-", "=" },
|
||||
priority = 5,
|
||||
gui = nil,
|
||||
color = nil,
|
||||
cterm = nil,
|
||||
color_nr = nil, -- cterm
|
||||
highlight = "DiagnosticVirtualTextHint",
|
||||
},
|
||||
Misc = {
|
||||
text = { "-", "=" },
|
||||
priority = 6,
|
||||
gui = nil,
|
||||
color = nil,
|
||||
cterm = nil,
|
||||
color_nr = nil, -- cterm
|
||||
highlight = "Normal",
|
||||
},
|
||||
GitAdd = {
|
||||
text = "┆",
|
||||
priority = 7,
|
||||
gui = nil,
|
||||
color = nil,
|
||||
cterm = nil,
|
||||
color_nr = nil, -- cterm
|
||||
highlight = "GitSignsAdd",
|
||||
},
|
||||
GitChange = {
|
||||
text = "┆",
|
||||
priority = 7,
|
||||
gui = nil,
|
||||
color = nil,
|
||||
cterm = nil,
|
||||
color_nr = nil, -- cterm
|
||||
highlight = "GitSignsChange",
|
||||
},
|
||||
GitDelete = {
|
||||
text = "▁",
|
||||
priority = 7,
|
||||
gui = nil,
|
||||
color = nil,
|
||||
cterm = nil,
|
||||
color_nr = nil, -- cterm
|
||||
highlight = "GitSignsDelete",
|
||||
},
|
||||
},
|
||||
excluded_buftypes = {
|
||||
"terminal",
|
||||
},
|
||||
excluded_filetypes = {
|
||||
"dropbar_menu",
|
||||
"dropbar_menu_fzf",
|
||||
"DressingInput",
|
||||
"cmp_docs",
|
||||
"cmp_menu",
|
||||
"noice",
|
||||
"prompt",
|
||||
"TelescopePrompt",
|
||||
},
|
||||
autocmd = {
|
||||
render = {
|
||||
"BufWinEnter",
|
||||
"TabEnter",
|
||||
"TermEnter",
|
||||
"WinEnter",
|
||||
"CmdwinLeave",
|
||||
"TextChanged",
|
||||
"VimResized",
|
||||
"WinScrolled",
|
||||
},
|
||||
clear = {
|
||||
"BufWinLeave",
|
||||
"TabLeave",
|
||||
"TermLeave",
|
||||
"WinLeave",
|
||||
},
|
||||
},
|
||||
handlers = {
|
||||
cursor = true,
|
||||
diagnostic = true,
|
||||
gitsigns = false, -- Requires gitsigns
|
||||
handle = true,
|
||||
search = false, -- Requires hlslens
|
||||
ale = false, -- Requires ALE
|
||||
},
|
||||
'dstein64/nvim-scrollview',
|
||||
setup = function()
|
||||
require('scrollview').setup({
|
||||
-- Default options
|
||||
current_only = true, -- Only show scroll indicator in current window
|
||||
winblend = 0, -- Blend of the scroll indicator
|
||||
-- base = 1, -- Base value for the scroll indicator
|
||||
-- max_lines = 1000, -- Maximum number of lines to show the scroll indicator
|
||||
excluded_filetypes = { 'help', 'neo-tree' }, -- Filetypes to exclude from showing the scroll indicator
|
||||
base = 'buffer',
|
||||
-- column = 80,
|
||||
signs_on_startup = {'all'},
|
||||
diagnostics_severities = {vim.diagnostic.severity.ERROR}
|
||||
})
|
||||
end
|
||||
},
|
||||
end,
|
||||
}
|
||||
|
||||
-- return {
|
||||
-- { "petertriho/nvim-scrollbar",
|
||||
-- cond = true,
|
||||
-- config = function()
|
||||
-- require("scrollbar").setup({
|
||||
-- show = true,
|
||||
-- show_in_active_only = false,
|
||||
-- set_highlights = true,
|
||||
-- folds = 1000, -- handle folds, set to number to disable folds if no. of lines in buffer exceeds this
|
||||
-- max_lines = false, -- disables if no. of lines in buffer exceeds this
|
||||
-- hide_if_all_visible = false, -- Hides everything if all lines are visible
|
||||
-- throttle_ms = 100,
|
||||
-- handle = {
|
||||
-- text = " ",
|
||||
-- blend = 30, -- Integer between 0 and 100. 0 for fully opaque and 100 to full transparent. Defaults to 30.
|
||||
-- color = nil,
|
||||
-- color_nr = nil, -- cterm
|
||||
-- highlight = "CursorColumn",
|
||||
-- hide_if_all_visible = true, -- Hides handle if all lines are visible
|
||||
-- },
|
||||
-- marks = {
|
||||
-- Cursor = {
|
||||
-- text = "•",
|
||||
-- priority = 0,
|
||||
-- gui = nil,
|
||||
-- color = nil,
|
||||
-- cterm = nil,
|
||||
-- color_nr = nil, -- cterm
|
||||
-- highlight = "Normal",
|
||||
-- },
|
||||
-- Search = {
|
||||
-- text = { "-", "=" },
|
||||
-- priority = 1,
|
||||
-- gui = nil,
|
||||
-- color = nil,
|
||||
-- cterm = nil,
|
||||
-- color_nr = nil, -- cterm
|
||||
-- highlight = "Search",
|
||||
-- },
|
||||
-- Error = {
|
||||
-- text = { "-", "=" },
|
||||
-- priority = 2,
|
||||
-- gui = nil,
|
||||
-- color = nil,
|
||||
-- cterm = nil,
|
||||
-- color_nr = nil, -- cterm
|
||||
-- highlight = "DiagnosticVirtualTextError",
|
||||
-- },
|
||||
-- Warn = {
|
||||
-- text = { "-", "=" },
|
||||
-- priority = 3,
|
||||
-- gui = nil,
|
||||
-- color = nil,
|
||||
-- cterm = nil,
|
||||
-- color_nr = nil, -- cterm
|
||||
-- highlight = "DiagnosticVirtualTextWarn",
|
||||
-- },
|
||||
-- Info = {
|
||||
-- text = { "-", "=" },
|
||||
-- priority = 4,
|
||||
-- gui = nil,
|
||||
-- color = nil,
|
||||
-- cterm = nil,
|
||||
-- color_nr = nil, -- cterm
|
||||
-- highlight = "DiagnosticVirtualTextInfo",
|
||||
-- },
|
||||
-- Hint = {
|
||||
-- text = { "-", "=" },
|
||||
-- priority = 5,
|
||||
-- gui = nil,
|
||||
-- color = nil,
|
||||
-- cterm = nil,
|
||||
-- color_nr = nil, -- cterm
|
||||
-- highlight = "DiagnosticVirtualTextHint",
|
||||
-- },
|
||||
-- Misc = {
|
||||
-- text = { "-", "=" },
|
||||
-- priority = 6,
|
||||
-- gui = nil,
|
||||
-- color = nil,
|
||||
-- cterm = nil,
|
||||
-- color_nr = nil, -- cterm
|
||||
-- highlight = "Normal",
|
||||
-- },
|
||||
-- GitAdd = {
|
||||
-- text = "┆",
|
||||
-- priority = 7,
|
||||
-- gui = nil,
|
||||
-- color = nil,
|
||||
-- cterm = nil,
|
||||
-- color_nr = nil, -- cterm
|
||||
-- highlight = "GitSignsAdd",
|
||||
-- },
|
||||
-- GitChange = {
|
||||
-- text = "┆",
|
||||
-- priority = 7,
|
||||
-- gui = nil,
|
||||
-- color = nil,
|
||||
-- cterm = nil,
|
||||
-- color_nr = nil, -- cterm
|
||||
-- highlight = "GitSignsChange",
|
||||
-- },
|
||||
-- GitDelete = {
|
||||
-- text = "▁",
|
||||
-- priority = 7,
|
||||
-- gui = nil,
|
||||
-- color = nil,
|
||||
-- cterm = nil,
|
||||
-- color_nr = nil, -- cterm
|
||||
-- highlight = "GitSignsDelete",
|
||||
-- },
|
||||
-- },
|
||||
-- excluded_buftypes = {
|
||||
-- "terminal",
|
||||
-- },
|
||||
-- excluded_filetypes = {
|
||||
-- "dropbar_menu",
|
||||
-- "dropbar_menu_fzf",
|
||||
-- "DressingInput",
|
||||
-- "cmp_docs",
|
||||
-- "cmp_menu",
|
||||
-- "noice",
|
||||
-- "prompt",
|
||||
-- "TelescopePrompt",
|
||||
-- },
|
||||
-- autocmd = {
|
||||
-- render = {
|
||||
-- "BufWinEnter",
|
||||
-- "TabEnter",
|
||||
-- "TermEnter",
|
||||
-- "WinEnter",
|
||||
-- "CmdwinLeave",
|
||||
-- "TextChanged",
|
||||
-- "VimResized",
|
||||
-- "WinScrolled",
|
||||
-- },
|
||||
-- clear = {
|
||||
-- "BufWinLeave",
|
||||
-- "TabLeave",
|
||||
-- "TermLeave",
|
||||
-- "WinLeave",
|
||||
-- },
|
||||
-- },
|
||||
-- handlers = {
|
||||
-- cursor = true,
|
||||
-- diagnostic = true,
|
||||
-- gitsigns = false, -- Requires gitsigns
|
||||
-- handle = true,
|
||||
-- search = false, -- Requires hlslens
|
||||
-- ale = false, -- Requires ALE
|
||||
-- },
|
||||
-- })
|
||||
-- end
|
||||
-- },
|
||||
-- }
|
||||
|
@ -1,3 +1,4 @@
|
||||
vim.g.suda_smart_edit = 1
|
||||
require("config.options")
|
||||
require("config.keymaps_nvim")
|
||||
require("config.keymaps")
|
||||
|
@ -124,10 +124,9 @@ zstyle ':completion:*:directory-stack' list-colors '=(#b) #([0-9]#)*( *)==95=38;
|
||||
zstyle ':completion:*' menu select
|
||||
|
||||
## Alias section
|
||||
alias cp="cp -i" # Confirm before overwriting something
|
||||
alias df='df -h' # Human-readable sizes
|
||||
alias free='free -m' # Show sizes in MB
|
||||
alias gitu='git add . && git commit && git push'
|
||||
alias cp="cp -i" # Confirm before overwriting something
|
||||
alias df='df -h' # Human-readable sizes
|
||||
alias free='free -m' # Show sizes in MB
|
||||
|
||||
# overwrite ls
|
||||
if command -v colorls &> /dev/null; then
|
||||
@ -152,43 +151,10 @@ elif [ "$(uname -s)" = 'Darwin' ]; then
|
||||
fi
|
||||
# bindkey -s '^E' 'gnome-terminal --working-directory="$PWD" -- zsh\n'
|
||||
|
||||
# Install ruby¬
|
||||
# Based on "`brew --prefix ruby`/bin"¬
|
||||
export PATH="/usr/local/opt/ruby/bin:$PATH"¬
|
||||
# Based on "`gem environment gemdir`/bin"¬
|
||||
export PATH="/usr/local/lib/ruby/gems/3.3.0/bin:$PATH"¬
|
||||
export PATH="$HOME/.local/share/gem/ruby/3.3.0/bin:$PATH"
|
||||
|
||||
# Fix ython3 to python Path on macOS
|
||||
if [ "$(uname -s)" = 'Darwin' ]; then
|
||||
export PATH=/usr/local/opt/python/libexec/bin:$PATH
|
||||
fi
|
||||
|
||||
# Created by `pipx` on 2023-01-30 19:57:14
|
||||
export PATH="$PATH:$HOME/.local/bin"
|
||||
|
||||
# GoLang Path
|
||||
export PATH="$PATH:$HOME/go/bin"
|
||||
|
||||
{{ if eq .chezmoi.os "darwin" -}}
|
||||
# iterm2
|
||||
test -e "${HOME}/.iterm2_shell_integration.zsh" && source "${HOME}/.iterm2_shell_integration.zsh"
|
||||
|
||||
# 圖片顯示
|
||||
# 既然即使加入判斷後還是「進入函數定義段落且噴錯」,那就代表:zsh 在解析 .zshrc 時,在到達 if 邏輯前,就已經知道 imgcat 是 alias,並因此直接報錯,這是因為:
|
||||
# ⚠️ 在 zsh 中,如果你寫 function_name() 這種形式,然後這個名稱之前被定義為 alias,會在 parse 階段直接錯誤,不會等到 if 判斷。
|
||||
# 解決方式:延遲定義(用 eval 避開 parser)
|
||||
# 你需要避免 zsh 在 parse 階段就看到 imgcat() 的寫法。可以這樣寫,透過 eval 延遲定義函數內容:
|
||||
if ! alias imgcat &>/dev/null && ! functions imgcat &>/dev/null && command -v magick &>/dev/null; then
|
||||
eval '
|
||||
imgcat() {
|
||||
if [[ -z "$1" ]]; then
|
||||
echo "❌ 請指定圖片檔案,例如:imgcat ~/Pictures/foo.png"
|
||||
return 1
|
||||
fi
|
||||
|
||||
magick "$1" -geometry 800x480 sixel:-
|
||||
}'
|
||||
fi
|
||||
{{ end -}}
|
||||
|
||||
zinit light mass8326/zsh-chezmoi
|
||||
|
||||
@ -205,3 +171,6 @@ function git_pushmulti() {
|
||||
# 執行 git pushmulti
|
||||
noglob git pushmulti "$remotes" "$branches"
|
||||
}
|
||||
|
||||
{{ template "common.sh.tmpl" . }}
|
||||
|
Loading…
x
Reference in New Issue
Block a user