diff --git a/bin/.local/bin/tmux-cht.sh b/bin/.local/bin/tmux-cht.sh index 4f19ab9c..68215e86 100755 --- a/bin/.local/bin/tmux-cht.sh +++ b/bin/.local/bin/tmux-cht.sh @@ -1,12 +1,15 @@ #!/usr/bin/env bash selected=`cat ~/.tmux-cht-languages ~/.tmux-cht-command | fzf` +if [[ -z $selected ]]; then + exit 0 +fi read -p "Enter Query: " query if grep -qs "$selected" ~/.tmux-cht-languages; then query=`echo $query | tr ' ' '+'` - tmux neww bash -c "curl cht.sh/$selected/$query & while [ : ]; do sleep 1; done" + tmux neww bash -c "echo \"curl cht.sh/$selected/$query/\" & curl cht.sh/$selected/$query & while [ : ]; do sleep 1; done" else - tmux neww bash -c "curl cht.sh/$selected~$query & while [ : ]; do sleep 1; done" + tmux neww bash -c "curl -s cht.sh/$selected~$query | less" fi diff --git a/bin/.local/bin/tmux-sessionizer b/bin/.local/bin/tmux-sessionizer index d87178e8..e4c7a9b3 100755 --- a/bin/.local/bin/tmux-sessionizer +++ b/bin/.local/bin/tmux-sessionizer @@ -1,63 +1,28 @@ #!/usr/bin/env bash -TMUX_HISTORY_LENGTH=10 -TMUX_HISTORY_FILE=$HOME/.tmux-sessionizer - -add_new_line() { - tail -n1 $1 | read -r _ || echo >> $1 -} - -update_history() { - # TODO: Probably change this to .config once i have the proper version of tmux - if [[ ! -e "$TMUX_HISTORY_FILE" ]]; then - touch $TMUX_HISTORY_FILE - fi - tmux_contents=`cat $TMUX_HISTORY_FILE` - printf "$1\n$tmux_contents" > $TMUX_HISTORY_FILE - sed -ni "1,${TMUX_HISTORY_LENGTH}p" $TMUX_HISTORY_FILE - add_new_line $TMUX_HISTORY_FILE -} - -clear_history() { - rm $TMUX_HISTORY_FILE - touch $TMUX_HISTORY_FILE -} - -if [[ "$1" = "clear" ]]; then - clear_history - exit 0 -elif [[ "$1" = "-v" ]]; then - cat $TMUX_HISTORY_FILE - exit 0 -elif [[ $# -eq 1 ]]; then +if [[ $# -eq 1 ]]; then selected=$1 -elif [[ $# -eq 2 && "$1" = "restore" ]]; then - history_length=`cat $TMUX_HISTORY_FILE | wc -l` - if [[ $2 -gt $history_length ]]; then - echo "Requested $2 item, but there is only $history_length available." - exit 1 - elif [[ $2 -ge $TMUX_HISTORY_LENGTH ]]; then - echo "cannot provide a length greater than $TMUX_HISTORY_LENGTH" - exit 1 - fi - selected=`cat $TMUX_HISTORY_FILE | sed -n "$2,${2}p"` else - items=`find ~/work -maxdepth 1 -mindepth 1 -type d` - items+=`find ~/personal -maxdepth 1 -mindepth 1 -type d` - items+=`find ~ -maxdepth 1 -mindepth 1 -type d` - selected=`echo "$items" | fzf` + selected=$(find ~/ ~/work ~/personal -mindepth 1 -maxdepth 1 -type d 2> /dev/null | fzf) fi if [[ -z $selected ]]; then exit 0 fi -tmux_session_name=`basename $selected | tr . _` -update_history $selected - -tmux switch-client -t $tmux_session_name -if [[ $? -eq 0 ]]; then +selected_name=$(basename "$selected" | tr . _) +tmux_running=$(pgrep tmux) +if [[ -z $TMUX ]] && [[ -z $tmux_running ]]; then + tmux new-session -s $selected_name -c $selected exit 0 fi -tmux new-session -c $selected -d -s $tmux_session_name && tmux switch-client -t $tmux_session_name || tmux new -c $selected -A -s $tmux_session_name +if ! tmux has-session -t $selected_name 2> /dev/null; then + tmux new-session -ds $selected_name -c $selected +fi + +if [[ -z $TMUX ]]; then + tmux attach-session -t $selected_name +else + tmux switch-client -t $selected_name +fi diff --git a/i3/.config/i3/config b/i3/.config/i3/config index c41619d3..ff662372 100644 --- a/i3/.config/i3/config +++ b/i3/.config/i3/config @@ -101,28 +101,40 @@ bindsym $mod+a focus parent #bindsym $mod+d focus child # switch to workspace -bindsym $mod+1 workspace 1 -bindsym $mod+2 workspace 2 -bindsym $mod+3 workspace 3 -bindsym $mod+4 workspace 4 -bindsym $mod+5 workspace 5 -bindsym $mod+6 workspace 6 -bindsym $mod+7 workspace 7 -bindsym $mod+8 workspace 8 -bindsym $mod+9 workspace 9 -bindsym $mod+0 workspace 10 +#bindsym $mod+1 workspace 1 +#bindsym $mod+2 workspace 2 +#bindsym $mod+3 workspace 3 +#bindsym $mod+4 workspace 4 +#bindsym $mod+5 workspace 5 +#bindsym $mod+6 workspace 6 +#bindsym $mod+7 workspace 7 +#bindsym $mod+8 workspace 8 +#bindsym $mod+9 workspace 9 +#bindsym $mod+0 workspace 10 + +# switch to workspace +bindsym $mod+Shift+equal workspace 1 +bindsym $mod+bracketleft workspace 2 +bindsym $mod+Shift+bracketleft workspace 3 +bindsym $mod+Shift+9 workspace 4 +bindsym $mod+Shift+7 workspace 5 +bindsym $mod+equal workspace 6 +bindsym $mod+Shift+0 workspace 7 +bindsym $mod+Shift+bracketright workspace 8 +bindsym $mod+bracketright workspace 9 +bindsym $mod+Shift+8 workspace 10 # move focused container to workspace -bindsym $mod+Shift+1 move container to workspace 1 -bindsym $mod+Shift+2 move container to workspace 2 -bindsym $mod+Shift+3 move container to workspace 3 -bindsym $mod+Shift+4 move container to workspace 4 -bindsym $mod+Shift+5 move container to workspace 5 -bindsym $mod+Shift+6 move container to workspace 6 -bindsym $mod+Shift+7 move container to workspace 7 -bindsym $mod+Shift+8 move container to workspace 8 -bindsym $mod+Shift+9 move container to workspace 9 -bindsym $mod+Shift+0 move container to workspace 10 +bindsym $mod+1 move container to workspace 1 +bindsym $mod+2 move container to workspace 2 +bindsym $mod+3 move container to workspace 3 +bindsym $mod+4 move container to workspace 4 +bindsym $mod+5 move container to workspace 5 +bindsym $mod+6 move container to workspace 6 +bindsym $mod+7 move container to workspace 7 +bindsym $mod+8 move container to workspace 8 +bindsym $mod+9 move container to workspace 9 +bindsym $mod+0 move container to workspace 10 # reload the configuration file bindsym $mod+Shift+c reload diff --git a/nvim/.config/nvim/init.vim b/nvim/.config/nvim/init.vim index de39acae..6b3061da 100644 --- a/nvim/.config/nvim/init.vim +++ b/nvim/.config/nvim/init.vim @@ -1,3 +1,4 @@ +" hello front end masters set path+=** " Nice menu when typing `:find *.py` @@ -41,6 +42,7 @@ Plug 'rafamadriz/friendly-snippets' Plug 'rust-lang/rust.vim' Plug 'darrikonn/vim-gofmt' Plug 'tpope/vim-fugitive' +Plug 'tpope/vim-rhubarb' Plug 'junegunn/gv.vim' Plug 'vim-utils/vim-man' Plug 'mbbill/undotree' @@ -101,7 +103,7 @@ imap luasnip#choice_active() ? 'luasnip-next-choice' smap luasnip#choice_active() ? 'luasnip-next-choice' : '' nnoremap Q -nnoremap :lua require("harpoon.term").sendCommand(1, "tmux-sessionizer\n"); require("harpoon.term").gotoTerminal(1) +nnoremap :silent !tmux neww tmux-sessionizer nnoremap vwh :h =expand("") nnoremap bs /=escape(expand(""), "/") nnoremap u :UndotreeShow @@ -119,10 +121,16 @@ nnoremap dwm :lua require("vim-with-me").disconnect() nnoremap gll :let g:_search_term = expand("%"):Gclog -- %:call search(g:_search_term) nnoremap gln :cnext:call search(_search_term) nnoremap glp :cprev:call search(_search_term) +nnoremap x :!chmod +x % vnoremap J :m '>+1gv=gv vnoremap K :m '<-2gv=gv +nnoremap Y yg$ +nnoremap n nzzzv +nnoremap N Nzzzv +nnoremap J mzJ`z + " greatest remap ever xnoremap p "_dP diff --git a/nvim/.config/nvim/lua/theprimeagen/git-worktree.lua b/nvim/.config/nvim/lua/theprimeagen/git-worktree.lua index d3e82d34..a6a39aa1 100644 --- a/nvim/.config/nvim/lua/theprimeagen/git-worktree.lua +++ b/nvim/.config/nvim/lua/theprimeagen/git-worktree.lua @@ -1,47 +1,8 @@ local Worktree = require("git-worktree") -local Job = require("plenary.job") -local Path = require("plenary.path") - -local function is_nrdp() - return not not (string.find(vim.loop.cwd(), vim.env.NRDP, 1, true)) -end - -local function is_tvui() - return not not (string.find(vim.loop.cwd(), vim.env.TVUI, 1, true)) -end - -local function get_nrdp_build_paths(path) - return - Path:new({vim.env.NRDP, path, "configure"}):absolute(), - Path:new({vim.env.NRDP, "build", path}):absolute() -end Worktree.on_tree_change(function(op, path, upstream) - - if op == Worktree.Operations.Switch and is_tvui() then - Job:new({ - "./tvui", "install" - }):start() - end - - if op == Worktree.Operations.Create and is_nrdp() then - local submodule = Job:new({ - "git", "submodule", "update" - }) - - local configure_path, build_path = get_nrdp_build_paths(path) - local make_build = Job:new({ - "mkdir", "-p", build_path - }) - - local configure = Job:new({ - configure_path, "--ninja", "--debug", - cwd = build_path, - }) - - submodule:and_then_on_success(make_build) - make_build:and_then_on_success(configure) - submodule:start() + if op == Worktree.Operations.Switch then + elseif op == Worktree.Operations.Create then end end) diff --git a/tmux/.tmux.conf b/tmux/.tmux.conf index 05b7f8a0..611c1e52 100644 --- a/tmux/.tmux.conf +++ b/tmux/.tmux.conf @@ -21,7 +21,7 @@ bind -r l select-pane -R bind -r D neww -c "#{pane_current_path}" "[[ -e TODO.md ]] && nvim TODO.md || nvim ~/dotfiles/todo.md" -bind-key -r ^ run-shell "~/.local/bin/tmux-sessionizer restore 2" +bind-key -r i run-shell "tmux neww tmux-cht.sh" bind-key -r G run-shell "~/.local/bin/tmux-sessionizer /home/theprimeagen/work/nrdp" bind-key -r C run-shell "~/.local/bin/tmux-sessionizer /home/theprimeagen/work/tvui" bind-key -r R run-shell "~/.local/bin/tmux-sessionizer /home/theprimeagen/work/milo" diff --git a/zsh/.zsh_profile b/zsh/.zsh_profile index 0c54160d..ad19f658 100644 --- a/zsh/.zsh_profile +++ b/zsh/.zsh_profile @@ -73,5 +73,3 @@ eslintify() { cat $1 > /tmp/file_to_eslint npx eslint } - -asdf diff --git a/zsh/.zshrc b/zsh/.zshrc index 6c6dad59..8fa612a6 100644 --- a/zsh/.zshrc +++ b/zsh/.zshrc @@ -53,7 +53,7 @@ ZSH_THEME="robbyrussell" # Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/ # Example format: plugins=(rails git textmate ruby lighthouse) # Add wisely, as too many plugins slow down shell startup. -plugins=(git zsh-autosuggestions) +plugins=(git) source $ZSH/oh-my-zsh.sh