Initial commit.
This commit is contained in:
		
						commit
						fb9d04b7ef
					
				
					 28 changed files with 2359 additions and 0 deletions
				
			
		
							
								
								
									
										69
									
								
								.config/zsh/functions.zsh
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										69
									
								
								.config/zsh/functions.zsh
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,69 @@
 | 
			
		|||
#!/bin/sh
 | 
			
		||||
# Open a script in path with vim quicly
 | 
			
		||||
vish () {
 | 
			
		||||
    nvim $(which $1)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# Create a directory and change into it
 | 
			
		||||
md () {
 | 
			
		||||
    mkdir -p "$@" && cd "$@"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# Move a file and create a link in it's place
 | 
			
		||||
mvln () {
 | 
			
		||||
    from=$(readlink -f $1)
 | 
			
		||||
    to="$2"
 | 
			
		||||
    [ ! -d "$(dirname $to)" ] && mkdir -p "$(dirname $to)"
 | 
			
		||||
    mv $from $to
 | 
			
		||||
    ln -s $to $from
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# Find my script and let me edit them
 | 
			
		||||
se() {
 | 
			
		||||
    fd . ~/bin -L --type f --color=never | fzf --prompt "Choose script to edit: " \
 | 
			
		||||
        --preview 'bat --color=always --style=plain --pager=never {}' | xargs -r $EDITOR
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# List my config and open the dir in a editor
 | 
			
		||||
ce() {
 | 
			
		||||
    current=$(pwd)
 | 
			
		||||
    dir=$(fd . ~/.config -L --maxdepth 1 --color=never | fzf --prompt \
 | 
			
		||||
        "Choose config to edit: " --preview 'tree -a -C {}')
 | 
			
		||||
    [ "$dir" = "" ] && return
 | 
			
		||||
    cd "$dir" && nvim .
 | 
			
		||||
    cd "$current"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# Copy current working directory
 | 
			
		||||
cpdir() {
 | 
			
		||||
    pwd | tr -d "\r\n" | xclip -sel c
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# Copy content of a file.
 | 
			
		||||
cf() {
 | 
			
		||||
    cat $1 | xclip -sel c
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# nnn
 | 
			
		||||
n () {
 | 
			
		||||
    # Block nesting of nnn in subshells
 | 
			
		||||
    [ "${NNNLVL:-0}" -eq 0 ] || {
 | 
			
		||||
        echo "nnn is already running"
 | 
			
		||||
        return
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    # Tempfile location
 | 
			
		||||
    NNN_TMPFILE="${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.lastd"
 | 
			
		||||
 | 
			
		||||
    nnn "$@"
 | 
			
		||||
 | 
			
		||||
    [ ! -f "$NNN_TMPFILE" ] || {
 | 
			
		||||
        . "$NNN_TMPFILE"
 | 
			
		||||
        rm -f "$NNN_TMPFILE" > /dev/null
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# upfast
 | 
			
		||||
upfast () {
 | 
			
		||||
    curl -F "file=@$(readlink -f $1)" "https://upfast.cronyakatsuki.xyz/"
 | 
			
		||||
}
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue