updated kakoune
This commit is contained in:
committed by
Michael Chalupiak
parent
9f23b8e92b
commit
00781ddcae
@@ -15,189 +15,83 @@ plug "andreyorst/smarttab.kak" defer smarttab %{
|
||||
|
||||
plug "occivink/kakoune-sudo-write"
|
||||
|
||||
plug "jtrv/grep-write.kak"
|
||||
|
||||
plug "kak-lsp/kak-lsp" do %{
|
||||
cargo install --locked --force --path .
|
||||
}
|
||||
|
||||
plug "gustavo-hms/luar" %{
|
||||
plug "gustavo-hms/peneira" %{
|
||||
require-module peneira
|
||||
}
|
||||
plug "gustavo-hms/luar" config %{
|
||||
require-module luar
|
||||
}
|
||||
|
||||
plug "gustavo-hms/peneira" config %{
|
||||
require-module peneira
|
||||
set-option global luar_interpreter luajit
|
||||
set-option global peneira_files_command 'fd -t f -I'
|
||||
}
|
||||
|
||||
plug 'theowenyoung/kakoune-buffer-manager'
|
||||
|
||||
plug "h-youhei/kakoune-surround"
|
||||
|
||||
plug "your-tools/kak-subvert" do %{
|
||||
cargo install --locked --force --path .
|
||||
}
|
||||
|
||||
plug "https://git.sr.ht/~nasmevka/repl.kak"
|
||||
|
||||
plug "https://gitlab.com/kstr0k/mru-files.kak" demand mru-files %{ # %{} needed even if empty
|
||||
# suggested mappings: *after* plugin loads
|
||||
# think "go alt[ernate]-f[iles]"
|
||||
# map global goto <a-f> '<esc>: mru-files ' -docstring 'mru-files'
|
||||
# map global goto <a-F> '<esc>: mru-files-related<ret>' -docstring 'mru-files-related'
|
||||
}
|
||||
|
||||
plug "custom-filetypes" load-path "~/.config/kak/al"
|
||||
# # Color Themes
|
||||
plug "tinted-theming/base16-kakoune" theme
|
||||
plug "https://git.sr.ht/~hadronized/kakoune-tree-sitter-themes" theme
|
||||
### End Of Plugins ###
|
||||
|
||||
set-option global luar_interpreter luajit
|
||||
|
||||
## Treesitter ##
|
||||
eval %sh{ kak-tree-sitter -dksvvv --with-highlighting --with-text-objects --init $kak_session }
|
||||
#eval %sh{ kak-tree-sitter -dks --with-text-objects --session $kak_session }
|
||||
#eval %sh{ kak-tree-sitter -dks --with-highlighting --session $kak_session }
|
||||
#eval %sh{ kak-tree-sitter -dksvvv --init $kak_session }
|
||||
#
|
||||
# evaluate-commands %sh{
|
||||
# echo "colorscheme base16-$BASE16_THEME"
|
||||
# }
|
||||
|
||||
## Popup ##
|
||||
evaluate-commands %sh{kak-popup init}
|
||||
|
||||
## Highlighting ##
|
||||
hook global WinCreate .* %{ add-highlighter window/number-lines number-lines -relative -hlcursor}
|
||||
add-highlighter global/ show-matching
|
||||
add-highlighter global/ column 80 MenuBackground
|
||||
add-highlighter global/ show-whitespaces -spc " " -nbsp ""
|
||||
#add-highlighter global/ show-whitespaces -nbsp "" -lf "" -indent "|"
|
||||
add-highlighter global/ show-whitespaces -spc " " -nbsp "" -indent " "
|
||||
|
||||
## Wrapping ##
|
||||
|
||||
add-highlighter global/ wrap -word -indent
|
||||
|
||||
set-option global grepcmd 'ag'
|
||||
## Formatting ##
|
||||
# define-command enable-autofmt -docstring 'enable autoformatting of buffer' %{
|
||||
#
|
||||
#
|
||||
# hook global -group autofmt BufSetOption filetype=(zig) %{
|
||||
# set-option buffer formatcmd 'zig fmt --stdin'
|
||||
#
|
||||
# hook -group autofmt buffer BufOpenFile .* %{
|
||||
# format
|
||||
# }
|
||||
#
|
||||
# hook -group autofmt buffer BufWritePre .* %{
|
||||
# format
|
||||
# }
|
||||
# }
|
||||
#
|
||||
# hook global -group autofmt BufSetOption filetype=(html) %{
|
||||
# set-option buffer formatcmd 'prettier --tab-width 4 --parser html'
|
||||
#
|
||||
# hook -group autofmt buffer BufOpenFile .* %{
|
||||
# format
|
||||
# }
|
||||
#
|
||||
# hook -group autofmt buffer BufWritePre .* %{
|
||||
# format
|
||||
# }
|
||||
# }
|
||||
#
|
||||
# hook global -group autofmt BufSetOption filetype=(css) %{
|
||||
# set-option buffer formatcmd 'prettier --tab-width 4 --parser css'
|
||||
#
|
||||
# hook -group autofmt buffer BufOpenFile .* %{
|
||||
# format
|
||||
# }
|
||||
#
|
||||
# hook -group autofmt buffer BufWritePre .* %{
|
||||
# format
|
||||
# }
|
||||
# }
|
||||
define-command enable-autofmt -docstring 'enable autoformatting of buffer' %{
|
||||
|
||||
hook global -group autofmt BufSetOption filetype=(c|cpp) %{
|
||||
set-option buffer formatcmd 'clang-format'
|
||||
|
||||
hook -group autofmt buffer BufOpenFile .* %{
|
||||
format
|
||||
}
|
||||
|
||||
hook -group autofmt buffer BufWritePre .* %{
|
||||
format
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
define-command disable-autofmt -docstring 'disable autoformatting of buffer' %{
|
||||
remove-hooks global autofmt
|
||||
}
|
||||
|
||||
enable-autofmt
|
||||
## Indentation ##
|
||||
set global tabstop 4
|
||||
set global indentwidth 4
|
||||
hook global WinSetOption filetype=.* expandtab
|
||||
hook global WinSetOption filetype=(makefile|gas) noexpandtab
|
||||
hook global BufCreate .* %{
|
||||
editorconfig-load
|
||||
autoconfigtab
|
||||
}
|
||||
|
||||
define-command set-spell -docstring 'Enable spellcheck' %{
|
||||
# hook -group spellcheck global BufOpenFile .* %{
|
||||
hook -group spellcheck buffer InsertChar .* %{
|
||||
evaluate-commands %{
|
||||
spell
|
||||
}
|
||||
}
|
||||
|
||||
hook -group spellcheck buffer InsertDelete .* %{
|
||||
evaluate-commands %{
|
||||
spell
|
||||
}
|
||||
}
|
||||
# }
|
||||
}
|
||||
|
||||
define-command set-nospell -docstring 'Disable spellcheck' %{
|
||||
remove-hooks buffer spellcheck
|
||||
}
|
||||
|
||||
define-command sleuth -docstring 'Heuristically set buffer options' %{
|
||||
try %{
|
||||
evaluate-commands -draft %{
|
||||
# Search the first indent level
|
||||
execute-keys 'gg' '/' '^\h+' '<ret>'
|
||||
|
||||
# Tab vs. Space
|
||||
# https://youtu.be/V7PLxL8jIl8
|
||||
try %{
|
||||
execute-keys '<a-k>' '\t' '<ret>'
|
||||
#set-option buffer indentwidth 0
|
||||
noexpandtab
|
||||
} catch %{
|
||||
set-option buffer indentwidth %val{selection_length}
|
||||
expandtab
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
define-command git-status -docstring 'Show git diff' %{
|
||||
hook -group git-status global BufOpenFile .* %{
|
||||
git show-diff
|
||||
}
|
||||
|
||||
hook -group git-status global BufWritePost .* %{
|
||||
git show-diff
|
||||
}
|
||||
}
|
||||
|
||||
define-command disable-git-status -docstring 'Disable git diff gutter' %{
|
||||
remove-hooks global git-status
|
||||
}
|
||||
|
||||
define-command sleuth-enable -docstring 'Enable sleuth' %{
|
||||
# Run sleuth when opening and saving files.
|
||||
hook -group sleuth global BufOpenFile .* %{
|
||||
sleuth
|
||||
}
|
||||
|
||||
hook -group sleuth global BufWritePost .* %{
|
||||
sleuth
|
||||
}
|
||||
}
|
||||
|
||||
define-command sleuth-disable -docstring 'Disable sleuth' %{
|
||||
remove-hooks global sleuth
|
||||
}
|
||||
|
||||
## LSP ##
|
||||
set-option global autocomplete 'prompt'
|
||||
lsp-enable
|
||||
lsp-inlay-diagnostics-enable global
|
||||
set-option global lsp_auto_highlight_references true
|
||||
set-option global lsp_hover_anchor true
|
||||
# lsp-inlay-diagnostics-enable global
|
||||
# set-option global lsp_auto_highlight_references true
|
||||
# set-option global lsp_hover_anchor true
|
||||
lsp-auto-signature-help-enable
|
||||
lsp-inlay-hints-enable global
|
||||
# lsp-inlay-hints-enable global
|
||||
|
||||
map global user k ':lsp-hover<ret>'
|
||||
|
||||
@@ -244,213 +138,190 @@ hook -group lsp-filetype-typst global BufSetOption filetype=typst %{
|
||||
# previewFeature = "disable"
|
||||
}
|
||||
}
|
||||
|
||||
set-option global lsp_config %{
|
||||
}
|
||||
|
||||
define-command fzf-buffer -docstring 'Invoke fzf to select a buffer' %{
|
||||
define-command -docstring 'git log' git-log %{
|
||||
evaluate-commands %sh{
|
||||
tmux split-window -l 20% "(printf \"%s\n\" $kak_quoted_buflist | fzf --bind 'focus:execute-silent(echo \"eval -client $kak_client %{ e {} }\" | kak -p $kak_session)' || echo \"$kak_buffile\") | xargs -I{} echo \"eval -client $kak_client %{ e '{}' }\" | /usr/bin/kak -p $kak_session"
|
||||
output=$(mktemp -d "${TMPDIR:-/tmp}"/kak-git.XXXXXXXX)/fifo
|
||||
mkfifo ${output}
|
||||
( trap - INT QUIT; git log > ${output} 2>&1 & ) > /dev/null 2>&1 < /dev/null
|
||||
|
||||
printf %s "evaluate-commands -try-client '$kak_opt_docsclient' '
|
||||
edit! -fifo ${output} *git*
|
||||
set-option buffer filetype git-log
|
||||
$(hide_blame)
|
||||
set-option buffer git_blob %{}
|
||||
hook -always -once buffer BufCloseFifo .* ''
|
||||
nop %sh{ rm -r $(dirname ${output}) }
|
||||
''
|
||||
'"
|
||||
}
|
||||
}
|
||||
|
||||
define-command -docstring 'Invoke fzf to select a buffer' prev-fzf-buff %{
|
||||
evaluate-commands %sh{
|
||||
BUFFER=$(
|
||||
(
|
||||
eval "set -- $kak_buflist"
|
||||
while [ $# -gt 0 ]; do
|
||||
printf "%s\0" "$1"
|
||||
shift
|
||||
done
|
||||
) |
|
||||
fzf-tmux --cycle -p 80%,90% --read0 --preview='bat --theme=base16-256 --color=always {} 2>/dev/null'
|
||||
)
|
||||
if [ -n "$BUFFER" ]; then
|
||||
printf "buffer %s" "${BUFFER}"
|
||||
fi
|
||||
}
|
||||
define-command -docstring 'fd find files' -params 1 fd %{
|
||||
edit %arg{1}
|
||||
}
|
||||
|
||||
define-command -docstring 'live grep' live-grep %{
|
||||
evaluate-commands %sh{
|
||||
complete-command -menu fd shell-script-candidates 'fd -I -t f .'
|
||||
|
||||
if [ -z "${kak_client_env_TMUX}" ]; then
|
||||
printf 'fail "client was not started under tmux"\n'
|
||||
else
|
||||
file="$(rfv.sh)"
|
||||
if [ -n "$file" ]; then
|
||||
printf "edit %s\n" "$file"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
declare-option -hidden str last_command
|
||||
|
||||
define-command -docstring 'compile a la emacs' compile %{
|
||||
prompt -init "%opt{last_command}" -shell-completion "Command: " compile_text
|
||||
}
|
||||
|
||||
define-command -docstring 'exact grep' exact-grep %{
|
||||
evaluate-commands %sh{
|
||||
|
||||
if [ -z "${kak_client_env_TMUX}" ]; then
|
||||
printf 'fail "client was not started under tmux"\n'
|
||||
else
|
||||
file="$(rfve.sh)"
|
||||
if [ -n "$file" ]; then
|
||||
printf "edit %s\n" "$file"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
}
|
||||
|
||||
define-command -docstring 'search contents of current file' file-search %{
|
||||
evaluate-commands -save-regs '"' %{
|
||||
set-register dquote %sh{ mktemp }
|
||||
execute-keys -draft '%<a-|> cat > $kak_reg_dquote<ret>'
|
||||
evaluate-commands %sh{
|
||||
if [ -z "${kak_client_env_TMUX}" ]; then
|
||||
printf 'fail "client was not started under tmux"\n'
|
||||
else
|
||||
file="$(rfs.sh ${kak_reg_dquote} ${kak_buffile})"
|
||||
if [ -n "$file" ]; then
|
||||
printf "edit %s\n" "$file"
|
||||
define-command -docstring 'compile_text' compile_text -hidden %{
|
||||
evaluate-commands %{
|
||||
evaluate-commands -try-client %opt{toolsclient} %{
|
||||
fifo -scroll -name *compile-mode* -script %{
|
||||
trap - INT QUIT
|
||||
printf "*compilation started at $(date)*\n"
|
||||
eval "$kak_quoted_text"
|
||||
exit_code=$?
|
||||
if [ $exit_code == 0 ]; then
|
||||
printf "*compilation finished at $(date)*\n"
|
||||
else
|
||||
printf "*compilation exited abnormally at $(date) with exit code $exit_code*\n"
|
||||
fi
|
||||
rm $kak_reg_dquote
|
||||
fi
|
||||
} -- %arg{@}
|
||||
set-option buffer filetype cmd
|
||||
set-option buffer jump_current_line 0
|
||||
set-option global last_command %val{text}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
define-command -docstring 'search contents of current file with regex' regex-file-search %{
|
||||
evaluate-commands -save-regs '"' %{
|
||||
set-register dquote %sh{ mktemp }
|
||||
execute-keys -draft '%<a-|> cat > $kak_reg_dquote<ret>'
|
||||
evaluate-commands %sh{
|
||||
if [ -z "${kak_client_env_TMUX}" ]; then
|
||||
printf 'fail "client was not started under tmux"\n'
|
||||
else
|
||||
file="$(rgrs.sh ${kak_reg_dquote} ${kak_buffile})"
|
||||
if [ -n "$file" ]; then
|
||||
printf "edit %s\n" "$file"
|
||||
fi
|
||||
rm $kak_reg_dquote
|
||||
fi
|
||||
define-command -docstring 'compile_run' compile_run -params .. -hidden %{
|
||||
evaluate-commands -save-regs ab %{
|
||||
set-register a %arg{@}
|
||||
set-register b %sh{ printf "*%s*" "$1" }
|
||||
evaluate-commands -try-client %opt{toolsclient} %{
|
||||
fifo -name %reg{b} -script %{
|
||||
trap - INT QUIT
|
||||
eval "$kak_quoted_reg_a"
|
||||
} -- %arg{@}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
define-command -docstring 'Invoke fzf to open a file' -params 0 fzf-edit %{
|
||||
evaluate-commands %sh{
|
||||
if [ -z "${kak_client_env_TMUX}" ]; then
|
||||
printf 'fail "client was not started under tmux"\n'
|
||||
else
|
||||
file="$(fd -t f . |TMUX="${kak_client_env_TMUX}" fzf-tmux --cycle -p 80%,90% --preview='bat --theme=base16-256 --color=always {} 2>/dev/null || cat {} 2>/dev/null')"
|
||||
if [ -n "$file" ]; then
|
||||
printf "edit %s\n" "$file"
|
||||
fi
|
||||
fi
|
||||
define-command -hidden cmd-jmp %{
|
||||
evaluate-commands -save-regs a %{
|
||||
try %{
|
||||
execute-keys -draft 'ght<ret>"ay'
|
||||
evaluate-commands -try-client %opt{jumpclient} -verbatim -- edit -existing -- %reg{a}
|
||||
try %{ focus %opt{jumpclient} }
|
||||
} catch %{
|
||||
jump
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
define-command -docstring 'Invoke fzf to open a file local to the current file' -params 0 fzf-edit-local %{
|
||||
evaluate-commands %sh{
|
||||
if [ -z "${kak_client_env_TMUX}" ]; then
|
||||
printf 'fail "client was not started under tmux"\n'
|
||||
else
|
||||
dir="$(get_local_path ${kak_buffile})"
|
||||
if [ -n "$dir" ]; then
|
||||
file="$(fd -u -t f . $dir |TMUX="${kak_client_env_TMUX}" fzf-tmux --cycle -p 80%,90% --preview='bat --theme=base16-256 --color=always {} 2>/dev/null || cat {} 2>/dev/null')"
|
||||
fi
|
||||
if [ -n "$file" ]; then
|
||||
printf "edit %s\n" "$file"
|
||||
fi
|
||||
fi
|
||||
hook -group cmd-highlight global WinSetOption filetype=cmd %{
|
||||
add-highlighter window/cmd group
|
||||
add-highlighter window/cmd/path regex "^([^:\n\*]+[^/:])$" 1:cyan
|
||||
add-highlighter window/cmd/num-path regex "^([^:\n\*]+):(\d+):(\d+)?" 1:cyan 2:green 3:green
|
||||
add-highlighter window/cmd/error regex "^([^:\n\*]+):(\d+):(?:(\d+):)?\h+(?:((?:fatal )?error)|(warning)|(note)|(required from(?: here)?))?.*?$" 1:cyan 2:green 3:green 4:red 5:yellow 6:blue 7:yellow
|
||||
add-highlighter window/cmd/extra regex "^\h*(~*(?:(\^)~*)?)$" 1:green 2:cyan+b
|
||||
add-highlighter window/cmd/info-error regex "(\*compilation exited abnormally at .+ with exit code )([0-9]+)(\*)" 1:default+b 2:red+b 3:default+b
|
||||
add-highlighter window/cmd/info regex "^(\*[^\n]+\*)$" 1:default+b
|
||||
add-highlighter window/cmd/ line %{%opt{jump_current_line}} default+b
|
||||
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/cmd}
|
||||
}
|
||||
|
||||
hook global WinSetOption filetype=cmd %{
|
||||
hook buffer -group cmd-hooks NormalKey <ret> cmd-jmp
|
||||
hook -once -always window WinSetOption filetype=.* %{ remove-hooks buffer cmd-hooks }
|
||||
}
|
||||
|
||||
declare-option str curpath_dirls %sh{pwd}
|
||||
|
||||
define-command dirls -params 1 %{
|
||||
set-option global curpath_dirls "%opt{curpath_dirls}/%arg{1}"
|
||||
compile_run ls -lh %opt{curpath_dirls}
|
||||
set-option buffer filetype dirls
|
||||
}
|
||||
|
||||
complete-command dirls file 0
|
||||
|
||||
define-command -hidden dirls-jmp %{
|
||||
evaluate-commands -save-regs ab %{
|
||||
try %{
|
||||
execute-keys 'gl<a-t> "ay'
|
||||
evaluate-commands -try-client %opt{jumpclient} -verbatim -- edit -existing -- %reg{a}
|
||||
try %{ focus %opt{jumpclient} }
|
||||
} catch %{
|
||||
execute-keys 'gl<a-t> "ay'
|
||||
dirls %reg{a}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
define-command -docstring 'Pick project' -params 0 switch-project %{
|
||||
evaluate-commands %sh{
|
||||
if [ -z "${kak_client_env_TMUX}" ]; then
|
||||
printf 'fail "client was not started under tmux"\n'
|
||||
else
|
||||
proj="$(cat ~/.scripts/projects | TMUX="${kak_client_env_TMUX}" fzf-tmux --cycle -p 80%,90% | cut -d' ' -f1)"
|
||||
if [ -n "$proj" ]; then
|
||||
printf "cd %s\n" "$proj"
|
||||
printf 'fzf-edit\n'
|
||||
fi
|
||||
fi
|
||||
}
|
||||
define-command -hidden dirls-jmp-up %{
|
||||
dirls ".."
|
||||
}
|
||||
|
||||
define-command -docstring 'Project wide search' project-search %{
|
||||
evaluate-commands %sh{
|
||||
hook -group dirls-highlight global WinSetOption filetype=dirls %{
|
||||
add-highlighter window/dirls group
|
||||
add-highlighter window/dirls/file regex "^(-[^\n]+)$" 1:cyan
|
||||
add-highlighter window/dirls/folder regex "^(d[^\n]+)$" 1:blue
|
||||
add-highlighter window/dirls/ line %{%opt{jump_current_line}} default+b
|
||||
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/dirls}
|
||||
}
|
||||
|
||||
if [ -z "${kak_client_env_TMUX}" ]; then
|
||||
printf 'fail "client was not started under tmux"\n'
|
||||
else
|
||||
file="$(rgfs.sh)"
|
||||
if [ -n "$file" ]; then
|
||||
printf "edit %s\n" "$file"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
hook global WinSetOption filetype=dirls %{
|
||||
hook buffer -group dirls-hooks NormalKey <ret> dirls-jmp
|
||||
hook buffer -group dirls-hooks NormalKey <minus> dirls-jmp-up
|
||||
}
|
||||
|
||||
define-command -docstring 'Print Working Directory' -params 0 pwd %{
|
||||
evaluate-commands echo %sh{ echo "$(pwd)"}
|
||||
}
|
||||
|
||||
# define-command -docstring 'copy to clipboard' xcopy %{
|
||||
# execute-keys '<a-|>xclip -selection clipboard -i<ret>'
|
||||
# }
|
||||
|
||||
# define-command -docstring 'paste from clipboard' xpaste %{
|
||||
# evaluate-commands -save-regs '"' %{
|
||||
# set-register dquote %sh{ xclip -selection clipboard -o }
|
||||
# execute-keys 'p'
|
||||
# }
|
||||
# }
|
||||
|
||||
define-command -docstring 'copy to clipboard' xcopy %{
|
||||
execute-keys '<a-|>wl-copy<ret>'
|
||||
execute-keys '<a-|>xclip -selection clipboard -i<ret>'
|
||||
}
|
||||
|
||||
define-command -docstring 'paste from clipboard' xpaste %{
|
||||
evaluate-commands -save-regs '"' %{
|
||||
set-register dquote %sh{ wl-paste }
|
||||
execute-keys 'P'
|
||||
set-register dquote %sh{ xclip -selection clipboard -o }
|
||||
execute-keys 'p'
|
||||
}
|
||||
}
|
||||
|
||||
define-command -docstring 'find files in particular directory' peneira-dir-files %{
|
||||
peneira-files-configure-buffer
|
||||
prompt -shell-script-completion '(fd -t d -d 1 -I . $@ || fd -t d -d 1 -I . $(dirname $@)) | (sk -f $@ || cat)' 'directory: ' peneira-files-in-dir
|
||||
}
|
||||
|
||||
define-command peneira-files-in-dir -hidden %{
|
||||
peneira 'file: ' 'fd -t f -I . $kak_text' 'edit %arg{1}'
|
||||
}
|
||||
|
||||
map -docstring 'fix c-i in silly terminals' global normal '<tab>' '<c-i>'
|
||||
declare-user-mode config
|
||||
map -docstring 'enter config mode' global user e ':enter-user-mode config<ret>'
|
||||
map -docstring 'edit kakoune config' global config k ':e ~/.config/kak/kakrc<ret>'
|
||||
map -docstring 'edit tmux config' global config t ':e ~/.tmux.conf<ret>'
|
||||
map -docstring 'edit bash config' global config b ':e ~/.bashrc<ret>'
|
||||
map -docstring 'edit scripts folder' global config s ':cd ~/.scripts<ret>:fzf-edit<ret>'
|
||||
map -docstring 'edit .config folder' global config c ':cd ~/.config<ret>:fzf-edit<ret>'
|
||||
|
||||
declare-user-mode buffer
|
||||
map -docstring 'enter buffer mode' global user b ':enter-user-mode buffer<ret>'
|
||||
map -docstring 'next buffer' global buffer n ':buffer-next<ret>'
|
||||
map -docstring 'previous buffer' global buffer p ':buffer-previous<ret>'
|
||||
map -docstring 'close current buffer' global buffer d ':delete-buffer!<ret>'
|
||||
map -docstring 'write and close current buffer' global buffer w ':w<ret>:db<ret>'
|
||||
map -docstring 'list and select a buffer' global buffer b ':fzf-buffer<ret>'
|
||||
map -docstring 'open buf manager' global user b ':buffer-manager<ret>'
|
||||
map -docstring 'compile mode' global user c ':compile<ret>'
|
||||
map -docstring 'next error' global user ] ':jump-next *compile-mode*<ret>'
|
||||
map -docstring 'previous error' global user [ ':jump-previous *compile-mode*<ret>'
|
||||
|
||||
declare-user-mode find
|
||||
map -docstring 'enter find mode' global user f ':enter-user-mode find<ret>'
|
||||
map -docstring 'find files' global find f ':fzf-edit<ret>'
|
||||
map -docstring 'find tags for the current project' global find t ':ctags-search '
|
||||
map -docstring 'find line in current file' global find l ':file-search<ret>'
|
||||
map -docstring 'find line in current file with regex' global find L ':regex-file-search<ret>'
|
||||
map -docstring 'find files in current directory' global find F ':fzf-edit-local<ret>'
|
||||
map -docstring "grep file contents recursively" global find g ':live-grep<ret>'
|
||||
map -docstring "grep exact file contents recursively" global find e ':exact-grep<ret>'
|
||||
map -docstring 'project wide search' global find p ':project-search<ret>'
|
||||
map -docstring 'clipboard paste' global user p ':xpaste<ret>'
|
||||
map -docstring 'clipboard yank' global user y ':xcopy<ret>'
|
||||
|
||||
map -docstring 'find tags for the current project' global user t ':ctags-search '
|
||||
|
||||
map -docstring 'find files' global user f ':peneira-files<ret>'
|
||||
map -docstring 'find files in particular dir' global user F ':peneira-dir-files<ret>'
|
||||
|
||||
map -docstring 'enter lsp mode' global user l ':enter-user-mode lsp<ret>'
|
||||
map -docstring 'goto definition (tag)' global lsp t '<a-i>w:ctags-search<ret>'
|
||||
|
||||
map -docstring 'enter treesitter mode' global user t ':enter-user-mode tree-sitter<ret>'
|
||||
map -docstring 'enter treesitter search mode' global user s ':enter-user-mode tree-sitter-search<ret>'
|
||||
|
||||
declare-user-mode tmux
|
||||
map -docstring 'enter tmux/window mode' global user w ':enter-user-mode tmux<ret>'
|
||||
map -docstring 'vertical split' global tmux v ':tmux-terminal-horizontal kak -c %val{session}<ret>'
|
||||
@@ -459,35 +330,9 @@ map -docstring 'new tab' global tmux t ':tmux-terminal-window kak -c %val{sessio
|
||||
map -docstring 'vertical terminal split' global tmux V ':tmux-repl-horizontal bash<ret>'
|
||||
map -docstring 'horizontal terminal split' global tmux H ':tmux-repl-vertical bash<ret>'
|
||||
map -docstring 'new terminal tab' global tmux T ':tmux-repl-window<ret>'
|
||||
map -docstring 'new git window' global tmux g ':tmux-terminal-window lazygit<ret>'
|
||||
|
||||
declare-user-mode project
|
||||
map -docstring 'enter project mode' global user p ':enter-user-mode project<ret>'
|
||||
map -docstring 'open project' global project o ':switch-project<ret>'
|
||||
|
||||
map -docstring 'enter man mode' global user m ':enter-user-mode man<ret>'
|
||||
|
||||
declare-user-mode general
|
||||
map -docstring 'enter general keybinds mode' global user g ':enter-user-mode general<ret>'
|
||||
#map -docstring 'clipboard yank' global user y '<a-|>clip.exe<ret>'
|
||||
map -docstring 'clipboard yank' global general y ':xcopy<ret>'
|
||||
#map -docstring 'clipboard paste' global user p '|powershell.exe -C Get-Clipboard | tr -d "\r"<ret>'
|
||||
map -docstring 'clipboard paste' global general p ':xpaste<ret>'
|
||||
map -docstring 'quit kakoune' global general q ':q<ret>'
|
||||
map -docstring 'toggle comments' global general c ':comment-line<ret>'
|
||||
|
||||
declare-user-mode spell
|
||||
map -docstring 'enter spell mode' global general s ':enter-user-mode spell<ret>'
|
||||
map -docstring 'enable spell check' global spell s ':spell<ret>'
|
||||
map -docstring 'clear spell check' global spell c ':spell-clear<ret>'
|
||||
map -docstring 'next spell check' global spell n ':spell-next<ret>'
|
||||
map -docstring 'spell check replacements' global spell r ':spell-replace<ret>'
|
||||
|
||||
map -docstring 'quit kakoune' global user q ':q!<ret>'
|
||||
try %{
|
||||
colorscheme %sh{
|
||||
ruby -e "time = Time.new; if time.hour < 20 and time.hour > 6 then puts 'dawnfox' else puts 'carbonfox' end"
|
||||
}
|
||||
} catch %{
|
||||
colorscheme carbonfox
|
||||
}
|
||||
colorscheme dawnfox
|
||||
|
||||
2
config/.config/nvim/compiler/dex_lxb.vim
Normal file
2
config/.config/nvim/compiler/dex_lxb.vim
Normal file
@@ -0,0 +1,2 @@
|
||||
CompilerSet errorformat&
|
||||
CompilerSet makeprg=cd\ /home/E40127478/projects/dex/dex_lxb/\ &&\ ./build_all.sh\ $*
|
||||
@@ -1,9 +1,10 @@
|
||||
{
|
||||
"auto-dark-mode.nvim": { "branch": "master", "commit": "e300259ec777a40b4b9e3c8e6ade203e78d15881" },
|
||||
"any-jump.vim": { "branch": "master", "commit": "f95674d9a4251ac02f452d5f1861e4422f4652c7" },
|
||||
"auto-dark-mode.nvim": { "branch": "main", "commit": "54058b4fe414bd64bd2904a6f8a63f1f14e3d8df" },
|
||||
"blink.cmp": { "branch": "main", "commit": "78336bc89ee5365633bcf754d93df01678b5c08f" },
|
||||
"catppuccin": { "branch": "main", "commit": "e068ab5f8261f23f6f71ffd8791ae40315b77b9c" },
|
||||
"catppuccin": { "branch": "main", "commit": "79e2049a0fdf7ec840f8463fe1d962c94493196b" },
|
||||
"cellular-automaton.nvim": { "branch": "main", "commit": "1606e9d5d04ff254023c3f3c62842d065708d6d3" },
|
||||
"command.nvim": { "branch": "main", "commit": "beb948e61c1d434b61b261d6768c26249e0a88fe" },
|
||||
"command.nvim": { "branch": "main", "commit": "e5736fea4bdab1f86b17bcd71b873517bb145e1b" },
|
||||
"compiler-explorer.nvim": { "branch": "master", "commit": "523c6a7a3d8c034b421a71eb20b0da75b0b16f62" },
|
||||
"diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" },
|
||||
"dim.lua": { "branch": "main", "commit": "a3a0dce75f7212ab61130e77a8157530bd23db15" },
|
||||
@@ -13,16 +14,15 @@
|
||||
"fennel.vim": { "branch": "main", "commit": "c6a9c035ca108cbb24273d96cd6277fb8fbc60b4" },
|
||||
"github-colors": { "branch": "main", "commit": "7292749e49e6f870e63879a528bb05c8c8d1a59a" },
|
||||
"github-nvim-theme": { "branch": "main", "commit": "c106c9472154d6b2c74b74565616b877ae8ed31d" },
|
||||
"gitsigns.nvim": { "branch": "main", "commit": "eb60cc7b94c46005237fd34170d76f3a089a90aa" },
|
||||
"gitsigns.nvim": { "branch": "main", "commit": "31d6fb2d618bca1482b9f274751ead5f03461408" },
|
||||
"gruvbox-material": { "branch": "master", "commit": "11d779b26a9ab2b3db8c22c6ac9fb6e8ed4fea79" },
|
||||
"gruvbox.nvim": { "branch": "main", "commit": "154eb5ff5b96d0641307113fa385eaf0d36d9796" },
|
||||
"indent-blankline.nvim": { "branch": "master", "commit": "d28a3f70721c79e3c5f6693057ae929f3d9c0a03" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "306a05526ada86a7b30af95c5cc81ffba93fef97" },
|
||||
"leap.nvim": { "branch": "main", "commit": "d7f8ee64155b7790188f17a993390f32577cfb81" },
|
||||
"love2d.nvim": { "branch": "main", "commit": "25715394680590f56aab90390d430cab0dc46808" },
|
||||
"lua-utils.nvim": { "branch": "main", "commit": "e565749421f4bbb5d2e85e37c3cef9d56553d8bd" },
|
||||
"leap.nvim": { "branch": "main", "commit": "52bc56ba61b1f54f123e29d6df7d1b7a0393eeac" },
|
||||
"lualine.nvim": { "branch": "master", "commit": "221ce6b2d999187044529f49da6554a92f740a96" },
|
||||
"markview.nvim": { "branch": "main", "commit": "092c0872fd2437b3b862d253910981142d2465aa" },
|
||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "47059d71b42d74b0a1e9f61c1d99d301039c3b5b" },
|
||||
"markview.nvim": { "branch": "main", "commit": "2471f4097f8561a6880a0fe05ee0f21cbc82b374" },
|
||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "7adc933dabcc7c86ae6b07aff7ee68eac398491f" },
|
||||
"mason.nvim": { "branch": "main", "commit": "2a6940af80375532e5e9e7c1f2fc6319a1b7a69d" },
|
||||
"melange-nvim": { "branch": "master", "commit": "ce42f6b629beeaa00591ba73a77d3eeac4cf28ce" },
|
||||
"mellow.nvim": { "branch": "main", "commit": "6273b7f0ddf6ac2b75021b3bc0bd8b3305cfeef1" },
|
||||
@@ -30,29 +30,24 @@
|
||||
"monokai.nvim": { "branch": "master", "commit": "b8bd44d5796503173627d7a1fc51f77ec3a08a63" },
|
||||
"moonlight.nvim": { "branch": "pure-lua", "commit": "e24e4218ec680b6396532808abf57ca0ada82e66" },
|
||||
"moonscript-vim": { "branch": "master", "commit": "715c96c7c3b02adc507f84bf5754985460afc426" },
|
||||
"multicursor.nvim": { "branch": "1.0", "commit": "704b99f10a72cc05d370cfeb294ff83412a8ab55" },
|
||||
"nabla.nvim": { "branch": "master", "commit": "9b69b709063ccf40ac36fabb4fff7d90b3736475" },
|
||||
"nelua.vim": { "branch": "main", "commit": "1342286a1c06fc2cef50f06cd34dfcdd8df5b65c" },
|
||||
"neogit": { "branch": "master", "commit": "6fc2fa890bd2031ed999c074daab0fb4feff20a5" },
|
||||
"neorg": { "branch": "main", "commit": "a09e0bb9b32e2d0406d4503ae8c1a7ad2ca83eae" },
|
||||
"neogit": { "branch": "master", "commit": "37e0f22a2345bad1bffe01b31970885882f46275" },
|
||||
"nightfox.nvim": { "branch": "main", "commit": "4dacd3f0185a2227bdf3b6c0975a8f0bf87cac9a" },
|
||||
"nord.nvim": { "branch": "master", "commit": "80c1e5321505aeb22b7a9f23eb82f1e193c12470" },
|
||||
"nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" },
|
||||
"nvim-autopairs": { "branch": "master", "commit": "7b9923abad60b903ece7c52940e1321d39eccc79" },
|
||||
"nvim-highlight-colors": { "branch": "main", "commit": "e4c7af0211866162d999ce0bdd6a029302e19139" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "d224a1920728ba129880efc700d4a0180ac4ecbb" },
|
||||
"nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "7ab79bb1b57160a537f427ac8a6026102f12b701" },
|
||||
"nvim-surround": { "branch": "main", "commit": "1098d7b3c34adcfa7feb3289ee434529abd4afd1" },
|
||||
"nvim-treesitter": { "branch": "main", "commit": "df7489eeea351bece7fd0f9c825be5cb6a1438f0" },
|
||||
"nvim-treesitter-textobjects": { "branch": "main", "commit": "851e865342e5a4cb1ae23d31caf6e991e1c99f1e" },
|
||||
"nvim-treesitter-textobjects": { "branch": "main", "commit": "898ee307df58f854d11cd7edd06472574d48014e" },
|
||||
"nvim-ts-autotag": { "branch": "main", "commit": "88c1453db4ba7dd24131086fe51fdf74e587d275" },
|
||||
"nvim-unception": { "branch": "main", "commit": "f14eeb22238d2c2bdafe9a2e5e1f4bd200d0e450" },
|
||||
"nvim-web-devicons": { "branch": "master", "commit": "dad71387de386a946b123079d0e53f23028f3abd" },
|
||||
"nvim-web-devicons": { "branch": "master", "commit": "2ae6958df7ced50baac5035cec0c15799eedfbf7" },
|
||||
"oceanic-next": { "branch": "master", "commit": "09833f72d5ba23de2e8bcae18f479f326f5f677a" },
|
||||
"oil.nvim": { "branch": "master", "commit": "b73018b75affd13fa38e2fc94ef753b465f770d7" },
|
||||
"one-nvim": { "branch": "main", "commit": "faf6fb3f98fccbe009c3466f657a8fff84a5f956" },
|
||||
"onedark.nvim": { "branch": "master", "commit": "df4792accde9db0043121f32628bcf8e645d9aea" },
|
||||
"pathlib.nvim": { "branch": "main", "commit": "57e5598af6fe253761c1b48e0b59b7cd6699e2c1" },
|
||||
"plantuml-syntax": { "branch": "master", "commit": "9d4900aa16674bf5bb8296a72b975317d573b547" },
|
||||
"range-highlight.nvim": { "branch": "master", "commit": "097103da6550c2a34c029971c3d7da63d3fef320" },
|
||||
"rose-pine": { "branch": "main", "commit": "ff483051a47e27d84bdef47703538df1ed9f4a47" },
|
||||
@@ -60,8 +55,6 @@
|
||||
"snacks.nvim": { "branch": "main", "commit": "882c996cf28183f4d63640de0b4c02ec886d01f2" },
|
||||
"telescope-tabs": { "branch": "vim_ui_select", "commit": "f01bc722582fdcaa58ea37492b382ff109893d95" },
|
||||
"tokyonight.nvim": { "branch": "main", "commit": "cdc07ac78467a233fd62c493de29a17e0cf2b2b6" },
|
||||
"tree-sitter-norg": { "branch": "main", "commit": "d7edfaf89198aab652c7a1f0f818196efedaccfb" },
|
||||
"tree-sitter-norg-meta": { "branch": "main", "commit": "729d4e54fb881ba0ddf0f925ec78401354c7c6db" },
|
||||
"treesitter-parser-registry": { "branch": "main", "commit": "6eb15358bb9fc88f0d3401d8538d56652e9bdf3c" },
|
||||
"v-vim": { "branch": "master", "commit": "1dc1388bafb89072f8349dbd96f9462ae22237cb" },
|
||||
"vim-colors-xcode": { "branch": "master", "commit": "2329a3ed092b4f72e9361a94567a5431e36e7d9c" },
|
||||
|
||||
@@ -12,6 +12,7 @@ setnx('<leader>b', Snacks.picker.buffers, 'List buffers')
|
||||
setnx('<leader>h', Snacks.picker.help, 'Search help')
|
||||
setnx('<leader>P', '<CMD>Markview splitToggle<CR>', 'Open markview preview')
|
||||
setnx('<leader>z', Snacks.zen.zen, 'Toggle snacks zen mode')
|
||||
setnx('<leader>d', '<CMD>AnyJump<CR>', 'AnyJump jump to definition')
|
||||
|
||||
local setto = function(key, command, desc)
|
||||
set({ 'x', 'o' }, key, command, { desc = desc })
|
||||
|
||||
@@ -64,25 +64,8 @@ vim.g.netrw_keepdir = 0
|
||||
vim.g.netrw_preview = 1
|
||||
vim.g.netrw_alto = 0
|
||||
|
||||
vim.opt.exrc = true
|
||||
|
||||
vim.ui.select = Snacks.picker.select
|
||||
|
||||
-- vim.cmd('colorscheme carbonfox')
|
||||
|
||||
vim.lsp.config('lua_ls', {
|
||||
settings = {
|
||||
Lua = {
|
||||
workspace = {
|
||||
library = vim.api.nvim_get_runtime_file("", true),
|
||||
maxPreload = 100000,
|
||||
preloadFileSize = 100000,
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
vim.lsp.config('tinymist', {
|
||||
settings = {
|
||||
exportPdf = "onType",
|
||||
}
|
||||
})
|
||||
vim.diagnostic.config({ update_in_insert = true, float = true, virtual_lines = true})
|
||||
|
||||
@@ -151,11 +151,11 @@ return {
|
||||
-- refer to the configuration section below
|
||||
set_dark_mode = function()
|
||||
vim.api.nvim_set_option_value("background", "dark", {})
|
||||
vim.cmd('colorscheme carbonfox')
|
||||
vim.cmd('colorscheme rose-pine-main')
|
||||
end,
|
||||
set_light_mode = function()
|
||||
vim.api.nvim_set_option_value("background", "light", {})
|
||||
vim.cmd('colorscheme dawnfox')
|
||||
vim.cmd('colorscheme rose-pine-dawn')
|
||||
end,
|
||||
},
|
||||
},
|
||||
|
||||
@@ -34,22 +34,22 @@ return {
|
||||
ft = 'puml',
|
||||
},
|
||||
|
||||
{
|
||||
"S1M0N38/love2d.nvim",
|
||||
-- event = "VeryLazy",
|
||||
ft = 'lua',
|
||||
version = "2.*",
|
||||
opts = { },
|
||||
},
|
||||
|
||||
{
|
||||
"nvim-neorg/neorg",
|
||||
-- lazy = false, -- Disable lazy loading as some `lazy.nvim` distributions set `lazy = true` by default
|
||||
ft = 'norg',
|
||||
version = "*", -- Pin Neorg to the latest stable release
|
||||
config = true,
|
||||
},
|
||||
|
||||
-- {
|
||||
-- "S1M0N38/love2d.nvim",
|
||||
-- -- event = "VeryLazy",
|
||||
-- ft = 'lua',
|
||||
-- version = "2.*",
|
||||
-- opts = { },
|
||||
-- },
|
||||
--
|
||||
-- {
|
||||
-- "nvim-neorg/neorg",
|
||||
-- -- lazy = false, -- Disable lazy loading as some `lazy.nvim` distributions set `lazy = true` by default
|
||||
-- ft = 'norg',
|
||||
-- version = "*", -- Pin Neorg to the latest stable release
|
||||
-- config = true,
|
||||
-- },
|
||||
--
|
||||
-- {
|
||||
-- "Olical/conjure"
|
||||
-- },
|
||||
|
||||
@@ -12,6 +12,13 @@ return {
|
||||
-- this is equivalent to setup({}) function
|
||||
},
|
||||
|
||||
{
|
||||
'pechorin/any-jump.vim',
|
||||
config = function()
|
||||
vim.g.any_jump_search_prefered_engine = 'ag'
|
||||
end,
|
||||
},
|
||||
|
||||
{
|
||||
"NeogitOrg/neogit",
|
||||
lazy = true,
|
||||
@@ -66,6 +73,19 @@ return {
|
||||
end
|
||||
},
|
||||
|
||||
{
|
||||
"lukas-reineke/indent-blankline.nvim",
|
||||
main = "ibl",
|
||||
---@module "ibl"
|
||||
---@type ibl.config
|
||||
opts = {
|
||||
scope = {
|
||||
show_start = false,
|
||||
show_end = false,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
"folke/snacks.nvim",
|
||||
priority = 1000,
|
||||
@@ -105,7 +125,7 @@ return {
|
||||
image = {
|
||||
enabled = true
|
||||
},
|
||||
indent = { enabled = true },
|
||||
indent = { enabled = false },
|
||||
input = { enabled = true },
|
||||
lazygit = { enabled = false },
|
||||
picker = {
|
||||
@@ -177,6 +197,10 @@ return {
|
||||
---@module 'oil'
|
||||
---@type oil.SetupOpts
|
||||
opts = {
|
||||
win_options = {
|
||||
winbar = "%#@attribute.builtin#%{substitute(v:lua.require('oil').get_current_dir(), '^' . $HOME, '~', '')}",
|
||||
},
|
||||
|
||||
triggers = {
|
||||
{ 'g', mode = { 'n', 'x' } },
|
||||
},
|
||||
@@ -238,98 +262,98 @@ return {
|
||||
event = 'VeryLazy',
|
||||
},
|
||||
|
||||
{
|
||||
"jake-stewart/multicursor.nvim",
|
||||
branch = "1.0",
|
||||
config = function()
|
||||
local mc = require("multicursor-nvim")
|
||||
mc.setup()
|
||||
|
||||
local set = vim.keymap.set
|
||||
|
||||
-- Add or skip cursor above/below the main cursor.
|
||||
set({"n", "x"}, "<localleader>k", function() mc.lineAddCursor(-1) end, { desc = "Add cursor to previous line" })
|
||||
set({"n", "x"}, "<localleader>j", function() mc.lineAddCursor(1) end, { desc = "Add cursor to next line" })
|
||||
set({"n", "x"}, "<up>", function() mc.lineAddCursor(-1) end, { desc = "Add cursor to previous line" })
|
||||
set({"n", "x"}, "<down>", function() mc.lineAddCursor(1) end, { desc = "Add cursor to next line" })
|
||||
set({"n", "x"}, "<localleader>K", function() mc.lineSkipCursor(-1) end, { desc = "Skip previous line to add cursor" })
|
||||
set({"n", "x"}, "<localleader>J", function() mc.lineSkipCursor(1) end, { desc = "Skip next line to add cursor" })
|
||||
|
||||
-- Add or skip adding a new cursor by matching word/selection
|
||||
set({"n", "x"}, "<localleader>n", function() mc.matchAddCursor(1) end, { desc = "Add cursor to next currently selected word" })
|
||||
set({"n", "x"}, "<localleader>s", function() mc.matchSkipCursor(1) end, { desc = "Skip next instance of current word to add cursor" })
|
||||
set({"n", "x"}, "<localleader>N", function() mc.matchAddCursor(-1) end, { desc = "Add cursor to previous currently selected word" })
|
||||
set({"n", "x"}, "<localleader>S", function() mc.matchSkipCursor(-1) end, { desc = "Skip previous instance of current word to add cursor" })
|
||||
|
||||
set({"n", "x"}, "<localleader>m", mc.operator, { desc = "Add cursors to text object" })
|
||||
set("n", "<localleader>s", function()
|
||||
vim.ui.input({prompt = "Match: "}, function(input) mc.operator({pattern = input}) end)
|
||||
end, { desc = "Add cursors to regex match inside text object " })
|
||||
set("n", "<localleader>*", function()
|
||||
mc.operator({pattern = vim.fn.expand("<cword>")})
|
||||
end, { desc = "Add cursors to current word inside text object" })
|
||||
set("x", "<localleader>s", mc.matchCursors, { desc = "Add cursors to regex match inside visual selection" })
|
||||
|
||||
-- Add cursor at next argument treesitter
|
||||
set({'n', 'x'}, ']A', function()
|
||||
if vim.v.count < 1 then
|
||||
mc.addCursor(']p')
|
||||
else
|
||||
for _=1, vim.v.count - 1 do
|
||||
mc.addCursor(']p')
|
||||
end
|
||||
end
|
||||
end, { desc = 'Create multicursor on next argument'})
|
||||
set({'n', 'x'}, '[A', function()
|
||||
if vim.v.count < 1 then
|
||||
mc.addCursor('[p')
|
||||
else
|
||||
for _=1, vim.v.count - 1 do
|
||||
mc.addCursor('[p')
|
||||
end
|
||||
end
|
||||
end, { desc = 'Create multicursor on previous argument'})
|
||||
|
||||
-- Add and remove cursors with control + left click.
|
||||
set("n", "<c-leftmouse>", mc.handleMouse)
|
||||
set("n", "<c-leftdrag>", mc.handleMouseDrag)
|
||||
set("n", "<c-leftrelease>", mc.handleMouseRelease)
|
||||
|
||||
-- Disable and enable cursors.
|
||||
set({"n", "x"}, "<c-q>", mc.toggleCursor, { desc = "Toggle multiple cursors" })
|
||||
|
||||
-- Mappings defined in a keymap layer only apply when there are
|
||||
-- multiple cursors. This lets you have overlapping mappings.
|
||||
mc.addKeymapLayer(function(layerSet)
|
||||
|
||||
-- Select a different cursor as the main one.
|
||||
layerSet({"n", "x"}, "<localleader>h", mc.prevCursor, { desc = "Make previous cursor primary" })
|
||||
layerSet({"n", "x"}, "<localleader>l", mc.nextCursor, { desc = "Make next cursor primary" })
|
||||
layerSet({"n", "x"}, "<left>", mc.prevCursor, { desc = "Make previous cursor primary" })
|
||||
layerSet({"n", "x"}, "<right>", mc.nextCursor, { desc = "Make next cursor primary" })
|
||||
|
||||
-- Delete the main cursor.
|
||||
layerSet({"n", "x"}, "<localleader>x", mc.deleteCursor)
|
||||
|
||||
-- Enable and clear cursors using escape.
|
||||
layerSet("n", "<esc>", function()
|
||||
if not mc.cursorsEnabled() then
|
||||
mc.enableCursors()
|
||||
else
|
||||
mc.clearCursors()
|
||||
end
|
||||
end)
|
||||
end)
|
||||
|
||||
-- Customize how cursors look.
|
||||
local hl = vim.api.nvim_set_hl
|
||||
hl(0, "MultiCursorCursor", { reverse = true })
|
||||
hl(0, "MultiCursorVisual", { link = "Visual" })
|
||||
hl(0, "MultiCursorSign", { link = "SignColumn"})
|
||||
hl(0, "MultiCursorMatchPreview", { link = "Search" })
|
||||
hl(0, "MultiCursorDisabledCursor", { reverse = true })
|
||||
hl(0, "MultiCursorDisabledVisual", { link = "Visual" })
|
||||
hl(0, "MultiCursorDisabledSign", { link = "SignColumn"})
|
||||
end
|
||||
},
|
||||
-- {
|
||||
-- "jake-stewart/multicursor.nvim",
|
||||
-- branch = "1.0",
|
||||
-- config = function()
|
||||
-- local mc = require("multicursor-nvim")
|
||||
-- mc.setup()
|
||||
--
|
||||
-- local set = vim.keymap.set
|
||||
--
|
||||
-- -- Add or skip cursor above/below the main cursor.
|
||||
-- set({"n", "x"}, "<localleader>k", function() mc.lineAddCursor(-1) end, { desc = "Add cursor to previous line" })
|
||||
-- set({"n", "x"}, "<localleader>j", function() mc.lineAddCursor(1) end, { desc = "Add cursor to next line" })
|
||||
-- set({"n", "x"}, "<up>", function() mc.lineAddCursor(-1) end, { desc = "Add cursor to previous line" })
|
||||
-- set({"n", "x"}, "<down>", function() mc.lineAddCursor(1) end, { desc = "Add cursor to next line" })
|
||||
-- set({"n", "x"}, "<localleader>K", function() mc.lineSkipCursor(-1) end, { desc = "Skip previous line to add cursor" })
|
||||
-- set({"n", "x"}, "<localleader>J", function() mc.lineSkipCursor(1) end, { desc = "Skip next line to add cursor" })
|
||||
--
|
||||
-- -- Add or skip adding a new cursor by matching word/selection
|
||||
-- set({"n", "x"}, "<localleader>n", function() mc.matchAddCursor(1) end, { desc = "Add cursor to next currently selected word" })
|
||||
-- set({"n", "x"}, "<localleader>s", function() mc.matchSkipCursor(1) end, { desc = "Skip next instance of current word to add cursor" })
|
||||
-- set({"n", "x"}, "<localleader>N", function() mc.matchAddCursor(-1) end, { desc = "Add cursor to previous currently selected word" })
|
||||
-- set({"n", "x"}, "<localleader>S", function() mc.matchSkipCursor(-1) end, { desc = "Skip previous instance of current word to add cursor" })
|
||||
--
|
||||
-- set({"n", "x"}, "<localleader>m", mc.operator, { desc = "Add cursors to text object" })
|
||||
-- set("n", "<localleader>s", function()
|
||||
-- vim.ui.input({prompt = "Match: "}, function(input) mc.operator({pattern = input}) end)
|
||||
-- end, { desc = "Add cursors to regex match inside text object " })
|
||||
-- set("n", "<localleader>*", function()
|
||||
-- mc.operator({pattern = vim.fn.expand("<cword>")})
|
||||
-- end, { desc = "Add cursors to current word inside text object" })
|
||||
-- set("x", "<localleader>s", mc.matchCursors, { desc = "Add cursors to regex match inside visual selection" })
|
||||
--
|
||||
-- -- Add cursor at next argument treesitter
|
||||
-- set({'n', 'x'}, ']A', function()
|
||||
-- if vim.v.count < 1 then
|
||||
-- mc.addCursor(']p')
|
||||
-- else
|
||||
-- for _=1, vim.v.count - 1 do
|
||||
-- mc.addCursor(']p')
|
||||
-- end
|
||||
-- end
|
||||
-- end, { desc = 'Create multicursor on next argument'})
|
||||
-- set({'n', 'x'}, '[A', function()
|
||||
-- if vim.v.count < 1 then
|
||||
-- mc.addCursor('[p')
|
||||
-- else
|
||||
-- for _=1, vim.v.count - 1 do
|
||||
-- mc.addCursor('[p')
|
||||
-- end
|
||||
-- end
|
||||
-- end, { desc = 'Create multicursor on previous argument'})
|
||||
--
|
||||
-- -- Add and remove cursors with control + left click.
|
||||
-- set("n", "<c-leftmouse>", mc.handleMouse)
|
||||
-- set("n", "<c-leftdrag>", mc.handleMouseDrag)
|
||||
-- set("n", "<c-leftrelease>", mc.handleMouseRelease)
|
||||
--
|
||||
-- -- Disable and enable cursors.
|
||||
-- set({"n", "x"}, "<c-q>", mc.toggleCursor, { desc = "Toggle multiple cursors" })
|
||||
--
|
||||
-- -- Mappings defined in a keymap layer only apply when there are
|
||||
-- -- multiple cursors. This lets you have overlapping mappings.
|
||||
-- mc.addKeymapLayer(function(layerSet)
|
||||
--
|
||||
-- -- Select a different cursor as the main one.
|
||||
-- layerSet({"n", "x"}, "<localleader>h", mc.prevCursor, { desc = "Make previous cursor primary" })
|
||||
-- layerSet({"n", "x"}, "<localleader>l", mc.nextCursor, { desc = "Make next cursor primary" })
|
||||
-- layerSet({"n", "x"}, "<left>", mc.prevCursor, { desc = "Make previous cursor primary" })
|
||||
-- layerSet({"n", "x"}, "<right>", mc.nextCursor, { desc = "Make next cursor primary" })
|
||||
--
|
||||
-- -- Delete the main cursor.
|
||||
-- layerSet({"n", "x"}, "<localleader>x", mc.deleteCursor)
|
||||
--
|
||||
-- -- Enable and clear cursors using escape.
|
||||
-- layerSet("n", "<esc>", function()
|
||||
-- if not mc.cursorsEnabled() then
|
||||
-- mc.enableCursors()
|
||||
-- else
|
||||
-- mc.clearCursors()
|
||||
-- end
|
||||
-- end)
|
||||
-- end)
|
||||
--
|
||||
-- -- Customize how cursors look.
|
||||
-- local hl = vim.api.nvim_set_hl
|
||||
-- hl(0, "MultiCursorCursor", { reverse = true })
|
||||
-- hl(0, "MultiCursorVisual", { link = "Visual" })
|
||||
-- hl(0, "MultiCursorSign", { link = "SignColumn"})
|
||||
-- hl(0, "MultiCursorMatchPreview", { link = "Search" })
|
||||
-- hl(0, "MultiCursorDisabledCursor", { reverse = true })
|
||||
-- hl(0, "MultiCursorDisabledVisual", { link = "Visual" })
|
||||
-- hl(0, "MultiCursorDisabledSign", { link = "SignColumn"})
|
||||
-- end
|
||||
-- },
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user