1
Fork 0
This commit is contained in:
Matei Adriel 2022-10-04 23:42:58 +02:00
parent b9ce1d1f87
commit d3ab72c6c8
4 changed files with 81 additions and 6 deletions

View file

@ -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)

View file

@ -10,6 +10,7 @@ local keybinds = {
{ "<C-P>", "find_files" },
{ "<Leader>ft", find_files_by_extension("tex") },
{ "<Leader>fl", find_files_by_extension("lua") },
{ "<Leader>d", "diagnostics" },
{ "<C-F>", "live_grep" },
{ "<Leader>t", "builtin" },
}

View file

@ -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

View file

@ -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"
]
}
}