diff --git a/README.md b/README.md index 7379ebb..25afac7 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ My personal configuration files. ##### Usage -1. Clone this repository into `~/.dotfiles` +1. Clone this repository into `~/dotfiles` 2. Install [Homebrew](https://brew.sh/): `./install-brew.sh` 3. Install tools: `brew bundle install --file=brew/Brewfile` 4. (Optional) Install more tools: `brew bundle install --file=brew/Brewfile.opt` diff --git a/bash/.bashrc b/bash/.bashrc index 6df5a39..168fdb2 100644 --- a/bash/.bashrc +++ b/bash/.bashrc @@ -24,8 +24,9 @@ alias afk='pmset displaysleepnow' alias dnsflush='sudo killall -HUP mDNSResponder' alias java8="export JAVA_HOME=$JAVA_HOME_8" alias java11="export JAVA_HOME=$JAVA_HOME_11" -alias md5sum="md5 -r $argv" +alias md5sum="md5 -r" alias vi='nvim' +alias vim='nvim' # Do not save lines which begin with a space character # Do not save lines which match the previous history entry diff --git a/fish/.gitignore b/fish/.gitignore index f894fcd..eca9056 100644 --- a/fish/.gitignore +++ b/fish/.gitignore @@ -1,3 +1,4 @@ fish_variables fisher/ -fisher.fish +fish_user_key_bindings.fish +fzf_key_bindings.fish diff --git a/fish/config.fish b/fish/config.fish index 777385e..cac3686 100644 --- a/fish/config.fish +++ b/fish/config.fish @@ -4,15 +4,38 @@ set fish_greeting # Disable the abbreviated directory format set fish_prompt_pwd_dir_length 0 -# Set global variables +# Environment variables set -x EDITOR nvim set -x LANG en_US.UTF-8 set -x MANPAGER 'nvim +Man!' -set -x FZF_DEFAULT_COMMAND 'fd --type f' -set -x FZF_DEFAULT_OPTS '--height=40% --layout=reverse' set -x JAVA_HOME (/usr/libexec/java_home -v 1.8) set -x SBT_OPTS '-Dsbt.supershell=false' +# FZF (https://github.com/junegunn/fzf) +set -x FZF_DEFAULT_OPTS "--height=40% --layout=reverse --multi" +set -x FZF_DEFAULT_COMMAND "fd --type=file" +set -x FZF_CTRL_T_COMMAND "fd --type=file --follow" +set -x FZF_CTRL_T_OPTS "--ansi --no-height --preview 'bat --color=always {}'" +set -x FZF_CTRL_R_OPTS "--preview 'echo {}' --preview-window down:3:hidden:wrap --bind '?:toggle-preview'" +set -x FZF_ALT_C_COMMAND "fd --type=directory --follow" +set -x FZF_ALT_C_OPTS "--preview 'tree -C {} | head -200'" + +# Git prompt +set -g __fish_git_prompt_showdirtystate 1 +set -g __fish_git_prompt_showstashstate 1 +set -g __fish_git_prompt_showuntrackedfiles 1 +set -g __fish_git_prompt_showupstream 'informative' +set -g __fish_git_prompt_char_upstream_ahead '↑' +set -g __fish_git_prompt_char_upstream_behind '↓' +set -g __fish_git_prompt_char_upstream_prefix ' ' +set -g __fish_git_prompt_color_branch magenta +set -g __fish_git_prompt_color_dirtystate cyan +set -g __fish_git_prompt_color_invalidstate red +set -g __fish_git_prompt_color_stagedstate cyan +set -g __fish_git_prompt_color_stashstate cyan +set -g __fish_git_prompt_color_untrackedfiles cyan +set -g __fish_git_prompt_color_upstream yellow + # Path set --erase PATH test -d $HOME/bin ; and set -x PATH $HOME/bin @@ -24,24 +47,22 @@ test -d /usr/sbin ; and set -x PATH $PATH /usr/sbin test -d /sbin ; and set -x PATH $PATH /sbin # Aliases -alias adventure='emacs -batch -l dunnet' alias afk='pmset displaysleepnow' -alias md5sum="md5 -r $argv" -alias sha256sum="shasum -a 256 $argv" +alias md5sum='md5 -r' +alias sha256sum='shasum -a 256' alias vi='nvim' +alias vim='nvim' -# Install package manager if needed -if not functions -q fisher - curl https://git.io/fisher --create-dirs -sLo ~/.config/fish/functions/fisher.fish - fish -c fisher -end - -# Set package installation folder +# Fish package manager set -g fisher_path ~/.config/fish/fisher - -# Add packages to fish config set fish_function_path $fish_function_path[1] $fisher_path/functions $fish_function_path[2..-1] set fish_complete_path $fish_complete_path[1] $fisher_path/completions $fish_complete_path[2..-1] for file in $fisher_path/conf.d/*.fish builtin source $file 2> /dev/null end +if not functions -q fisher + echo "Installing fish-shell package manager: $fisher_path/functions/fisher.fish" + curl https://git.io/fisher --create-dirs -sLo $fisher_path/functions/fisher.fish + echo "Installing fish-shell packages..." + fish -c fisher +end diff --git a/fish/fishfile b/fish/fishfile index 3fbd4b5..8e9cef5 100644 --- a/fish/fishfile +++ b/fish/fishfile @@ -1,2 +1,4 @@ jorgebucaran/fish-bax jorgebucaran/fish-nvm +oh-my-fish/plugin-license +oh-my-fish/plugin-sublime diff --git a/fish/functions/_set_global_if_unset.fish b/fish/functions/_set_global_if_unset.fish deleted file mode 100644 index 1f64406..0000000 --- a/fish/functions/_set_global_if_unset.fish +++ /dev/null @@ -1,5 +0,0 @@ -function _set_global_if_unset --argument-names variable_name variable_value - if not set --query $variable_name - set --global $variable_name $variable_value - end -end diff --git a/fish/functions/battery.fish b/fish/functions/battery.fish index e443992..8bf1f4d 100644 --- a/fish/functions/battery.fish +++ b/fish/functions/battery.fish @@ -1,15 +1,15 @@ function battery - # Only works on Mac - if test (uname -s) != Darwin - echo "Unsupported OS: "(uname -s) - return 1 - end + # Only works on Mac + if test (uname -s) != Darwin + echo "Unsupported OS: "(uname -s) + return 1 + end - set --local battery_status (pmset -g batt | string split0) - set --local battery_charge (echo $battery_status | rg --only-matching "\d+%") - set --local power_source (echo $battery_status | rg --only-matching "[A-Za-z]+\sPower") + set --local battery_status (pmset -g batt | string split0) + set --local battery_charge (echo $battery_status | rg --only-matching "\d+%") + set --local power_source (echo $battery_status | rg --only-matching "[A-Za-z]+\sPower") - set_color green - echo "⚡️ Running on $power_source with $battery_charge charge" - set_color normal + set_color green + echo "⚡️ Running on $power_source with $battery_charge charge" + set_color normal end diff --git a/fish/functions/brew_install.fish b/fish/functions/brew_install.fish deleted file mode 100644 index 3680902..0000000 --- a/fish/functions/brew_install.fish +++ /dev/null @@ -1,12 +0,0 @@ -function brew_install --description "Select packages to install" - set --local inst_pkgs $argv - - if test (count $inst_pkgs) -eq 0 - set inst_pkgs (brew search | eval "fzf --multi --prompt='[brew:install] '") - end - - if test (count $inst_pkgs) -gt 0 - echo "Installing: $inst_pkgs" - brew install $inst_pkgs - end -end diff --git a/fish/functions/brew_uninstall.fish b/fish/functions/brew_uninstall.fish deleted file mode 100644 index 1bc19b0..0000000 --- a/fish/functions/brew_uninstall.fish +++ /dev/null @@ -1,49 +0,0 @@ -function brew_uninstall --description "Select packages to uninstall" - set --local uninst_pkgs $argv - - if test (count $uninst_pkgs) -eq 0 - set uninst_pkgs (brew leaves | eval "fzf --multi --prompt='[brew:uninstall] '") - end - - if test (count $uninst_pkgs) -gt 0 - echo "Determining package dependencies..." - - # Output is multiline with format "pkgname:" if no dependencies, otherwise "pkgname: dep1 dep2 dep3 ..." - set --local brew_deps_installed (string collect (brew deps --installed)) - - # Accumulate uninst_pkgs and their transitive dependencies - set --local uninst_pkgs_all $uninst_pkgs - for bdi in $brew_deps_installed - set --local pkg (string split ':' $bdi | head -n 1) - set --local deps (string split ' ' (string split ':' $bdi | tail -n +2)) - if contains -- $pkg $uninst_pkgs - for dep in $deps - if test -n $dep - if not contains -- $dep $uninst_pkgs_all - set uninst_pkgs_all $uninst_pkgs_all $dep - end - end - end - end - end - - # Don't uninstall packages that are still dependencies of other packages - set --local uninst_pkgs_final $uninst_pkgs_all - for bdi in $brew_deps_installed - set --local pkg (string split ':' $bdi | head -n 1) - set --local deps (string split ' ' (string split ':' $bdi | tail -n +2)) - if not contains -- $pkg $uninst_pkgs_all - for dep in $deps - if test -n $dep - if set --local index (contains --index $dep $uninst_pkgs_final) - set --erase uninst_pkgs_final[$index] - end - end - end - end - end - - echo "Uninstalling: $uninst_pkgs_final" - brew uninstall $uninst_pkgs_final - end -end diff --git a/fish/functions/_confirmation.fish b/fish/functions/confirm.fish similarity index 62% rename from fish/functions/_confirmation.fish rename to fish/functions/confirm.fish index cc96a26..1d8016b 100644 --- a/fish/functions/_confirmation.fish +++ b/fish/functions/confirm.fish @@ -1,8 +1,8 @@ -function _confirmation --description "Ask for user confirmation" +function confirm --description "Ask for user confirmation" while true - read --local --prompt-str='Are you sure you want to continue? [y/N] ' confirm + read --local --prompt-str='Are you sure you want to continue? [y/N] ' confirmed - switch $confirm + switch $confirmed case Y y return 0 case '' N n diff --git a/fish/functions/dns_flush.fish b/fish/functions/dns_flush.fish index 9d14fbe..8a1f1c6 100644 --- a/fish/functions/dns_flush.fish +++ b/fish/functions/dns_flush.fish @@ -1,8 +1,8 @@ function dns_flush - switch (uname -s) - case Darwin - sudo killall -HUP mDNSResponder - case '*' - echo "Unsupported OS: "(uname -s) - end + switch (uname -s) + case Darwin + sudo killall -HUP mDNSResponder + case '*' + echo "Unsupported OS: "(uname -s) + end end diff --git a/fish/functions/fbrew.fish b/fish/functions/fbrew.fish new file mode 100644 index 0000000..035537a --- /dev/null +++ b/fish/functions/fbrew.fish @@ -0,0 +1,78 @@ +function fbrew --description "Fuzzy homebrew" + if test (count $argv) -eq 0 + echo "Usage: fbrew " + return 1 + end + + switch $argv[1] + case i install + _fbrew_install $argv[2..-1] + case u uninstall + _fbrew_uninstall $argv[2..-1] + case '*' + echo "Unsupported command: $argv[1]" + end +end + +function _fbrew_install + set --local inst_pkgs $argv + + if test (count $inst_pkgs) -eq 0 + set inst_pkgs (brew search | eval "fzf --prompt='[brew:install] '") + end + + if test (count $inst_pkgs) -gt 0 + echo "Installing: $inst_pkgs" + brew install $inst_pkgs + end +end + +function _fbrew_uninstall + set --local uninst_pkgs $argv + + if test (count $uninst_pkgs) -eq 0 + set uninst_pkgs (brew leaves | eval "fzf --prompt='[brew:uninstall] '") + end + + if test (count $uninst_pkgs) -gt 0 + echo "Determining package dependencies..." + + # Output is multiline with format "pkgname:" if no dependencies, otherwise "pkgname: dep1 dep2 dep3 ..." + set --local brew_deps_installed (string collect (brew deps --installed)) + + # Accumulate uninst_pkgs and their transitive dependencies + set --local uninst_pkgs_all $uninst_pkgs + for bdi in $brew_deps_installed + set --local pkg (string split ':' $bdi | head -n 1) + set --local deps (string split ' ' (string split ':' $bdi | tail -n +2)) + if contains -- $pkg $uninst_pkgs + for dep in $deps + if test -n $dep + if not contains -- $dep $uninst_pkgs_all + set uninst_pkgs_all $uninst_pkgs_all $dep + end + end + end + end + end + + # Don't uninstall packages that are still dependencies of other packages + set --local uninst_pkgs_final $uninst_pkgs_all + for bdi in $brew_deps_installed + set --local pkg (string split ':' $bdi | head -n 1) + set --local deps (string split ' ' (string split ':' $bdi | tail -n +2)) + if not contains -- $pkg $uninst_pkgs_all + for dep in $deps + if test -n $dep + if set --local index (contains --index $dep $uninst_pkgs_final) + set --erase uninst_pkgs_final[$index] + end + end + end + end + end + + echo "Uninstalling: $uninst_pkgs_final" + brew uninstall $uninst_pkgs_final + end +end diff --git a/fish/functions/fish_prompt.fish b/fish/functions/fish_prompt.fish index 9ff7328..55dfc3b 100644 --- a/fish/functions/fish_prompt.fish +++ b/fish/functions/fish_prompt.fish @@ -1,14 +1,13 @@ function fish_prompt --description 'Write out the prompt' # Save status code for previous command - set -l last_status $status + set -l last_status $status # Print working directory set_color $fish_color_cwd echo -n (prompt_pwd) set_color normal - # Print Git information - fish_prompt_git_settings + # Print git information printf '%s ' (__fish_git_prompt) # Print status code for previous command, if nonzero @@ -18,6 +17,6 @@ function fish_prompt --description 'Write out the prompt' set_color normal end - # Print the final character (§) + # Print the final character echo -n "> " end diff --git a/fish/functions/fish_prompt_git_settings.fish b/fish/functions/fish_prompt_git_settings.fish deleted file mode 100644 index 0f9248b..0000000 --- a/fish/functions/fish_prompt_git_settings.fish +++ /dev/null @@ -1,21 +0,0 @@ -function fish_prompt_git_settings --description 'Configure the git prompt' - # Toggles - _set_global_if_unset __fish_git_prompt_showdirtystate 1 - _set_global_if_unset __fish_git_prompt_showstashstate 1 - _set_global_if_unset __fish_git_prompt_showuntrackedfiles 1 - _set_global_if_unset __fish_git_prompt_showupstream "informative" - - # Characters - _set_global_if_unset __fish_git_prompt_char_upstream_ahead '↑' - _set_global_if_unset __fish_git_prompt_char_upstream_behind '↓' - _set_global_if_unset __fish_git_prompt_char_upstream_prefix ' ' - - # Colors - _set_global_if_unset __fish_git_prompt_color_branch magenta - _set_global_if_unset __fish_git_prompt_color_dirtystate cyan - _set_global_if_unset __fish_git_prompt_color_invalidstate red - _set_global_if_unset __fish_git_prompt_color_stagedstate cyan - _set_global_if_unset __fish_git_prompt_color_stashstate cyan - _set_global_if_unset __fish_git_prompt_color_untrackedfiles cyan - _set_global_if_unset __fish_git_prompt_color_upstream yellow -end diff --git a/fish/functions/fkill.fish b/fish/functions/fkill.fish new file mode 100644 index 0000000..01f5135 --- /dev/null +++ b/fish/functions/fkill.fish @@ -0,0 +1,32 @@ +function fkill --description "Fuzzy kill processes" + # + # Signal Numbers: + # + # 1 HUP (hang up) + # 2 INT (interrupt) + # 3 QUIT (quit) + # 6 ABRT (abort) + # 9 KILL (non-catchable, non-ignorable kill) + # 14 ALRM (alarm clock) + # 15 TERM (software termination signal) + # + + set --local fkill_uid (id -u) + set --local fkill_pid + set --local fkill_procs + + if contains -- '--tcp' $argv + set fkill_pid (lsof -Pwni tcp | sed 1d | eval "fzf --prompt='[kill:tcp] '" | awk '{print $2}') + else + if test $fkill_uid -eq 0 + set fkill_procs (ps -ef | tail -n +2 | string collect) + else + set fkill_procs (ps -f -u $fkill_uid | tail -n +2 | string collect) + end + set fkill_pid (echo $fkill_procs | eval "fzf --prompt='[kill:process] ' --preview='ps -p {2}' --preview-window='down:3'" | awk '{print $2}') + end + + if test (count $fkill_pid) -gt 0 + echo $fkill_pid | xargs kill -9 + end +end diff --git a/fish/functions/hr.fish b/fish/functions/hr.fish index 38e8341..d1e8985 100644 --- a/fish/functions/hr.fish +++ b/fish/functions/hr.fish @@ -1,5 +1,5 @@ function hr --description "Draw horizontal rule" - set --local char '─' + set --local char '─' printf "%.s$char" (seq $COLUMNS) echo end diff --git a/fish/functions/jira.fish b/fish/functions/jira.fish new file mode 100644 index 0000000..cd3eea9 --- /dev/null +++ b/fish/functions/jira.fish @@ -0,0 +1,3 @@ +function jira + open "https://track.akamai.com/jira/browse/"$argv[1] +end diff --git a/fish/functions/jvm.fish b/fish/functions/jvm.fish index 75decf6..c09a47f 100644 --- a/fish/functions/jvm.fish +++ b/fish/functions/jvm.fish @@ -1,21 +1,21 @@ function jvm --argument-names __jvm_version - # Only works on Mac - if test (uname -s) != Darwin - echo "Unsupported OS: "(uname -s) - return 1 - end + # Only works on Mac + if test (uname -s) != Darwin + echo "Unsupported OS: "(uname -s) + return 1 + end - if test -z "$__jvm_version" - echo "Usage: jvm " - #echo - #/usr/libexec/java_home --verbose - return 2 - end + if test -z "$__jvm_version" + echo "Usage: jvm " + #echo + #/usr/libexec/java_home --verbose + return 2 + end - set --local __jvm_homedir (/usr/libexec/java_home -v $__jvm_version) + set --local __jvm_homedir (/usr/libexec/java_home -v $__jvm_version) - if test $status -eq 0 - echo "Setting JAVA_HOME to $__jvm_homedir" - set -gx JAVA_HOME $__jvm_homedir - end + if test $status -eq 0 + echo "Setting JAVA_HOME to $__jvm_homedir" + set -gx JAVA_HOME $__jvm_homedir + end end diff --git a/fish/functions/kp.fish b/fish/functions/kp.fish deleted file mode 100644 index 5fa3f56..0000000 --- a/fish/functions/kp.fish +++ /dev/null @@ -1,17 +0,0 @@ -function kp --description "Kill processes" - set --local __kp__pid '' - - if contains -- '--tcp' $argv - set __kp__pid (lsof -Pwni tcp | sed 1d | eval "fzf --multi --prompt='[kill:tcp] '" | awk '{print $2}') - else - set __kp__pid (ps -ef | sed 1d | eval "fzf --multi --prompt='[kill:process] '" | awk '{print $2}') - end - - if test "x$__kp__pid" != "x" - if test "x$argv[1]" != "x" - echo $__kp__pid | xargs kill $argv[1] - else - echo $__kp__pid | xargs kill -9 - end - end -end diff --git a/fish/functions/motd.fish b/fish/functions/motd.fish index 2d5936a..1f6c45d 100644 --- a/fish/functions/motd.fish +++ b/fish/functions/motd.fish @@ -1,11 +1,11 @@ function motd --description "Message of the day!" - set --local daily_msg + set --local daily_msg - if contains -- '--chuck-norris' $argv - set daily_msg (curl -s 'https://api.chucknorris.io/jokes/random' | jq --raw-output '.value') - else - set daily_msg (fortune) - end + if contains -- '--chuck-norris' $argv + set daily_msg (curl -s 'https://api.chucknorris.io/jokes/random' | jq --raw-output '.value') + else + set daily_msg (fortune) + end - cowsay $daily_msg + cowsay $daily_msg end diff --git a/fish/functions/path_search.fish b/fish/functions/path_search.fish deleted file mode 100644 index 17fc404..0000000 --- a/fish/functions/path_search.fish +++ /dev/null @@ -1,13 +0,0 @@ -function path_search --description "Search your path for an executable" - set --local loc (echo $PATH | tr ' ' '\n' | eval "fzf --prompt='[find:path] '") - - if test (count $loc) = 1 - set --local cmd (rg --files -L $loc | rev | cut -d'/' -f1 | rev | tr ' ' '\n' | eval "fzf --preview='head -20 $loc/{}' --prompt='[find:exe] '") - if test (count $cmd) = 1 - echo $cmd - else - path_search - end - end -end - diff --git a/fish/functions/pip_upgrade.fish b/fish/functions/pip_upgrade.fish index 4165f86..a0f8517 100644 --- a/fish/functions/pip_upgrade.fish +++ b/fish/functions/pip_upgrade.fish @@ -1,4 +1,4 @@ -function pip3_upgrade --description "Upgrade python packages (pip3)" +function pip_upgrade --description "Upgrade python packages" set --local py_pkgs_outdated (pip3 list --outdated | awk 'NR > 2 {print $1}') if test (count $py_pkgs_outdated) = 0 diff --git a/fish/functions/port_listener.fish b/fish/functions/port_listener.fish new file mode 100644 index 0000000..7f92dde --- /dev/null +++ b/fish/functions/port_listener.fish @@ -0,0 +1,7 @@ +function port_listener --argument-names port + if test -n "$port" + lsof -n -i :$port | rg LISTEN + else + lsof -n -i | rg LISTEN + end +end diff --git a/fish/functions/portlistener.fish b/fish/functions/portlistener.fish deleted file mode 100644 index fc845f2..0000000 --- a/fish/functions/portlistener.fish +++ /dev/null @@ -1,7 +0,0 @@ -function portlistener --argument-names port - if test -n "$port" - lsof -n -i :$port | grep LISTEN - else - lsof -n -i | grep LISTEN - end -end diff --git a/fish/functions/pull_request.fish b/fish/functions/pull_request.fish new file mode 100644 index 0000000..e2648a6 --- /dev/null +++ b/fish/functions/pull_request.fish @@ -0,0 +1,17 @@ +function pull_request --argument-names target_branch source_branch + if test -z "$target_branch" + set target_branch (git symbolic-ref refs/remotes/origin/HEAD | sed 's@^refs/remotes/origin/@@') + echo "Using default branch as target: "$target_branch + end + if test -z "$source_branch" + set source_branch (git branch --show-current) + echo "Using current branch as source: "$source_branch + end + + # Format: ssh://git@git.source.akamai.com:7999//.git + set --local origin (git remote get-url origin) + set --local project (string split -r -m2 '/' $origin)[-2] + set --local repo (basename -s .git $origin) + + open "https://git.source.akamai.com/projects/"$project"/repos/"$repo"/compare/commits?sourceBranch=refs%2Fheads%2F"$source_branch"&targetBranch=refs%2Fheads%2F"$target_branch +end diff --git a/fish/functions/video_compress.fish b/fish/functions/video_compress.fish index 09543bc..0690104 100644 --- a/fish/functions/video_compress.fish +++ b/fish/functions/video_compress.fish @@ -1,20 +1,20 @@ function video_compress --argument-names srcfile - if test -z "$srcfile" - echo "Error: missing argument" - return 1 - end - if not test -f "$srcfile" - echo "Error: not a regular file: $srcfile" - return 2 - end - if not command --search --quiet HandBrakeCLI - echo "Error: HandBrakeCLI is required" - return 3 - end + if test -z "$srcfile" + echo "Error: missing argument" + return 1 + end + if not test -f "$srcfile" + echo "Error: not a regular file: $srcfile" + return 2 + end + if not command --search --quiet HandBrakeCLI + echo "Error: HandBrakeCLI is required" + return 3 + end - # Output: srcfile.extension -> srcfile-compressed.mp4 - set --local dstfile (string split -r -m1 . $srcfile)[1]-compressed.mp4 - set --local preset 'Vimeo YouTube HQ 720p60' + # Output: srcfile.extension -> srcfile-compressed.mp4 + set --local dstfile (string split -r -m1 . $srcfile)[1]-compressed.mp4 + set --local preset 'Vimeo YouTube HQ 720p60' - HandBrakeCLI --preset $preset --input $srcfile --output $dstfile + HandBrakeCLI --preset $preset --input $srcfile --output $dstfile end diff --git a/fish/functions/video_transfer.fish b/fish/functions/video_transfer.fish index 5d14705..9b6e71c 100644 --- a/fish/functions/video_transfer.fish +++ b/fish/functions/video_transfer.fish @@ -1,8 +1,8 @@ function video_transfer - for folder in (find ~/Pictures/GoPro -type d -mindepth 1 -maxdepth 1) - mkdir -p ~/Movies/GoPro/$folder - pushd ~/Pictures/GoPro/$folder - fd --extension mp4 --exec mv -i -v "{}" ~/Movies/GoPro/$folder/"{/}" - popd - end + for folder in (find ~/Pictures/GoPro -type d -mindepth 1 -maxdepth 1) + mkdir -p ~/Movies/GoPro/$folder + pushd ~/Pictures/GoPro/$folder + fd --extension mp4 --exec mv -i -v "{}" ~/Movies/GoPro/$folder/"{/}" + popd + end end diff --git a/git/config b/git/config index db437c4..aa84667 100644 --- a/git/config +++ b/git/config @@ -29,7 +29,8 @@ cand = commit --amend --no-edit --date=now rbi = rebase --interactive re = restore - rh = reset HEAD + res = restore --staged + rh = reset -q HEAD -- [color] ui = auto [color "branch"] diff --git a/install-symlinks.sh b/install-symlinks.sh index c113d3d..70461fb 100755 --- a/install-symlinks.sh +++ b/install-symlinks.sh @@ -1,6 +1,6 @@ #!/bin/sh -DOTFILES="$HOME/.dotfiles" +DOTFILES="$HOME/dotfiles" # Create required directories before making links mkdir -p "$HOME/.config" diff --git a/install.sh b/install.sh index 481da7e..7260b99 100755 --- a/install.sh +++ b/install.sh @@ -1,6 +1,6 @@ #!/bin/sh -DOTFILES="$HOME/.dotfiles" +DOTFILES="$HOME/dotfiles" # Install plugin manager for Neovim, if it doesn't exist VIM_PLUG_SRC="https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim" @@ -15,7 +15,7 @@ grep -q /usr/local/bin/bash /etc/shells || echo /usr/local/bin/bash | sudo tee - grep -q /usr/local/bin/fish /etc/shells || echo /usr/local/bin/fish | sudo tee -a /etc/shells # Make fish the default shell -chsh -s /usr/local/bin/fish +sudo chsh -s /usr/local/bin/fish `whoami` # Install symlinks "$DOTFILES/install-symlinks.sh"