diff options
-rwxr-xr-x | bin/common/ask | 2 | ||||
-rwxr-xr-x | bin/common/ytclipo | 19 | ||||
-rwxr-xr-x | bin/guiscripts/dmapimg | 7 | ||||
-rwxr-xr-x | bin/guiscripts/dmask | 2 | ||||
-rwxr-xr-x | bin/guiscripts/dmclip | 92 | ||||
-rwxr-xr-x | bin/guiscripts/dmemoji | 2 | ||||
-rwxr-xr-x | bin/guiscripts/dmpdf | 14 | ||||
-rwxr-xr-x | bin/guiscripts/dmvid | 20 | ||||
-rw-r--r-- | config/X/dunst/dunstrc | 2 | ||||
-rw-r--r-- | config/common/btop/btop.conf | 4 | ||||
-rw-r--r-- | config/common/newsboat/urls | 20 | ||||
-rw-r--r-- | config/essentials/nvim/after/plugin/luasnip.lua | 142 | ||||
-rw-r--r-- | config/essentials/nvim/ftplugin/all.lua | 1 | ||||
-rw-r--r-- | config/essentials/nvim/ftplugin/sh.lua | 1 | ||||
-rw-r--r-- | config/essentials/nvim/lua/tlast/cmp/bash.lua | 1 | ||||
-rw-r--r-- | config/essentials/nvim/lua/tlast/cmp/init.lua | 1 | ||||
-rw-r--r-- | config/essentials/nvim/lua/tlast/packer.lua | 1 | ||||
-rw-r--r-- | config/essentials/nvim/lua/tlast/remap.lua | 95 | ||||
-rw-r--r-- | config/essentials/nvim/lua/tlast/set.lua | 61 | ||||
-rw-r--r-- | config/essentials/zsh/.zshrc (renamed from config/zshrc/.zshrc) | 40 | ||||
-rw-r--r-- | config/essentials/zsh/aliases.zsh | 23 | ||||
-rw-r--r-- | config/home/.zshenv | 47 | ||||
-rwxr-xr-x | stowcmds.sh | 6 |
23 files changed, 394 insertions, 209 deletions
diff --git a/bin/common/ask b/bin/common/ask index 140d9f6..a06e3c7 100755 --- a/bin/common/ask +++ b/bin/common/ask @@ -12,7 +12,7 @@ test -z "${inp:=$@}" && prompt="$(echo "$inp" | tr "\n\t\"" " '")" API_KEY="$(pass tokens/openai-api)" -model="text-ada-001" +model="text-curie-001" tokens="1024" temperature=0 diff --git a/bin/common/ytclipo b/bin/common/ytclipo new file mode 100755 index 0000000..0ac412c --- /dev/null +++ b/bin/common/ytclipo @@ -0,0 +1,19 @@ +#!/bin/sh + +# argument ($1) -> clipboard -> stdin +test -z "${inp:=${1:-"$(xclip -sel c -o)"}}" \ + && inp="$(cat /dev/stdin)" + +echo "inp: ${inp}" 1>&2 +# take last link from clipboard +# works when link is from yt-local +inp="$(echo -n "$inp" | awk -F 'https?://' '{print $NF}')" +echo "inp: ${inp}" 1>&2 +notify-send "ytclipo" "<b>ytclipo</b><br><i>downloading</i> $inp" + +yt-dlp "$inp" \ + -f "b" \ + -S "res:720" \ + -P "$HOME/vids" \ + -o "%(title)s.%(ext)s" +notify-send "ytclipo" "<b>ytclipo</b><br>finished downloading." diff --git a/bin/guiscripts/dmapimg b/bin/guiscripts/dmapimg index 25c414b..3677ed3 100755 --- a/bin/guiscripts/dmapimg +++ b/bin/guiscripts/dmapimg @@ -1,6 +1,7 @@ -#!/bin/bash +#!/bin/sh +dest="$XDG_DATA_HOME"/appimages/ appimage="$(\ - find ~/.local/share/appimages -type f -printf "%f\n" \ + find "$dest" -type f -printf "%f\n" \ | sed 's/\.[Aa]pp[Ii]mage$//g' \ | dmenu -x -l 10 -g 1 -p "AppImage:")" -setsid ~/AppImages/"${appimage:-NOSEL}"* +setsid "${dest}/${appimage:-NOSEL}"* diff --git a/bin/guiscripts/dmask b/bin/guiscripts/dmask index 6772854..dd52c5a 100755 --- a/bin/guiscripts/dmask +++ b/bin/guiscripts/dmask @@ -4,7 +4,7 @@ which dmenu Xdialog ask > /dev/null || exit 1 -prompt="$(echo -n | dmenu -p "prompt:" | tr '"' "'")" +prompt="$(echo -n | dmenu -p "prompt:" | tr '"' "'" | tee -a /tmp/dmask_history)" test -z "$prompt" && exit 1 answer="$(ask "$prompt" | tr '"' "'" | fold -w 80 -s)" diff --git a/bin/guiscripts/dmclip b/bin/guiscripts/dmclip index 5282b35..9c09b04 100755 --- a/bin/guiscripts/dmclip +++ b/bin/guiscripts/dmclip @@ -1,83 +1,79 @@ -#!/usr/bin/env bash +#!/bin/sh + +# Display Clipboard Length +DICL_LEN=48 +tmp="/tmp/dmclip" + NotImage () { echo -n "" | dmenu -p "NOT AN IMAGE" exit } -# Display clipboard max length - -selection="$(echo -e "primary\nclipboard\nswap" | dmenu -l 1 -g 3 -p "selection:")" -if [[ "${selection}" == "swap" ]] +selection="$(echo -e "primary\nclipboard\nswap" | + dmenu -l 1 -g 3 -p "selection:")" +if [[ "$selection" == "swap" ]] then clipboard="$(xclip -o)" xclip -o | xclip -sel c - echo -n "${clipboard}" | xclip -sel c + echo -n "$clipboard" | xclip -sel c exit -elif [[ "${selection}" == "" ]] +elif [ "$selection" == "" ] then exit 1 -fi -if "${selection}" == "primary" ]] +elif [ "$selection" == "primary" ] then selection2="clipboard" else selection2="primary" fi - -clipboard="$(xclip -out -sel "${selection}" -r)" - -DICL_LEN=48 -if [[ "$(xclip -sel ${selection} -o | head -n1 | cut -c 2-4)" == "PNG" ]] +if xclip -sel $selection -o -t TARGETS | grep "image/png" then disp_clip="IMAGE" else - disp_clip="$(echo -n "${clipboard}" | tr -d '\n' | cut -c -"${DICL_LEN}")" + clipboard="$(xclip -out -sel "$selection" -r)" + disp_clip="$(echo -n "$clipboard" | + tr -d '\n' | + cut -c -"$DICL_LEN")" fi -menu_option="$(\ - echo -e "save\nload\nimage\nreplace" \ - | dmenu -l 1 -g 4 -p "'${disp_clip}'" \ -)" -[[ "${menu_option}" ]] || exit - -case "${menu_option}" in +menu_option="$(echo -e "save\nload\nimage\nreplace" | + dmenu -l 1 -g 4 -p "'$disp_clip'")" +[ "${menu_option}" ] || exit +case "$menu_option" in replace) - replace_text="$(echo -n "" | dmenu -l 0 -p "replace:")" - [[ "${replace_text}" ]] || exit - replace_by_text="$(echo -n "" | dmenu -l 0 -p "by:")" - [[ "${replace_by_text}" ]] || exit - echo "${clipboard}" \ - | sed "s/${replace_text}/${replace_by_text}/g" \ - | xclip -r -sel "${selection}" + replace_text="$(echo -n "" | + dmenu -l 0 -p "replace:")" + [ "$replace_text" ] || exit + replace_by_text="$(echo -n "" | + dmenu -l 0 -p "by:")" + [ "$replace_by_text" ] || exit + echo "$clipboard" | + sed "s/$replace_text/$replace_by_text/g" | + xclip -r -sel "$selection" ;; save) - echo "${clipboard}" >> /tmp/tmpclip.txt + echo "$clipboard" >> /tmp/tmpclip.txt ;; load) - choice="$(\ - sort /tmp/tmpclip.txt \ - | uniq \ - | dmenu -g 1 -l 5 || exit \ - )" - echo -n "${choice}" | xclip -sel "${selection}" + choice="$(sort "${tmp}.txt" | + uniq | + dmenu -g 1 -l 5)" + [ "$choice" ] || exit 1 + echo -n "$choice" | xclip -sel "$selection" ;; image) - # Menu - # 1: line from paragraph - # 2: param - # - file_name="tmp_xclip" - xclip -o -sel c > "/tmp/${file_name}.png" - file "/tmp/${file_name}.png" \ - | cut -d ':' -f 2 \ - | grep "image" || NotImage + xclip -o -sel c > "${tmp}.png" + file -bi "${tmp}.png" | + grep "image/png" || NotImage # sed so that dmenu doesn't skip if one line - tesseract "/tmp/${file_name}.png" stdout > "/tmp/${file_name}" - sed "1i\ " "/tmp/${file_name}" | dmenu -l 10 -g 1 -p "PREVIEW:" -l 20 || exit - xclip -sel "${selection}" -in "/tmp/${file_name}" + tesseract "${tmp}.png" stdout > "$tmp" + sed "1i\ " "$tmp" | + dmenu -l 10 -g 1 -p "PREVIEW:" -l 20 || + exit + xclip -sel "$selection" -i "$tmp" ;; esac diff --git a/bin/guiscripts/dmemoji b/bin/guiscripts/dmemoji index 9f026b1..21c5150 100755 --- a/bin/guiscripts/dmemoji +++ b/bin/guiscripts/dmemoji @@ -17,7 +17,7 @@ case "$1" in if [ ! -z "$input" ]; then emoji=${input::1} echo -n "$emoji" | xclip -selection c - dunstify "dmemoji" "$emoji copied!" + notify-send "dmemoji" "$emoji <b>copied!</b>" fi ;; "") diff --git a/bin/guiscripts/dmpdf b/bin/guiscripts/dmpdf index 21f3ed0..2d51760 100755 --- a/bin/guiscripts/dmpdf +++ b/bin/guiscripts/dmpdf @@ -1,14 +1,14 @@ #!/bin/bash -find ${1:-$HOME/docs $HOME/dl} 2> /dev/null | grep -E ".+\.pdf" | sort > /tmp/dmpdf +tmp="/tmp/dmpdf" +find ${1:-$HOME/docs $HOME/dl} 2> /dev/null | grep -E ".+\.pdf" | sort > "$tmp" choice="$(\ - sed 's|^/home/aluc|\~| ; s|\([^/]\)[^/]*/|\1/|g' /tmp/dmpdf \ - | awk '{printf "%s %s\n", NR ":", $0}' \ - | dmenu -l 10 -g 1 -x -i \ - | grep -oE "^[0-9]+:" \ -)" + sed 's|^/home/aluc|\~| ; s|\([^/]\)[^/]*/|\1/|g' "$tmp" | + awk '{printf "%s %s\n", NR ":", $0}' | + dmenu -p "pdf:" -l 10 -g 1 -x -i | + grep -oE "^[0-9]+:")" if [ -z "$choice" ]; then exit fi -file="$(sed -n "${choice::-1}p" /tmp/dmpdf)" +file="$(sed -n "${choice::-1}p" "$tmp")" zathura "$file" & diff --git a/bin/guiscripts/dmvid b/bin/guiscripts/dmvid index 16e164f..fe3155e 100755 --- a/bin/guiscripts/dmvid +++ b/bin/guiscripts/dmvid @@ -1,14 +1,12 @@ #!/usr/bin/env bash find ${1:-~/vids ~/dl} 2> /dev/null | grep -E ".+\.(webm|mp4|mpeg|mkv)$" | sort > /tmp/dmvids -choice="$(\ - sed 's|^/home/aluc|\~| ; s|\([^/]\)[^/]*/|\1/|g' /tmp/dmvids \ - | awk '{printf "%s %s\n", NR ":", $0}' \ - | dmenu -l 10 -g 1 -x -i \ - | grep -zoE "^[0-9]+:" \ -)" -if [ -z "$choice" ]; then - exit -fi -vid="$(sed -n "${choice::-1}p" /tmp/dmvids)" -mpv "$vid" + +choice="$(sed 's|^/home/aluc|\~| ; s|\([^/]\)[^/]*/|\1/|g' /tmp/dmvids | + awk '{printf "%s %s\n", NR ":", $0}' | + dmenu -l 10 -g 1 -x -i | + grep -zoE "^[0-9]+:")" +test -z "$choice" && + exit 1 + +mpv "$(sed -n "${choice::-1}p" /tmp/dmvids)" diff --git a/config/X/dunst/dunstrc b/config/X/dunst/dunstrc index 58a2753..f4d3a29 100644 --- a/config/X/dunst/dunstrc +++ b/config/X/dunst/dunstrc @@ -162,7 +162,7 @@ # Alignment of message text. # Possible values are "left", "center" and "right". - alignment = left + alignment = center # Vertical alignment of message text and icon. # Possible values are "top", "center" and "bottom". diff --git a/config/common/btop/btop.conf b/config/common/btop/btop.conf index 7affea4..a0b99b6 100644 --- a/config/common/btop/btop.conf +++ b/config/common/btop/btop.conf @@ -54,13 +54,13 @@ update_ms = 2000 #* Processes sorting, "pid" "program" "arguments" "threads" "user" "memory" "cpu lazy" "cpu direct", #* "cpu lazy" sorts top process over time (easier to follow), "cpu direct" updates top process directly. -proc_sorting = "cpu direct" +proc_sorting = "memory" #* Reverse sorting order, True or False. proc_reversed = False #* Show processes as a tree. -proc_tree = True +proc_tree = False #* Use the cpu graph colors in the process list. proc_colors = True diff --git a/config/common/newsboat/urls b/config/common/newsboat/urls index 0e9aee1..801d556 100644 --- a/config/common/newsboat/urls +++ b/config/common/newsboat/urls @@ -3,16 +3,17 @@ https://hackaday.com/blog/feed/ https://thisweek.gnome.org/index.xml https://itsfoss.com/rss https://archlinux.org/feeds/news/ +https://www.hln.be/home/rss.xml "---VIDEOS---" -https://www.youtube.com/feeds/videos.xml?channel_id=UCngn7SVujlvskHRvRKc1cTw -https://www.youtube.com/feeds/videos.xml?channel_id=UCVls1GmFKf6WlTraIb_IaJg -https://www.youtube.com/feeds/videos.xml?channel_id=UCsBjURrPoezykLs9EqgamOA -https://www.youtube.com/feeds/videos.xml?channel_id=UC2eYFnH61tmytImy1mTYvhA -https://www.youtube.com/feeds/videos.xml?channel_id=UC7YOGHUfC1Tb6E4pudI9STA -https://www.youtube.com/feeds/videos.xml?channel_id=UC5UAwBUum7CPN5buc-_N1Fw -https://www.youtube.com/feeds/videos.xml?channel_id=UCbTp1BYjpuhDRG5OmgIT8iw -https://www.youtube.com/feeds/videos.xml?channel_id=UC_ML5xP23TOWKUcc-oAE_Eg -https://www.youtube.com/feeds/videos.xml?channel_id=UCx-ljiKQcLSd8_4AFi_yaIw +https://www.youtube.com/feeds/videos.xml?channel_id=UCngn7SVujlvskHRvRKc1cTw # Bugswrite +https://www.youtube.com/feeds/videos.xml?channel_id=UCVls1GmFKf6WlTraIb_IaJg # Distrotube +https://www.youtube.com/feeds/videos.xml?channel_id=UCsBjURrPoezykLs9EqgamOA # Fireship +https://www.youtube.com/feeds/videos.xml?channel_id=UC2eYFnH61tmytImy1mTYvhA # Luke Smith +https://www.youtube.com/feeds/videos.xml?channel_id=UC7YOGHUfC1Tb6E4pudI9STA # Mental Outlaw +https://www.youtube.com/feeds/videos.xml?channel_id=UC5UAwBUum7CPN5buc-_N1Fw # The Linux Experiment +https://www.youtube.com/feeds/videos.xml?channel_id=UCbTp1BYjpuhDRG5OmgIT8iw # James Tomsaino +https://www.youtube.com/feeds/videos.xml?channel_id=UC_ML5xP23TOWKUcc-oAE_Eg # Hussein Nasser +https://www.youtube.com/feeds/videos.xml?channel_id=UCd3dNckv1Za2coSaHGHl5aA # TJ De vries http://vimcasts.org/feeds/ogg.rss "---REDDIT---" https://www.reddit.com/r/linux.rss @@ -28,3 +29,4 @@ https://github.com/hrsh7th/nvim-cmp/releases.atom https://github.com/L3MON4D3/LuaSnip/releases.atom https://github.com/alacritty/alacritty/releases.atom https://github.com/umlaeute/v4l2loopback/releases.atom +https://github.com/MultiMC/Launcher/releases.atom diff --git a/config/essentials/nvim/after/plugin/luasnip.lua b/config/essentials/nvim/after/plugin/luasnip.lua new file mode 100644 index 0000000..2e375e1 --- /dev/null +++ b/config/essentials/nvim/after/plugin/luasnip.lua @@ -0,0 +1,142 @@ +local ls = require("luasnip") +local s = ls.snippet +local sn = ls.snippet_node +local isn = ls.indent_snippet_node +local t = ls.text_node +local i = ls.insert_node +local f = ls.function_node +local c = ls.choice_node +local d = ls.dynamic_node +local r = ls.restore_node +local events = require("luasnip.util.events") +local ai = require("luasnip.nodes.absolute_indexer") +local extras = require("luasnip.extras") +local l = extras.lambda +local rep = extras.rep +local p = extras.partial +local m = extras.match +local n = extras.nonempty +local dl = extras.dynamic_lambda +local fmt = require("luasnip.extras.fmt").fmt +local fmta = require("luasnip.extras.fmt").fmta +local conds = require("luasnip.extras.expand_conditions") +local postfix = require("luasnip.extras.postfix").postfix +local types = require("luasnip.util.types") +local parse = require("luasnip.util.parser").parse_snippet + +-- keymaps +vim.keymap.set({"i", "s"}, "<C-k>", "<Plug>luasnip-expand-or-jump", { noremap = true }) +vim.keymap.set({"i", "s"}, "<C-j>", "<Plug>luasnip-jump-prev", { noremap = true }) +vim.keymap.set({"i", "s"}, "<C-l>", "<Plug>luasnip-next-choice", { noremap = true }) +vim.keymap.set("n", "<leader><leader>s", function() + ls.cleanup() + vim.cmd("source ~/.config/nvim/after/plugin/luasnip.lua") + print("snippets reloaded.") +end, { noremap = true }) + +ls.add_snippets("lua", { + -- print + s("pt", fmt([[print("{}")]], { i(1, "Hello World!") })), + -- local function + parse("lf", "local $1 = function($2)\n\t$3\nend$0", {}), + -- require + s("lrq", fmt("local {} = require('{}')", { i(1), rep(1) })), + parse("rq", "require('$1')$0", {}), + parse("rqs", "require('$1').setup {\n\t$2\n}$0", {}), + parse("use", "use('$1')$0", {}), + -- function + s("fn", fmt( + [[ + function {}({}) + {} + end{} + ]], + { i(1), i(2), i(3), i(0) })), + parse("sn", "s(\"$1\", fmt(\n[[\n$2\n]],\n{ $3 })),$0", {}), +}) + +ls.add_snippets("html", { + s("<!DOCTYPE>", { + t({"<!DOCTYPE html>", "<html lang=\"en\">", "\t<head>", "\t\t<title>"}), + i(1, "title"), + t("</title>"), i(2), + t({"", "\t</head>", "\t<body>", "\t\t<h1>"}), + i(3, "Header"), + t("</h1>"), i(4), + t({"", "\t</body>", "</html>"}), i(0) + }), +}) + +ls.add_snippets("java", { + -- function + s("fn", fmt( + [[ + {}{} {} ({}) {{ + {} + }} + ]], + { + c(1, {t "public ", t "private ", t ""}), + i(2, "type"), + i(3, "f"), + i(4), i(0) + })), + -- constructor + s("cst", fmt( + [[ + public {} ({}) {{ + {} + }}{} + ]], + { i(1), i(2), i(3), i(0) })), + -- setter function + s("sfn", fmt( + [[ + {}void set_{} ({} {}) {{ + this.{} = {}; + }}{} + ]], + { c(1, {t "public ", t "private ", t ""}), + i(2), i(3), rep(2), rep(2), rep(2), i(0) })), + -- getter function + s("gfn", fmt( + [[ + {}{} get_{} () {{ + return this.{}; + }}{} + ]], + { c(1, {t "public ", t "private ", t ""}), i(2, "type"), i(3), rep(3), i(0)})), + s("psv", fmt( + [[ + public class Main {{ + public static void main (String[] args) {{ + {} + }} + }} + ]], + { i(0) })), + -- constructor + s("class", fmt( + [[ + {}class {} {{ + {} + }} + ]], + { c(1, {t "public ", t "private ", t ""}), i(2), i(0)})), + -- print + parse("pt", "System.out.println($1);$0", {}), + parse("pti", "System.out.println(\"$1: \" + $1);$0", {}), + parse("abs", "Math.abs($1);$0", {}), + -- quick + s("pr", t "private "), + s("ob", fmt( + [[ + {} {} = new {}({}); + {} + ]], + { i(1), i(2), rep(1), i(3), i(0) })), +}) + +ls.add_snippets("sh", { + parse("fn", "function $1 {\n\t$2\n}$0", {}) +}) diff --git a/config/essentials/nvim/ftplugin/all.lua b/config/essentials/nvim/ftplugin/all.lua new file mode 100644 index 0000000..1608f4e --- /dev/null +++ b/config/essentials/nvim/ftplugin/all.lua @@ -0,0 +1 @@ +vim.cmd("set formatoptions=cqrnj") diff --git a/config/essentials/nvim/ftplugin/sh.lua b/config/essentials/nvim/ftplugin/sh.lua index 3ebb1c9..4b66c75 100644 --- a/config/essentials/nvim/ftplugin/sh.lua +++ b/config/essentials/nvim/ftplugin/sh.lua @@ -1,2 +1,3 @@ vim.keymap.set("n", "<LocalLeader>t", "<cmd>s/\\(\\s*\\)\\(.*\\)/\\1echo \"\\2\"<cr><cmd>setlocal nohls<cr>") vim.keymap.set("n", "<LocalLeader>i", "<cmd>s/\\(\\s*\\)\\(.*\\)/\\1echo \"\\2: ${\\2}\"<cr><cmd>setlocal nohls<cr>") +vim.opt.formatoptions = "cqrnj" diff --git a/config/essentials/nvim/lua/tlast/cmp/bash.lua b/config/essentials/nvim/lua/tlast/cmp/bash.lua new file mode 100644 index 0000000..91b6fba --- /dev/null +++ b/config/essentials/nvim/lua/tlast/cmp/bash.lua @@ -0,0 +1 @@ +require'lspconfig'.bashls.setup{} diff --git a/config/essentials/nvim/lua/tlast/cmp/init.lua b/config/essentials/nvim/lua/tlast/cmp/init.lua index d932138..a80856c 100644 --- a/config/essentials/nvim/lua/tlast/cmp/init.lua +++ b/config/essentials/nvim/lua/tlast/cmp/init.lua @@ -1,6 +1,7 @@ require("tlast.cmp.setup") require("tlast.cmp.arduino") +require("tlast.cmp.bash") require("tlast.cmp.clangd") require("tlast.cmp.html") require("tlast.cmp.css") diff --git a/config/essentials/nvim/lua/tlast/packer.lua b/config/essentials/nvim/lua/tlast/packer.lua index 2400ff9..931e7d4 100644 --- a/config/essentials/nvim/lua/tlast/packer.lua +++ b/config/essentials/nvim/lua/tlast/packer.lua @@ -6,6 +6,7 @@ return require('packer').startup(function(use) 'nvim-telescope/telescope.nvim', tag = '0.1.1', requires = { {'nvim-lua/plenary.nvim'} } } + use('nvim-telescope/telescope-symbols.nvim') use('theprimeagen/harpoon') -- colors diff --git a/config/essentials/nvim/lua/tlast/remap.lua b/config/essentials/nvim/lua/tlast/remap.lua index 09589c4..c2d4c0b 100644 --- a/config/essentials/nvim/lua/tlast/remap.lua +++ b/config/essentials/nvim/lua/tlast/remap.lua @@ -1,48 +1,43 @@ vim.g.mapleader = " " -vim.g.localleader = "\\" +vim.g.maplocalleader = "\\" -vim.keymap.set("n", "-", vim.cmd.Ex) +-- -- vinegar is already doing this +-- vim.keymap.set("n", "-", vim.cmd.Ex) -- moving -vim.keymap.set("i", "<C-a>", "<C-o>I") -vim.keymap.set("i", "<C-e>", "<C-o>A") -vim.keymap.set("i", "<C-k>", "<C-o>D") - --- -- add closing -vim.keymap.set("i", '"', '""<Left>') --- vim.keymap.set("i", "'", "''<Left>") --- vim.keymap.set("i", "(", "()<Left>") --- vim.keymap.set("i", "[", "[]<Left>") --- vim.keymap.set("i", "{", "{}<Left>") -vim.keymap.set("i", "{<cr>", "{<cr>}<C-o>O") -vim.keymap.set("i", "{;<cr>", "{<cr>};<C-o>O") +vim.keymap.set("i", "<C-a>", "<C-o>I", { noremap = true }) +vim.keymap.set("i", "<C-e>", "<C-o>A", { noremap = true }) +vim.keymap.set("i", "<C-k>", "<C-o>D", { noremap = true }) + +vim.keymap.set("i", "{<cr>", "{<cr>}<C-o>O", { noremap = true }) +vim.keymap.set("i", "{;<cr>", "{<cr>};<C-o>O", { noremap = true }) -- buffers -vim.keymap.set("n", "gb", "<cmd>buffers<cr>:buffer<Space>") -vim.keymap.set("n", "<Leader>q", "<cmd>q!<cr>") -vim.keymap.set("n", "<Leader>Q", "<cmd>qa!<cr>") +vim.keymap.set("n", "gb", "<cmd>buffers<cr>:buffer<Space>", { noremap = true }) +vim.keymap.set("n", "<Leader>q", "<cmd>q!<cr>", { noremap = true }) +vim.keymap.set("n", "<Leader>Q", "<cmd>qa!<cr>", { noremap = true }) -- Windows -vim.keymap.set({"n", "i", "v", "c", "o", "s", "x"}, "<A-h>", "<C-W>h") -vim.keymap.set({"n", "i", "v", "c", "o", "s", "x"}, "<A-j>", "<C-W>j") -vim.keymap.set({"n", "i", "v", "c", "o", "s", "x"}, "<A-k>", "<C-W>k") -vim.keymap.set({"n", "i", "v", "c", "o", "s", "x"}, "<A-l>", "<C-W>l") -vim.keymap.set({"n", "i", "v", "c", "o", "s", "x"}, "<A-o>", "<C-W>o") +vim.keymap.set({"n", "i", "v", "c", "o", "s", "x"}, "<A-h>", "<C-W>h", { noremap = true }) +vim.keymap.set({"n", "i", "v", "c", "o", "s", "x"}, "<A-j>", "<C-W>j", { noremap = true }) +vim.keymap.set({"n", "i", "v", "c", "o", "s", "x"}, "<A-k>", "<C-W>k", { noremap = true }) +vim.keymap.set({"n", "i", "v", "c", "o", "s", "x"}, "<A-l>", "<C-W>l", { noremap = true }) +vim.keymap.set({"n", "i", "v", "c", "o", "s", "x"}, "<A-o>", "<C-W>o", { noremap = true }) -- command line -vim.keymap.set("c", "<M-b>", "<C-Left>") -vim.keymap.set("c", "<M-f>", "<C-Right>") -vim.keymap.set("c", "<M-d>", "<C-Right><C-w>") +vim.keymap.set("c", "<M-b>", "<C-Left>", { noremap = true }) +vim.keymap.set("c", "<M-f>", "<C-Right>", { noremap = true }) +vim.keymap.set("c", "<M-d>", "<C-Right><C-w>", { noremap = true }) -- move visual selection up/down wards -vim.keymap.set("v", "J", "<cmd>m '>+1<cr>gv=gv<cr>") -vim.keymap.set("v", "K", "<cmd>m '<-2<cr>gv=gv<cr>") +vim.keymap.set("v", "J", "<cmd>m '>+1<cr>gv=gv<cr>", { noremap = true }) +vim.keymap.set("v", "K", "<cmd>m '<-2<cr>gv=gv<cr>", { noremap = true }) -- clipboard -vim.keymap.set("n", "<Leader>y", "\"+y") -vim.keymap.set("n", "<Leader>o", "<Plug>OSCYank") +vim.keymap.set("n", "<Leader>y", "\"+y", { noremap = true }) +vim.keymap.set("n", "<Leader>o", "<Plug>OSCYank", { noremap = true }) -- templates -vim.keymap.set("n", "<Leader>rt", ":r " .. vim.fn.stdpath("config") .. "/templates/") +vim.keymap.set("n", "<LocalLeader>rt", ":-1r " .. vim.fn.stdpath("config") .. "/templates", { noremap = true }) -- hide all local s = {hidden_all = 0} @@ -56,41 +51,41 @@ vim.keymap.set("n", "<C-h>", function () vim.opt.showcmd = opt vim.opt.laststatus = opt and 2 or 0 vim.opt.signcolumn = opt and "yes" or "no" -end) +end, { noremap = true }) -- utils -vim.keymap.set("i", "<LocalLeader>r", "<cmd>r!echo -n $RANDOM<cr><esc>kJA") +vim.keymap.set("i", "<LocalLeader>r", "<cmd>r!echo -n $RANDOM<cr><esc>kJA", { noremap = true }) -- ordered list -vim.keymap.set("v", "<Leader>n", "I0. <esc>gvg<C-a>") -vim.keymap.set("v", "<Leader>u", "<cmd>'<,'>s/^[0-9]\\+\\. //<cr><esc>") +vim.keymap.set("v", "<Leader>n", "I0. <esc>gvg<C-a>", { noremap = true }) +vim.keymap.set("v", "<Leader>u", "<cmd>'<,'>s/^[0-9]\\+\\. //<cr><esc>", { noremap = true }) -- scripts -vim.keymap.set("n", "<Leader>x", "<cmd>!chmod +x %<cr>", { silent = true}) +vim.keymap.set("n", "<Leader>x", "<cmd>!chmod +x %<cr>", { noremap = true, silent = true}) -- replace -vim.keymap.set("n", "<Leader>rf", [[:%s/\<<C-r><C-w>\>/<C-r><C-w><C-w>/gI<Left><Left><Left>]]) -vim.keymap.set("n", "<Leader>rl", [[:s/\<<C-r><C-w>\>/<C-r><C-w><C-w>/gI<Left><Left><Left>]]) +vim.keymap.set("n", "<Leader>sf", [[:%s/\<<C-r><C-w>\>/<C-r><C-w><C-w>/gI<Left><Left><Left>]]) +vim.keymap.set("n", "<Leader>sl", [[:s/\<<C-r><C-w>\>/<C-r><C-w><C-w>/gI<Left><Left><Left>]]) -- write -vim.keymap.set("n", "<LocalLeader>w", "<cmd>write<cr>") -vim.keymap.set("n", "<LocalLeader>W", "<cmd>write!<cr>") -vim.keymap.set("n", "<LocalLeader>e", "<cmd>edit<cr>") -vim.keymap.set("n", "<Leader><M-s>", "<cmd>source<cr>") +vim.keymap.set("n", "<LocalLeader>w", "<cmd>write<cr>", { noremap = true }) +vim.keymap.set("n", "<LocalLeader>W", "<cmd>write!<cr>", { noremap = true }) +vim.keymap.set("n", "<LocalLeader>e", "<cmd>edit<cr>", { noremap = true }) +vim.keymap.set("n", "<LocalLeader>s", function () + vim.cmd.source() + print("sourced.") +end, { noremap = true }) -- Packer -vim.keymap.set("n", "<Leader>P", "<cmd>PackerSync<cr>") +vim.keymap.set("n", "<Leader>P", "<cmd>PackerSync<cr>", { noremap = true }) -- spelling -vim.keymap.set("n", "<Leader><C-s>", "<cmd>setlocal spell!<cr>") +vim.keymap.set("n", "<Leader><C-s>", "<cmd>setlocal spell!<cr>", { noremap = true }) -- open terminal in file's parent director -- this needs to be asynchrous vim.keymap.set("n", "<Return>", function () local cmd = "cd " .. vim.fn.expand("%:p:h") .. "; setsid st" - vim.fn.jobstart(cmd, { - on_exit = function(job_id, exit_code, event_type) - -- Do nothing here - end - }) -end) + -- asynchrous go brr + vim.fn.jobstart(cmd, { on_exit = function(job_id, exit_code, event_type) end }) +end, { noremap = true }) -- clear registers @@ -103,4 +98,4 @@ vim.keymap.set("n", "<Leader>rc", function () for _, r in ipairs(regs) do vim.fn.setreg(r, {}) end -end) +end, { noremap = true }) diff --git a/config/essentials/nvim/lua/tlast/set.lua b/config/essentials/nvim/lua/tlast/set.lua index a89e2e3..69ee4ae 100644 --- a/config/essentials/nvim/lua/tlast/set.lua +++ b/config/essentials/nvim/lua/tlast/set.lua @@ -1,38 +1,43 @@ -vim.opt.clipboard = "unnamed" +local opt = vim.opt -vim.opt.termguicolors = true +opt.clipboard = "unnamed" -vim.opt.number = true -vim.opt.relativenumber = true -vim.opt.showmatch = true -vim.opt.matchtime = 0 -vim.opt.showcmd = true -vim.opt.cursorline = true -vim.opt.ruler = true +opt.termguicolors = true -vim.opt.wildmenu = true -vim.opt.incsearch = true -vim.opt.hlsearch = false +opt.number = true +opt.relativenumber = true +opt.showmatch = true +opt.matchtime = 0 +opt.showcmd = true +opt.cursorline = true +opt.ruler = true -vim.opt.mouse = "" +opt.path:append("**") -vim.opt.tabstop = 4 -vim.opt.shiftwidth = 4 -vim.opt.backspace = "indent,eol,start" +opt.wildmenu = true +opt.incsearch = true +opt.hlsearch = false -vim.opt.signcolumn = "yes" -vim.opt.updatetime = 100 -vim.opt.laststatus = 2 -vim.opt.history = 200 -vim.opt.encoding = "utf-8" +opt.mouse = "" -vim.opt.smartindent = true -vim.opt.scrolloff = 8 +opt.tabstop = 4 +opt.shiftwidth = 4 +opt.backspace = "indent,eol,start" -vim.opt.ignorecase = true -vim.opt.smartcase = true +opt.signcolumn = "yes" +opt.updatetime = 100 +opt.laststatus = 2 +opt.history = 200 +opt.encoding = "utf-8" -vim.opt.swapfile = false -vim.opt.backup = false +opt.smartindent = true +opt.scrolloff = 8 -vim.opt.spelllang = "en_us,nl" +opt.ignorecase = true +opt.smartcase = true + +opt.swapfile = false +opt.backup = false + +opt.spelllang = "en_us,nl" +opt.formatoptions = "cqrnj" diff --git a/config/zshrc/.zshrc b/config/essentials/zsh/.zshrc index 32c7531..dd52e5e 100644 --- a/config/zshrc/.zshrc +++ b/config/essentials/zsh/.zshrc @@ -1,30 +1,10 @@ #!/bin/zsh -export PATH="$HOME/.local/bin:$PATH" -export PATH="$HOME/bin:$PATH" -export PATH="$HOME/go/bin:$PATH" - -export XINITRC="$HOME/.config/x11/xinitrc" -export EDITOR="nvim" -export VISUAL="nvim" -export TERMINAL="st" -export BROWSER="firefox" - -export CARGO_HOME=~/.config/cargo -export GNUPGHOME="$HOME/.config/gnupg" -export GTK2_RC_FILES="$HOME/.config/gtk-2.0/gtkrc-2.0" -export QT_QPA_PLATFORMTHEME="qt5ct" - -export _JAVA_AWT_WM_NONREPARENTING=1 -export _JAVA_OPTIONS='-Dawt.useSystemAAFontSettings=on' - -export PASSWORD_STORE_CLIP_TIME=5 - if [ ! $(pgrep Xorg) ] && [ "tty1" = "$(basename $(tty))" ] then clear - eval "$(keychain --dir "$HOME/.config/keychain" --eval --quiet --agents gpg 3A626DD20A32EB2E5DD9CE71CFD9ABC97158CD5D 2> /dev/null)" - eval "$(keychain --dir "$HOME/.config/keychain" --noask --eval --quiet --agents ssh 2> /dev/null)" + eval "$(keychain --dir "$XDG_CONFIG_HOME/keychain" --eval --quiet --agents gpg 3A626DD20A32EB2E5DD9CE71CFD9ABC97158CD5D 2> /dev/null)" + eval "$(keychain --dir "$XDG_CONFIG_HOME/keychain" --noask --eval --quiet --agents ssh 2> /dev/null)" clear startx 2&> /dev/null exit @@ -36,6 +16,7 @@ zle -N edit-command-line zstyle ':compinstall' filename '/home/aluc/.zshrc' zstyle ':completion:*' menu select autoload -Uz compinit +compinit -d $XDG_CACHE_HOME/zsh/zcompdump-$ZSH_VERSION autoload -Uz surround zle -N delete-surround surround zle -N add-surround surround @@ -116,18 +97,3 @@ setopt histreduceblanks setopt interactivecomments setopt notify setopt cdablevars - -# Variables -HISTFILE=~/.config/zsh/histfile -HISTSIZE=100000 -SAVEHIST=100000 - -ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=10' -GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01' -ZOT="${HOME}/zot" - -# old -# export RANGER_LOAD_DEFAULT_RC=FALSE -# export VIMINIT="source ~/.config/vim/vimrc" -# export NVM_DIR="$HOME/.config/nvm" -# export fpath=($HOME/.config/zsh/completion/ $fpath) diff --git a/config/essentials/zsh/aliases.zsh b/config/essentials/zsh/aliases.zsh index 01a7fec..a45a684 100644 --- a/config/essentials/zsh/aliases.zsh +++ b/config/essentials/zsh/aliases.zsh @@ -7,6 +7,8 @@ alias -g nb='newsboat' alias -g sr='surfraw' alias -g ccu='calcurse' +alias arduino-cli='arduino-cli --config-file $XDG_CONFIG_HOME/arduino15/arduino-cli.yaml' + if [ -x /usr/bin/dircolors ]; then test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)" # alias ls='ls -h --color --group-directories-first' @@ -20,6 +22,7 @@ if [ -x /usr/bin/dircolors ]; then fi alias -g l='ls -l' +alias -g l1='ls -1' alias -g ll='ls -la' alias -g la='ls -aF' alias -g lst='ls --tree' @@ -89,7 +92,6 @@ alias vidlen='ffprobe -show_entries format=duration -v quiet -of csv="p=0" -i' alias whatsmyip='curl "ifconfig.me"' alias icognito='unset HISTFILE' alias penv='python -m venv' -alias ytclipo='yt-dlp "$(xclip -sel c -o)" -f "b" -S "res:720" -P $HOME/movies -o "%(title)s.%(ext)s"' alias -g '...'='../..' alias -g '....'='../../..' @@ -101,23 +103,30 @@ alias -g pi='ping archlinux.org -c4' alias -g sba='source bin/activate' alias -g smc='systemctl' alias -g smcu='systemctl --user' -alias zsr='source ~/.zshrc && rehash' +alias zsr='source ${ZDOTDIR:-$HOME}/.zshrc && rehash' alias -g wf='doas wipefs -a' alias -g dmci="doas make clean install" # quick config -alias -g ez='$EDITOR ~/.zshrc' -alias -g eza='$EDITOR ~/.config/zsh/aliases.zsh' +alias -g ez='$EDITOR ${ZDOTDIR:-$HOME}/.zshrc' +alias -g eza='$EDITOR ${ZDOTDIR}/aliases.zsh' alias -g eto='$EDITOR ~/sync/TODO' alias -g edw='$EDITOR ~/src/dwm/config.def.h' alias -g edm='$EDITOR ~/src/dmenu/config.def.h' alias -g est='$EDITOR ~/src/st/config.def.h' alias -g esl='$EDITOR ~/src/slock/config.def.h' alias -g cfdef='$EDITOR config.def.h' +alias -g cdo='$HOME/src/dotfiles' -alias -g ff='`fzffile`' -alias -g fd='`fzfdir`' -alias -g fdf='`fzfdirfile`' +alias -g ff='"`fzffile`"' +alias -g fd='"`fzfdir`"' +alias -g fdf='"`fzfdirfile`"' +alias fzps='ps aux | tail +2 | fzf --bind \ +"1:execute(echo -n {} | awk '\''{print \$1}'\'' | xclip -sel c -r),\ +2:execute(echo -n {} | awk '\''{print \$2}'\'' | xclip -sel c -r),\ +3:execute(echo -n {} | awk '\''{print \$7}'\'' | xclip -sel c -r),\ +4:execute(echo -n {} | awk '\''{print \$9}'\'' | xclip -sel c -r),\ +5:execute(echo -n {} | tr -s '\'' '\'' | cut -f 11- -d '\'' '\'' | xclip -sel c -r)"' alias -s conf="$EDITOR" alias -s txt="$EDITOR" diff --git a/config/home/.zshenv b/config/home/.zshenv new file mode 100644 index 0000000..3a59c6a --- /dev/null +++ b/config/home/.zshenv @@ -0,0 +1,47 @@ +#!/bin/zsh +export PATH="$HOME/.local/bin:$PATH" +export PATH="$HOME/bin:$PATH" +export PATH="$HOME/go/bin:$PATH" + +export EDITOR="nvim" +export VISUAL="nvim" +export TERMINAL="st" +export BROWSER="firefox" + +export XDG_CONFIG_HOME="$HOME"/.config +export XDG_CACHE_HOME="$HOME"/.cache +export XDG_DATA_HOME="$HOME"/.local/share +export XDG_STATE_HOME="$HOME"/.local/state + +test ! -d "$XDG_CONFIG_HOME"/x11 && + mkdir "$XDG_CONFIG_HOME"/x11 +export XINITRC="$XDG_CONFIG_HOME/x11"/xinitrc +export XAUTHORITY="$XDG_RUNTIME_DIR"/Xauthority +export CARGO_HOME="$XDG_CONFIG_HOME"/cargo +export GTK2_RC_FILES="$XDG_CONFIG_HOME"/gtk-2.0/gtkrc +export GNUPGHOME="$XDG_CONFIG_HOME"/gnupg +export GTK2_RC_FILES="$XDG_CONFIG_HOME"/gtk-2.0/gtkrc-2.0 +export CUDA_CACHE_PATH="$XDG_CONFIG_HOME"/nv +export NPM_CONFIG_USERCONFIG="$XDG_CONFIG_HOME"/npm/npmrc +export NVM_DIR="$XDG_DATA_HOME/nvm" +export W3M_DIR="$XDG_STATE_HOME"/w3m + +export ZDOTDIR="$XDG_CONFIG_HOME"/zsh +export HISTFILE="$ZDOTDIR"/histfile +export HISTSIZE=100000 +export SAVEHIST=100000 +export ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=10' + +export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01' + +export QT_QPA_PLATFORMTHEME="qt5ct" + +# export _JAVA_AWT_WM_NONREPARENTING=1 +# export _JAVA_OPTIONS=-Djava.util.prefs.userRoot="$XDG_CONFIG_HOME"/java + +export PASSWORD_STORE_CLIP_TIME=5 + +# old +# export RANGER_LOAD_DEFAULT_RC=FALSE +# export VIMINIT="source ~/.config/vim/vimrc" +# export fpath=($XDG_CONFIG_HOME/zsh/completion/ $fpath) diff --git a/stowcmds.sh b/stowcmds.sh index 9e9d26e..05d163c 100755 --- a/stowcmds.sh +++ b/stowcmds.sh @@ -26,21 +26,21 @@ case "$MACH" in stow -d bin/ -t "$HOME/bin" -R common guiscripts extra mkdir -p "$HOME/.config" stow -d config/ -t "$HOME/.config" -R essentials common extra X theme xdg - stow -d config/ -t "$HOME/" -R zshrc + stow -d config/ -t "$HOME/" -R home ;; "server" | "s") mkdir -p "$HOME/bin" stow -d bin/ -t "$HOME/bin" -R common mkdir -p "$HOME/.config" stow -d config/ -t "$HOME/.config" -R essentials common - stow -d config/ -t "$HOME/" -R zshrc + stow -d config/ -t "$HOME/" -R home ;; "laptop" | "l") mkdir -p "$HOME/bin" stow -d bin/ -t "$HOME/bin" -R common guiscripts extra mkdir -p "$HOME/.config" stow -d config/ -t "$HOME/.config" -R essentials common extra theme xdg hyprland X - stow -d config/ -t "$HOME/" -R zshrc + stow -d config/ -t "$HOME/" -R home ;; *) echo "E: invalid value for 'MACH'" 1>&2 |