From 8e5a9c49bde602349dc0bf17511bceb0fab232ae Mon Sep 17 00:00:00 2001 From: Chen Asraf Date: Wed, 14 Jun 2023 17:30:51 +0300 Subject: [PATCH] feat: updates --- .config/nvim/lua/casraf/remap.lua | 3 +++ .zshrc | 17 +++++++++-------- exports.sh | 9 +++++++-- functions.sh | 24 ++++++++++++++---------- sources.sh | 10 ---------- zsh_init.sh | 1 - 6 files changed, 33 insertions(+), 31 deletions(-) delete mode 100755 sources.sh diff --git a/.config/nvim/lua/casraf/remap.lua b/.config/nvim/lua/casraf/remap.lua index 5ffa9256..bf3ec8c4 100644 --- a/.config/nvim/lua/casraf/remap.lua +++ b/.config/nvim/lua/casraf/remap.lua @@ -116,3 +116,6 @@ vim.keymap.set("n", "Srv", function() vim.cmd(":silent !open http://localhost:5500") vim.cmd("belowright split | terminal " .. cmd) end, { desc = "Serve working directory" }) + +vim.cmd("command! Pwd :echo expand('%:p:h')") +vim.cmd("command! Pwf :echo expand('%:p')") diff --git a/.zshrc b/.zshrc index 2d0412c0..fa8fb7b9 100644 --- a/.zshrc +++ b/.zshrc @@ -18,20 +18,21 @@ export fpath=("$DOTFILES/completions" $fpath) zstyle ':completion:*:*:*:*:*' menu select # Use ESC to edit the current command line: -autoload -U edit-command-line -zle -N edit-command-line -# bindkey '\033\033' edit-command-line -bindkey -M vicmd V edit-command-line -bindkey "^[[1;3C" forward-word -bindkey "^[[1;3D" backward-word +# check if edit-command-line not already loaded +if [[ ! -n "$(bindkey -L | grep edit-command-line)" ]]; then + autoload -U edit-command-line + zle -N edit-command-line + bindkey -M vicmd V edit-command-line + # back/forward word + bindkey "^[[1;3C" forward-word + bindkey "^[[1;3D" backward-word +fi # echo 'Loading '$DOTFILES/exports.sh source $DOTFILES/exports.sh # must run before zsh_init # echo 'Loading '$DOTFILES/aliases.sh source $DOTFILES/aliases.sh -# echo 'Loading '$DOTFILES/sources.sh -source $DOTFILES/sources.sh # echo 'Loading '$DOTFILES/scripts/home/home.sh source $DOTFILES/scripts/home/home.sh # echo 'Loading '$DOTFILES/zsh_init.sh diff --git a/exports.sh b/exports.sh index d9fc3a09..c2e7acbb 100755 --- a/exports.sh +++ b/exports.sh @@ -8,8 +8,8 @@ if is_mac; then # export PATH="/opt/homebrew/opt/ruby/bin:$PATH" export PATH="/opt/homebrew/opt/flex/bin:$PATH" export PATH="/opt/homebrew/opt/make/libexec/gnubin:$PATH" - export PATH="$HOME/Library/Python/3.10/bin:$PATH" - export PATH="$HOME/Library/Python/3.8/bin:$PATH" + # export PATH="$HOME/Library/Python/3.10/bin:$PATH" + # export PATH="$HOME/Library/Python/3.8/bin:$PATH" export PATH="/Applications/Postgres.app/Contents/Versions/latest/bin:$PATH" export PATH="/Applications/Visual Studio Code.app/Contents/Resources/app/bin:$PATH" export PATH="$HOME/.surrealdb:$PATH" @@ -80,3 +80,8 @@ fi if [[ -f "$HOME/.cargo/env" ]]; then . "$HOME/.cargo/env" fi + +if [[ -f ~/.fzf.zsh ]]; then source ~/.fzf.zsh; fi +if [[ -f /opt/homebrew/opt/chruby/share/chruby/chruby.sh ]]; then source /opt/homebrew/opt/chruby/share/chruby/chruby.sh; fi +if [[ -f $(which rbenv) ]]; then eval "$(rbenv init - zsh)"; fi +if [[ -f "$HOME/.dotfiles/_local.sh" ]]; then source "$HOME/.dotfiles/_local.sh"; fi diff --git a/functions.sh b/functions.sh index a4414165..7d7a3166 100755 --- a/functions.sh +++ b/functions.sh @@ -349,25 +349,29 @@ tn-custom () { tabname="$winname" fi - # sleep 0.1 - # echo new-window -n $tabname -c $dir + # create new window tmux new-window -n $tabname -c $dir - # echo - # sleep 0.1 - # echo send-keys -t $winname:$tabname v . Enter + # open vim on main pane tmux send-keys -t $winname:$tabname v Enter - # echo - # sleep 0.1 - # echo split-window -h -t $winname:$tabname -c $dir + # split window horizontally tmux split-window -h -t $winname:$tabname -c $dir + # resize pane + tmux resize-pane -t 0 -x 90 + + # auto-select main pane tmux select-pane -t 0 - # echo + + # zoom into main pane + tmux resize-pane -Z done - tmux select-window -t $winname:0 + # select first non-general window + tmux select-window -t $winname:1 + + # attach to session tmux attach -t $winname } diff --git a/sources.sh b/sources.sh deleted file mode 100755 index 563a8a2b..00000000 --- a/sources.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env zsh - -if [[ -f "$HOME/.dotfiles/_local.sh" ]]; then source "$HOME/.dotfiles/_local.sh"; fi -if [[ -f "$HOME/.iterm2_shell_integration.zsh" ]]; then source "$HOME/.iterm2_shell_integration.zsh"; fi -if [[ -f ~/.fzf.zsh ]]; then source ~/.fzf.zsh; fi -if [[ -f /opt/homebrew/opt/chruby/share/chruby/chruby.sh ]]; then source /opt/homebrew/opt/chruby/share/chruby/chruby.sh; fi - -if [[ -f $(which rbenv) ]]; then - eval "$(rbenv init - zsh)" -fi diff --git a/zsh_init.sh b/zsh_init.sh index 077e68ee..2735634d 100755 --- a/zsh_init.sh +++ b/zsh_init.sh @@ -1,6 +1,5 @@ #!/usr/bin/env zsh - # Uncomment the following line if you want to change the command execution time # stamp shown in the history command output. # You can set one of the optional three formats: