Compare commits
No commits in common. "main" and "cloud" have entirely different histories.
@ -1 +0,0 @@
|
|||||||
/usr/share/kak/autoload
|
|
||||||
@ -1,34 +0,0 @@
|
|||||||
hook global BufSetOption filetype=go %{
|
|
||||||
set buffer snippets %opt{snippets} # keep global snippets (if any)
|
|
||||||
# Main structure of a go file
|
|
||||||
set -add buffer snippets 'init-structure' 'inist' \
|
|
||||||
%{ phantom-selection-clear ; snippets-insert %{package main
|
|
||||||
|
|
||||||
import(${})
|
|
||||||
|
|
||||||
func main() {${}}
|
|
||||||
}; phantom-selection-add-selection ; phantom-selection-iterate-next }
|
|
||||||
|
|
||||||
# Basic read file and populate array
|
|
||||||
set -add buffer snippets 'read-populate' 'rbufpop' \
|
|
||||||
%{ phantom-selection-clear ; snippets-insert %{file, err := os.Open("${}")
|
|
||||||
check(err)
|
|
||||||
defer file.Close()
|
|
||||||
|
|
||||||
${} := make([]string, 0)
|
|
||||||
|
|
||||||
scanner := bufio.NewScanner(file)
|
|
||||||
for scanner.Scan() {
|
|
||||||
lines = append(${}, scanner.Text())
|
|
||||||
}
|
|
||||||
}; phantom-selection-add-selection ; phantom-selection-iterate-next }
|
|
||||||
}
|
|
||||||
|
|
||||||
# With phantom
|
|
||||||
#set -add buffer snippets 'name' 'short' \
|
|
||||||
# %{ phantom-selection-clear ; snippets-insert %{snippet-here
|
|
||||||
#}; phantom-selection-add-selection ; phantom-selection-iterate-next }
|
|
||||||
#
|
|
||||||
# Without phantom
|
|
||||||
#set -add buffer snippets 'name' 'short' %{ snippets-insert %snippet-here{
|
|
||||||
#}}
|
|
||||||
53
kakrc
53
kakrc
@ -2,35 +2,14 @@
|
|||||||
source "%val{config}/plugins/plug.kak/rc/plug.kak"
|
source "%val{config}/plugins/plug.kak/rc/plug.kak"
|
||||||
plug "alexherbo2/auto-pairs.kak"
|
plug "alexherbo2/auto-pairs.kak"
|
||||||
plug "andreyorst/plug.kak" noload
|
plug "andreyorst/plug.kak" noload
|
||||||
# plug kakoune-snippets
|
|
||||||
plug "occivink/kakoune-snippets"
|
|
||||||
plug "occivink/kakoune-phantom-selection" config %{
|
|
||||||
map global user f ": phantom-selection-add-selection<ret>"
|
|
||||||
map global user F ": phantom-selection-select-all; phantom-selection-clear<ret>"
|
|
||||||
map global user <a-f> ": phantom-selection-iterate-next<ret>"
|
|
||||||
map global user <a-F> ": phantom-selection-iterate-prev<ret>"
|
|
||||||
|
|
||||||
# this would be nice, but currrently doesn't work
|
|
||||||
# see https://github.com/mawww/kakoune/issues/1916
|
|
||||||
#map global insert <a-f> "<a-;>: phantom-selection-iterate-next<ret>"
|
|
||||||
#map global insert <a-F> "<a-;>: phantom-selection-iterate-prev<ret>"
|
|
||||||
# so instead, have an approximate version that uses 'i'
|
|
||||||
map global insert <a-f> "<esc>: phantom-selection-iterate-next<ret>i"
|
|
||||||
map global insert <a-F> "<esc>: phantom-selection-iterate-prev<ret>i"
|
|
||||||
}
|
|
||||||
# plug collection of snippets
|
|
||||||
plug "andreyorst/kakoune-snippet-collection"
|
|
||||||
# plug auto-pairs
|
|
||||||
plug "alexherbo2/auto-pairs.kak"
|
|
||||||
# plug kak-lsp
|
|
||||||
plug "kak-lsp/kak-lsp" do %{
|
plug "kak-lsp/kak-lsp" do %{
|
||||||
cargo build --release --locked
|
cargo build --release --locked
|
||||||
cargo install --force --path .
|
cargo install --force --path .
|
||||||
} config %{
|
} config %{
|
||||||
|
|
||||||
# uncomment to enable debugging
|
# uncomment to enable debugging
|
||||||
eval %sh{echo ${kak_opt_lsp_cmd} >> /tmp/kak-lsp.log}
|
# 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"
|
# set global lsp_cmd "kak-lsp -s %val{session} -vvv --log /tmp/kak-lsp.log"
|
||||||
|
|
||||||
# this is not necessary; the `lsp-enable-window` will take care of it
|
# this is not necessary; the `lsp-enable-window` will take care of it
|
||||||
# eval %sh{${kak_opt_lsp_cmd} --kakoune -s $kak_session}
|
# eval %sh{${kak_opt_lsp_cmd} --kakoune -s $kak_session}
|
||||||
@ -43,9 +22,10 @@ plug "kak-lsp/kak-lsp" do %{
|
|||||||
define-command ee -docstring 'go to current error/warning from lsp' %{ lsp-find-error --include-warnings; 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 }
|
define-command lsp-restart -docstring 'restart lsp server' %{ lsp-stop; lsp-start }
|
||||||
hook global WinSetOption filetype=(c|cpp|sh|cc|rust|javascript|typescript|go|python|java) %{
|
hook global WinSetOption filetype=(c|cpp|sh|cc|rust|javascript|typescript|go|python) %{
|
||||||
set-option window lsp_auto_highlight_references true
|
set-option window lsp_auto_highlight_references true
|
||||||
set-option window lsp_hover_anchor false
|
set-option window lsp_hover_anchor false
|
||||||
|
map window insert <a-l> lsp-next-location
|
||||||
lsp-auto-hover-enable
|
lsp-auto-hover-enable
|
||||||
echo -debug "Enabling LSP for filtetype %opt{filetype}"
|
echo -debug "Enabling LSP for filtetype %opt{filetype}"
|
||||||
lsp-enable-window
|
lsp-enable-window
|
||||||
@ -64,7 +44,7 @@ plug "kak-lsp/kak-lsp" do %{
|
|||||||
}
|
}
|
||||||
|
|
||||||
map global user l %{:enter-user-mode lsp<ret>} -docstring "LSP mode"
|
map global user l %{:enter-user-mode lsp<ret>} -docstring "LSP mode"
|
||||||
map global insert <a-q> '<a-;>:try lsp-snippets-select-next-placeholders catch %{ execute-keys -with-hooks <lt>tab> }<ret>' -docstring 'Select next snippet placeholder'
|
map global insert <tab> '<a-;>:try lsp-snippets-select-next-placeholders catch %{ execute-keys -with-hooks <lt>tab> }<ret>' -docstring 'Select next snippet placeholder'
|
||||||
map global object a '<a-semicolon>lsp-object<ret>' -docstring 'LSP any symbol'
|
map global object a '<a-semicolon>lsp-object<ret>' -docstring 'LSP any symbol'
|
||||||
map global object <a-a> '<a-semicolon>lsp-object<ret>' -docstring 'LSP any symbol'
|
map global object <a-a> '<a-semicolon>lsp-object<ret>' -docstring 'LSP any symbol'
|
||||||
map global object e '<a-semicolon>lsp-object Function Method<ret>' -docstring 'LSP function or method'
|
map global object e '<a-semicolon>lsp-object Function Method<ret>' -docstring 'LSP function or method'
|
||||||
@ -74,19 +54,18 @@ plug "kak-lsp/kak-lsp" do %{
|
|||||||
|
|
||||||
hook global KakEnd .* lsp-exit
|
hook global KakEnd .* lsp-exit
|
||||||
}
|
}
|
||||||
define-command ide %{ tmux-terminal-horizontal "KAK_SESSION=%val{session} KAK_CLIENT=%val{client} nnn" }
|
|
||||||
# Substitute c-n with tab
|
# Substitute c-n with tab
|
||||||
hook global InsertCompletionShow .* %{
|
#hook global InsertCompletionShow .* %{
|
||||||
try %{
|
# try %{
|
||||||
execute-keys -draft 'h<a-K>\h<ret>'
|
# execute-keys -draft 'h<a-K>\h<ret>'
|
||||||
map window insert <tab> <c-n>
|
# map window insert <tab> <c-n>
|
||||||
map window insert <s-tab> <c-p>
|
# map window insert <s-tab> <c-p>
|
||||||
hook -once -always window InsertCompletionHide .* %{
|
# hook -once -always window InsertCompletionHide .* %{
|
||||||
map window insert <tab> <tab>
|
# map window insert <tab> <tab>
|
||||||
map window insert <s-tab> <s-tab>
|
# map window insert <s-tab> <s-tab>
|
||||||
}
|
# }
|
||||||
}
|
# }
|
||||||
}
|
#}
|
||||||
# enable auto pair closing
|
# enable auto pair closing
|
||||||
enable-auto-pairs
|
enable-auto-pairs
|
||||||
# yaml linter
|
# yaml linter
|
||||||
|
|||||||
@ -1,16 +0,0 @@
|
|||||||
### Commands used when setting up `kak-lsp`. Need to tidy up this and create a proper README.md
|
|
||||||
|
|
||||||
[kak-lsp Github](https://github.com/kak-lsp/kak-lsp)
|
|
||||||
[plug.kak Github](https://github.com/andreyorst/plug.kak)
|
|
||||||
`$ sudo yum install cargo`
|
|
||||||
`$ sudo yum install clangd`
|
|
||||||
`$ sudo yum install clang-tools`
|
|
||||||
`$ sudo yum install llvm`
|
|
||||||
`$ sudo yum install clang-tools-extra`
|
|
||||||
`$ git clone https://github.com/andreyorst/plug.kak.git $HOME/.config/kak/plugins/plug.kak`
|
|
||||||
`$ export PATH=$PATH:/home/doddo/.cargo/bin`
|
|
||||||
|
|
||||||
### Issues
|
|
||||||
- For some reason, kak-lsp does not seem to compile with the last version of Rust
|
|
||||||
- Fall back to download static precompiled `kak-lsp`
|
|
||||||
- Need to refactor the whole kakrc to make it more readable
|
|
||||||
Loading…
x
Reference in New Issue
Block a user