New structure for kak config folder
This commit is contained in:
parent
4493ebbfcb
commit
fcd9f69f80
1
autoload/default
Symbolic link
1
autoload/default
Symbolic link
@ -0,0 +1 @@
|
||||
/usr/share/kak/autoload
|
||||
34
autoload/snippets/golang.kak
Normal file
34
autoload/snippets/golang.kak
Normal 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{
|
||||
#}}
|
||||
18
kakrc
18
kakrc
@ -1,6 +1,24 @@
|
||||
# Load plug.kak
|
||||
source "%val{config}/plugins/plug.kak/rc/plug.kak"
|
||||
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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user