Last active
August 29, 2015 14:04
-
-
Save jimmed/29ce84bd28dda0fdca8a to your computer and use it in GitHub Desktop.
My config.fish
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Aliases to common git methods | |
function gs; git status --short $argv; end; | |
function gd; git diff --color $argv; end; | |
function gf; git fetch -p; end; | |
function gpl; git pull $argv; end; | |
function gps; git push $argv; end; | |
function gch; git checkout $argv; end; | |
function gb; git branch $argv; end; | |
function ga; git add $argv; end; | |
function gco; git commit -m $argv; end; | |
# Just in case it's ever disabled :'( | |
git config --global --add color.ui true | |
# Handy alias for ls -la | |
function la; ls -la $argv; end; | |
# I edit my config too much | |
function fish-edit-config -d "Opens the fish configuration file for editing, and reloads it on quit" | |
set -l configPath ~/.config/fish/config.fish | |
vim $configPath | |
and . $configPath | |
end | |
# Helper methods | |
function read_confirm | |
while true | |
read -l -p read_confirm_prompt confirm | |
switch $confirm | |
case Y y | |
return 0 | |
case '' N n | |
return 1 | |
end | |
end | |
end | |
function read_confirm_prompt | |
echo 'Do you want to continue? [Y/n] ' | |
end | |
# Methods for listing/deleting untracked files in git | |
function git-show-untracked-files -d "Shows untracked files in the repository" | |
echo (gs | grep -E '^\?\?' | cut -c 4-) | |
end | |
function git-delete-untracked-files -d "Deletes all untracked files in the repository. Dangerous!" | |
set -l files (git-show-untracked-files) | |
if test $files | |
echo "The following files will be deleted by this operation:" | |
echo $files | |
if read_confirm | |
for f in $files | |
rm $f | |
and echo "Deleted" $f | |
end | |
end | |
else | |
echo "There are no untracked files to delete." | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment