Browse Source

Add new kakoune plugins. Switch keybinds. Add lint/lsp/format for many languages.

Remove old scripts. Add supporting nim scripts.
Switch git diff. Add multilang project icon to elvish theme with SolitudeSF/dotutils.
master
SolitudeSF 1 year ago
parent
commit
4679f453dc
No known key found for this signature in database
11 changed files with 73 additions and 54 deletions
  1. 0
    26
      bin/get-song-cover
  2. 0
    2
      bin/get-wallpaper
  3. 2
    0
      bin/nimlint
  4. 6
    0
      bin/nimprettify
  5. 2
    3
      elvish/lib/theme.elv
  6. 1
    0
      elvish/rc.elv
  7. 6
    0
      gitconfig.ini
  8. 46
    19
      kak.kak
  9. 2
    2
      profile
  10. 7
    1
      splug.toml
  11. 1
    1
      sxhkd

+ 0
- 26
bin/get-song-cover View File

@@ -1,26 +0,0 @@
#!/usr/bin/env elvish

if (eq (mpc current) "") { exit 1 }

library-location = (xdg-user-dir MUSIC)
song-relative = (mpc -f '%file%' | take 1)
song-location = $library-location'/'$song-relative
song-dir = (path-dir $song-location)
@images = (fd -t f -e png -e jpg -e jpeg . $song-dir)

if (> (count $images) 0) {
use str
image = ""
for i $images {
t = (str:to-lower (joins . [(splits . (path-base $i))][:-1]))
if (or (eq $t "cover") \
(eq $t "folder")) { image = $i }
}
if (eq $image '') {
print $images[0]
} else {
print $image
}
} else {
exit 1
}

+ 0
- 2
bin/get-wallpaper View File

@@ -1,2 +0,0 @@
#!/usr/bin/env elvish
print [(splits "'" (cat $E:XDG_CONFIG_HOME/setroot/.setroot-restore))][-2]

+ 2
- 0
bin/nimlint View File

@@ -0,0 +1,2 @@
#!/bin/sh
nim check --hints:off --colors:off --stdout "$1" | sd '\(([1-9]\d*), ([1-9]\d*)\)' ':$1:$2:'

+ 6
- 0
bin/nimprettify View File

@@ -0,0 +1,6 @@
#!/bin/sh
f=${TMPDIR:-/tmp}/$(mktemp nimprettify_XXXX.nim)
cat >"$f"
nimpretty "$f" >/dev/null 2>/dev/null
cat "$f"
rm "$f"

+ 2
- 3
elvish/lib/theme.elv View File

@@ -16,9 +16,8 @@ if (or (has-env SSH_CLIENT) (has-env SSH_TTY)) {
}

fn sym {
if ?(isnimbleproject) {
put 👑
} else { put $basesym }
o = (e = ?(getprojecticon))
if $e { put $o } else { put $basesym }
}

fn pwd {

+ 1
- 0
elvish/rc.elv View File

@@ -35,4 +35,5 @@ xr~ = (alias sudo xbps-remove -R)
}
}

-override-wcwidth 🦀 2
set-env GPG_TTY (tty)

+ 6
- 0
gitconfig.ini View File

@@ -25,6 +25,12 @@
program = gpg2
[credential]
helper = store
[pager]
log = diffr | kakpager
show = diffr | kakpager
diff = diffr | kakpager
[interactive]
diffFilter = diffr
[diff]
tool = kitty
guitool = kitty.gui

+ 46
- 19
kak.kak View File

@@ -29,6 +29,7 @@ alias global bo! buffer-only-force
alias global sw sudo-write
alias global cdb change-directory-current-buffer
alias global f find
alias global s sort-selections
alias global c connect-terminal

face global LineNumbersWrapped black
@@ -51,15 +52,15 @@ map global normal -docstring 'comment block' '<a-#>' ': comment-block<ret>'
map global normal -docstring 'delete to end of line' D <a-l>d
map global normal -docstring 'yank to end of line' Y <a-l>

