From 895b779eaba0ab715b0663ea4d1f002af1282768 Mon Sep 17 00:00:00 2001 From: Noah Masur <7386960+nmasur@users.noreply.github.com> Date: Wed, 12 May 2021 18:59:22 -0400 Subject: [PATCH] fcd and clean up fish --- .gitignore | 1 + fd/fdignore.symlink | 1 + fish.configlink/functions/abbrs.fish | 3 +-- fish.configlink/functions/fcd.fish | 13 ++++++++++--- .../functions/fish_user_key_bindings.fish | 1 + fish.configlink/functions/vim.fish | 4 ---- rg/rgignore.symlink | 1 + 7 files changed, 15 insertions(+), 9 deletions(-) delete mode 100644 fish.configlink/functions/vim.fish diff --git a/.gitignore b/.gitignore index 3b2e07c..4a08331 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ nvim.configlink/.netrwhist nvim.configlink/plugged/** nvim.configlink/autoload/** fish.configlink/config.fish.bac +fish.configlink/functions/vim.fish fish_variables homebrew/*.lock.json *.bak diff --git a/fd/fdignore.symlink b/fd/fdignore.symlink index 1426cab..f385e61 100644 --- a/fd/fdignore.symlink +++ b/fd/fdignore.symlink @@ -1,6 +1,7 @@ !.env* !.github/ !.gitignore +!*.tfvars .terraform/ .target/ /Library/ diff --git a/fish.configlink/functions/abbrs.fish b/fish.configlink/functions/abbrs.fish index 9a47a4c..c7cd136 100644 --- a/fish.configlink/functions/abbrs.fish +++ b/fish.configlink/functions/abbrs.fish @@ -8,11 +8,9 @@ function abbrs --description 'All abbreviations' abbr -a ll 'ls -alhF' abbr -a lf 'ls -lh | fzf' abbr -a c 'cd' - abbr -a fcd 'cd (fd -t d . ~ | fzf)' abbr -a -- - 'cd -' abbr -a proj 'cd $PROJ' abbr -a mkd 'mkdir -pv' - alias --save fcd 'set jump (fd -t d . ~ | fzf); and cd $jump' # Tmux abbr -a ta 'tmux attach-session' @@ -54,6 +52,7 @@ function abbrs --description 'All abbreviations' alias --save vim='nvim' abbr -a vimrc 'vim $HOME/.config/nvim/init.vim' else + alias --save vim='vim' abbr -a vimrc 'vim $HOME/.vimrc' end abbr -a v 'vim' diff --git a/fish.configlink/functions/fcd.fish b/fish.configlink/functions/fcd.fish index be2753f..0df4f8a 100644 --- a/fish.configlink/functions/fcd.fish +++ b/fish.configlink/functions/fcd.fish @@ -1,4 +1,11 @@ -# Defined via `source` -function fcd --wraps='set jump (fd -t d . ~ | fzf); and cd $jump' --description 'alias fcd set jump (fd -t d . ~ | fzf); and cd $jump' - set jump (fd -t d . ~ | fzf); and cd $jump $argv; +function fcd --description 'Jump to directory' -a 'directory' + if test -z $directory + set directory "$HOME" + end + if ! test -d $directory + echo "Directory not found: $directory" + return 1 + end + set jump (fd -t d . $directory | fzf) + and cd $jump $argv; end diff --git a/fish.configlink/functions/fish_user_key_bindings.fish b/fish.configlink/functions/fish_user_key_bindings.fish index 7861770..2d5afcd 100644 --- a/fish.configlink/functions/fish_user_key_bindings.fish +++ b/fish.configlink/functions/fish_user_key_bindings.fish @@ -5,4 +5,5 @@ function fish_user_key_bindings bind -M insert \ce 'recent' bind -M insert \cg 'commandline-git-commits' bind -M insert \x1F accept-autosuggestion + bind -M default \x1F accept-autosuggestion end diff --git a/fish.configlink/functions/vim.fish b/fish.configlink/functions/vim.fish deleted file mode 100644 index b567dfb..0000000 --- a/fish.configlink/functions/vim.fish +++ /dev/null @@ -1,4 +0,0 @@ -# Defined via `source` -function vim --wraps=nvim --description 'alias vim=nvim' - nvim $argv; -end diff --git a/rg/rgignore.symlink b/rg/rgignore.symlink index 6412c7e..6dd3b43 100644 --- a/rg/rgignore.symlink +++ b/rg/rgignore.symlink @@ -1,6 +1,7 @@ !.env* !.github/ !.gitignore +!*.tfvars .terraform/ .target/ /Library/