Add layout and note plugins
This commit is contained in:
parent
e13e70de6b
commit
ada3cb7d3d
@ -18,6 +18,10 @@
|
|||||||
dst: ~/.local/share/zsh/site-functions/prompt_fresh_setup
|
dst: ~/.local/share/zsh/site-functions/prompt_fresh_setup
|
||||||
- src: sandbox/_sandbox
|
- src: sandbox/_sandbox
|
||||||
dst: ~/.local/share/zsh/site-functions/_sandbox
|
dst: ~/.local/share/zsh/site-functions/_sandbox
|
||||||
|
- src: layout/_layout
|
||||||
|
dst: ~/.local/share/zsh/site-functions/_layout
|
||||||
|
- src: notes/_note
|
||||||
|
dst: ~/.local/share/zsh/site-functions/_note
|
||||||
- repo:
|
- repo:
|
||||||
- https://github.com/zsh-users/zsh-autosuggestions.git
|
- https://github.com/zsh-users/zsh-autosuggestions.git
|
||||||
- https://github.com/zsh-users/zsh-history-substring-search.git
|
- https://github.com/zsh-users/zsh-history-substring-search.git
|
||||||
|
14
layout/_layout
Normal file
14
layout/_layout
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
#compdef layout
|
||||||
|
|
||||||
|
__get_layouts() {
|
||||||
|
ls -1 ~/.config/tmux/layouts 2>/dev/null | \
|
||||||
|
while read -r layout; do echo $layout; done
|
||||||
|
}
|
||||||
|
|
||||||
|
__layouts() {
|
||||||
|
local -a layouts
|
||||||
|
layouts=(${(fo)"$(__get_layouts)"})
|
||||||
|
_describe 'layout' layouts
|
||||||
|
}
|
||||||
|
|
||||||
|
_arguments ':layout:__layouts'
|
10
layout/layout.plugin.zsh
Normal file
10
layout/layout.plugin.zsh
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
layout() {
|
||||||
|
if [[ "$1" == "" ]]; then
|
||||||
|
echo "usage: layout <layout> [name]"
|
||||||
|
else
|
||||||
|
tmux source-file ~/.config/tmux/layouts/$1
|
||||||
|
if [[ "$2" != "" ]]; then
|
||||||
|
tmux rename-window $2
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
13
notes/_note
Normal file
13
notes/_note
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
#compdef note
|
||||||
|
|
||||||
|
__get_notes() {
|
||||||
|
ls -1 ~/Sync/Notes 2>/dev/null | while read -r note; do echo $note; done
|
||||||
|
}
|
||||||
|
|
||||||
|
__notes() {
|
||||||
|
local -a notes
|
||||||
|
notes=(${(fo)"$(__get_notes)"})
|
||||||
|
_describe 'notes' notes
|
||||||
|
}
|
||||||
|
|
||||||
|
_arguments ':notes:__notes'
|
8
notes/notes.plugin.zsh
Normal file
8
notes/notes.plugin.zsh
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
# TODO: Support opening multiple notes in buffers or tabs
|
||||||
|
note() {
|
||||||
|
if [[ "$1" == "" ]]; then
|
||||||
|
echo "usage: note \"<title>\""
|
||||||
|
else
|
||||||
|
vim -c "Note $1"
|
||||||
|
fi
|
||||||
|
}
|
6
zshrc
6
zshrc
@ -30,6 +30,12 @@ source-plugin build
|
|||||||
# Project sandboxing commands
|
# Project sandboxing commands
|
||||||
source-plugin sandbox
|
source-plugin sandbox
|
||||||
|
|
||||||
|
# Layout tmux window commands
|
||||||
|
source-plugin layout
|
||||||
|
|
||||||
|
# Note taking commands
|
||||||
|
source-plugin notes
|
||||||
|
|
||||||
# Remove duplicates from history
|
# Remove duplicates from history
|
||||||
setopt hist_ignore_all_dups
|
setopt hist_ignore_all_dups
|
||||||
setopt hist_reduce_blanks
|
setopt hist_reduce_blanks
|
||||||
|
Loading…
x
Reference in New Issue
Block a user