From 6e1c56020239baa1e80b93ca78bb4ace46dda674 Mon Sep 17 00:00:00 2001 From: Joseph Ferano Date: Sun, 26 Apr 2020 16:52:54 +0700 Subject: [PATCH] Fixes to bookmark. New tmux colors. Alacritty on linux --- .config/alacritty/alacritty.yml | 20 ++++++------ .config/fish/config.fish | 13 ++++---- .config/fish/functions/winpwd.fish | 1 - .config/fish/marks.fish | 51 ++++++++++++++++++++++-------- .tmux.conf | 8 ++--- 5 files changed, 58 insertions(+), 35 deletions(-) diff --git a/.config/alacritty/alacritty.yml b/.config/alacritty/alacritty.yml index c5ce129..cc72f8d 100644 --- a/.config/alacritty/alacritty.yml +++ b/.config/alacritty/alacritty.yml @@ -10,7 +10,7 @@ env: # each instance of Alacritty. If it is not present, alacritty will # check the local terminfo database and use `alacritty` if it is # available, otherwise `xterm-256color` is used. - TERM: alacritty + TERM: xterm-256color window: # Window dimensions (changes require restart) @@ -18,24 +18,24 @@ window: # Specified in number of columns/lines, not pixels. # If both are `0`, this setting is ignored. dimensions: - columns: 232 - lines: 60 + columns: 200 + lines: 55 # Window position (changes require restart) # # Specified in number of pixels. # If the position is not set, the window manager will handle the placement. position: - x: 24 - y: 22 + x: 0 + y: 0 # Window padding (changes require restart) # # Blank space added around the window in pixels. This padding is scaled # by DPI and the specified value is always added at both opposing sides. padding: - x: 5 - y: 5 + x: 0 + y: 0 # Spread additional padding evenly around the terminal content. #dynamic_padding: true @@ -49,7 +49,7 @@ window: # Values for `decorations` (macOS only): # - transparent: Title bar, transparent background and title bar buttons # - buttonless: Title bar, transparent background, but no title bar buttons - decorations: none + decorations: full # Startup Mode (changes require restart) # @@ -289,7 +289,7 @@ background_opacity: 0.75 # - (Linux/BSD) user login shell # - (Windows) powershell shell: - program: wsl + program: fish # args: # - --login @@ -297,7 +297,7 @@ shell: # # Directory the shell is started in. If this is unset, or `None`, the working # directory of the parent process will be used. -working_directory: C:\Users\josep +working_directory: /home/joe # WinPTY backend (Windows only) # diff --git a/.config/fish/config.fish b/.config/fish/config.fish index 9ccaaf7..0204252 100644 --- a/.config/fish/config.fish +++ b/.config/fish/config.fish @@ -10,23 +10,22 @@ source ~/.config/fish/dircolors.fish source ~/.config/fish/marks.fish bind \cx 'if jobs > /dev/null ; fg; fish_prompt; end' -bind \ep 'edit_dotfile' abbr -a -g c "clip.exe" abbr -a -g o wsl-open abbr -a -g dot dotfiles abbr -a -g fcon "source ~/.config/fish/config.fish" -alias ll "exa -la" +alias ls "exa --group-directories-first" +alias ll "exa -la --group-directories-first" +alias lc "exa -1 --group-directories-first" +alias lt "exa -l --sort=modified" + alias xdg-open wsl-open alias dotfiles "git --git-dir=$HOME/.dotfiles --work-tree=$HOME" -alias bms save_bookmark -alias g fuzzy_bookmarks -alias bmp print_bookmark -alias bmd delete_bookmark -alias bml list_bookmarks +alias g "bookmark go" alias restart-tmux "not pgrep tmux && tmux new -d -s delete-me \ && tmux run-shell ~/.tmux/plugins/tmux-resurrect/scripts/restore.sh \ diff --git a/.config/fish/functions/winpwd.fish b/.config/fish/functions/winpwd.fish index d13c68c..baee960 100644 --- a/.config/fish/functions/winpwd.fish +++ b/.config/fish/functions/winpwd.fish @@ -1,4 +1,3 @@ -# Defined in /tmp/fish.Ln0oz6/winpwd.fish @ line 1 function winpwd wslupath (pwd) | clip.exe end diff --git a/.config/fish/marks.fish b/.config/fish/marks.fish index ff83a7a..c0fdbc2 100644 --- a/.config/fish/marks.fish +++ b/.config/fish/marks.fish @@ -5,7 +5,9 @@ if not set -q BMS_OPENER set -gx BMS_OPENER xdg-open end -touch $BMS_FILE +if [ ! -e "$BMS_FILE" ] + touch $BMS_FILE +end set title_col (set_color cyan) set text_col (set_color normal) @@ -13,6 +15,8 @@ set error_col (set_color red) function bookmark --description "Bookmark files and directories in fish" if [ (count $argv) -lt 1 ]; or [ "-h" = $argv[1] ]; or [ "-help" = $argv[1] ]; or [ "--help" = $argv[1] ] + echo '' + echo 'Create bookmarks to all your favorite files and directories. Data written to $HOME/.config/fish/bmarks' echo '' echo -n 'add - Adds the file/directory directory as "bookmark_name". ' echo 'If no name is provided, the current working directory is used.' @@ -43,7 +47,15 @@ function bookmark --description "Bookmark files and directories in fish" end else __bookmarks_print_error "Bookmark is no longer valid for $bpath." - # TODO Add prompt for deletion + read -l -P 'Would you like to remove it?? [y/N] ' confirm + switch $confirm + case Y y + sed -i "/^$bname /d" $BMS_FILE + echo "Bookmark '$bname' removed." + __bookmarks_update_completions + case '' n N + return 1 + end end case "add" @@ -72,8 +84,8 @@ function bookmark --description "Bookmark files and directories in fish" end echo "$bname $bpath" >> $BMS_FILE set -l ftype ([ -d $bname ] && echo "file" || echo "directory") + __bookmarks_update_completions echo "Bookmark '$bname' added for $ftype $bpath" - # __bookmarks_update_completions case "remove" if [ (count $argv) -lt 2 ] @@ -85,7 +97,8 @@ function bookmark --description "Bookmark files and directories in fish" __bookmarks_print_error "No bookmark by the name of $bname exists." return 1 end - sed -i "/^$bname /d" bmarks + sed -i "/^$bname /d" $BMS_FILE + __bookmarks_update_completions echo "Bookmark '$bname' removed." case "list" @@ -121,14 +134,26 @@ function __bookmarks_print_error end function __bookmarks_update_completions - cat $BMS_FILE | grep "^export DIR_" | sed "s/^export /set -x /" | sed "s/=/ /" | . - set -x _marks (env | grep "^DIR_" | sed "s/^DIR_//" | cut -f1 -d "=" | tr '\n' ' ') - complete -c print_bookmark -a $_marks -f - complete -c delete_bookmark -a $_marks -f - complete -c go_to_bookmark -a $_marks -f - if not set -q NO_FISHMARKS_COMPAT_ALIASES - complete -c p -a $_marks -f - complete -c d -a $_marks -f - complete -c g -a $_marks -f + set -l bmarks $HOME/.config/fish/bmarks + set -l cmds add remove go list + set -l cnd __fish_seen_subcommand_from $cmds + # set -l sub_cmd_cnd "(not __fish_seen_subcommand_from) $cmds" + complete -f -c bookmark -a "$cmds[1]" -n "not $cnd" -d "Description 1 with more words hello there" + complete -f -c bookmark -a "$cmds[2]" -n "not $cnd" -d "Description 2 how about this will this help create the other style?" + complete -f -c bookmark -a "$cmds[3]" -n "not $cnd" -d "Description 3" + complete -f -c bookmark -a "$cmds[4]" -n "not $cnd" -d "Description 3" + + for bmark in (cat $bmarks) + set -l bname (echo $bmark | cut -f1 -d' ') + set -l bpath (echo $bmark | cut -f2- -d' ') + if [ -e "$bpath" ] + set description (echo -n $bpath; [ -d $bpath ] && echo -n ' - Dir' || echo -n ' - File') + else + set description "Bookmark target no longer exists" + end + + complete -x -c bookmark -a "$bname" -n "__fish_seen_subcommand_from go remove" -d "$description" end + + complete -c g -w bookmark end diff --git a/.tmux.conf b/.tmux.conf index 8200569..9bfc22d 100644 --- a/.tmux.conf +++ b/.tmux.conf @@ -76,10 +76,10 @@ set-window-option -g window-status-current-format '#[bg=colour254,fg=black] [#I] set -g status-right '#[bg=cyan] %H:%M #[bg=green] %A, %e %b %Y ' set -g status-left-length 100 -set -g window-style 'fg=colour248,bg=black' -set -g window-active-style 'fg=colour255,bg=colour237' -set -g pane-border-style 'fg=colour235,bg=colour238' -set -g pane-active-border-style 'fg=white,bg=colour236' +set -g window-style 'fg=colour248,bg=colour233' +set -g window-active-style 'fg=colour255,bg=colour235' +set -g pane-border-style 'fg=colour235,bg=default' +set -g pane-active-border-style 'fg=white,bg=default' set -g @resurrect-capture-pane-contents 'on' set -g @resurrect-processes 'ranger'