Browse Source

Use my own implementation of mpw. Remove special handling of kak files. Drop nim version guards.

master
SolitudeSF 11 months ago
parent
commit
3b63334ad0
No known key found for this signature in database
8 changed files with 46 additions and 67 deletions
  1. 2
    4
      bin/agent-init
  2. 9
    32
      bin/elvmv
  3. 2
    2
      bin/mpw-get
  4. 4
    5
      elvish/rc.elv
  5. 16
    13
      kak/kakrc
  6. 9
    8
      nim.nim
  7. 4
    0
      pulse/daemon.conf
  8. 0
    3
      sxhkd

+ 2
- 4
bin/agent-init View File

@@ -1,6 +1,4 @@
#!/bin/sh
echo "What the heck? :---DD"
printf %s "$(mpw -t x gpg 2>/dev/null)" | xclip -sel c -l 1
gpg2 -d -q "$HOME/sns/password.gpg" | xclip -l 1
mpw -t x ssh -M "$(xclip -o)" 2>/dev/null | xclip -sel c -l 1
mpwc -k max -s gpg | xclip -sel c -l 1
gpg2 -d -q "$HOME/sns/password.gpg" | mpwc -k max -s ssh -S 2>/dev/null | xclip -sel c -l 1
ssh-add

+ 9
- 32
bin/elvmv View File

@@ -1,17 +1,5 @@
#!/usr/bin/env elvish

use re

fn call [a @b]{
list = [(splits ' ' $a)]
bin = (external $list[0])
rest = [$@b]
if (> (count $list) 1) {
rest = [$list[1:] $@b]
}
$bin $@rest
}

