aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--alacritty.yml18
-rw-r--r--bash/env.sh6
-rwxr-xr-xbin/fzf-tmux234
-rwxr-xr-xbin/tm13
-rwxr-xr-xbin/tmux-sessionizer26
-rwxr-xr-xbin/tmux-windowizer14
-rw-r--r--install.conf.yaml36
-rw-r--r--justfile22
-rw-r--r--nvim/ftplugin/json.vim5
-rw-r--r--nvim/init.vim193
-rw-r--r--nvim/lua/theprimeagen/debugger.lua19
-rw-r--r--nvim/lua/theprimeagen/git-worktree.lua29
-rw-r--r--nvim/lua/theprimeagen/harpoon.lua13
-rw-r--r--nvim/lua/theprimeagen/init.lua19
-rw-r--r--nvim/lua/theprimeagen/lsp.lua191
-rw-r--r--nvim/lua/theprimeagen/telescope.lua222
-rw-r--r--nvim/plugin/colors.vim33
-rw-r--r--nvim/plugin/git.vim8
-rw-r--r--nvim/plugin/harpoon.vim19
-rw-r--r--nvim/plugin/lsp.vim24
-rw-r--r--nvim/plugin/navigation.vim33
-rw-r--r--nvim/plugin/netrw.vim4
-rw-r--r--nvim/plugin/plenary.vim2
-rw-r--r--nvim/plugin/refactoring.vim9
-rw-r--r--nvim/plugin/sets.vim34
-rw-r--r--nvim/plugin/telescope.vim16
-rw-r--r--nvim/plugin/vimspector.vim12
-rwxr-xr-xscripts/td.sh61
-rw-r--r--tmux.conf17
-rw-r--r--wezterm.lua18
-rwxr-xr-xwsl.install1
-rwxr-xr-xwsl/gpg.sh20
-rw-r--r--zsh/keybindings.zsh1
-rw-r--r--zshenv5
34 files changed, 1301 insertions, 76 deletions
diff --git a/alacritty.yml b/alacritty.yml
index 4cd523d..212a792 100644
--- a/alacritty.yml
+++ b/alacritty.yml
@@ -14,14 +14,14 @@
# Any items in the `env` entry below will be added as
# environment variables. Some entries may override variables
# set by alacritty itself.
-#env:
+env:
# TERM variable
#
# This value is used to set the `$TERM` environment variable for
# each instance of Alacritty. If it is not present, alacritty will
# check the local terminfo database and use `alacritty` if it is
# available, otherwise `xterm-256color` is used.
-#TERM: alacritty
+ TERM: alacritty
#window:
# Window dimensions (changes require restart)
@@ -81,7 +81,7 @@
#startup_mode: Windowed
# Window title
-#title: Alacritty
+title: Alacritty
# Allow terminal applications to change Alacritty's window title.
#dynamic_title: true
@@ -99,13 +99,13 @@
# and `light`. Set this to `None` to use the default theme variant.
#gtk_theme_variant: None
-#scrolling:
+scrolling:
# Maximum number of lines in the scrollback buffer.
# Specifying '0' will disable scrolling.
-#history: 10000
+ history: 10000
# Scrolling distance multiplier.
-#multiplier: 3
+ multiplier: 3
# Font configuration
font:
@@ -348,7 +348,7 @@ font:
# Duration of the visual bell flash in milliseconds. A `duration` of `0` will
# disable the visual bell animation.
-#duration: 0
+duration: 100
# Visual bell animation color.
#color: '#ffffff'
@@ -366,13 +366,13 @@ font:
#
#command: None
-#selection:
+selection:
# This string contains all characters that are used as separators for
# "semantic words" in Alacritty.
#semantic_escape_chars: ",│`|:\"' ()[]{}<>\t"
# When set to `true`, selected text will be copied to the primary clipboard.
-#save_to_clipboard: false
+ save_to_clipboard: false
#cursor:
# Cursor style
diff --git a/bash/env.sh b/bash/env.sh
index 4891067..6424fd9 100644
--- a/bash/env.sh
+++ b/bash/env.sh
@@ -1,6 +1,7 @@
#!/usr/bin/env bash
export EDITOR="$(command -v vim 2>/dev/null || command -v vi)"
+export TERM=alacritty
export VISUAL="code --wait"
export GPG_TTY=$(tty)
export MANPAGER="sh -c 'col -bx | bat -l man -p'"
@@ -9,9 +10,14 @@ export STARSHIP_LOG="error"
export FZF_PREVIEW_COMMAND="bat --style=numbers,changes --wrap never --color always {} || cat {} || tree -C {}"
export FZF_CTRL_T_OPTS="--min-height 30 --preview-window down:60% --preview-window noborder --preview '($FZF_PREVIEW_COMMAND) 2> /dev/null'"
+export PATH=$PATH:$HOME/dotfiles/bin
export PATH=$PATH:$HOME/.local/bin
export PATH=$PATH:$HOME/.go/bin
export PATH=$PATH:$HOME/.dotnet/tools
export PATH=$PATH:$HOME/.cargo/bin
export PATH=$PATH:$HOME/dotfiles/scripts
export PATH=$PATH:/usr/local/texlive/2021/bin/x86_64-linux
+
+if command -v tmux &>/dev/null && [ -n "$PS1" ] && [[ ! "$TERM" =~ screen ]] && [[ ! "$TERM" =~ tmux ]] && [ -z "$TMUX" ]; then
+ exec tmux
+fi
diff --git a/bin/fzf-tmux b/bin/fzf-tmux
new file mode 100755
index 0000000..7daaf60
--- /dev/null
+++ b/bin/fzf-tmux
@@ -0,0 +1,234 @@
+#!/usr/bin/env bash
+# fzf-tmux: starts fzf in a tmux pane
+# usage: fzf-tmux [LAYOUT OPTIONS] [--] [FZF OPTIONS]
+
+fail() {
+ echo >&2 "$1"
+ exit 2
+}
+
+fzf="$(command -v fzf 2>/dev/null)" || fzf="$(dirname "$0")/fzf"
+[[ -x "$fzf" ]] || fail 'fzf executable not found'
+
+tmux_args=()
+args=()
+opt=""
+skip=""
+swap=""
+close=""
+term=""
+[[ -n "$LINES" ]] && lines=$LINES || lines=$(tput lines) || lines=$(tmux display-message -p "#{pane_height}")
+[[ -n "$COLUMNS" ]] && columns=$COLUMNS || columns=$(tput cols) || columns=$(tmux display-message -p "#{pane_width}")
+
+help() {
+ echo >&2 'usage: fzf-tmux [LAYOUT OPTIONS] [--] [FZF OPTIONS]
+
+ LAYOUT OPTIONS:
+ (default layout: -d 50%)
+
+ Popup window (requires tmux 3.2 or above):
+ -p [WIDTH[%][,HEIGHT[%]]] (default: 50%)
+ -w WIDTH[%]
+ -h HEIGHT[%]
+ -x COL
+ -y ROW
+
+ Split pane:
+ -u [HEIGHT[%]] Split above (up)
+ -d [HEIGHT[%]] Split below (down)
+ -l [WIDTH[%]] Split left
+ -r [WIDTH[%]] Split right
+'
+ exit
+}
+
+while [[ $# -gt 0 ]]; do
+ arg="$1"
+ shift
+ [[ -z "$skip" ]] && case "$arg" in
+ -)
+ term=1
+ ;;
+ --help)
+ help
+ ;;
+ --version)
+ echo "fzf-tmux (with fzf $("$fzf" --version))"
+ exit
+ ;;
+ -p* | -w* | -h* | -x* | -y* | -d* | -u* | -r* | -l*)
+ if [[ "$arg" =~ ^-[pwhxy] ]]; then
+ [[ "$opt" =~ "-K -E" ]] || opt="-K -E"
+ elif [[ "$arg" =~ ^.[lr] ]]; then
+ opt="-h"
+ if [[ "$arg" =~ ^.l ]]; then
+ opt="$opt -d"
+ swap="; swap-pane -D ; select-pane -L"
+ close="; tmux swap-pane -D"
+ fi
+ else
+ opt=""
+ if [[ "$arg" =~ ^.u ]]; then
+ opt="$opt -d"
+ swap="; swap-pane -D ; select-pane -U"
+ close="; tmux swap-pane -D"
+ fi
+ fi
+ if [[ ${#arg} -gt 2 ]]; then
+ size="${arg:2}"
+ else
+ if [[ "$1" =~ ^[0-9%,]+$ ]] || [[ "$1" =~ ^[A-Z]$ ]]; then
+ size="$1"
+ shift
+ else
+ continue
+ fi
+ fi
+
+ if [[ "$arg" =~ ^-p ]]; then
+ if [[ -n "$size" ]]; then
+ w=${size%%,*}
+ h=${size##*,}
+ opt="$opt -w$w -h$h"
+ fi
+ elif [[ "$arg" =~ ^-[whxy] ]]; then
+ opt="$opt ${arg:0:2}$size"
+ elif [[ "$size" =~ %$ ]]; then
+ size=${size:0:((${#size} - 1))}
+ if [[ -n "$swap" ]]; then
+ opt="$opt -p $((100 - size))"
+ else
+ opt="$opt -p $size"
+ fi
+ else
+ if [[ -n "$swap" ]]; then
+ if [[ "$arg" =~ ^.l ]]; then
+ max=$columns
+ else
+ max=$lines
+ fi
+ size=$((max - size))
+ [[ $size -lt 0 ]] && size=0
+ opt="$opt -l $size"
+ else
+ opt="$opt -l $size"
+ fi
+ fi
+ ;;
+ --)
+ # "--" can be used to separate fzf-tmux options from fzf options to
+ # avoid conflicts
+ skip=1
+ tmux_args=("${args[@]}")
+ args=()
+ continue
+ ;;
+ *)
+ args+=("$arg")
+ ;;
+ esac
+ [[ -n "$skip" ]] && args+=("$arg")
+done
+
+if [[ -z "$TMUX" ]]; then
+ "$fzf" "${args[@]}"
+ exit $?
+fi
+
+# --height option is not allowed. CTRL-Z is also disabled.
+args=("${args[@]}" "--no-height" "--bind=ctrl-z:ignore")
+
+# Handle zoomed tmux pane without popup options by moving it to a temp window
+if [[ ! "$opt" =~ "-K -E" ]] && tmux list-panes -F '#F' | grep -q Z; then
+ zoomed_without_popup=1
+ original_window=$(tmux display-message -p "#{window_id}")
+ tmp_window=$(tmux new-window -d -P -F "#{window_id}" "bash -c 'while :; do for c in \\| / - '\\;' do sleep 0.2; printf \"\\r\$c fzf-tmux is running\\r\"; done; done'")
+ tmux swap-pane -t $tmp_window \; select-window -t $tmp_window
+fi
+
+set -e
+
+# Clean up named pipes on exit
+id=$RANDOM
+argsf="${TMPDIR:-/tmp}/fzf-args-$id"
+fifo1="${TMPDIR:-/tmp}/fzf-fifo1-$id"
+fifo2="${TMPDIR:-/tmp}/fzf-fifo2-$id"
+fifo3="${TMPDIR:-/tmp}/fzf-fifo3-$id"
+tmux_win_opts=($(tmux show-window-options remain-on-exit \; show-window-options synchronize-panes | sed '/ off/d; s/^/set-window-option /; s/$/ \\;/'))
+cleanup() {
+ \rm -f $argsf $fifo1 $fifo2 $fifo3
+
+ # Restore tmux window options
+ if [[ "${#tmux_win_opts[@]}" -gt 0 ]]; then
+ eval "tmux ${tmux_win_opts[*]}"
+ fi
+
+ # Remove temp window if we were zoomed without popup options
+ if [[ -n "$zoomed_without_popup" ]]; then
+ tmux display-message -p "#{window_id}" >/dev/null
+ tmux swap-pane -t $original_window \; \
+ select-window -t $original_window \; \
+ kill-window -t $tmp_window \; \
+ resize-pane -Z
+ fi
+
+ if [[ $# -gt 0 ]]; then
+ trap - EXIT
+ exit 130
+ fi
+}
+trap 'cleanup 1' SIGUSR1
+trap 'cleanup' EXIT
+
+envs="export TERM=$TERM "
+[[ "$opt" =~ "-K -E" ]] && FZF_DEFAULT_OPTS="--margin 0,1 $FZF_DEFAULT_OPTS"
+[[ -n "$FZF_DEFAULT_OPTS" ]] && envs="$envs FZF_DEFAULT_OPTS=$(printf %q "$FZF_DEFAULT_OPTS")"
+[[ -n "$FZF_DEFAULT_COMMAND" ]] && envs="$envs FZF_DEFAULT_COMMAND=$(printf %q "$FZF_DEFAULT_COMMAND")"
+echo "$envs;" >"$argsf"
+
+# Build arguments to fzf
+opts=$(printf "%q " "${args[@]}")
+
+pppid=$$
+echo -n "trap 'kill -SIGUSR1 -$pppid' EXIT SIGINT SIGTERM;" >>$argsf
+close="; trap - EXIT SIGINT SIGTERM $close"
+
+export TMUX=$(cut -d , -f 1,2 <<<"$TMUX")
+mkfifo -m o+w $fifo2
+if [[ "$opt" =~ "-K -E" ]]; then
+ cat $fifo2 &
+ if [[ -n "$term" ]] || [[ -t 0 ]]; then
+ cat <<<"\"$fzf\" $opts > $fifo2; out=\$? $close; exit \$out" >>$argsf
+ else
+ mkfifo $fifo1
+ cat <<<"\"$fzf\" $opts < $fifo1 > $fifo2; out=\$? $close; exit \$out" >>$argsf
+ cat <&0 >$fifo1 &
+ fi
+
+ # tmux dropped the support for `-K`, `-R` to popup command
+ # TODO: We can remove this once tmux 3.2 is released
+ if [[ ! "$(tmux popup --help 2>&1)" =~ '-R shell-command' ]]; then
+ opt="${opt/-K/}"
+ else
+ opt="${opt} -R"
+ fi
+
+ tmux popup -d "$PWD" "${tmux_args[@]}" $opt "bash $argsf" >/dev/null 2>&1
+ exit $?
+fi
+
+mkfifo -m o+w $fifo3
+if [[ -n "$term" ]] || [[ -t 0 ]]; then
+ cat <<<"\"$fzf\" $opts > $fifo2; echo \$? > $fifo3 $close" >>$argsf
+else
+ mkfifo $fifo1
+ cat <<<"\"$fzf\" $opts < $fifo1 > $fifo2; echo \$? > $fifo3 $close" >>$argsf
+ cat <&0 >$fifo1 &
+fi
+tmux set-window-option synchronize-panes off \; set-window-option remain-on-exit off \; split-window -c "$PWD" $opt "${tmux_args[@]}" "bash -c 'exec -a fzf bash $argsf'" $swap \
+ >/dev/null 2>&1 || {
+ "$fzf" "${args[@]}"
+ exit $?
+}
+cat $fifo2
+exit "$(cat $fifo3)"
diff --git a/bin/tm b/bin/tm
new file mode 100755
index 0000000..5c976d3
--- /dev/null
+++ b/bin/tm
@@ -0,0 +1,13 @@
+#!/usr/bin/env bash
+
+[[ -n "$TMUX" ]] && change="switch-client" || change="attach-session"
+session=$(
+ tmux list-sessions -F "#{session_name}" 2>/dev/null |
+ sed "/^$(tmux display-message -p '#S' 2>/dev/null)$/d" |
+ fzf --query="$1" --select-1 --exit-0
+) &&
+ tmux $change -t "$session" ||
+ (
+ tmux new-session -d -s $session &&
+ tmux $change -t "$session"
+ )
diff --git a/bin/tmux-sessionizer b/bin/tmux-sessionizer
new file mode 100755
index 0000000..020648e
--- /dev/null
+++ b/bin/tmux-sessionizer
@@ -0,0 +1,26 @@
+#!/usr/bin/env bash
+
+if [[ $# -eq 1 ]]; then
+ selected=$1
+else
+ selected=$(cat <(fd . ~/src ~/dkr --exact-depth 1 -td) <(echo $HOME/dotfiles) | sort |
+ fzf -d/ --with-nth 3.. --preview="tree -a -C -L 1 {}")
+fi
+
+if [[ -z $selected ]]; then
+ exit 0
+fi
+
+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
+
+if ! tmux has-session -t=$selected_name 2>/dev/null; then
+ tmux new-session -ds $selected_name -c $selected
+fi
+
+tmux switch-client -t $selected_name
diff --git a/bin/tmux-windowizer b/bin/tmux-windowizer
new file mode 100755
index 0000000..6cee8b0
--- /dev/null
+++ b/bin/tmux-windowizer
@@ -0,0 +1,14 @@
+#!/usr/bin/env bash
+
+branch_name=$(basename $1)
+session_name=$(tmux display-message -p "#S")
+clean_name=$(echo $branch_name | tr "./" "__")
+target="$session_name:$clean_name"
+
+if ! tmux has-session -t $target 2>/dev/null; then
+ tmux neww -dn $clean_name
+fi
+
+shift
+tmux send-keys -t $target "$*
+"
diff --git a/install.conf.yaml b/install.conf.yaml
index c33833f..6c738e1 100644
--- a/install.conf.yaml
+++ b/install.conf.yaml
@@ -54,10 +54,11 @@
curl -sL https://gist.github.com/junegunn/8b572b8d4b5eddd8b85e5f4d40f17236/raw/6e5d520bfc96d6b3e42571a54cb4d1ebc8e2dd84/key-binding.zsh >>~/.bash/fzf-key-bindings.sh;
)
- - description: Installing bat
- command:
- target=$(rustc -Vv | grep host | cut -d' ' -f2 | sed s/armv7/arm/) &&
- scripts/install-crate.sh --git sharkdp/bat --target $target --completion-bash --completion-zsh
+ # Install manually with cargo see https://github.com/sharkdp/bat/issues/2106
+ # - description: Installing bat
+ # command:
+ # target=$(rustc -Vv | grep host | cut -d' ' -f2 | sed s/armv7/arm/) &&
+ # scripts/install-crate.sh --git sharkdp/bat --target $target --completion-bash --completion-zsh
- description: Installing fd
command:
@@ -120,25 +121,14 @@
- description: Installing zsh-autosuggestions
command: repo=https://github.com/zsh-users/zsh-autosuggestions &&
target=~/.zsh/zsh-autosuggestions &&
- git clone $repo $target ||
- git -C $target pull
+ git clone $repo $target ||
+ git -C $target pull
- description: Installing zsh-syntax-highlighting
command: repo=https://github.com/zsh-users/zsh-syntax-highlighting
target=~/.zsh/zsh-syntax-highlighting &&
- git clone $repo $target ||
- git -C $target pull
-
- - description: Installing zsh-syntax-highlighting
- command: repo=https://github.com/nvm-sh/nvm.git
- target=~/.nvm &&
- git clone $repo $target ||
- git -C $target pull;
- ln -sf $target/nvm.sh .bash/nvm.sh &&
- ln -sf $target/nvm.sh .zsh/nvm.sh &&
- ln -sf $target/bash_completion ~/.local/share/bash-completion/completions/nvm &&
- ln -sf $target/bash_completion .zsh/nvm_completion.sh
-
+ git clone $repo $target ||
+ git -C $target pull
- link:
# shell
@@ -150,7 +140,7 @@
glob: true
if: '[ -n "${WSL_DISTRO_NAME+1}" ]'
path: wsl/*
-
+
~/.zshenv:
~/.zsh/.zshrc: zsh/zshrc
~/.zsh/.zshenv: bash/env.sh
@@ -168,9 +158,15 @@
~/.config/bat/config: bat.conf
~/.gitconfig:
~/.ssh/config: ssh/config
+ ~/.tmux.conf:
+ path: /dev/null
+ if: "! ln -f tmux.conf ~/.tmux.conf"
~/.gnupg/:
glob: true
path: gnupg/*.conf
+ ~/.local/bin:
+ glob: true
+ path: bin/*
- shell:
- description: Installing gpg key
diff --git a/justfile b/justfile
new file mode 100644
index 0000000..fe09d19
--- /dev/null
+++ b/justfile
@@ -0,0 +1,22 @@
+#!/usr/bin/env just --justfile
+
+dotfiles_path := justfile_directory()
+comp_dir_zsh := "$HOME/.local/share/zsh/site-functions"
+comp_dir_bash := "$HOME/.local/share/bash-completion/completions"
+
+default:
+ @just --choose
+
+# install completion scripts for just
+completion_just:
+ just --completions zsh > {{comp_dir_zsh}}/_just
+ just --completions bash > {{comp_dir_bash}}/just
+
+install_rust:
+ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --no-modify-path
+
+completion_rust:
+ rustup completions bash > {{comp_dir_bash}}/rustup;
+ rustup completions zsh > {{comp_dir_zsh}}/_rustup;
+ rustup completions bash cargo > {{comp_dir_bash}}/cargo;
+ rustup completions zsh cargo > {{comp_dir_zsh}}/_cargo \ No newline at end of file
diff --git a/nvim/ftplugin/json.vim b/nvim/ftplugin/json.vim
new file mode 100644
index 0000000..4533aea
--- /dev/null
+++ b/nvim/ftplugin/json.vim
@@ -0,0 +1,5 @@
+nnoremap <left> :lua require("jvim").to_parent()<CR>
+nnoremap <right> :lua require("jvim").descend()<CR>
+nnoremap <up> :lua require("jvim").prev_sibling()<CR>
+nnoremap <down> :lua require("jvim").next_sibling()<CR>
+
diff --git a/nvim/init.vim b/nvim/init.vim
index 7470c67..643814f 100644
--- a/nvim/init.vim
+++ b/nvim/init.vim
@@ -1 +1,192 @@
-set termguicolors
+" hello front end masters
+set path+=**
+
+" Nice menu when typing `:find *.py`
+set wildmode=longest,list,full
+set wildmenu
+" Ignore files
+set wildignore+=*.pyc
+set wildignore+=*_build/*
+set wildignore+=**/coverage/*
+set wildignore+=**/node_modules/*
+set wildignore+=**/android/*
+set wildignore+=**/ios/*
+set wildignore+=**/.git/*
+
+call plug#begin('~/.vim/plugged')
+
+" Yes, I am a sneaky snek now
+Plug 'ambv/black'
+
+" Plebvim lsp Plugins
+Plug 'neovim/nvim-lspconfig'
+Plug 'hrsh7th/cmp-nvim-lsp'
+Plug 'hrsh7th/cmp-buffer'
+Plug 'hrsh7th/nvim-cmp'
+Plug 'onsails/lspkind-nvim'
+Plug 'nvim-lua/lsp_extensions.nvim'
+
+" Plug 'nvim-lua/completion-nvim'
+Plug 'glepnir/lspsaga.nvim'
+Plug 'simrat39/symbols-outline.nvim'
+" Plug 'tjdevries/nlua.nvim'
+" Plug 'tjdevries/lsp_extensions.nvim'
+
+" Neovim Tree shitter
+Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'}
+Plug 'nvim-treesitter/playground'
+
+" Debugger Plugins
+Plug 'mfussenegger/nvim-dap'
+Plug 'Pocco81/DAPInstall.nvim'
+Plug 'szw/vim-maximizer'
+
+" Snippets
+Plug 'L3MON4D3/LuaSnip'
+Plug 'rafamadriz/friendly-snippets'
+
+Plug 'simrat39/rust-tools.nvim'
+Plug 'darrikonn/vim-gofmt'
+Plug 'tpope/vim-fugitive'
+Plug 'tpope/vim-rhubarb'
+Plug 'junegunn/gv.vim'
+Plug 'vim-utils/vim-man'
+Plug 'mbbill/undotree'
+Plug 'tpope/vim-dispatch'
+Plug 'gruvbox-community/gruvbox'
+Plug 'luisiacc/gruvbox-baby'
+Plug 'tpope/vim-projectionist'
+Plug 'tomlion/vim-solidity'
+
+
+" telescope requirements...
+Plug 'nvim-lua/popup.nvim'
+Plug 'nvim-lua/plenary.nvim'
+Plug 'nvim-telescope/telescope.nvim'
+Plug 'nvim-telescope/telescope-fzy-native.nvim'
+
+Plug 'vim-conf-live/vimconflive2021-colorscheme'
+Plug 'flazz/vim-colorschemes'
+Plug 'chriskempson/base16-vim'
+
+" HARPOON!!
+Plug 'mhinz/vim-rfc'
+
+" prettier
+Plug 'sbdchd/neoformat'
+
+" ThePrimeagen plugins
+Plug 'theprimeagen/vim-be-good'
+Plug 'ThePrimeagen/harpoon'
+Plug 'ThePrimeagen/git-worktree.nvim'
+Plug 'ThePrimeagen/refactoring.nvim'
+Plug 'ThePrimeagen/jvim.nvim'
+
+" should I try another status bar???
+" Plug 'glepnir/galaxyline.nvim' , {'branch': 'main'}
+" Plug 'hoob3rt/lualine.nvim'
+
+call plug#end()
+
+" let g:vimspector_install_gadgets = [ 'debugpy', 'vscode-cpptools', 'CodeLLDB' ]
+
+lua require("theprimeagen")
+lua require'nvim-treesitter.configs'.setup { highlight = { enable = true }, incremental_selection = { enable = true }, textobjects = { enable = true }}
+let g:vim_be_good_log_file = 1
+let g:vim_apm_log = 1
+
+if executable('rg')
+ let g:rg_derive_root='true'
+endif
+
+let loaded_matchparen = 1
+let mapleader = " "
+
+imap <silent><expr> <Tab> luasnip#expand_or_jumpable() ? '<Plug>luasnip-expand-or-jump' : '<Tab>'
+inoremap <silent> <S-Tab> <cmd>lua require'luasnip'.jump(-1)<Cr>
+
+snoremap <silent> <Tab> <cmd>lua require('luasnip').jump(1)<Cr>
+snoremap <silent> <S-Tab> <cmd>lua require('luasnip').jump(-1)<Cr>
+
+imap <silent><expr> <C-E> luasnip#choice_active() ? '<Plug>luasnip-next-choice' : '<C-E>'
+smap <silent><expr> <C-E> luasnip#choice_active() ? '<Plug>luasnip-next-choice' : '<C-E>'
+
+nnoremap <silent> Q <nop>
+nnoremap <silent> <C-f> :silent !tmux neww tmux-sessionizer<CR>
+" Probably rename this, because its straight silly to be a worktree.
+nnoremap <leader>; :lua require("theprimeagen.git-worktree").execute(vim.loop.cwd(), "just-build")<CR>
+
+nnoremap <leader>vwh :h <C-R>=expand("<cword>")<CR><CR>
+nnoremap <leader>bs /<C-R>=escape(expand("<cWORD>"), "/")<CR><CR>
+nnoremap <leader>u :UndotreeShow<CR>
+nnoremap <leader>pv :Ex<CR>
+nnoremap <Leader><CR> :so ~/.config/nvim/init.vim<CR>
+nnoremap <Leader>+ :vertical resize +5<CR>
+nnoremap <Leader>- :vertical resize -5<CR>
+nnoremap <Leader>rp :resize 100<CR>
+nnoremap <Leader>ee oif err != nil {<CR>log.Fatalf("%+v\n", err)<CR>}<CR><esc>kkI<esc>
+nnoremap <Leader>cpu a%" PRIu64 "<esc>
+nnoremap <leader>s :%s/\<<C-r><C-w>\>/<C-r><C-w>/gI<Left><Left><Left>
+nnoremap <leader>gt <Plug>PlenaryTestFile
+nnoremap <leader>vwm :lua require("vim-with-me").init()<CR>
+nnoremap <leader>dwm :lua require("vim-with-me").disconnect()<CR>
+nnoremap <leader>gll :let g:_search_term = expand("%")<CR><bar>:Gclog -- %<CR>:call search(g:_search_term)<CR>
+nnoremap <leader>gln :cnext<CR>:call search(_search_term)<CR>
+nnoremap <leader>glp :cprev<CR>:call search(_search_term)<CR>
+nnoremap <leader>nf :!./scripts/format.py %
+
+nnoremap <leader>x :silent !chmod +x %<CR>
+
+vnoremap J :m '>+1<CR>gv=gv
+vnoremap K :m '<-2<CR>gv=gv
+
+nnoremap Y yg$
+nnoremap n nzzzv
+nnoremap N Nzzzv
+nnoremap J mzJ`z
+
+" greatest remap ever
+xnoremap <leader>p "_dP
+
+" next greatest remap ever : asbjornHaland
+nnoremap <leader>y "+y
+vnoremap <leader>y "+y
+nmap <leader>Y "+Y
+
+nnoremap <leader>d "_d
+vnoremap <leader>d "_d
+
+" vim TODO
+nmap <Leader>tu <Plug>BujoChecknormal
+nmap <Leader>th <Plug>BujoAddnormal
+let g:bujo#todo_file_path = $HOME . "/.cache/bujo"
+
+nnoremap <Leader>ww ofunction wait(ms: number): Promise<void> {<CR>return new Promise(res => setTimeout(res, ms));<CR>}<esc>k=i{<CR>
+
+inoremap <C-c> <esc>
+
+fun! EmptyRegisters()
+ let regs=split('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789/-"', '\zs')
+ for r in regs
+ call setreg(r, [])
+ endfor
+endfun
+
+" ES
+com! W w
+
+nmap <leader>nn :echo "hi<" . synIDattr(synID(line("."),col("."),1),"name") . '> trans<'
+\ . synIDattr(synID(line("."),col("."),0),"name") . "> lo<"
+\ . synIDattr(synIDtrans(synID(line("."),col("."),1)),"name") . ">"<CR>
+
+augroup highlight_yank
+ autocmd!
+ autocmd TextYankPost * silent! lua require'vim.highlight'.on_yank({timeout = 40})
+augroup END
+
+augroup THE_PRIMEAGEN
+ autocmd!
+ autocmd BufWritePre *.lua Neoformat
+ autocmd BufWritePre * %s/\s\+$//e
+ autocmd BufEnter,BufWinEnter,TabEnter *.rs :lua require'lsp_extensions'.inlay_hints{}
+augroup END
diff --git a/nvim/lua/theprimeagen/debugger.lua b/nvim/lua/theprimeagen/debugger.lua
new file mode 100644
index 0000000..c935273
--- /dev/null
+++ b/nvim/lua/theprimeagen/debugger.lua
@@ -0,0 +1,19 @@
+local dap_install = require("dap-install")
+dap_install.config("chrome", {})
+
+
+local dap = require("dap");
+dap.configurations.typescriptreact = { -- change to typescript if needed
+ {
+ type = "chrome",
+ request = "attach",
+ program = "${file}",
+ cwd = vim.fn.getcwd(),
+ sourceMaps = true,
+ protocol = "inspector",
+ port = 9222,
+ webRoot = "${workspaceFolder}"
+ }
+}
+
+require('dap.ext.vscode').load_launchjs()
diff --git a/nvim/lua/theprimeagen/git-worktree.lua b/nvim/lua/theprimeagen/git-worktree.lua
new file mode 100644
index 0000000..7c3bce9
--- /dev/null
+++ b/nvim/lua/theprimeagen/git-worktree.lua
@@ -0,0 +1,29 @@
+local Worktree = require("git-worktree")
+
+local function is_nrdp(path)
+ local found = path:find(vim.env["NRDP"])
+ return type(found) == "number" and found > 0
+end
+
+local function is_tvui(path)
+ local found = path:find(vim.env["TVUI"])
+ return type(found) == "number" and found > 0
+end
+
+local M = {}
+function M.execute(path, just_build)
+ if is_nrdp(path) then
+ local command = string.format(":silent !tmux-nrdp tmux %s %s", path, just_build)
+ vim.cmd(command)
+ elseif is_tvui(path) then
+ print("EXECUTE ", path)
+ local command = string.format(":!tmux-tvui %s", path)
+ vim.cmd(command)
+ end
+end
+
+Worktree.on_tree_change(function(_ --[[op]], path, _ --[[upstream]])
+ M.execute(path.path)
+end)
+
+return M
diff --git a/nvim/lua/theprimeagen/harpoon.lua b/nvim/lua/theprimeagen/harpoon.lua
new file mode 100644
index 0000000..4f1543e
--- /dev/null
+++ b/nvim/lua/theprimeagen/harpoon.lua
@@ -0,0 +1,13 @@
+require("harpoon").setup({
+ nav_first_in_list = true,
+ projects = {
+ ["/home/theprimeagen/work/nrdp/backport-2"] = {
+ term = {
+ cmds = {
+ "ninja -C /home/theprimeagen/work/nrdp/builds/backport-2 -j 25 && cp compile_commands.json /home/theprimeagen/work/nrdp/backport-2\n",
+ }
+ }
+ }
+ }
+})
+
diff --git a/nvim/lua/theprimeagen/init.lua b/nvim/lua/theprimeagen/init.lua
new file mode 100644
index 0000000..5db4e28
--- /dev/null
+++ b/nvim/lua/theprimeagen/init.lua
@@ -0,0 +1,19 @@
+require("theprimeagen.telescope")
+require("theprimeagen.git-worktree")
+require("theprimeagen.debugger")
+require("theprimeagen.harpoon")
+require("theprimeagen.lsp")
+
+P = function(v)
+ print(vim.inspect(v))
+ return v
+end
+
+if pcall(require, "plenary") then
+ RELOAD = require("plenary.reload").reload_module
+
+ R = function(name)
+ RELOAD(name)
+ return require(name)
+ end
+end
diff --git a/nvim/lua/theprimeagen/lsp.lua b/nvim/lua/theprimeagen/lsp.lua
new file mode 100644
index 0000000..3911c72
--- /dev/null
+++ b/nvim/lua/theprimeagen/lsp.lua
@@ -0,0 +1,191 @@
+local sumneko_root_path = "/home/mpaulson/personal/lua-language-server"
+local sumneko_binary = sumneko_root_path .. "/bin/lua-language-server"
+
+local capabilities = vim.lsp.protocol.make_client_capabilities()
+capabilities.textDocument.completion.completionItem.snippetSupport = true
+
+-- Setup nvim-cmp.
+local cmp = require("cmp")
+local source_mapping = {
+ buffer = "[Buffer]",
+ nvim_lsp = "[LSP]",
+ nvim_lua = "[Lua]",
+ path = "[Path]"
+}
+local lspkind = require("lspkind")
+require("lspkind").init({
+ mode = 'Text'
+})
+
+cmp.setup({
+ snippet = {
+ expand = function(args)
+ -- For `vsnip` user.
+ -- vim.fn["vsnip#anonymous"](args.body)
+
+ -- For `luasnip` user.
+ require("luasnip").lsp_expand(args.body)
+
+ -- For `ultisnips` user.
+ -- vim.fn["UltiSnips#Anon"](args.body)
+ end
+ },
+ mapping = {
+ ["<C-u>"] = cmp.mapping.scroll_docs(-4),
+ ["<C-d>"] = cmp.mapping.scroll_docs(4),
+ ["<C-Space>"] = cmp.mapping.complete()
+ },
+
+ formatting = {
+ format = function(entry, vim_item)
+ vim_item.kind = lspkind.presets.default[vim_item.kind]
+ local menu = source_mapping[entry.source.name]
+ vim_item.menu = menu
+ return vim_item
+ end
+ },
+
+ sources = {{
+ name = "nvim_lsp"
+ }, -- For vsnip user.
+ -- { name = 'vsnip' },
+ -- For luasnip user.
+ {
+ name = "luasnip"
+ }, -- For ultisnips user.
+ -- { name = 'ultisnips' },
+ {
+ name = "buffer"
+ }}
+})
+
+local function config(_config)
+ return vim.tbl_deep_extend("force", {
+ capabilities = require("cmp_nvim_lsp").update_capabilities(vim.lsp.protocol.make_client_capabilities())
+ }, _config or {})
+end
+
+require("lspconfig").tsserver.setup(config())
+
+--[[ I cannot seem to get this woring on new computer..
+require("lspconfig").clangd.setup(config({
+ cmd = { "clangd", "--background-index", "--log=verbose" },
+ root_dir = function()
+ print("clangd-Rootdir", vim.loop.cwd())
+ return vim.loop.cwd()
+ end,
+}))
+--]]
+require("lspconfig").ccls.setup(config())
+
+require("lspconfig").jedi_language_server.setup(config())
+
+require("lspconfig").svelte.setup(config())
+
+require("lspconfig").solang.setup(config())
+
+require("lspconfig").cssls.setup(config())
+
+require("lspconfig").gopls.setup(config({
+ cmd = {"gopls", "serve"},
+ settings = {
+ gopls = {
+ analyses = {
+ unusedparams = true
+ },
+ staticcheck = true
+ }
+ }
+}))
+
+require('rust-tools').setup(config({
+ tools = {
+ autoSetHints = true,
+ hover_with_actions = true,
+ runnables = {
+ use_telescope = true
+ },
+ inlay_hints = {
+ show_parameter_hints = false,
+ parameter_hints_prefix = "",
+ other_hints_prefix = ""
+ }
+ },
+
+ -- all the opts to send to nvim-lspconfig
+ -- these override the defaults set by rust-tools.nvim
+ -- see https://github.com/neovim/nvim-lspconfig/blob/master/CONFIG.md#rust_analyzer
+ server = {
+ -- on_attach is a callback called when the language server attachs to the buffer
+ -- on_attach = on_attach,
+ settings = {
+ -- to enable rust-analyzer settings visit:
+ -- https://github.com/rust-analyzer/rust-analyzer/blob/master/docs/user/generated_config.adoc
+ ["rust-analyzer"] = {
+ -- enable clippy on save
+ checkOnSave = {
+ command = "clippy"
+ }
+ }
+ }
+ }
+}))
+
+require("lspconfig").sumneko_lua.setup(config({
+ cmd = {sumneko_binary, "-E", sumneko_root_path .. "/main.lua"},
+ settings = {
+ Lua = {
+ runtime = {
+ -- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim)
+ version = "LuaJIT",
+ -- Setup your lua path
+ path = vim.split(package.path, ";")
+ },
+ diagnostics = {
+ -- Get the language server to recognize the `vim` global
+ globals = {"vim"}
+ },
+ workspace = {
+ -- Make the server aware of Neovim runtime files
+ library = {
+ [vim.fn.expand("$VIMRUNTIME/lua")] = true,
+ [vim.fn.expand("$VIMRUNTIME/lua/vim/lsp")] = true
+ }
+ }
+ }
+ }
+}))
+
+local opts = {
+ -- whether to highlight the currently hovered symbol
+ -- disable if your cpu usage is higher than you want it
+ -- or you just hate the highlight
+ -- default: true
+ highlight_hovered_item = true,
+
+ -- whether to show outline guides
+ -- default: true
+ show_guides = true
+}
+
+require("symbols-outline").setup(opts)
+
+local snippets_paths = function()
+ local plugins = {"friendly-snippets"}
+ local paths = {}
+ local path
+ local root_path = vim.env.HOME .. "/.vim/plugged/"
+ for _, plug in ipairs(plugins) do
+ path = root_path .. plug
+ if vim.fn.isdirectory(path) ~= 0 then
+ table.insert(paths, path)
+ end
+ end
+ return paths
+end
+
+require("luasnip.loaders.from_vscode").lazy_load({
+ paths = snippets_paths(),
+ include = nil, -- Load all languages
+ exclude = {}
+})
diff --git a/nvim/lua/theprimeagen/telescope.lua b/nvim/lua/theprimeagen/telescope.lua
new file mode 100644
index 0000000..2be6bbb
--- /dev/null
+++ b/nvim/lua/theprimeagen/telescope.lua
@@ -0,0 +1,222 @@
+local pickers = require("telescope.pickers")
+local finders = require("telescope.finders")
+local previewers = require("telescope.previewers")
+local action_state = require("telescope.actions.state")
+local conf = require("telescope.config").values
+local actions = require("telescope.actions")
+
+require("telescope").setup({
+ defaults = {
+ file_sorter = require("telescope.sorters").get_fzy_sorter,
+ prompt_prefix = " >",
+ color_devicons = true,
+
+ file_previewer = require("telescope.previewers").vim_buffer_cat.new,
+ grep_previewer = require("telescope.previewers").vim_buffer_vimgrep.new,
+ qflist_previewer = require("telescope.previewers").vim_buffer_qflist.new,
+
+ mappings = {
+ i = {
+ ["<C-x>"] = false,
+ ["<C-q>"] = actions.send_to_qflist,
+ },
+ },
+ },
+ extensions = {
+ fzy_native = {
+ override_generic_sorter = false,
+ override_file_sorter = true,
+ },
+ },
+})
+
+require("telescope").load_extension("git_worktree")
+require("telescope").load_extension("fzy_native")
+
+local M = {}
+
+function M.reload_modules()
+ -- Because TJ gave it to me. Makes me happpy. Put it next to his other
+ -- awesome things.
+ local lua_dirs = vim.fn.glob("./lua/*", 0, 1)
+ for _, dir in ipairs(lua_dirs) do
+ dir = string.gsub(dir, "./lua/", "")
+ require("plenary.reload").reload_module(dir)
+ end
+end
+
+M.search_dotfiles = function()
+ require("telescope.builtin").find_files({
+ prompt_title = "< VimRC >",
+ cwd = vim.env.DOTFILES,
+ hidden = true,
+ })
+end
+
+local function set_background(content)
+ vim.fn.system("dconf write /org/mate/desktop/background/picture-filename \"'" .. content .. "'\"")
+end
+
+local function select_background(prompt_bufnr, map)
+ local function set_the_background(close)
+ local content = require("telescope.actions.state").get_selected_entry(prompt_bufnr)
+ set_background(content.cwd .. "/" .. content.value)
+ if close then
+ require("telescope.actions").close(prompt_bufnr)
+ end
+ end
+
+ map("i", "<C-p>", function()
+ set_the_background()
+ end)
+
+ map("i", "<CR>", function()
+ set_the_background(true)
+ end)
+end
+
+local function image_selector(prompt, cwd)
+ return function()
+ require("telescope.builtin").find_files({
+ prompt_title = prompt,
+ cwd = cwd,
+
+ attach_mappings = function(prompt_bufnr, map)
+ select_background(prompt_bufnr, map)
+
+ -- Please continue mapping (attaching additional key maps):
+ -- Ctrl+n/p to move up and down the list.
+ return true
+ end,
+ })
+ end
+end
+
+M.anime_selector = image_selector("< Anime Bobs > ", "~/personal/anime")
+
+local function refactor(prompt_bufnr)
+ local content = require("telescope.actions.state").get_selected_entry(prompt_bufnr)
+ require("telescope.actions").close(prompt_bufnr)
+ require("refactoring").refactor(content.value)
+end
+
+M.refactors = function()
+ require("telescope.pickers").new({}, {
+ prompt_title = "refactors",
+ finder = require("telescope.finders").new_table({
+ results = require("refactoring").get_refactors(),
+ }),
+ sorter = require("telescope.config").values.generic_sorter({}),
+ attach_mappings = function(_, map)
+ map("i", "<CR>", refactor)
+ map("n", "<CR>", refactor)
+ return true
+ end,
+ }):find()
+end
+
+M.git_branches = function()
+ require("telescope.builtin").git_branches({
+ attach_mappings = function(_, map)
+ map("i", "<c-d>", actions.git_delete_branch)
+ map("n", "<c-d>", actions.git_delete_branch)
+ return true
+ end,
+ })
+end
+
+M.dev = function(opts)
+ opts = opts or {}
+
+ opts.cwd = opts.cwd or vim.loop.fs_realpath(vim.loop.cwd())
+ print("HEY BAE", opts.cwd)
+
+ local possible_files = vim.api.nvim_get_runtime_file("/lua/**/dev.lua", true)
+ local local_files = {}
+ for _, raw_f in ipairs(possible_files) do
+ local real_f = vim.loop.fs_realpath(raw_f)
+
+ if string.find(real_f, opts.cwd, 1, true) then
+ table.insert(local_files, real_f)
+ end
+ end
+
+ local dev = local_files[1]
+ local loaded = loadfile(dev)
+ local ok, mod = pcall(loaded)
+ if not ok then
+ print("===================================================")
+ print("HEY PRIME. YOUR CODE DOESNT WORK. THIS IS NOT ON ME")
+ print("===================================================")
+ return
+ end
+
+ -- P(mod)
+ local objs = {}
+ for k, v in pairs(mod) do
+ local debug_info = debug.getinfo(v)
+ table.insert(objs, {
+ filename = string.sub(debug_info.source, 2),
+ text = k,
+ })
+ end
+
+ local mod_name = vim.split(dev, "/lua/")
+ if #mod_name ~= 2 then
+ print("===================================================")
+ print("HEY PRIME. I DO NOT KNOW HOW TO FIND THIS FILE:")
+ print(dev)
+ print("===================================================")
+ end
+ mod_name = string.gsub(mod_name[2], ".lua$", "")
+ mod_name = string.gsub(mod_name, "/", ".")
+
+ pickers.new({
+ finder = finders.new_table({
+ results = objs,
+ entry_maker = function(entry)
+ return {
+ value = entry,
+ text = entry.text,
+ display = entry.text,
+ ordinal = entry.text,
+ filename = entry.filename,
+ }
+ end,
+ }),
+ sorter = conf.generic_sorter(opts),
+ previewer = previewers.builtin.new(opts),
+ attach_mappings = function(_, map)
+ actions.select_default:replace(function(...)
+ -- print("SELECTED", vim.inspect(action_state.get_selected_entry()))
+ local entry = action_state.get_selected_entry()
+ actions.close(...)
+
+ mod[entry.value.text]()
+ end)
+
+ map("i", "<tab>", function(...)
+ local entry = action_state.get_selected_entry()
+ actions.close(...)
+
+ vim.schedule(function()
+ -- vim.cmd(string.format([[normal!]], entry.value.text))
+ vim.api.nvim_feedkeys(
+ vim.api.nvim_replace_termcodes(
+ string.format("<esc>:lua require('%s').%s()", mod_name, entry.value.text),
+ true,
+ false,
+ true
+ ),
+ "n",
+ true
+ )
+ end)
+ end)
+
+ return true
+ end,
+ }):find()
+end
+
+return M
diff --git a/nvim/plugin/colors.vim b/nvim/plugin/colors.vim
new file mode 100644
index 0000000..d200e2a
--- /dev/null
+++ b/nvim/plugin/colors.vim
@@ -0,0 +1,33 @@
+let g:theprimeagen_colorscheme = "gruvbox"
+fun! ColorMyPencils()
+ let g:gruvbox_contrast_dark = 'hard'
+ if exists('+termguicolors')
+ let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"
+ let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"
+ endif
+ let g:gruvbox_invert_selection='0'
+
+ set background=dark
+ if has('nvim')
+ call luaeval('vim.cmd("colorscheme " .. _A[1])', [g:theprimeagen_colorscheme])
+ else
+ " TODO: What the way to use g:theprimeagen_colorscheme
+ colorscheme gruvbox
+ endif
+
+ highlight ColorColumn ctermbg=0 guibg=grey
+ hi SignColumn guibg=none
+ hi CursorLineNR guibg=None
+ highlight Normal guibg=none
+ " highlight LineNr guifg=#ff8659
+ " highlight LineNr guifg=#aed75f
+ highlight LineNr guifg=#5eacd3
+ highlight netrwDir guifg=#5eacd3
+ highlight qfFileName guifg=#aed75f
+ hi TelescopeBorder guifg=#5eacd
+endfun
+call ColorMyPencils()
+
+" Vim with me
+nnoremap <leader>cmp :call ColorMyPencils()<CR>
+nnoremap <leader>vwb :let g:theprimeagen_colorscheme =
diff --git a/nvim/plugin/git.vim b/nvim/plugin/git.vim
new file mode 100644
index 0000000..11c26dd
--- /dev/null
+++ b/nvim/plugin/git.vim
@@ -0,0 +1,8 @@
+nnoremap <leader>ga :Git fetch --all<CR>
+nnoremap <leader>grum :Git rebase upstream/master<CR>
+nnoremap <leader>grom :Git rebase origin/master<CR>
+
+nmap <leader>gh :diffget //3<CR>
+nmap <leader>gu :diffget //2<CR>
+nmap <leader>gs :G<CR>
+
diff --git a/nvim/plugin/harpoon.vim b/nvim/plugin/harpoon.vim
new file mode 100644
index 0000000..46c3a31
--- /dev/null
+++ b/nvim/plugin/harpoon.vim
@@ -0,0 +1,19 @@
+lua require("theprimeagen")
+
+" Terminal commands
+" ueoa is first through fourth finger left hand home row.
+" This just means I can crush, with opposite hand, the 4 terminal positions
+"
+" These functions are stored in harpoon. A plugn that I am developing
+nnoremap <silent><leader>a :lua require("harpoon.mark").add_file()<CR>
+nnoremap <silent><C-e> :lua require("harpoon.ui").toggle_quick_menu()<CR>
+nnoremap <silent><leader>tc :lua require("harpoon.cmd-ui").toggle_quick_menu()<CR>
+
+nnoremap <silent><C-h> :lua require("harpoon.ui").nav_file(1)<CR>
+nnoremap <silent><C-t> :lua require("harpoon.ui").nav_file(2)<CR>
+nnoremap <silent><C-n> :lua require("harpoon.ui").nav_file(3)<CR>
+nnoremap <silent><C-s> :lua require("harpoon.ui").nav_file(4)<CR>
+nnoremap <silent><leader>tu :lua require("harpoon.term").gotoTerminal(1)<CR>
+nnoremap <silent><leader>te :lua require("harpoon.term").gotoTerminal(2)<CR>
+nnoremap <silent><leader>cu :lua require("harpoon.term").sendCommand(1, 1)<CR>
+nnoremap <silent><leader>ce :lua require("harpoon.term").sendCommand(1, 2)<CR>
diff --git a/nvim/plugin/lsp.vim b/nvim/plugin/lsp.vim
new file mode 100644
index 0000000..2d4672d
--- /dev/null
+++ b/nvim/plugin/lsp.vim
@@ -0,0 +1,24 @@
+" Do this in lua?? maybe...
+" vim.o is short for something teej thinks makes sense.
+set completeopt=menu,menuone,noselect
+let g:completion_matching_strategy_list = ['exact', 'substring', 'fuzzy']
+
+fun! LspLocationList()
+ " lua vim.lsp.diagnostic.set_loclist({open_loclist = false})
+endfun
+
+nnoremap <leader>vd :lua vim.lsp.buf.definition()<CR>
+nnoremap <leader>vi :lua vim.lsp.buf.implementation()<CR>
+nnoremap <leader>vsh :lua vim.lsp.buf.signature_help()<CR>
+nnoremap <leader>vrr :lua vim.lsp.buf.references()<CR>
+nnoremap <leader>vrn :lua vim.lsp.buf.rename()<CR>
+nnoremap <leader>vh :lua vim.lsp.buf.hover()<CR>
+nnoremap <leader>vca :lua vim.lsp.buf.code_action()<CR>
+nnoremap <leader>vsd :lua vim.lsp.diagnostic.show_line_diagnostics(); vim.lsp.util.show_line_diagnostics()<CR>
+nnoremap <leader>vn :lua vim.lsp.diagnostic.goto_next()<CR>
+nnoremap <leader>vll :call LspLocationList()<CR>
+
+augroup THE_PRIMEAGEN_LSP
+ autocmd!
+ autocmd! BufWrite,BufEnter,InsertLeave * :call LspLocationList()
+augroup END
diff --git a/nvim/plugin/navigation.vim b/nvim/plugin/navigation.vim
new file mode 100644
index 0000000..4db3e4c
--- /dev/null
+++ b/nvim/plugin/navigation.vim
@@ -0,0 +1,33 @@
+nnoremap <C-Left> :call AfPPAlternatePluthPluth()<CR>
+nnoremap <C-Up> :call AfPPAlternate()<CR>
+inoremap <C-Left> <esc>:call AfPPAlternatePluthPluth()<CR>
+inoremap <C-Up> <esc>:call AfPPAlternate()<CR>
+nnoremap <C-k> :cnext<CR>zz
+nnoremap <C-j> :cprev<CR>zz
+nnoremap <leader>k :lnext<CR>zz
+nnoremap <leader>j :lprev<CR>zz
+nnoremap <C-q> :call ToggleQFList(1)<CR>
+nnoremap <leader>q :call ToggleQFList(0)<CR>
+
+let g:the_primeagen_qf_l = 0
+let g:the_primeagen_qf_g = 0
+
+fun! ToggleQFList(global)
+ if a:global
+ if g:the_primeagen_qf_g == 1
+ let g:the_primeagen_qf_g = 0
+ cclose
+ else
+ let g:the_primeagen_qf_g = 1
+ copen
+ end
+ else
+ if g:the_primeagen_qf_l == 1
+ let g:the_primeagen_qf_l = 0
+ lclose
+ else
+ let g:the_primeagen_qf_l = 1
+ lopen
+ end
+ endif
+endfun
diff --git a/nvim/plugin/netrw.vim b/nvim/plugin/netrw.vim
new file mode 100644
index 0000000..7988327
--- /dev/null
+++ b/nvim/plugin/netrw.vim
@@ -0,0 +1,4 @@
+let g:netrw_browse_split = 0
+let g:netrw_banner = 0
+let g:netrw_winsize = 25
+
diff --git a/nvim/plugin/plenary.vim b/nvim/plugin/plenary.vim
new file mode 100644
index 0000000..c282c9a
--- /dev/null
+++ b/nvim/plugin/plenary.vim
@@ -0,0 +1,2 @@
+nmap <leader>tt <Plug>PlenaryTestFile
+
diff --git a/nvim/plugin/refactoring.vim b/nvim/plugin/refactoring.vim
new file mode 100644
index 0000000..78f3756
--- /dev/null
+++ b/nvim/plugin/refactoring.vim
@@ -0,0 +1,9 @@
+lua require("theprimeagen")
+
+lua require("refactoring").setup({})
+
+vnoremap <silent> <leader>rr :lua require("theprimeagen.telescope").refactors()<CR>
+nnoremap <silent> <leader>rr :lua require("theprimeagen.telescope").refactors()<CR>
+nnoremap <silent> <leader>df :lua require("refactoring").debug.printf({below = false})<CR>
+nnoremap <silent> <leader>db :lua require("refactoring").debug.printf({below = true})<CR>
+
diff --git a/nvim/plugin/sets.vim b/nvim/plugin/sets.vim
new file mode 100644
index 0000000..b691eb2
--- /dev/null
+++ b/nvim/plugin/sets.vim
@@ -0,0 +1,34 @@
+set guicursor=
+set relativenumber
+set nohlsearch
+set hidden
+set noerrorbells
+set tabstop=4 softtabstop=4
+set shiftwidth=4
+set expandtab
+set smartindent
+set nu
+set nowrap
+set noswapfile
+set nobackup
+set undodir=~/.vim/undodir
+set undofile
+set incsearch
+set termguicolors
+set scrolloff=8
+" set noshowmode
+set signcolumn=yes
+set isfname+=@-@
+" set ls=0
+
+" Give more space for displaying messages.
+set cmdheight=1
+
+" Having longer updatetime (default is 4000 ms = 4 s) leads to noticeable
+" delays and poor user experience.
+set updatetime=50
+
+" Don't pass messages to |ins-completion-menu|.
+set shortmess+=c
+
+set colorcolumn=80
diff --git a/nvim/plugin/telescope.vim b/nvim/plugin/telescope.vim
new file mode 100644
index 0000000..fdd9603
--- /dev/null
+++ b/nvim/plugin/telescope.vim
@@ -0,0 +1,16 @@
+lua require("theprimeagen")
+
+nnoremap <leader>ps :lua require('telescope.builtin').grep_string({ search = vim.fn.input("Grep For > ")})<CR>
+nnoremap <C-p> :lua require('telescope.builtin').git_files()<CR>
+nnoremap <Leader>pf :lua require('telescope.builtin').find_files()<CR>
+
+nnoremap <leader>pw :lua require('telescope.builtin').grep_string { search = vim.fn.expand("<cword>") }<CR>
+nnoremap <leader>pb :lua require('telescope.builtin').buffers()<CR>
+nnoremap <leader>vh :lua require('telescope.builtin').help_tags()<CR>
+nnoremap <leader>vrc :lua require('theprimeagen.telescope').search_dotfiles({ hidden = true })<CR>
+nnoremap <leader>va :lua require('theprimeagen.telescope').anime_selector()<CR>
+nnoremap <leader>vc :lua require('theprimeagen.telescope').chat_selector()<CR>
+nnoremap <leader>gc :lua require('theprimeagen.telescope').git_branches()<CR>
+nnoremap <leader>gw :lua require('telescope').extensions.git_worktree.git_worktrees()<CR>
+nnoremap <leader>gm :lua require('telescope').extensions.git_worktree.create_git_worktree()<CR>
+nnoremap <leader>td :lua require('theprimeagen.telescope').dev()<CR>
diff --git a/nvim/plugin/vimspector.vim b/nvim/plugin/vimspector.vim
new file mode 100644
index 0000000..deba533
--- /dev/null
+++ b/nvim/plugin/vimspector.vim
@@ -0,0 +1,12 @@
+fun! GotoWindow(id)
+ call win_gotoid(a:id)
+ MaximizerToggle
+endfun
+
+" Debugger remaps
+nnoremap <leader>m :MaximizerToggle!<CR>
+
+" <Plug>VimspectorStop
+" <Plug>VimspectorPause
+" <Plug>VimspectorAddFunctionBreakpoint
+
diff --git a/scripts/td.sh b/scripts/td.sh
index 44ca0ab..968c98b 100755
--- a/scripts/td.sh
+++ b/scripts/td.sh
@@ -1,6 +1,16 @@
#!/bin/sh
+TEMP=$(getopt -o hf --long help,force \
+ -n 'javawrap' -- "$@")
+
+if [ $? != 0 ]; then
+ echo "Terminating..." >&2
+ exit 1
+fi
+
+eval set -- "$TEMP"
SCRIPT="$(basename $0)"
+ENV_CACHE="${HOME}/.cache/td/.env"
help() {
cat <<-EOF
@@ -43,22 +53,6 @@ echo_err() {
echo >&2 "$SCRIPT: $@"
}
-rm_args="-r"
-while test $# -gt 0; do
- case $1 in
- --help | -h)
- help
- return 0
- ;;
- --force | -f)
- rm_args="-rf"
- shift
- ;;
- *) break ;;
-
- esac
-done
-
show() {
if [ ! -n "$TD" ]; then
echo_err "Not set"
@@ -82,6 +76,7 @@ remove() {
cd "$TD_ORIGIN"
fi
+ rm "$ENV_CACHE" -rf
unset TD
unset TD_ORIGIN
}
@@ -92,22 +87,54 @@ create() {
td=$(mktemp -d)
export TD="$td"
- export TD_ORIGIN="$PWD"
+ update-origin
echo "created $TD"
cd "$TD"
}
+update-origin() {
+ export TD_ORIGIN="$PWD"
+ cat >$ENV_CACHE <<-EOF
+TD=$TD
+TD_ORIGIN=$TD_ORIGIN
+EOF
+}
+
toggle() {
if [ "$PWD" = "$TD" ]; then
cd "$TD_ORIGIN"
elif [ -n "$TD" ]; then
+ update-origin
cd "$TD"
else
create
fi
}
+if [ -f "$ENV_CACHE" ]; then
+ export $(cat "$ENV_CACHE" | xargs)
+fi
+
+rm_args="-r"
+while test $# -gt 0; do
+ case $1 in
+ --help | -h)
+ help
+ return 0
+ ;;
+ --force | -f)
+ rm_args="-rf"
+ shift
+ ;;
+ --)
+ shift
+ break
+ ;;
+ *) break ;;
+ esac
+done
+
case $1 in
ls | list | show)
show
diff --git a/tmux.conf b/tmux.conf
index 026697e..22e93b6 100644
--- a/tmux.conf
+++ b/tmux.conf
@@ -1,6 +1,5 @@
-set -g default-terminal "tmux-256color"
-set -ga terminal-overrides ",xterm-256color*:Tc"
set -g mouse on
+set -ga terminal-overrides ',*256color*:smcup@:rmcup@'
unbind C-b
set-option -g prefix C-a
@@ -25,3 +24,17 @@ bind -r k select-pane -U
bind -r j select-pane -D
bind -r h select-pane -L
bind -r l select-pane -R
+
+bind -r D neww -c "#{pane_current_path}" "[[ -e TODO.md ]] && nvim TODO.md || nvim ~/.todo.md"
+
+# forget the find window. That is for chumps
+bind-key -r f run-shell "tmux neww ~/.local/bin/tmux-sessionizer"
+
+bind-key -r i run-shell "tmux neww tmux-cht.sh"
+# bind-key -r G run-shell "~/.local/bin/tmux-sessionizer ~/work/nrdp"
+# bind-key -r C run-shell "~/.local/bin/tmux-sessionizer ~/work/tvui"
+# bind-key -r R run-shell "~/.local/bin/tmux-sessionizer ~/work/milo"
+# bind-key -r H run-shell "~/.local/bin/tmux-sessionizer ~/personal/vim-with-me"
+# bind-key -r T run-shell "~/.local/bin/tmux-sessionizer ~/personal/refactoring.nvim"
+# bind-key -r N run-shell "~/.local/bin/tmux-sessionizer ~/personal/harpoon"
+# bind-key -r S run-shell "~/.local/bin/tmux-sessionizer ~/personal/developer-productivity"
diff --git a/wezterm.lua b/wezterm.lua
deleted file mode 100644
index 879a615..0000000
--- a/wezterm.lua
+++ /dev/null
@@ -1,18 +0,0 @@
-local wezterm = require "wezterm"
-
-return {
- default_prog = {"wsl.exe"},
- font = wezterm.font_with_fallback({"Fira Code", "FiraCode NF"}),
- window_close_confirmation = "NeverPrompt",
- canonicalize_pasted_newlines = true,
- audible_bell = "Disabled",
- visual_bell = {
- fade_in_duration_ms = 75,
- fade_out_duration_ms = 75,
- target = "CursorColor"
- },
- exit_behavior = "Close",
- use_fancy_tab_bar = false,
- enable_tab_bar = false,
- enable_scroll_bar = true
-}
diff --git a/wsl.install b/wsl.install
index 3686da8..0438bb7 100755
--- a/wsl.install
+++ b/wsl.install
@@ -45,7 +45,6 @@ $mkln $@ "gnupg/gpg-agent.conf" "${WINHOME}/AppData/Roaming/gnupg/gpg-agent.conf
$mkln $@ "gnupg/scdaemon.conf" "${WINHOME}/AppData/Roaming/gnupg/scdaemon.conf"
$mkln $@ "wt.json" "${WINHOME}/AppData/Local/Packages/Microsoft.WindowsTerminalPreview_8wekyb3d8bbwe/LocalState/settings.json"
$mkln $@ "winget.json" "${WINHOME}/AppData/Local/Packages/Microsoft.DesktopAppInstaller_8wekyb3d8bbwe/LocalState/settings.json"
-$mkln $@ "wezterm.lua" "${WINHOME}/.config/wezterm/wezterm.lua"
# install hotkeys.exe
install_dir="${WINHOME}/AppData/Local/Programs/hotkeys"
diff --git a/wsl/gpg.sh b/wsl/gpg.sh
index 5fa3ec2..a4cbcc4 100755
--- a/wsl/gpg.sh
+++ b/wsl/gpg.sh
@@ -10,7 +10,7 @@
export SSH_AUTH_SOCK="$HOME/.ssh/agent.sock"
export GPG_AGENT_SOCK="$HOME/.gnupg/S.gpg-agent"
-function gpg-init() (
+gpg-init() (
if ! ss -a | grep -q "$SSH_AUTH_SOCK"; then
rm -f "$SSH_AUTH_SOCK"
wsl2_ssh_pageant_bin="$HOME/.ssh/wsl2-ssh-pageant.exe"
@@ -45,8 +45,22 @@ function gpg-init() (
fi
)
+start-pageant() {
+ # TODO: WIP
+ if ! ss -a | grep -q "${GPG_AGENT_SOCK}.extra"; then
+ rm -rf "${GPG_AGENT_SOCK}.extra"
+ wsl2_ssh_pageant_bin="$HOME/.ssh/wsl2-ssh-pageant.exe"
+ if test -x "$wsl2_ssh_pageant_bin"; then
+ (setsid nohup socat UNIX-LISTEN:"${GPG_AGENT_SOCK}.extra,fork" EXEC:"$wsl2_ssh_pageant_bin --gpg S.gpg-agent.extra" >/dev/null 2>&1 &)
+ else
+ echo >&2 "WARNING: $wsl2_ssh_pageant_bin is not executable."
+ fi
+ unset wsl2_ssh_pageant_bin
+ fi
+}
+
# Reload
-function gpg-reset() {
+gpg-reset() {
gpg-connect-agent.exe KILLAGENT /bye &>/dev/null
pkill -f 'socat.*wsl2-ssh-pageant.exe'
gpg-connect-agent.exe /bye &>/dev/null
@@ -54,7 +68,7 @@ function gpg-reset() {
}
# Relearn card serial number
-function gpg-learn {
+gpg-learn() {
gpg-connect-agent.exe "scd serialno" "learn --force" /bye
}
diff --git a/zsh/keybindings.zsh b/zsh/keybindings.zsh
index fe919fc..7eef985 100644
--- a/zsh/keybindings.zsh
+++ b/zsh/keybindings.zsh
@@ -103,6 +103,7 @@ for key kcap seq mode widget (
bindkey '^ ' autosuggest-accept
bindkey '^[[Z' reverse-menu-complete
+bindkey -s ^f "tmux-sessionizer\n"
# register ctrl+c as interupt
function ctrl_c_intr() {
diff --git a/zshenv b/zshenv
index 3e1b2e5..9993733 100644
--- a/zshenv
+++ b/zshenv
@@ -1,7 +1,2 @@
ZDOTDIR=$HOME/.zsh
-
-if command -v tmux &>/dev/null && [ -n "$PS1" ] && [[ ! "$TERM" =~ screen ]] && [[ ! "$TERM" =~ tmux ]] && [ -z "$TMUX" ]; then
- exec tmux
-fi
-
. $ZDOTDIR/.zshenv