Browse Source

Actually use kak-lsp. Improve imgur script. Bunch of minor fixes.

master
SolitudeSF 1 year ago
parent
commit
bacac45e44
No known key found for this signature in database
6 changed files with 62 additions and 35 deletions
  1. 28
    12
      bin/imgur
  2. 0
    15
      bin/imgur-delete
  3. 10
    7
      firefox/user.js
  4. 16
    1
      kak/kakrc
  5. 5
    0
      profile
  6. 3
    0
      splug.toml

+ 28
- 12
bin/imgur View File

@@ -3,19 +3,35 @@
resp = [&]
id = (from-json <~/sns/imgur.json)[SolitudeAnon][id]
command = [-sLX POST 'https://api.imgur.com/3/image' --data-binary '@-' -H "Authorization: Client-ID "$id ]
argn = (count $args)

if (not-eq ?(tty -s) $ok) {
resp = (all | base64 | curl $@command | from-json)
} elif (> (count $args) 0) {
resp = (base64 $args[0] | curl $@command | from-json)
if (and (> $argn 0) (eq $args[0] -d)) {
if (== $argn 1) {
echo Provide deletion hash
exit 1
}
resp = (curl -sLX DELETE 'https://api.imgur.com/3/image/'$args[1] -H \
'Authorization: Client-ID '$id | from-json)
if (and (has-key $resp success) (eq $resp[success] $true)) {
echo Image deleted
} else {
echo Failed to delete image
exit 1
}
} else {
exit 1
}
if (not-eq ?(tty -s) $ok) {
resp = (all | base64 | curl $@command | from-json)
} elif (> $argn 0) {
resp = (base64 $args[0] | curl $@command | from-json)
} else {
exit 1
}

if (and (has-key $resp success) (eq $resp[success] $true)) {
echo Uploaded to $resp[data][link]
echo Delete hash: $resp[data][deletehash]
} else {
echo Upload failed
exit 1
if (and (has-key $resp success) (eq $resp[success] $true)) {
echo Uploaded to $resp[data][link]
echo Delete hash: $resp[data][deletehash]
} else {
echo Upload failed
exit 1
}
}

+ 0
- 15
bin/imgur-delete View File

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

if (== (count $args) 0) {
echo Provide deletion hash
exit 1
}

id = (from-json <~/sns/imgur.json)[SolitudeAnon][id]
resp = (curl -sLX DELETE 'https://api.imgur.com/3/image/'$args[0] -H 'Authorization: Client-ID '$id | from-json)
if (and (has-key $resp success) (eq $resp[success] $true)) {
echo Image deleted
} else {
echo Failed to delete image
exit 1
}

+ 10
- 7
firefox/user.js View File

@@ -1,25 +1,28 @@


user_pref("general.warnOnAboutConfig", false);

user_pref("browser.chrome.errorReporter.enabled", false);


user_pref("browser.newtabpage.activity-stream.feeds.section.highlights", false);
user_pref("browser.newtabpage.activity-stream.feeds.snippets", false);
user_pref("browser.newtabpage.activity-stream.feeds.topsites", false);
user_pref("browser.newtabpage.activity-stream.prerender", false);
user_pref("browser.newtabpage.activity-stream.showSearch", false);


user_pref("browser.safebrowsing.malware.enabled", false);
user_pref("browser.safebrowsing.phishing.enabled", false);

user_pref("browser.search.suggest.enabled", false);

user_pref("extensions.formautofill.addresses.enabled", false);
user_pref("extensions.formautofill.creditCards.enabled", false);

user_pref("browser.tabs.closeTabByDblclick", true);
user_pref("widget.chrome.allow-gtk-dark-theme", true);
user_pref("widget.content.allow-gtk-dark-theme", true);

user_pref("extensions.pocket.enabled", false);
user_pref("extensions.pocket.api", "");
user_pref("extensions.pocket.site", "");

user_pref("extensions.formautofill.addresses.enabled", false);
user_pref("extensions.formautofill.creditCards.enabled", false);
user_pref("font.name.monospace.x-western", "Iosevka SS04");
user_pref("font.name.sans-serif.x-western", "Inter UI");
user_pref("font.name.serif.x-western", "Inter UI");

+ 16
- 1
kak/kakrc View File

@@ -1,5 +1,8 @@
# Merge and manually source plugins
eval %sh{ cat $(find "$kak_config/autosource" -name '*\.kak') }
eval %sh{
cat $(find "$kak_config/autosource" -name '*\.kak')
kak-lsp --kakoune -s $kak_session
}

# Initialization
decl -hidden regex curword
@@ -99,6 +102,13 @@ def lint-on-write -docstring 'Activate linting on buffer write' %{
hook buffer BufWritePost .* %{ lint }
}

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>'
}

def no-tabs -params 0..1 -docstring 'Indent with spaces' %{
eval %sh{ [ -n "$1" ] && printf %s "
set buffer indentwidth $1
@@ -162,6 +172,11 @@ hook global WinSetOption filetype=elvish %{
no-tabs 2
}

hook global WinSetOption filetype=python %{
lsp-engage
hook window BufWritePre .* lsp-formatting-sync
}

hook global WinSetOption filetype=nim %{
set buffer gdb_program 'nim-gdb'
no-tabs 2

+ 5
- 0
profile View File

@@ -27,6 +27,8 @@ GPG_AGENT_INFO=$GNUPGHOME/S.gpg-agent:0:1
_JAVA_AWT_WM_NONREPARENTING=1
_JAVA_OPTIONS='-Dawt.useSystemAAFontSettings=on -Dswing.aatext=true'

unset LS_COLORS

# Mass export
export \
XDG_DATA_HOME XDG_RUNTIME_DIR XDG_CACHE_HOME XDG_CONFIG_HOME XDG_RUNTIME_DIR \
@@ -42,6 +44,9 @@ if [ -z "$SSH_AUTH_SOCK" ]; then
. "$XDG_CACHE_HOME/ssh-env"
fi

# Sensitive info
. $HOME/sns/profile

# Start X or shell
if [ -z "$DISPLAY" ] && [ "$GPG_TTY" = /dev/tty1 ]; then
exec dbus-launch sx

+ 3
- 0
splug.toml View File

@@ -55,6 +55,9 @@ files = ["find.kak"]
["https://github.com/occivink/kakoune-gdb"]
files = ["gdb.kak"]

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

["https://github.com/occivink/kakoune-vertical-selection"]
files = ["vertical-selection.kak"]


Loading…
Cancel
Save