fn list-items [a]{
if (-is-dir $a) { put $a/* } else { put $a }
}
@@ -30,14 +18,11 @@ if (== (count $args) 0) {
}
}

high = (- (count $items) 1)
file = (mktemp -p /tmp elvmvXXXXX)
print > $file
c = 0

for i $items {
echo $c"\t"$items[$c] >> $file
c = (+ $c 1)
echo $i >> $file
}

editor = vi
@@ -54,28 +39,20 @@ fn abort [&code=1 a]{
}

try {
call $editor $file
(external $editor) $file
} except {
abort 'Editor exited with error. Aborting...'
}

i = 0
cat $file | each [l]{
matches = (re:find '^(\d+)\t?(.*)$' $l)
if (not (eq $matches '')) {
id = $matches[groups][1][text]
name = $matches[groups][2][text]
src = $items[$id]
if (> $id $high) {
abort 'Unknown item id: '$id'. Aborting...'
} elif (not (eq $src $name)) {
mkdir -p (path-dir $name)
mv $items[$id] $name
}
} elif (re:match '^\s*$' $l) {
continue
} else {
abort 'Couldn''t parse line "'$l'". Aborting...'
if (eq $l '') {
rm $items[$i]
} elif (not-eq $l $items[$i]) {
mkdir -p (path-dir $l)
mv $items[$i] $l
}
i = (+ $i 1)
}

rm $file

+ 2
- 2
bin/mpw-get View File

@@ -1,7 +1,7 @@
#!/usr/bin/env elvish
t=""
if (eq 0 (count $args)) {
@sites=(keys (from-json <~/.mpw.d/(get-env MPW_FULLNAME).mpsites.json)[sites])
@sites=(keys (from-json <(get-env XDG_CONFIG_HOME)/mpwc/(get-env MPW_FULLNAME).mpsites.json)[sites])
if (eq ?(tty -s) $ok) {
t=(echo &sep="\n" $@sites | sk)
} else {
@@ -10,4 +10,4 @@ if (eq 0 (count $args)) {
} else {
t=$args[0]
}
mpw -t x -M (gpg2 -d -q ~/sns/password.gpg) $t 2>/dev/null | xclip -sel c -r -l 1
gpg2 -d -q ~/sns/password.gpg | mpwc -S -k max -s $t 2>/dev/null | xclip -sel c -r -l 1

+ 4
- 5
elvish/rc.elv View File

@@ -1,10 +1,6 @@
use epm
use util
use config
use module


fn alias [cmd @a]{ put [@b]{ (external $cmd) (explode $a) $@b } }

fn xqt [a]{ e $E:XBPS_DISTDIR/srcpkgs/$a/template }

@@ -14,6 +10,8 @@ fn r [@a]{
rm -f $f
}

fn alias [cmd @a]{ put [@b]{ (external $cmd) (explode $a) $@b } }

ls~ = (alias exa --group-directories-first -s Name)
cat~ = (alias bat)
xr~ = (alias sudo xbps-remove -R)
@@ -21,10 +19,11 @@ xr~ = (alias sudo xbps-remove -R)
-exports- = [&]

{
use github.com/xiaq/edit.elv/smart-matcher
use theme
use completers
use github.com/xiaq/edit.elv/smart-matcher
use stack
use module
-exports- = (module:exported $stack:)
smart-matcher:apply
util:add-before-readline {

+ 16
- 13
kak/kakrc View File

@@ -1,6 +1,5 @@
# Manually merge and source plugins
eval %sh{
kaksource "$kak_config/autosource"
kak-lsp --kakoune -s $kak_session
colorcol
}
@@ -17,12 +16,8 @@ set global modelinefmt '%opt{modeline_git_branch} %val{bufname}
%val{cursor_line}:%val{cursor_char_column} {{mode_info}}
{{context_info}}◂%val{client}⊙%val{session}▸'

set global connect_source "%val{config}/autosource/splug"
set global connect_source "%val{config}/autoload/splug"
set global connect_shell elvish
set global fzf_implementation sk
set global fzf_file_command fd
set global fzf_highlight_cmd bat
set global fzf_sk_grep_command 'rg -LHn'

unalias global e edit
alias global e edit-or-dir
@@ -109,6 +104,7 @@ map global clipboard -docstring 'clip-yank' y '<a-|>xclip -i -f -sel c<ret>'
map global clipboard -docstring 'clip-cut -> insert mode' c '<a-|>xclip -i -f -sel c<ret><a-c>'

# Functions

def toggle-highlighter -params .. -docstring 'Toggle highlighter' %{
try %{
addhl window/%arg{@} %arg{@}
@@ -162,10 +158,17 @@ hook global ModuleLoad kitty %{
set global kitty_window_type kitty
}

hook global ModuleLoad fzf %{
set global fzf_implementation sk
set global fzf_file_command fd
set global fzf_highlight_cmd bat
set global fzf_sk_grep_command 'rg -LHn'
}

hook global WinDisplay .* info-buffers
hook global NormalIdle .* %{ try %{ exec -draft '<a-i>w: palette-status<ret>' } }
hook global BufWritePost .* %{ git show-diff }
hook global BufReload .* %{ git show-diff }
hook global BufReload .* %{ git show-diff }

hook global WinCreate .* %{
auto-pairs-enable
@@ -197,7 +200,7 @@ hook global BufCreate .*srcpkgs/.+/template$ %{

hook global BufCreate .*/\.?((sx|xinit)(rc)?|profile) %{ set buffer filetype sh }
hook global BufCreate .*\.ino %{ set buffer filetype cpp }
hook global BufCreate .*\.cs %{ addhl window/java }
hook global BufCreate .*\.cs %{ addhl buffer/java }
hook global BufCreate .*\.rasi %{ set buffer filetype css }

# Filetype settings
@@ -211,7 +214,11 @@ hook global WinSetOption filetype=elvish %{
no-tabs 2
}

hook global WinSetOption filetype=(go|rust|python) %{
hook global WinSetOption filetype=(go|rust|c|cpp) %{
lsp-engage
}

hook global WinSetOption filetype=python %{
lsp-engage
set global lsp_server_configuration pyls.plugins.jedi_completion.include_params=false
}
@@ -222,8 +229,4 @@ hook global WinSetOption filetype=nim %{
set buffer makecmd 'nimble build'
no-tabs 2
lsp-engage
# set buffer lintcmd "sh -c 'cp -f $0 $0.nim;nim --stdout --colors:off --hints:off --path:$(dirname ${kak_buffile}) check $0 | sed \"s/(/:/;s/, /:/;s/)/:/\" | sed \":a;N;/\n[buf.nim]/!s/\n//;ta;P;D\"'"
# set buffer lintcmd "sh -c 'nim --stdout --hints:off check $0 | sed \'s/(/:/;s/, /:/;s/)/:/\''"
# lint-on-write
# format-on-write
}

+ 9
- 8
nim.nim View File

@@ -33,17 +33,18 @@ when defined(musl):
switch "passL", "-static"

when defined(release) or defined(danger):
switch "excessiveStackTrace", "off"
switch "passC", "-flto"
switch "passL", "-s"

when (NimMajor, NimMinor, NimPatch) >= (0, 19, 9):
switch "styleCheck", "hint"
when defined(release):
switch "nimcache", "/tmp/nim/" & projectName() & "_r"
when defined(danger):
switch "nimcache", "/tmp/nim/" & projectName() & "_d"
else:
switch "nimcache", "/tmp/nim/" & projectName()
when defined(release):
switch "nimcache", "/tmp/nim/" & projectName() & "_r"
when defined(danger):
switch "nimcache", "/tmp/nim/" & projectName() & "_d"
else:
switch "nimcache", "/tmp/nim/" & projectName()

when defined(hotcodereloading):
switch "nimcache", "nimcache"

switch "styleCheck", "hint"

+ 4
- 0
pulse/daemon.conf View File

@@ -1,2 +1,6 @@
allow-module-loading = no
use-pid-file = no
log-level = error
default-sample-format = s24le
default-sample-rate = 44100
alternate-sample-rate = 48000

+ 0
- 3
sxhkd View File

@@ -31,9 +31,6 @@ super + space
super + shift + m
exec mpv "$(xclip -sel c -o)"

super + shift + e
exec spacefm

super + shift + {n,p}
exec kitty -1 --class=kittyfloat -o initial_window_width=900 -o initial_window_height=900 \
{ncmpcpp,htop}

Loading…
Cancel
Save