map global user -docstring 'add phantom selection' f ': phantom-selection-add-selection<ret>'
map global user -docstring 'clear all phantom selections' <a-f> ': phantom-selection-select-all<ret>: phantom-selection-clear<ret>'
map global user -docstring 'next phantom selection' F ': phantom-selection-iterate-next<ret>'
map global user -docstring 'previous phantom selection' <a-F> ': phantom-selection-iterate-prev<ret>'
map global user -docstring 'add phantom selection' <a-f> ': phantom-selection-add-selection<ret>'
map global user -docstring 'clear all phantom selections' <a-F> ': phantom-selection-select-all<ret>: phantom-selection-clear<ret>'
map global user -docstring 'next phantom selection' f ': phantom-selection-iterate-next<ret>'
map global user -docstring 'previous phantom selection' F ': phantom-selection-iterate-prev<ret>'

map global normal -docstring 'select view' <a-%> ': select-view<ret>'
map global view -docstring 'select view' s '<esc>: select-view<ret>'

map global user -docstring 'select selection on each line' s ': keep-selection-each-line<ret>'
map global user -docstring 'select selection on each line' <a-s> ': keep-selection-each-line<ret>'
map global user -docstring 'drop selection on each line' S ': drop-selection-each-line<ret>'

map global user -docstring 'add mark' m ': mark-word<ret>'
@@ -79,20 +80,24 @@ map global user -docstring "next error" l ': lint-next-error<ret>'
map global user -docstring "previous error" L ': lint-previous-error<ret>'

declare-user-mode surround
map global user -docstring 'surround mode' <a-s> ': enter-user-mode surround<ret>'
map global user -docstring 'surround mode' s ': enter-user-mode surround<ret>'
map global surround -docstring 'surround' s ': surround<ret>'
map global surround -docstring 'change' c ': change-surround<ret>'
map global surround -docstring 'delete' d ': delete-surround<ret>'
map global surround -docstring 'select tag' t ': select-surrounding-tag<ret>'
map global surround -docstring 'select surround' <a-s> ': select-surround<ret>'
map global surround -docstring 'surround tag' S ': surrounding-tag<ret>'
map global surround -docstring 'change tag' C ': change-surrounding-tag<ret>'
map global surround -docstring 'delete tag' D ': delete-surrounding-tag<ret>'
map global surround -docstring 'select surrounding tag' <a-S> ': select-surrounding-tag<ret>'
map global surround -docstring 'auto-pairs surround' a ': auto-pairs-surround<ret>'

declare-user-mode anchor
map global normal ';' ': enter-user-mode anchor<ret>'
map global anchor -docstring 'reduce to anchor' a '<a-;>;'
map global anchor -docstring 'reduce to cursor' c ';'
map global anchor -docstring 'flip cursor and anchor' f '<a-;>'
map global anchor -docstring 'ensure anchor after cursor' h '<a-:><a-;>'
map global anchor -docstring 'ensure cursor after anchor' l '<a-:>'
map global anchor -docstring 'flip cursor and anchor' f '<a-;>'
map global anchor -docstring 'reduce to anchor' a '<a-;>;'
map global anchor -docstring 'reduce to cursor' c ';'
map global anchor -docstring 'select cursor and anchor' s '<a-S>'

declare-user-mode clipboard
@@ -124,15 +129,10 @@ def lint-on-write -docstring 'Activate linting on buffer write' %{
hook buffer BufWritePost .* lint
}

def format-on-write -docstring 'Format buffer on write' %{
hook buffer BufWritePost .* format
}

def lsp-engage -docstring 'Enable language server' %{
lsp-enable
lsp-auto-hover-enable
map global user -docstring 'Enter lsp user mode' l ': enter-user-mode lsp<ret>'
map global user -docstring 'Lock lsp user mode' L ': enter-user-mode -lock lsp<ret>'
map global user -docstring 'Enter lsp user mode' <a-l> ': enter-user-mode lsp<ret>'
}

