aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--alias107
-rw-r--r--mutt/muttrc.topo80
-rw-r--r--snippets/make_basic9
-rw-r--r--vim/mini.lua1
4 files changed, 64 insertions, 133 deletions
diff --git a/alias b/alias
index 1e5a250..491336c 100644
--- a/alias
+++ b/alias
@@ -39,9 +39,51 @@ urlencode() {
39} 39}
40# }}} 40# }}}
41# ADMIN {{{ 41# ADMIN {{{
42
42alias etc.passwd='sudo vim /etc/passwd' 43alias etc.passwd='sudo vim /etc/passwd'
44alias s='sudo systemctl'
45alias j='sudo journalctl -xeu'
46alias jf='sudo journalctl -xfeu'
47
48# }}}
49# Nginx{{{
50alias vgx='sudo vim /etc/nginx/sites-enabled/vps && sudo nginx -t && sudo systemctl reload nginx'
51alias ng.conf='sudo vim /etc/nginx/nginx.conf'
52alias ng.log='tail -f /var/log/nginx/access.log'
53alias cdngx='cd /etc/nginx'
54# }}}
55# Web {{{
56alias www.git='/srv/git/create.sh'
57alias www='make -f ~/site/www/Makefile'
58alias cdwww='cd ~/site/www'
59vp() {
60 [[ $HOST = vultr ]] || PREFIX='ssh -qt vps'
61
62 filename="${1%.md}.md"
63 post=$(eval $PREFIX find ~/blog/content -name $filename | head -1 | sed 's/\r//')
64
65 if [ -z "$post" ]; then
66 echo "sh -c 'cd ~/blog && hugo new posts/$filename'" | eval ${PREFIX}
67 post="~/blog/content/posts/$filename"
68 fi
69
70 shift
71 if [[ $HOST = vultr ]]; then
72 vim $@ "$post"
73 else
74 # Copy from vps
75 tmpfile=$(mktemp --suffix .md)
76 scp vps:"$post" $tmpfile
77
78 # Edit locally
79 vim $tmpfile --cmd "autocmd BufWritePost $tmpfile silent! :!setsid scp % vps:$post &" && \
80 cat $tmpfile | ssh vps "cd ~/blog && cat >$post && git add $post && git commit -m 'Update with vim'" && \
81 rm $tmpfile
82 fi
83}
43# }}} 84# }}}
44# UNIX {{{ 85# UNIX {{{
86
45config(){ cd ~/.config/$1; } 87config(){ cd ~/.config/$1; }
46alias sound="echo -ne '\a'" 88alias sound="echo -ne '\a'"
47alias hg='history | grep' 89alias hg='history | grep'
@@ -129,11 +171,6 @@ file.size() {
129} 171}
130 172
131# }}} 173# }}}
132# Systemctl {{{
133alias s='sudo systemctl'
134alias j='sudo journalctl -xeu'
135alias jf='sudo journalctl -xfeu'
136# }}}
137# TTY {{{ 174# TTY {{{
138alias tma='tmux a' 175alias tma='tmux a'
139alias tmux.config="$EDITOR ~/.tmux.conf" 176alias tmux.config="$EDITOR ~/.tmux.conf"
@@ -272,6 +309,10 @@ alias xo='xsel -ob'
272alias xl='history | tail -1 | grep -oP "^\s*[0-9]+\s\s\K.*" | xsel -ib && echo Copied to clipboard && xsel -ob' 309alias xl='history | tail -1 | grep -oP "^\s*[0-9]+\s\s\K.*" | xsel -ib && echo Copied to clipboard && xsel -ob'
273# }}} 310# }}}
274# X11: Misc {{{ 311# X11: Misc {{{
312alias cdD='cd ~/Documents'
313alias cdP='cd ~/Pictures'
314alias cdV='cd ~/Videos'
315alias cdM='cd ~/Music'
275alias x='xdg-open' 316alias x='xdg-open'
276alias ob.rc='vim ~/.config/openbox/rc.xml' 317alias ob.rc='vim ~/.config/openbox/rc.xml'
277# }}} 318# }}}
@@ -315,43 +356,10 @@ alias ld='cd -' # last directory
315alias cda='mkdir -p ~/data && cd ~/data' 356alias cda='mkdir -p ~/data && cd ~/data'
316cde() { cd /etc/$@; } 357cde() { cd /etc/$@; }
317alias cdetc='cde' 358alias cdetc='cde'
318alias cdd='cd ~/Downloads'
319alias cdD='cd ~/Documents'
320alias cdP='cd ~/Pictures'
321alias cdpu='cd ~/public' 359alias cdpu='cd ~/public'
322alias cdV='cd ~/Videos' 360alias cdd='cd ~/Downloads'
323alias cdM='cd ~/Music'
324alias cdtrash='cd ~/.local/share/Trash' 361alias cdtrash='cd ~/.local/share/Trash'
325# }}} 362# }}}
326# website {{{
327alias cdb='cd ~/site/www'
328vp() {
329 [[ $HOST = vultr ]] || PREFIX='ssh -qt vps'
330
331 filename="${1%.md}.md"
332 post=$(eval $PREFIX find ~/blog/content -name $filename | head -1 | sed 's/\r//')
333
334 if [ -z "$post" ]; then
335 echo "sh -c 'cd ~/blog && hugo new posts/$filename'" | eval ${PREFIX}
336 post="~/blog/content/posts/$filename"
337 fi
338
339 shift
340 if [[ $HOST = vultr ]]; then
341 vim $@ "$post"
342 else
343 # Copy from vps
344 tmpfile=$(mktemp --suffix .md)
345 scp vps:"$post" $tmpfile
346
347 # Edit locally
348 vim $tmpfile --cmd "autocmd BufWritePost $tmpfile silent! :!setsid scp % vps:$post &" && \
349 cat $tmpfile | ssh vps "cd ~/blog && cat >$post && git add $post && git commit -m 'Update with vim'" && \
350 rm $tmpfile
351 fi
352}
353
354# }}}
355# GIT: config {{{ 363# GIT: config {{{
356alias git.config="$EDITOR ~/.gitconfig" 364alias git.config="$EDITOR ~/.gitconfig"
357unalias gc &> /dev/null # override zsh plugin alias 365unalias gc &> /dev/null # override zsh plugin alias
@@ -369,9 +377,6 @@ alias ch="/home/pham/helper/bin/git/check-repos.sh"
369alias git.check="/home/pham/helper/bin/git/check-repos.sh" 377alias git.check="/home/pham/helper/bin/git/check-repos.sh"
370 378
371# }}} 379# }}}
372# GIT: Web {{{
373alias git.web='/srv/git/create.sh'
374# }}}
375# GIT: TIG {{{ 380# GIT: TIG {{{
376alias cdt='cd ~/git/tig' 381alias cdt='cd ~/git/tig'
377alias t='tig' 382alias t='tig'
@@ -445,13 +450,6 @@ adb.push() {
445 adb push $1 /sdcard/Download 450 adb push $1 /sdcard/Download
446} 451}
447# }}} 452# }}}
448# Beancount{{{
449alias cdB='cd $HOME/bean'
450alias b='vim $HOME/bean/main.bean'
451# }}}
452# python{{{
453alias pip3='python3 -m pip'
454# }}}
455# sample file{{{ 453# sample file{{{
456alias foo='echo bar > foo && echo File foo is created && ls -lh foo' 454alias foo='echo bar > foo && echo File foo is created && ls -lh foo'
457alias bar='echo foo > bar && echo File bar is created && ls -lh bar' 455alias bar='echo foo > bar && echo File bar is created && ls -lh bar'
@@ -524,11 +522,12 @@ words() {
524} 522}
525 523
526# }}} 524# }}}
527# Nginx{{{ 525# Beancount{{{
528alias vgx='sudo vim /etc/nginx/sites-enabled/vps && sudo nginx -t && sudo systemctl reload nginx' 526alias cdB='cd $HOME/bean'
529alias ng.conf='sudo vim /etc/nginx/nginx.conf' 527alias b='vim $HOME/bean/main.bean'
530alias ng.log='tail -f /var/log/nginx/access.log' 528# }}}
531alias cdngx='cd /etc/nginx' 529# python{{{
530alias pip3='python3 -m pip'
532# }}} 531# }}}
533# GIS {{{ 532# GIS {{{
534alias oo='ogr2ogr' 533alias oo='ogr2ogr'
diff --git a/mutt/muttrc.topo b/mutt/muttrc.topo
index 0672b63..fc0a0a6 100644
--- a/mutt/muttrc.topo
+++ b/mutt/muttrc.topo
@@ -1,83 +1,5 @@
1source ~/.config/mutt/default 1source ~/.config/mutt/default
2 2
3# IMAP/SMTP settings 3# IMAP/SMTP settings
4set my_user = "pham@mail.topo.tw"; setenv my_user "$my_user" 4#set my_user = "pham@mail.topo.tw"; setenv my_user "$my_user"
5set folder = "/home/pham/Maildir" 5set folder = "/home/pham/Maildir"
6set smtp_url = "smtp://$my_user:587"
7set smtp_pass = "$imap_pass"
8
9# Identify meself
10set from = "pham@topo.tw"
11set realname = "謝晉凡 Hsieh Chin Fan"
12set signature = "~/.config/mutt/.signature"
13set pgp_use_gpg_agent = yes
14set crypt_use_gpgme = yes
15set pgp_timeout = 300
16set pgp_sign_as = 6DD8C14A # replace 6DD8C14A with your gpg key id
17set autocrypt = yes
18
19# For contacts
20set display_filter = ~/.config/mutt/message_filter.sh
21source ~/.config/mutt/alias.topo
22source ~/.config/mutt/hooks.topo
23
24# Basic Mailbox
25set spoolfile = "+INBOX"
26set mbox= "+mbox"
27set move = yes
28set record = "+INBOX"
29set trash = "+Trash"
30set postponed = "+Drafts"
31set mask="!(INBOX|mbox|dev|Sent|Trash|Drafts|DeltaChat|civildef|hometeach|osm|STOCK|pay|keep|login|update|test|spam)"
32
33# Sidebar
34mailboxes -label '📭 [i]' +INBOX \
35 -label '📥 [m]' +mbox \
36 -label '👀 [d]' +dev \
37 -label '💬 [D]' +DeltaChat \
38 +github \
39 +JOB \
40 +promotion \
41 "+---- Watch -----" \
42 -label CivilDEF +civildef \
43 +hometeach \
44 -label OSM +osm \
45 +STOCK \
46 -label '📢 [f]' +feedback \
47 "+-- Permanent ---" \
48 -label '💲 [p]' +pay \
49 -label '🍺 [k]' +keep \
50 -label '📤 [s]' +Sent \
51 -label '🗑 [t]' -poll +Trash \
52 +login \
53 +update \
54 +service \
55 +Drafts \
56 +test \
57 +spam
58
59# Keybinding
60macro index,pager <f4> '<sync-mailbox><enter-command>source ~/.config/mutt/muttrc.topo<enter><change-folder>!<enter>'
61macro index,pager <f2> '<sync-mailbox><enter-command>source ~/.config/mutt/muttrc.gmail<enter><change-folder>!<enter>'
62macro index,pager <f3> '<sync-mailbox><enter-command>source ~/.config/mutt/muttrc.b97602041<enter><change-folder>!<enter>'
63
64# Hooks for accounts
65folder-hook imaps://imap.gmail.com/ 'source ~/.config/mutt/muttrc.gmail'
66folder-hook ~/Maildir 'source ~/.config/mutt/muttrc.b97602041'
67
68# Change mailboxes
69macro index,pager,browser gi "<change-folder>+INBOX<Return>" "Switch to INBOX folder"
70macro index,pager,browser gm "<change-folder>+mbox<Return>" "Switch to mbox folder"
71macro index,pager,browser gp "<change-folder>+pay<Return>" "Switch to pay folder"
72macro index,pager,browser gP "<change-folder>+promotion<Return>" "Switch to promotion folder"
73macro index,pager,browser gh "<change-folder>+hometeach<Return>" "Switch to hometeach folder"
74macro index,pager,browser gs "<change-folder>+Sent<Return>" "Switch to Sent folder"
75macro index,pager,browser gS "<change-folder>+spam<Return>" "Switch to spam folder"
76macro index,pager,browser gd "<change-folder>+dev<Return>" "Switch to DEV folder"
77macro index,pager,browser gD "<change-folder>+DeltaChat<Return>" "Switch to DeltaChat folder"
78macro index,pager,browser gt "<change-folder>+Trash<Return>" "Switch to Trash folder"
79macro index,pager,browser gl "<change-folder>+login<Return>" "Switch to login folder"
80macro index,pager,browser ga "<change-folder>+arch-general<Return>" "Switch to arch-general folder"
81macro index,pager,browser gk "<change-folder>+keep<Return>" "Switch to keep folder"
82macro index,pager,browser gu "<change-folder>+update<Return>" "Switch to update folder"
83macro index,pager,browser gf "<change-folder>+feedback<Return>" "Switch to feedback folder"
diff --git a/snippets/make_basic b/snippets/make_basic
new file mode 100644
index 0000000..5ab47b9
--- /dev/null
+++ b/snippets/make_basic
@@ -0,0 +1,9 @@
1.ONESHELL:
2.PHONY: some-target
3ROOT_DIR := $(dir $(realpath $(lastword $(MAKEFILE_LIST))))
4
5all:
6 echo bar
7
8some-target:
9 echo foo
diff --git a/vim/mini.lua b/vim/mini.lua
index 7ca5051..24d868b 100644
--- a/vim/mini.lua
+++ b/vim/mini.lua
@@ -907,6 +907,7 @@ require("lazy").setup({
907 vim.keymap.set("v", "<leader>on", ":ObsidianLinkNew<CR>", {}) 907 vim.keymap.set("v", "<leader>on", ":ObsidianLinkNew<CR>", {})
908 vim.keymap.set("n", "<leader>ol", ":ObsidianLinks<CR>", {}) 908 vim.keymap.set("n", "<leader>ol", ":ObsidianLinks<CR>", {})
909 require("obsidian").setup({ 909 require("obsidian").setup({
910 disable_frontmatter = true,
910 workspaces = { 911 workspaces = {
911 { 912 {
912 name = "log", 913 name = "log",