Skip to content

Instantly share code, notes, and snippets.

@jssee
Created April 2, 2019 02:23
Show Gist options
  • Save jssee/5239986733b302815faf616b4baf5042 to your computer and use it in GitHub Desktop.
Save jssee/5239986733b302815faf616b4baf5042 to your computer and use it in GitHub Desktop.
# OPTIONS
# =======
set-option global ui_options ncurses_assistant=cat ncurses_enable_mouse=no
set-option global autoreload yes
set-option global scrolloff 5,10
set-option global tabstop 2
set-option global indentwidth 2
set-option global grepcmd 'rg --column --with-filename'
# HIHGHLIGHTERS
# =============
add-highlighter global/ show-matching
add-highlighter global/ number-lines
# COMMANDS
# ========
define-command find-edit -params 1 -shell-script-candidates 'fd --type file' 'edit %arg(1)'
# MAPS
# ====
map global normal <space> ,
map global normal <ret> :
map global user f -docstring 'Find files' :find-edit<space>
map global user w -docstring 'Write file' :write<ret>
map global user q -docstring 'Quit' :quit<ret>
# use <k><j> to escape
hook global InsertChar j %{ try %{
execute-keys -draft 'hH<a-k>kj<ret>d'
execute-keys <esc>
}}
# Primary cursor face:
# Normal: Cyan
# Insert: Green
hook global ModeChange '.+:normal' %(face global PrimaryCursor 'black,green')
hook global ModeChange '.+:insert' %(face global PrimaryCursor 'black,cyan')
# {for} Grep
hook global BufOpenFifo '\Q*grep*' %{
map global normal <c-n> :grep-next-match<ret>
map global normal <c-p> :grep-previous-match<ret>
}
# {for} Make
hook global BufOpenFifo '\Q*make*' %{
map global normal <c-n> :make-next-error<ret>
map global normal <c-p> :make-previous-error<ret>
}
# back to normal
hook global BufClose '\*(grep|make)\*' %{
map global normal <c-n> :buffer-next<ret>
map global normal <c-p> :buffer-previous<ret>
}
hook global WinSetOption filetype=(typescript|typescript.tsx|tsx) %{
set window lintcmd 'tslint --outputAbsolutePaths -t json $kak_buffile | jqn \'map(e => `${e.name}:${e.startPosition.line + 1}:${e.startPosition.character}: Error: ${e.failure} (${e.ruleName}) `) | join("\n")\''
lint-enable
}
hook global WinSetOption filetype=javascript %{
set window lintcmd 'run() { cat "$1" | npx eslint -f ~/.config/kak/eslint-kak.js --stdin --stdin-filename "$kak_buffile";} && run '
lint-enable
hook buffer BufWritePost .* % {
lint
}
}
# LSP
# ===
# eval %sh{kak-lsp --kakoune -s $kak_session}
# lsp-enable
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment