diff --git a/dotfiles/neovim/ftplugin/tex.lua b/dotfiles/neovim/ftplugin/tex.lua index af73f0c..f291e37 100644 --- a/dotfiles/neovim/ftplugin/tex.lua +++ b/dotfiles/neovim/ftplugin/tex.lua @@ -33,6 +33,7 @@ local abbreviations = { { "en", "^{n}" }, { "etn", "^{-}" }, { "ett", "^{t}" }, + { "tmat", "^{T}" }, -- Tranpose of a matrix { "etp", "^{+}" }, -- Subscripts @@ -87,10 +88,14 @@ local abbreviations = { { "nope", "\\bot" }, { "yee", "\\top" }, { "ccan", "\\cancel" }, + { "comp", "\\circ" }, { "mul", "\\cdot" }, { "smul", "\\times" }, { "texpl", "&& \\text{}" }, - { "card", "\\#" } + { "card", "\\#" }, + + -- words + { "rref", "reduced row echalon form" } } A.manyLocalAbbr(abbreviations) diff --git a/dotfiles/neovim/lua/my/plugins/telescope.lua b/dotfiles/neovim/lua/my/plugins/telescope.lua index eeeff12..210c27f 100644 --- a/dotfiles/neovim/lua/my/plugins/telescope.lua +++ b/dotfiles/neovim/lua/my/plugins/telescope.lua @@ -10,6 +10,7 @@ local keybinds = { { "", "find_files" }, { "ft", find_files_by_extension("tex") }, { "fl", find_files_by_extension("lua") }, + { "d", "diagnostics" }, { "", "live_grep" }, { "t", "builtin" }, } diff --git a/dotfiles/tmux/tmux.conf b/dotfiles/tmux/tmux.conf index f302b64..55140db 100644 --- a/dotfiles/tmux/tmux.conf +++ b/dotfiles/tmux/tmux.conf @@ -38,11 +38,38 @@ bind -T copy-mode-vi V send-keys -X rectangle-toggle # Check if this works bind -T copy-mode-vi v send-keys -X begin-selection bind -T copy-mode-vi y send-keys -X copy-selection -# smart pane switching with awareness of vim splits -bind -n C-h run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-h) || tmux select-pane -L" -bind -n C-j run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-j) || tmux select-pane -D" -bind -n C-k run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-k) || tmux select-pane -U" -bind -n C-l run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-l) || tmux select-pane -R" +# Pane navigation with vim support +# cmd="$(tmux display -p '#{pane_current_command}')" +# cmd="$(basename "$cmd" | tr A-Z a-z)" +# pane_count="$(tmux list-panes | wc -l)" +# +# if [ "${cmd%m}" = "vi" ] || [ "$pane_count" -eq 1 ]; then +# direction="$(echo "${1#-}" | tr 'lLDUR' '\\hjkl')" +# # forward the keystroke to Vim +# tmux send-keys "C-$direction" +# else +# tmux select-pane "$@" +# fi + +# Smart pane switching with awareness of Vim splits. +# See: https://github.com/christoomey/vim-tmux-navigator +is_vim="ps -o state= -o comm= -t '#{pane_tty}' \ + | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'" +bind-key -n 'C-h' if-shell "$is_vim" 'send-keys C-h' 'select-pane -L' +bind-key -n 'C-j' if-shell "$is_vim" 'send-keys C-j' 'select-pane -D' +bind-key -n 'C-k' if-shell "$is_vim" 'send-keys C-k' 'select-pane -U' +bind-key -n 'C-l' if-shell "$is_vim" 'send-keys C-l' 'select-pane -R' +tmux_version='$(tmux -V | sed -En "s/^tmux ([0-9]+(.[0-9]+)?).*/\1/p")' +if-shell -b '[ "$(echo "$tmux_version < 3.0" | bc)" = 1 ]' \ + "bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\' 'select-pane -l'" +if-shell -b '[ "$(echo "$tmux_version >= 3.0" | bc)" = 1 ]' \ + "bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\\\' 'select-pane -l'" + +bind-key -T copy-mode-vi 'C-h' select-pane -L +bind-key -T copy-mode-vi 'C-j' select-pane -D +bind-key -T copy-mode-vi 'C-k' select-pane -U +bind-key -T copy-mode-vi 'C-l' select-pane -R +bind-key -T copy-mode-vi 'C-\' select-pane -l # Copy to clipboard using fastcopy # set-option -g set-clipboard on diff --git a/dotfiles/vscode-snippets/snippets/latex/core.json b/dotfiles/vscode-snippets/snippets/latex/core.json index 5845280..e96fb13 100644 --- a/dotfiles/vscode-snippets/snippets/latex/core.json +++ b/dotfiles/vscode-snippets/snippets/latex/core.json @@ -248,5 +248,47 @@ "prefix": "aleq", "description": "Aligned equation", "body": ["\\\\\\ $1 &= $2", "$0"] + }, + "2x2 matrices": { + "prefix": "mat22", + "description": "Create a 2x2 matrix", + "body": [ + "\\begin{bmatrix}", + " ${1:1} & ${2:0}", + "\\\\\\ ${3:0} & ${4:1}", + "\\end{bmatrix}$0" + ] + }, + "3x3 matrices": { + "prefix": "mat33", + "description": "Create a 3x3 matrix", + "body": [ + "\\begin{bmatrix}", + " ${1:1} & ${2:0} & ${3:0}", + "\\\\\\ ${4:0} & ${5:1} & ${6:0}", + "\\\\\\ ${7:0} & ${8:0} & ${9:1}", + "\\end{bmatrix}$0" + ] + }, + "3x3 determinants": { + "prefix": "det33", + "description": "Create a 3x3 determinant", + "body": [ + "\\begin{vmatrix}", + " $1 & $2 & $3", + "\\\\\\ $4 & $5 & $6", + "\\\\\\ $7 & $8 & $9", + "\\end{vmatrix}$0" + ] + }, + "2x2 determinants": { + "prefix": "det22", + "description": "Create a 2x2 determinant", + "body": [ + "\\begin{vmatrix}", + " $1 & $2", + "\\\\\\ $3 & $4", + "\\end{vmatrix}$0" + ] } }