mirror of
https://codeberg.org/leana8959/.files.git
synced 2025-12-07 07:09:15 +00:00
add(nvim): improved keymaps
This commit is contained in:
parent
9e9b03a7a1
commit
a1aff2d68e
9 changed files with 75 additions and 90 deletions
|
|
@ -1,15 +1,13 @@
|
|||
# OS-based aliases
|
||||
if test (uname) = "Linux"
|
||||
alias chmod='chmod --preserve-root'
|
||||
alias chown='chown --preserve-root'
|
||||
else if test (uname) = "Darwin"
|
||||
alias hide_desktop='defaults write com.apple.finder CreateDesktop false; killall Finder'
|
||||
alias show_desktop='defaults write com.apple.finder CreateDesktop true; killall Finder'
|
||||
alias reset_launchpad='defaults write com.apple.dock ResetLaunchPad -bool true; killall Dock'
|
||||
alias add_spacer_tile='defaults write com.apple.dock persistent-apps -array-add \'{tile-type="small-spacer-tile";}\'; killall Dock'
|
||||
|
||||
else
|
||||
# Neither, do nothing
|
||||
switch $uname
|
||||
case "Linux"
|
||||
alias chmod='chmod --preserve-root'
|
||||
alias chown='chown --preserve-root'
|
||||
case "Darwin"
|
||||
alias hide_desktop='defaults write com.apple.finder CreateDesktop false; killall Finder'
|
||||
alias show_desktop='defaults write com.apple.finder CreateDesktop true; killall Finder'
|
||||
alias reset_launchpad='defaults write com.apple.dock ResetLaunchPad -bool true; killall Dock'
|
||||
alias add_spacer_tile='defaults write com.apple.dock persistent-apps -array-add \'{tile-type="small-spacer-tile";}\'; killall Dock'
|
||||
end
|
||||
|
||||
## Git
|
||||
|
|
@ -68,6 +66,8 @@ abbr ip 'curl ipinfo.io'
|
|||
abbr k 'killall'
|
||||
abbr o 'open'
|
||||
abbr o. 'open .'
|
||||
abbr :q exit
|
||||
abbr :Q exit
|
||||
|
||||
## Preferences
|
||||
abbr vp 'cd ~/.dotfiles/.config/nvim/lua/ && nvim'
|
||||
|
|
|
|||
21
.config/fish/functions/tmux_attach.fish
Normal file
21
.config/fish/functions/tmux_attach.fish
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
function tmux_attach
|
||||
|
||||
if test -z $argv
|
||||
set -f cmd "fish"
|
||||
else
|
||||
set -f cmd "$argv"
|
||||
end
|
||||
|
||||
set -f choice (string join ';' "new" (tmux list-sessions -F "#{session_name}") | tr ';' '\n' | fzf)
|
||||
switch $choice
|
||||
case ""
|
||||
case "new"
|
||||
read -l -P "How would you like to name this session? " prefix
|
||||
if not test -z $prefix
|
||||
set prefix $prefix"@"
|
||||
end
|
||||
tmux new-session -s "$prefix""$PWD" "$cmd"
|
||||
case "*"
|
||||
tmux attach-session -t "$choice"
|
||||
end
|
||||
end
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
# Name each session with the name of the directory where tmux is invoked
|
||||
# If there's already a session present for that directory, fuzzy search your way through
|
||||
function tmux_sessionizer --description 'manages tmux sessions'
|
||||
function tmux_sessionizer --description 'manage tmux sessions'
|
||||
tmux start-server
|
||||
|
||||
if test -z $argv
|
||||
|
|
@ -16,16 +16,7 @@ function tmux_sessionizer --description 'manages tmux sessions'
|
|||
tmux new-session -s "$PWD" "$cmd"
|
||||
else
|
||||
# attach to existing session(s)
|
||||
set -f choice (string join ';' "new" (tmux list-sessions -F "#{session_name}") | tr ';' '\n' | fzf)
|
||||
|
||||
if test -z $choice
|
||||
echo "[exited fzf]"
|
||||
else if test $choice = "new"
|
||||
read -l -P "How would you like to name this session? " custom_name
|
||||
tmux new-session -s "$custom_name"@"$PWD" "$cmd"
|
||||
else
|
||||
tmux attach-session -t "$choice"
|
||||
end
|
||||
tmux_attach $argv
|
||||
end
|
||||
|
||||
commandline --function repaint
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue