kakoune update

This commit is contained in:
Johann Dreo 2021-04-21 17:01:43 +02:00
commit c486d8f554
3 changed files with 244 additions and 110 deletions

171
kak/colors/kalolo.kak Normal file
View file

@ -0,0 +1,171 @@
# Blues
declare-option -hidden str kalolo_shiny_blue rgb:b7dbff
declare-option -hidden str kalolo_light_blue rgb:87bbff
declare-option -hidden str kalolo_blue rgb:6f9dfe
declare-option -hidden str kalolo_dark_blue rgb:4f7dde
# Magentas
declare-option -hidden str kalolo_light_magenta rgb:c6b3ff
declare-option -hidden str kalolo_magenta rgb:a073bb
# Yellows
declare-option -hidden str kalolo_light_yellow rgb:fffb95
declare-option -hidden str kalolo_mid_yellow rgb:f5db65
declare-option -hidden str kalolo_yellow rgb:efcd45
declare-option -hidden str kalolo_dark_yellow rgb:cf8200
# Greens
declare-option -hidden str kalolo_light_green rgb:b5d271
declare-option -hidden str kalolo_green rgb:a5c261
declare-option -hidden str kalolo_dark_green rgb:529f50
# Reds
declare-option -hidden str kalolo_light_red rgb:fb5949
declare-option -hidden str kalolo_red rgb:db4939
# Orange-ish
declare-option -hidden str kalolo_cream rgb:bf8753
declare-option -hidden str kalolo_dark_cream rgb:363037
# Whites
declare-option -hidden str kalolo_light_white rgb:f8f8f8
declare-option -hidden str kalolo_white rgb:d3d0cc
declare-option -hidden str kalolo_mid_white rgb:b1bfb1
declare-option -hidden str kalolo_dark_white rgb:73707c
# Blacks
declare-option -hidden str kalolo_light_black rgb:4b4b4b
declare-option -hidden str kalolo_mid_black rgb:343534
declare-option -hidden str kalolo_black rgb:2b2b2b
declare-option -hidden str kalolo_dawn_black rgb:232323
declare-option -hidden str kalolo_dark_black rgb:000000
# Code
# Comment are important information, they are the only thing in light green.
set-face global comment "%opt{kalolo_green},default"
# Documentation is even more important, it's in bold.
set-face global documentation "%opt{kalolo_green},default+b"
# Metadata are less important, they are in dark green.
set-face global meta "%opt{kalolo_mid_white},%opt{kalolo_dawn_black}"
# Values are a kind of "side" information, they are in dark green.
set-face global value "%opt{kalolo_dark_green},default"
# "Stable" objects in blue.
set-face global identifier "%opt{kalolo_blue},default"
set-face global type "%opt{kalolo_light_blue},default"
set-face global entity "%opt{kalolo_magenta},default+b"
# "Mutable" objects in blue.
set-face global variable "%opt{kalolo_white},default"
set-face global module "%opt{kalolo_dark_blue},default"
# String are ubiquitous, they have their own color,
# with a different background, to easily spot multiline strings.
# set-face global string "%opt{kalolo_cream},%opt{kalolo_dark_cream}"
set-face global string "%opt{kalolo_mid_white},%opt{kalolo_mid_black}"
# More or less single-character delimiter which are everywhere.
set-face global operator "%opt{kalolo_light_magenta},default"
set-face global delimiter "%opt{kalolo_light_yellow},default"
# Attributes in yellow.
set-face global attribute "%opt{kalolo_yellow},default"
# Builtins in lighter white.
set-face global builtin "%opt{kalolo_light_white},default"
# Generic keywords in red.
set-face global keyword "%opt{kalolo_red},default"
# Additional keywords
set-face global flow "%opt{kalolo_red},default+b" # Keywords related to control flow (if,for,assert,etc.).
set-face global state "%opt{kalolo_red},default" # Keywords reated to state (cast,new,sizeof,etc.).
# LSP faces
# Additionnal "function"
set-face global function "%opt{kalolo_light_white},default"
# Faces used by inline diagnostics.
set-face global DiagnosticError "rgb:ff0000,default"
set-face global DiagnosticWarning "rgb:ff00ff,default"
# Faces used by inlay diagnostics.
set-face global InlayDiagnosticError "rgb:ff00ff,default+i"
set-face global InlayDiagnosticWarning "rgb:ff00ff,default+i"
# Line flags for errors and warnings both use this face.
set-face global LineFlagErrors red
# Face for highlighting references.
# FIXME Reference faces not taken into account
set-face global Reference "default,%opt{kalolo_light_black}+F"
set-face global ReferenceBind "default,%opt{kalolo_light_black}+Fbu"
# Face for inlay hints.
set-face global InlayHint "%opt{kalolo_light_white},default+i"
# text
set-face global title "%opt{kalolo_light_blue},default+bi"
set-face global header "%opt{kalolo_light_magenta},default+bu"
set-face global bold "%opt{kalolo_light_yellow},default+b"
set-face global italic "%opt{kalolo_light_white},default+i"
set-face global mono "%opt{kalolo_white},%opt{kalolo_dawn_black}"
set-face global block "%opt{kalolo_light_green},default"
set-face global link "%opt{kalolo_dark_blue},default+u"
set-face global bullet "%opt{kalolo_yellow},default+b"
set-face global list "%opt{kalolo_light_white},default"
# kakoune UI
set-face global Default "%opt{kalolo_white},%opt{kalolo_black}"
set-face global MatchingChar "%opt{kalolo_light_white},%opt{kalolo_dark_green}"
set-face global Whitespace "%opt{kalolo_dark_white},default"
set-face global BufferPadding "%opt{kalolo_light_black},%opt{kalolo_dark_black}"
set-face global LineNumbers "%opt{kalolo_dark_white},default"
set-face global LineNumberCursor "%opt{kalolo_light_white},default"
set-face global LineNumbersWrapped "%opt(kalolo_dark_black)"
set-face global MenuForeground "%opt{kalolo_light_white},%opt{kalolo_dark_yellow}+b"
set-face global MenuBackground "%opt{kalolo_light_white},%opt{kalolo_dark_blue}"
set-face global MenuInfo "%opt{kalolo_light_white},%opt{kalolo_blue}+i"
set-face global Information "%opt{kalolo_white},%opt{kalolo_light_black}"
set-face global Error "%opt{kalolo_light_yellow},%opt{kalolo_red}"
set-face global StatusLine "%opt{kalolo_dark_black},%opt{kalolo_dark_blue}+b"
set-face global StatusLineMode "%opt{kalolo_light_white},%opt{kalolo_dark_yellow}+b"
set-face global StatusLineInfo "%opt{kalolo_light_white},%opt{kalolo_black}"
set-face global StatusLineValue "%opt{kalolo_black},%opt{kalolo_dark_yellow}"
set-face global StatusCursor "%opt{kalolo_light_white},%opt{kalolo_yellow}"
set-face global Prompt "%opt{kalolo_dark_black},%opt{kalolo_dark_blue}+b"
# Additional UI
# Like a temporary comment: light green.
set-face global Search "%opt{kalolo_black},%opt{kalolo_light_green}+i"
# Cursors varying with mode
# Default normal
set-face global PrimarySelection "%opt{kalolo_light_white},%opt{kalolo_dark_yellow}"
set-face global PrimaryCursor "%opt{kalolo_black},%opt{kalolo_yellow}+F"
set-face global PrimaryCursorEol "default,%opt{kalolo_light_red}+F"
set-face global SecondarySelection "%opt{kalolo_light_black},%opt{kalolo_yellow}"
set-face global SecondaryCursor "%opt{kalolo_black},%opt{kalolo_light_yellow}+F"
set-face global SecondaryCursorEol "default,%opt{kalolo_red}+F"
# Switching to normal = shades of yellows
hook global ModeChange '.*:normal' %{
set-face global PrimarySelection "%opt{kalolo_light_white},%opt{kalolo_dark_yellow}"
set-face global PrimaryCursor "%opt{kalolo_black},%opt{kalolo_yellow}+F"
set-face global PrimaryCursorEol "default,%opt{kalolo_light_red}+F"
set-face global SecondarySelection "%opt{kalolo_light_black},%opt{kalolo_yellow}"
set-face global SecondaryCursor "%opt{kalolo_black},%opt{kalolo_light_yellow}+F"
set-face global SecondaryCursorEol "default,%opt{kalolo_red}+F"
}
# Switching to insert = shades of blue
hook global ModeChange '.*:insert' %{
set-face global PrimarySelection "%opt{kalolo_light_white},%opt{kalolo_dark_blue}"
set-face global PrimaryCursor "%opt{kalolo_light_white},%opt{kalolo_light_blue}+F"
set-face global PrimaryCursorEol "default,%opt{kalolo_light_magenta}+F"
set-face global SecondarySelection "%opt{kalolo_light_black},%opt{kalolo_light_blue}"
set-face global SecondaryCursor "%opt{kalolo_light_black},%opt{kalolo_blue}+F"
set-face global SecondaryCursorEol "default,%opt{kalolo_magenta}+F"
}

View file

@ -1,89 +0,0 @@
evaluate-commands %sh{
light_blue="rgb:87bbff"
blue="rgb:6f9dfe"
dark_blue="rgb:4f7dde"
light_magenta="rgb:c6b3fb"
light_yellow="rgb:ffeb85"
yellow="rgb:efcd45"
dark_yellow="rgb:cf8200"
green="rgb:a5c261"
dark_green="rgb:529f50"
red="rgb:db4939"
cream="rgb:bf8753"
dark_cream="rgb:363037"
light_white="rgb:f8f8f8"
white="rgb:d3d0cc"
dark_white="rgb:73707c"
light_black="rgb:4b4b4b"
black="rgb:2b2b2b"
mid_black="rgb:202020"
dark_black="rgb:000000"
# code
echo "
face global value ${dark_green},default
face global type ${blue},default
face global entity ${blue},default+b
face global variable ${light_blue},default
face global module ${light_blue},default
face global string ${cream},${dark_cream}
face global keyword ${red},default
face global flow ${red},default+b # Keywords related to control flow (if, for, assert, etc.).
face global state ${red},default # Keywords reated to state (cast, new, sizeof, etc.).
face global operator ${light_magenta},default
face global attribute ${yellow},default
face global comment ${green},default
face global documentation ${green},default+b
face global builtin ${light_white},default
face global delimiter ${light_yellow},default
face global meta ${dark_green},default+b
face global identifier ${blue},default
"
# text
echo "
face global title ${black},${light_blue}+b
face global header ${light_blue},default+b
face global bold default,default+b
face global italic default,default+i
face global mono ${white},${mid_black}
face global block ${light_yellow},default
face global link ${dark_blue},default+u
face global bullet ${dark_green},default+b
face global list default,default+b
"
# kakoune UI
echo "
face global Default ${white},${black}
face global PrimarySelection ${light_white},${dark_yellow}
face global SecondarySelection ${light_white},${light_blue}
face global PrimaryCursor ${black},${yellow}+Fb
face global SecondaryCursor ${light_white},${blue}+Fb
face global MatchingChar default,${blue}
face global Whitespace ${dark_white},default
face global BufferPadding ${light_black},${mid_black}
face global LineNumbers ${dark_white},default
face global LineNumberCursor ${white},default
face global MenuForeground ${light_white},${dark_yellow}+b
face global MenuBackground ${light_white},${dark_blue}
face global MenuInfo ${light_white},${blue}+i
face global Information ${white},${light_black}
face global Error ${light_yellow},${red}
face global StatusLine ${dark_black},${dark_blue}+b
face global StatusLineMode ${light_white},${dark_yellow}+b
face global StatusLineInfo ${light_white},${black}
face global StatusLineValue ${black},${dark_yellow}
face global StatusCursor ${light_white},${yellow}
face global Prompt ${dark_black},${dark_blue}+b
face global Search ${black},${light_yellow}+Fi
"
}

View file

@ -13,12 +13,16 @@ define-command filetype-hook -params 2 %{
# Comments
map global normal '$' -docstring 'Comment the selected lines' ': comment-line<ret>'
map global normal '<a-$>' -docstring 'Comment the selected block with begin/end characters' ': comment-block<ret>'
map global normal '#' -docstring 'duplicate and comment line' 'xyp: comment-line<ret>j'
map global normal '*' -docstring 'Select all occurrences of the current selection set' 'bw*%s<ret>'
map global normal '*' -docstring 'select all occurrences of the word under cursor' 'be*n<ret>'
define-command cq -docstring 'Quit with an (arbitrary) error code' %{q 666}
map global normal '=' -docstring 'indent like the line above' '<a-C>gi<a-&><space>jgi'
# define-command pwd -docstring 'Print the current working directory' %{ evaluate-commands %sh{ echo "echo -markup {Information}$PWD" } }
map global normal '<c-up>' -docstring 'move line down' 'xdkPk'
map global normal '<c-down>' -docstring 'move line down' 'xdpj'
define-command cq -docstring 'Quit with an (arbitrary) error code' %{q! 666}
# Use Tab and Shift-Tab to navigate completion in insert mode.
hook global InsertCompletionShow .* %{
@ -33,9 +37,21 @@ hook global InsertCompletionShow .* %{
}
}
map global normal <tab> -docstring 'Swap selections cursor and anchor' '<a-;>'
# Cursor switch.
map global normal <tab> -docstring 'Swap selections cursor and anchor' '<a-;>'
map global normal <a-tab> -docstring 'Ensure selection cursor is after anchor' '<a-:>'
# Go to paragraph/indents.
map global goto 'p' -docstring 'select to next paragraph' '<esc>]p'
map global goto 'P' -docstring 'extend to next paragraph' '<esc>}p'
map global goto 'o' -docstring 'select to prev paragraph' '<esc>[p'
map global goto 'O' -docstring 'extend to prev paragraph' '<esc>{p'
map global goto 't' -docstring 'select to indent end' '<esc>]i'
map global goto 'T' -docstring 'select to indent beginning' '<esc>[i'
# Paths.
map global prompt <a-?> -docstring 'Current buffer name' '<c-r>%'
map global prompt <a-/> -docstring 'Current buffer directory' '%sh(dirname "$kak_bufname")<a-!>/'
#################################
# Generic config
@ -43,7 +59,6 @@ map global normal <a-tab> -docstring 'Ensure selection cursor is after anchor' '
set-option -add global ui_options ncurses_assistant=none
set-option -add global ui_options ncurses_set_title=yes
set-option -add global ui_options ncurses_padding_char= # Examples: ▚
set-option -add global ui_options ncurses_padding_fill=yes
# Indent with 2 spaces and make tabs appear as 2 spaces.
@ -55,28 +70,20 @@ hook global InsertChar \t %{
exec -draft h@
}
# keep space around cursor
set-option global scrolloff 10,10
# Keep space around cursor when scrolling.
set-option global scrolloff 3,3
# Add characters as matching pairs
# Add characters as matching pairs.
set-option -add global matching_pairs « » “ ”
# Autoformat (indent) line (if formatcmd is defined for the current filetype).
map global normal '=' ': format<ret>' -docstring 'format'
# Paths
map global prompt <a-?> -docstring 'Current buffer name' '<c-r>%'
map global prompt <a-/> -docstring 'Current buffer directory' '%sh(dirname "$kak_bufname")<a-!>/'
hook global ModuleLoaded x11 %{
set global termcmd 'terminator -e '
alias global terminal x11-terminal
}
# Persistent history across sessions.
hook global KakEnd .* %{ echo -to-file .kak_history -quoting kakoune reg : %reg{:} }
hook global KakBegin .* %{ try %{ source .kak_history } }
hook global KakEnd .* %{ echo -to-file ~/.kak_history -quoting kakoune reg : %reg{:} }
hook global KakBegin .* %{ try %{ source ~/.kak_history } }
#################################
@ -88,7 +95,7 @@ add-highlighter global/wrap wrap -word -indent -marker ⤷
add-highlighter global/suspicicous-whitespaces show-whitespaces -tab ⭲ -nbsp · -spc " " -lf " "
add-highlighter global/trailing-whitespaces regex '\h+$' 0:error
colorscheme nojhan
colorscheme kalolo
# Highlight generic tags
hook global WinSetOption comment_line=(.+) %{
@ -100,7 +107,7 @@ hook global WinSetOption comment_line=(.+) %{
# Show line numbers (and highlight current cursor line)
hook global WinCreate ^[^*]+$ %{
add-highlighter window/ number-lines # -hlcursor
add-highlighter window/ number-lines -hlcursor -min-digits 3
}
@ -176,11 +183,11 @@ plug "andreyorst/fzf.kak" %{
map global normal <c-p> ': fzf-mode<ret>'
}
# ctags tagbar FIXME does not work out of tmux
plug "andreyorst/tagbar.kak" defer "tagbar" %{
set-option global tagbar_sort false
set-option global tagbar_size 40
set-option global tagbar_display_anon false
set-option global tagbar_show_details true
} config %{
# if you have wrap highlighter enamled in you configuration
# files it's better to turn it off for tagbar, using this hook:
@ -227,3 +234,48 @@ hook global WinDisplay .* %{
search-highlight-enable
}
plug "kak-lsp/kak-lsp" do %{
cargo install --locked --force --path .
} config %{
# uncomment to enable debugging
# eval %sh{echo ${kak_opt_lsp_cmd} >> /tmp/kak-lsp.log}
# set global lsp_cmd "kak-lsp -s %val{session} -vvv --log /tmp/kak-lsp.log"
# ,l will display a specific menu for LSP
map global user l %{: enter-user-mode lsp<ret>} -docstring "LSP mode"
# lsp-enable
set-option global lsp_server_configuration pyls.configurationSources=["flake8"]
set global lsp_diagnostic_line_error_sign '║'
set global lsp_diagnostic_line_warning_sign '┊'
# define-command ne -docstring 'go to next error/warning from lsp' %{ lsp-find-error --include-warnings }
# define-command pe -docstring 'go to previous error/warning from lsp' %{ lsp-find-error --previous --include-warnings }
# define-command ee -docstring 'go to current error/warning from lsp' %{ lsp-find-error --include-warnings; lsp-find-error --previous --include-warnings }
define-command lsp-restart -docstring 'restart lsp server' %{ lsp-stop; lsp-start }
hook global WinSetOption filetype=(c|cpp|python) %{
# Show matching objects?
set-option window lsp_auto_highlight_references false
map global '<s-*>' -docstring 'Highlight related references' ': lsp-highlight-references<ret>'
# Hint window next to the cursor?
set-option window lsp_hover_anchor false
lsp-auto-hover-enable
lsp-enable-window
}
hook global KakEnd .* lsp-exit
}
set-option -add global ui_options ncurses_padding_char= # Examples: ▚ ┼ ╲╱╳╲╱
add-highlighter global/ scrollbar
add-highlighter global/scrollbar/ scrollbar-indicator red,default lsp_error_lines
add-highlighter global/scrollbar/ scrollbar-indicator yellow,default lint_flags
# add-highlighter global/scrollbar/ scrollbar-indicator red,default git_diff_flags
# git show-diff