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
 | 
			
		||||
    - src: sandbox/_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:
 | 
			
		||||
    - https://github.com/zsh-users/zsh-autosuggestions.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
 | 
			
		||||
}
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user