Compare commits

..

9 Commits
cloud ... main

Author SHA1 Message Date
82eb0a5e37 Merge branch 'cloud' 2023-12-11 21:11:08 +01:00
8e42ad41ca Added Java to the kak-lsp filetype list 2023-12-11 19:53:03 +01:00
fcd9f69f80 New structure for kak config folder 2023-12-10 20:08:55 +01:00
4493ebbfcb Added go to the list of kak-lsp languages 2023-12-08 19:27:35 +01:00
5c6318341b Added the plug for auto-pairs 2023-10-02 22:17:22 +02:00
0929cece74 Removed unused code and languages
Commented code removed, also removed languages like rust and
javascript that I do not use.
2023-10-02 22:12:16 +02:00
f04fd3e314 quicknotes.md expanded 2023-10-02 22:05:55 +02:00
22d29b811a Update quicknotes.md
Formatting
2023-08-08 21:29:11 +00:00
3be06b91df Add quicknotes.md
Creation of quicknotes.md to simplify remembering what I did in the past
2023-08-08 21:27:47 +00:00
4 changed files with 88 additions and 16 deletions

1
autoload/default Symbolic link
View File

@ -0,0 +1 @@
/usr/share/kak/autoload

View File

@ -0,0 +1,34 @@
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
View File

@ -2,14 +2,35 @@
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}
@ -22,10 +43,9 @@ 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) %{ hook global WinSetOption filetype=(c|cpp|sh|cc|rust|javascript|typescript|go|python|java) %{
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
@ -44,7 +64,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 <tab> '<a-;>:try lsp-snippets-select-next-placeholders catch %{ execute-keys -with-hooks <lt>tab> }<ret>' -docstring 'Select next snippet placeholder' 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 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'
@ -54,18 +74,19 @@ 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

16
quicknotes.md Normal file
View File

@ -0,0 +1,16 @@
### 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