def no-tabs -params 0..1 -docstring 'Indent with spaces' %{
@@ -206,7 +206,7 @@ hook global BufCreate .*\.rasi %{ set buffer filetype css }
# Filetype settings

hook global WinSetOption filetype=sh %{
set buffer lintcmd 'shellcheck -x -fgcc'
set buffer lintcmd 'shellcheck --norc -x -f gcc'
lint-on-write
}

@@ -218,15 +218,42 @@ hook global WinSetOption filetype=(go|rust|c|cpp) %{
lsp-engage
}

hook global WinSetOption filetype=python %{
hook global WinSetOption filetype=html %{
set buffer formatcmd 'prettier --parser html'
set buffer lintcmd 'htmlhint -f unix'
lint-on-write
lsp-engage
}

hook global WinSetOption filetype=css %{
set buffer formatcmd 'prettier --parser css'
set buffer lintcmd 'stylelint -f unix'
lint-on-write
lsp-engage
}

hook global WinSetOption filetype=scss %{
set buffer formatcmd 'prettier --parser scss'
set buffer lintcmd 'stylelint -f unix'
lint-on-write
lsp-engage
}

hook global WinSetOption filetype=markdown %{
set buffer formatcmd 'prettier --parser markdown'
}

hook global WinSetOption filetype=python %{
set global lsp_server_configuration pyls.plugins.jedi_completion.include_params=false
lsp-engage
}

hook global WinSetOption filetype=nim %{
set buffer gdb_program 'nim-gdb'
set buffer formatcmd "nimpretty ${kak_buffile}"
set buffer formatcmd 'nimprettify'
set buffer makecmd 'nimble build'
set buffer lintcmd 'nimlint'
no-tabs 2
lint-on-write
lsp-engage
}

+ 2
- 2
profile View File

@@ -8,7 +8,7 @@ DOTS_DIR=$HOME/dot
GOPATH=$XDG_DATA_HOME/go
CARGO_HOME=$XDG_DATA_HOME/cargo

mkdir -p $XDG_RUNTIME_DIR
mkdir -p "$XDG_RUNTIME_DIR"

# Override system variables
PATH=$HOME/.local/bin:$DOTS_DIR/bin:$HOME/.nimble/bin:$CARGO_HOME/bin:$GOPATH/bin:$PATH
@@ -47,7 +47,7 @@ if [ -z "$SSH_AUTH_SOCK" ]; then
fi

# Sensitive info
. $HOME/sns/profile
. "$HOME/sns/profile"

# Start X or shell
if [ "$GPG_TTY" = /dev/tty1 ]; then

+ 7
- 1
splug.toml View File

@@ -12,7 +12,7 @@ files = ["rc/search-highlighter.kak"]
files = ["mark.kak"]

["https://github.com/lenormf/kakoune-extra"]
files = ["widgets/git-branch.kak", "readline.kak", "vcs.kak"]
files = ["widgets/git-branch.kak", "vcs.kak"]

["https://github.com/Delapouite/kakoune-auto-percent"]
files = ["auto-percent.kak"]
@@ -56,6 +56,9 @@ files = ["vertical-selection.kak"]
["https://github.com/occivink/kakoune-phantom-selection"]
files = ["phantom-selection.kak"]

["https://github.com/occivink/kakoune-sort-selections"]
files = ["sort-selections.kak"]

["https://gitlab.com/notramo/elvish.kak"]
files = ["elvish.kak"]

@@ -70,6 +73,9 @@ files = ["rc/tagbar.kak"]

["https://github.com/andreyorst/fzf.kak"]

["https://github.com/chambln/kakoune-readline"]
files = ["readline.kak"]

# mpv plugins

["https://github.com/ElegantMonkey/mpv-webm"]

+ 1
- 1
sxhkd View File

@@ -4,7 +4,7 @@

# power operations
super + End ; {s,S,alt + s}
lockscreen && loginctl {suspend,hibernate,hybrid-sleep}
loginctl {suspend,hibernate,hybrid-sleep}

super + End ; {r,p}
loginctl {reboot,poweroff}

Loading…
Cancel
Save