mirror of
https://github.com/m-housh/dotfiles.git
synced 2026-02-14 06:12:34 +00:00
Adds zsh functions, needs work on moving some items
This commit is contained in:
@@ -32,17 +32,6 @@ export LESSHISTFILE="-"
|
||||
|
||||
#------------------------------ path ------------------------------
|
||||
|
||||
path_append() {
|
||||
declare arg
|
||||
for arg in "$@"; do
|
||||
test -d "$arg" || continue
|
||||
PATH=${PATH//":$arg:"/:}
|
||||
PATH=${PATH/#"$arg:"/}
|
||||
PATH=${PATH/%":$arg"/}
|
||||
export PATH="${PATH:+"$PATH:"}$arg"
|
||||
done
|
||||
} && export path_append
|
||||
|
||||
path_prepend() {
|
||||
declare arg
|
||||
for arg in "$@"; do
|
||||
@@ -76,12 +65,6 @@ path_prepend \
|
||||
"$HOME/.local/bin" \
|
||||
"$SCRIPTS"
|
||||
|
||||
fpath_prepend \
|
||||
"$(brew --prefix)/share/zsh/site-functions" \
|
||||
"$(brew --prefix)/share/zsh-completions" \
|
||||
"$ZDOTDIR/completions" \
|
||||
"$HOME/.local/completions"
|
||||
|
||||
#------------------------------ history ------------------------------
|
||||
setopt appendhistory # append to history
|
||||
setopt sharehistory # share history across multiple sessions
|
||||
@@ -166,24 +149,22 @@ alias tss='~/.local/scripts/tmux-sessionator --choose'
|
||||
alias tls='tmux list-sessions'
|
||||
alias temp='cd $(mktemp -d)'
|
||||
alias vi='nvim'
|
||||
alias n='unset VIMINIT && unset MYVIMRC && nvim'
|
||||
alias nvim='unset VIMINIT && unset MYVIMRC && nvim'
|
||||
alias nvim-mhoush='NVIM_APPNAME=m-housh && nvim'
|
||||
alias nvim-kickstart='NVIM_APPNAME=kickstart nvim'
|
||||
alias nvim-lazy='NVIM_APPNAME=lazy nvim'
|
||||
|
||||
|
||||
#------------------------------ functions ------------------------------
|
||||
|
||||
# Create a directory and move into it.
|
||||
mkcd() {
|
||||
local dir="$1"
|
||||
mkdir -p "$dir" && cd "$dir"
|
||||
} && export mkcd
|
||||
|
||||
#------------------------------ local configs ------------------------------
|
||||
_source_if "$ZDOTDIR/.zshrc-local"
|
||||
|
||||
# [ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
|
||||
#------------------------------ functions ------------------------------
|
||||
fpath_prepend \
|
||||
"$(brew --prefix)/share/zsh/site-functions" \
|
||||
"$(brew --prefix)/share/zsh-completions" \
|
||||
"$ZDOTDIR/completions" \
|
||||
"$HOME/.local/completions" \
|
||||
"$ZDOTDIR/functions"
|
||||
|
||||
autoload -Uz $fpath[1]/*(.:t)
|
||||
|
||||
|
||||
#test -d "$HOME/.tea" && source <("$HOME/.tea/tea.xyz/v*/bin/tea" --magic=zsh --silent)
|
||||
|
||||
17
zsh/config/functions/n
Executable file
17
zsh/config/functions/n
Executable file
@@ -0,0 +1,17 @@
|
||||
#!/usr/bin/env zsh
|
||||
|
||||
# Open's neovim.
|
||||
#
|
||||
# If the argument passed in is a directory or not supplied, then
|
||||
# open neovim with telescope find files opened. Otherwise open the
|
||||
# file that is supplied.
|
||||
#
|
||||
|
||||
function n() {
|
||||
[ -d "$1" ] || [ -z "$1" ] \
|
||||
&& nvim -c ":Telescope find_files" \
|
||||
&& return 0
|
||||
|
||||
nvim "$1"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user