146 lines
4.1 KiB
Plaintext
146 lines
4.1 KiB
Plaintext
source /home/joe/.config/kak/plugins/plug.kak/rc/plug.kak
|
||
colorscheme tomorrow-night
|
||
|
||
ranger-open-on-edit-directory
|
||
|
||
set-option global tabstop 4
|
||
|
||
hook global WinCreate .* %{
|
||
auto-pairs-enable
|
||
}
|
||
|
||
hook global BufCreate .*Fastfile %{
|
||
set buffer filetype ruby
|
||
}
|
||
|
||
# Plugins
|
||
plug "andreyorst/plug.kak" noload
|
||
plug "danr/kakoune-easymotion"
|
||
plug "h-youhei/kakoune-surround"
|
||
plug "Delapouite/kakoune-i3"
|
||
plug "lexherbo2/auto-pairs.kak"
|
||
plug "Delapouite/kakoune-buffers"
|
||
plug "Screwtapello/kakoune-cargo"
|
||
|
||
# Highlighters
|
||
addhl global/ number-lines -relative -hlcursor -separator ' '
|
||
|
||
# Custom Mappings
|
||
map global normal <minus> ':ranger<ret>' -docstring 'NERDTree style open ranger'
|
||
map global normal <space> , -docstring 'leader'
|
||
map global normal , ':enter-user-mode<space>easymotion<ret>'
|
||
map global user <space> <space> -docstring 'clear multiple selections'
|
||
|
||
# Surround
|
||
declare-user-mode surround
|
||
map global normal \' ':enter-user-mode<space>surround<ret>'
|
||
map global surround s ':surround<ret>' -docstring 'Add Surround'
|
||
map global surround c ":change-surround<ret>" -docstring 'Change Surround'
|
||
map global surround d ':delete-surround<ret>' -docstring 'Delete Surround'
|
||
|
||
# Map macros here
|
||
map global normal ^ q
|
||
map global normal <a-^> Q
|
||
|
||
def -params 1 extend-line-down %{
|
||
exec "<a-:>%arg{1}X"
|
||
}
|
||
def -params 1 extend-line-up %{
|
||
exec "<a-:><a-;>%arg{1}K<a-;>"
|
||
try %{
|
||
exec -draft ';<a-K>\n<ret>'
|
||
exec X
|
||
}
|
||
exec '<a-;><a-X>'
|
||
}
|
||
map global normal x ':extend-line-down %val{count}<ret>'
|
||
map global normal X ':extend-line-up %val{count}<ret>'
|
||
|
||
# Clipboard hooks
|
||
|
||
hook global NormalKey y|d|c %{ nop %sh{
|
||
printf %s "$kak_main_reg_dquote" | xsel --input --clipboard
|
||
}}
|
||
map global normal P '!xsel --output --clipboard<ret>'
|
||
map global normal p '<a-!>xsel --output --clipboard<ret>'
|
||
|
||
map global normal <c-v> ': select-block<ret>'
|
||
|
||
declare-user-mode window
|
||
map global normal <c-w> ':enter-user-mode<space>window<ret>'
|
||
|
||
# i3wm
|
||
map global window h ':i3-new-left<ret>'
|
||
map global window j ':i3-new-down<ret>'
|
||
map global window k ':i3-new-up<ret>'
|
||
map global window l ':i3-new-right<ret>'
|
||
|
||
# Comment with <C-/>
|
||
map global normal ':comment-line<ret>' -docstring 'comment line'
|
||
|
||
|
||
# Increase/Decrease Count
|
||
# define-command -hidden -params 2 inc %{
|
||
# evaluate-commands %sh{
|
||
# if [ "$1" = 0 ]
|
||
# then
|
||
# count=1
|
||
# else
|
||
# count="$1"
|
||
# fi
|
||
# printf '%s%s\n' 'exec h"_xs\d<ret><a-i>na' "$2($count)<esc>|bc<ret>h"
|
||
# }
|
||
# }
|
||
# map global normal <c-a> ':inc %val{count} +<ret>'
|
||
# map global normal <c-x> ':inc %val{count} -<ret>'
|
||
|
||
# Experimental Word Lock
|
||
# source ./word-mode.kak
|
||
|
||
map global normal w e
|
||
map global normal W E
|
||
map global normal <a-w> <a-e>
|
||
map global normal <a-W> <a-E>
|
||
map global normal e <a-i>w
|
||
map global normal E '"_s.<ret><a-i>w'
|
||
map global normal <a-e> <a-i><a-w>
|
||
map global normal <a-E> '"_s.<ret><a-i><a-w>'
|
||
|
||
def -hidden select-next-subword %{
|
||
exec /[A-Z][a-z]+|[A-Z]+|[a-z]+<ret>
|
||
}
|
||
def -hidden extend-next-subword %{
|
||
exec ?[A-Z][a-z]+|[A-Z]+|[a-z]+<ret>
|
||
}
|
||
def -hidden select-prev-subword %{
|
||
exec <a-/>[A-Z][a-z]+|[A-Z]+|[a-z]+<ret>
|
||
}
|
||
def -hidden extend-prev-subword %{
|
||
exec <a-?>[A-Z][a-z]+|[A-Z]+|[a-z]+<ret>
|
||
}
|
||
map global normal q :select-next-subword<ret> -docstring 'select to next subword'
|
||
map global normal Q :extend-next-subword<ret> -docstring 'extend to next subword'
|
||
map global normal <a-q> :select-prev-subword<ret> -docstring 'select to previous subword'
|
||
map global normal <a-Q> :extend-prev-subword<ret> -docstring 'extend to previous subword'
|
||
|
||
# Buffers
|
||
map global user b ':enter-buffers-mode<ret>' -docstring 'buffers…'
|
||
map global user B ':info-buffers<ret>' -docstring 'buffer list'
|
||
|
||
# Rust
|
||
hook global BufCreate .*\.(py|rs) %{
|
||
eval %sh{kak-lsp --kakoune -s $kak_session}
|
||
|
||
set-option global lsp_auto_highlight_references true
|
||
# set-option global lsp_hover_insert_mode_trigger true
|
||
lsp-auto-hover-insert-mode-enable
|
||
lsp-auto-signature-help-enable
|
||
map global normal D ':lsp-hover<ret>'
|
||
map global insert <c-d> '<a-;>:lsp-hover<ret>'
|
||
map global normal '#' ':enter-user-mode lsp<ret>'
|
||
|
||
map global user c ':enter-user-mode<space>cargo<ret>'
|
||
map global cargo b ':cargo build<ret>'
|
||
}
|
||
|