fish: add kp (kill process) function, other tweaks
This commit is contained in:
parent
03ec1fcc30
commit
89689156e2
@ -8,6 +8,8 @@ set fish_prompt_pwd_dir_length 0
|
||||
set -x EDITOR nvim
|
||||
set -x LANG en_US.UTF-8
|
||||
set -x MANPAGER 'nvim +Man!'
|
||||
set -x FZF_DEFAULT_COMMAND 'fd --type f --hidden --follow --exclude .git'
|
||||
set -x FZF_DEFAULT_OPTS '--height 40%'
|
||||
|
||||
# Java environment
|
||||
set JAVA_HOME_8 (/usr/libexec/java_home -v 1.8)
|
||||
@ -30,4 +32,5 @@ alias afk='pmset displaysleepnow'
|
||||
alias java8="set -gx JAVA_HOME $JAVA_HOME_8"
|
||||
alias java11="set -gx JAVA_HOME $JAVA_HOME_11"
|
||||
alias md5sum="md5 -r $argv"
|
||||
alias sha256sum="shasum -a 256 $argv"
|
||||
alias vi='nvim'
|
||||
|
@ -12,11 +12,9 @@ function compress_video --argument-names srcfile
|
||||
return 3
|
||||
end
|
||||
|
||||
set --local dstdir (dirname $srcfile)/Compressed
|
||||
set --local dstfile (dirname $srcfile)/Compressed/(basename $srcfile)
|
||||
# Output: srcfile.extension -> srcfile-compressed.mp4
|
||||
set --local dstfile (string split -r -m1 . $srcfile)[1]-compressed.mp4
|
||||
set --local preset 'Vimeo YouTube HQ 720p60'
|
||||
|
||||
mkdir -p $dstdir
|
||||
|
||||
HandBrakeCLI --preset $preset --input $srcfile --output $dstfile
|
||||
end
|
||||
|
18
fish/functions/kp.fish
Normal file
18
fish/functions/kp.fish
Normal file
@ -0,0 +1,18 @@
|
||||
function kp --description "Kill processes"
|
||||
set --local __kp__pid ''
|
||||
|
||||
if contains -- '--tcp' $argv
|
||||
set __kp__pid (lsof -Pwni tcp | sed 1d | eval "fzf $FZF_DEFAULT_OPTS -m --header='[kill:tcp]'" | awk '{print $2}')
|
||||
else
|
||||
set __kp__pid (ps -ef | sed 1d | eval "fzf $FZF_DEFAULT_OPTS -m --header='[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
|
||||
kp
|
||||
end
|
||||
end
|
8
fish/functions/move_videos.fish
Normal file
8
fish/functions/move_videos.fish
Normal file
@ -0,0 +1,8 @@
|
||||
function move_videos
|
||||
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
|
@ -15,6 +15,7 @@
|
||||
lol = log --oneline --max-count=10 --decorate=no
|
||||
ss = status --short
|
||||
st = status --long
|
||||
sw = switch
|
||||
cp = cherry-pick
|
||||
f = fetch --all --prune
|
||||
pl = pull
|
||||
@ -27,6 +28,7 @@
|
||||
can = commit --amend --no-edit
|
||||
cand = commit --amend --no-edit --date=now
|
||||
rbi = rebase --interactive
|
||||
re = restore
|
||||
rh = reset HEAD
|
||||
[color]
|
||||
ui = auto
|
||||
|
@ -17,6 +17,9 @@ call plug#end()
|
||||
set nonumber norelativenumber " show hybrid line numbers at startup
|
||||
noremap <F2> :set number! relativenumber!<CR> " toggle line numbers
|
||||
|
||||
" Disable match highlighting
|
||||
let g:loaded_matchparen=1
|
||||
|
||||
" write settings
|
||||
set confirm " confirm :q in case of unsaved changes
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user