update
This commit is contained in:
parent
0da2c62dfe
commit
4e4c0e3e17
3 changed files with 37 additions and 23 deletions
2
.bashrc
2
.bashrc
|
|
@ -27,3 +27,5 @@ echo "You are here to witness."
|
|||
echo "色即是空 空即是色"
|
||||
eval "$(direnv hook bash)"
|
||||
export PATH="$HOME/.npm-global/bin:$PATH"
|
||||
export PATH="$HOME/bin:$PATH"
|
||||
export PATH="$HOME/.local/bin:$PATH"
|
||||
|
|
|
|||
52
init.lua
52
init.lua
|
|
@ -795,6 +795,18 @@ vim.api.nvim_create_autocmd('BufEnter', {
|
|||
end,
|
||||
})
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
-- C
|
||||
-------------------------------------------------------------------------------
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
pattern = "c",
|
||||
callback = function()
|
||||
vim.opt_local.tabstop = 2
|
||||
vim.opt_local.shiftwidth = 2
|
||||
vim.opt_local.softtabstop = 2
|
||||
vim.opt_local.expandtab = true
|
||||
end,
|
||||
})
|
||||
-------------------------------------------------------------------------------
|
||||
-- Golang
|
||||
-------------------------------------------------------------------------------
|
||||
|
|
@ -827,23 +839,23 @@ vim.api.nvim_create_autocmd('BufEnter', {
|
|||
end,
|
||||
})
|
||||
local function toggle_checkbox()
|
||||
local line = vim.api.nvim_get_current_line()
|
||||
local new
|
||||
if line:match('%[ %]') then
|
||||
new = line:gsub('%[ %]', '[x]', 1)
|
||||
elseif line:match('%[x%]') then
|
||||
new = line:gsub('%[x%]', '[ ]', 1)
|
||||
elseif line:match('^(%s*[-*+])%s+(.*)') then
|
||||
-- bare list item → promote to checkbox
|
||||
new = line:gsub('^(%s*[-*+])%s+', '%1 [ ] ', 1)
|
||||
else
|
||||
return
|
||||
end
|
||||
vim.api.nvim_set_current_line(new)
|
||||
local line = vim.api.nvim_get_current_line()
|
||||
local new
|
||||
if line:match('%[ %]') then
|
||||
new = line:gsub('%[ %]', '[x]', 1)
|
||||
elseif line:match('%[x%]') then
|
||||
new = line:gsub('%[x%]', '[ ]', 1)
|
||||
elseif line:match('^(%s*[-*+])%s+(.*)') then
|
||||
-- bare list item → promote to checkbox
|
||||
new = line:gsub('^(%s*[-*+])%s+', '%1 [ ] ', 1)
|
||||
else
|
||||
return
|
||||
end
|
||||
vim.api.nvim_set_current_line(new)
|
||||
end
|
||||
|
||||
vim.keymap.set('n', '<leader>tc', toggle_checkbox,
|
||||
{ desc = 'Toggle markdown checkbox', buffer = false })
|
||||
{ desc = 'Toggle markdown checkbox', buffer = false })
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
-- Comments
|
||||
|
|
@ -858,10 +870,10 @@ vim.api.nvim_create_autocmd('BufEnter', {
|
|||
-- Refreshing
|
||||
-------------------------------------------------------------------------------
|
||||
vim.api.nvim_create_autocmd({ "FocusGained", "BufEnter", "CursorHold", "CursorHoldI" }, {
|
||||
pattern = "*",
|
||||
callback = function()
|
||||
if vim.fn.mode() ~= "c" and vim.fn.getcmdwintype() == "" then
|
||||
vim.cmd("checktime")
|
||||
end
|
||||
end,
|
||||
pattern = "*",
|
||||
callback = function()
|
||||
if vim.fn.mode() ~= "c" and vim.fn.getcmdwintype() == "" then
|
||||
vim.cmd("checktime")
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
|
|
|||
|
|
@ -31,9 +31,9 @@ if-shell 'upower -i /org/freedesktop/UPower/devices/battery_BAT0 | grep -q "ener
|
|||
}
|
||||
set -ag @minimal-tmux-status-right-extra "#[fg=color150]#[bg=color150,fg=black]CPU:#(uptime | awk -F'load average:' '{ print \$2 }' | cut -d',' -f1)#[fg=color150,bg=default]#[bg=default] "
|
||||
set -ag @minimal-tmux-status-right-extra "#[fg=color150]#[bg=color150,fg=black]RAM:#(free -h | awk '/^Mem:/ {print \$3 \"/\" \$2}')#[fg=color150,bg=default]#[bg=default] "
|
||||
if-shell 'command -v nvidia-smi' {
|
||||
set -ag @minimal-tmux-status-right-extra "#[fg=color150]#[bg=color150,fg=black]GPU: #(nvidia-smi --query-gpu=utilization.gpu --format=csv,noheader,nounits)%#[fg=color150,bg=default]#[bg=default] "
|
||||
}
|
||||
# if-shell 'command -v nvidia-smi' {
|
||||
# set -ag @minimal-tmux-status-right-extra "#[fg=color150]#[bg=color150,fg=black]GPU: #(nvidia-smi --query-gpu=utilization.gpu --format=csv,noheader,nounits)%#[fg=color150,bg=default]#[bg=default] "
|
||||
# }
|
||||
set -ag @minimal-tmux-status-right-extra "#[fg=color150]#[bg=color150,fg=black]#(date +"%Y-%m-%dT%H:%M")#[fg=color150,bg=default]#[bg=default]"
|
||||
set -g @minimal-tmux-status-left-extra "#{pane_title}"
|
||||
set -g @minimal-tmux-use-arrow true
|
||||
|
|
|
|||
Loading…
Reference in a new issue