Compare commits

..

220 Commits

Author SHA1 Message Date
4a698f6e1f nvim: migrate to paq package manager 2025-11-24 22:10:13 +01:00
195176678c nvim: replace with a new config 2025-11-23 21:06:37 +01:00
71b7e78112 vis: add odin language lexer and define ols as lsp for odin 2025-11-10 16:02:29 +01:00
11e8870aed shell: remove CDPATH 2025-10-17 09:44:29 +02:00
19a7dd6dee xsession: add startx argument, lupan-set-theme: use pkill, shell: try eza before exa 2025-10-15 07:53:14 +02:00
e734764630 vis: disable autopairs in vis-pairs 2025-10-14 19:26:33 +02:00
a09a464f0c shell: move X before wayland, use output of tty instead of XDG_VTNR 2025-10-12 21:15:07 +02:00
5018c78956 merge yash into shell, Makefile: update dwm, st and other instalation 2025-10-11 10:18:13 +02:00
ce19fa1371 add xres value st.lightmode, aliases: add missing local and query from command, new lg alias
- rename st alias to gst
2025-10-10 08:04:10 +02:00
95fdacdd31 vis: theme switching based on existance of ~/.lightmode 2025-10-08 22:39:36 +02:00
cef92f13c9 vis: add keys for make, profile add CDPATH 2025-10-08 22:30:39 +02:00
876aa0ac1c vis: add vis-quickfix and vis-pairs 2025-10-07 23:53:37 +02:00
7c05d57053 lupan-set-theme: toggle based on existence of ~/.lightmode, update dwm theme 2025-10-07 20:52:53 +02:00
bce8fbc87c vis: select from src and dotfiles directories, not only zoxide 2025-10-07 20:52:53 +02:00
58fa05c6f8 xsession: move dwm to top 2025-10-07 20:52:53 +02:00
77108587b2 vis: fzf.sh scheme path, alt-enter for enable search 2025-10-07 20:52:53 +02:00
297d2959fa vis: fzf.sh when on fd switches between fd and find 2025-10-07 20:52:53 +02:00
bcd7480efc vis: change shell and global marks edit keys, add new file key 2025-10-07 20:52:53 +02:00
e149e46b81 vis: use vis-pin-files and vis-colorizer 2025-10-07 20:51:23 +02:00
e54be984ac vis: clone plugins with shell script, update visrc.lua 2025-10-07 20:38:07 +02:00
9130eb1a37 add compile_tools.sh 2025-10-07 20:38:07 +02:00
fb9eece5ce yash: add config for yash shell 2025-10-03 08:52:15 +02:00
3f2951a1ea vis: fast-jump: set tab stop and clear bg+ 2025-10-01 22:42:34 +02:00
b04611b199 vis: fast-jump: add proper padding for windows in horizontal and vertical splits 2025-10-01 22:24:15 +02:00
aeb8a78721 vis: set proper fzf padding in case of numbers or relativenumbers 2025-10-01 21:40:06 +02:00
836267b80e vis: fast-jump: up uses unused down keys and down uses unused up keys 2025-10-01 20:49:14 +02:00
4866eb3f9c vis: new fast jump using fzf and selecting by letter 2025-10-01 08:49:31 +02:00
18e93a89db vis: add note inserts empty title, current time and file 2025-10-01 08:36:27 +02:00
869482ba91 vis: remove lfs dependency 2025-09-30 21:24:57 +02:00
73d76e8cee vis: fix search, add keys for rg/fd, change global marks keys, add notes keys 2025-09-29 23:46:53 +02:00
e0f22f25cf alias: tni and tai as interactive versions of tn i ta, .profile: add startx as alternative to sx 2025-09-29 23:42:03 +02:00
f76cac70eb lupan-set-theme follow links, awesome lighter fg_normal
- awesome: fg_normal is common between themes so make it somewhat
lighter then it was on dark theme
2025-09-29 23:42:03 +02:00
270338f6d3 vis: use <vis-prompt-show> instead of colon in key binding 2025-09-29 23:42:03 +02:00
9edf260607 vis: use lf instead of yazi, shorter keys for lf and lsp commands 2025-09-29 23:42:03 +02:00
512599d8d7 vis: add command fzf-files, use it in shell alias vf 2025-09-29 23:42:03 +02:00
7f28c1c13f awesome: no gap and border on maximized windows 2025-09-29 23:42:03 +02:00
e1869dcbc3 vis: update theme on C-l but only if file changed and theme changed dark<->light 2025-09-29 23:42:03 +02:00
f5ea4d4c13 vis: change light background (also for st) and embedded background 2025-09-29 23:42:03 +02:00
c3580ea62a vis: fzf.sh allow multi select (puts to messages), skip register value if default register 2025-09-29 23:42:03 +02:00
edb02ef94b vis: format go files on write 2025-09-29 23:42:03 +02:00
53b29759e8 vis: improve opening make-like file with pos, improve close prev/next window 2025-09-29 23:42:03 +02:00
a95d62b7e8 vis: add go_ext grammar with embedded sql with go templating 2025-09-29 23:42:03 +02:00
bf90b5fbe9 vis: fix shell escape and update lazyjj key 2025-09-29 23:42:03 +02:00
9edbed2349 tmux/nvim: remove switch pane/window integration 2025-09-29 23:42:03 +02:00
95fc836b55 vis: templ: add (implement) templ lexer 2025-09-29 23:42:03 +02:00
51457299a9 vis: implement fast jump 2025-09-29 23:42:03 +02:00
ad532f260f lupan-set-theme: toggle st theme (note: needs st patched to handle USR1) 2025-09-29 23:42:03 +02:00
5ffcbbffcc shell: improve tmux and edit aliases 2025-09-29 23:42:03 +02:00
0794c045fb lazygit: new, vis as editor and use nerd fonts 2025-09-29 23:42:03 +02:00
7fcc30a7c7 xsession: move awesome to top 2025-09-29 23:42:03 +02:00
8a4b46d38d vis: change status bar in dark theme and background in light one 2025-09-29 23:42:03 +02:00
1c36fc4f5d tmux: change terminal for vis compat, pane name on title, more vi like keys in copy mode 2025-09-29 23:42:03 +02:00
ff8b03f04d awesome: better toggle maximize, add keys to focus nth window on active tag 2025-09-29 23:42:03 +02:00
ec87546913 awesome: new themes, use st and clock without date 2025-09-29 23:42:03 +02:00
a1f90c79d6 vis: fzf.sh: add key to select alternative directory, fix switching between search and find 2025-09-29 23:42:03 +02:00
399fae9c2b vis: add script fzf.sh and use it with just two keys
fzf.sh is a wrapper around fzf with mode for fd, rg, git and jj which
allow to switch between them with keys
2025-09-29 23:42:03 +02:00
9538406245 vis: set dark or light theme and start and also add key for this action 2025-09-29 23:42:03 +02:00
90e7cbe7c6 vis: add keys for shell and themes, change current dir keys 2025-09-29 23:42:03 +02:00
fd727586f9 vis: add lupan-dark and lupan-light themes, based on default with my selection of colors 2025-09-29 23:42:03 +02:00
1c42f46fbc xsession: add st-abduco-tabbed; dk: change term to st and add key for st-abduco-tabbed 2025-09-29 23:42:03 +02:00
86027c1564 dk: add key for theme toggle 2025-09-29 23:42:03 +02:00
78d758b8fb vis: global marks, do not reopen already opened file, fzf search current file 2025-09-29 23:42:03 +02:00
6757fc6aec vis: keys for yazi and fzf with hidden files; vis as default editor (also in yazi) 2025-09-10 10:36:54 +02:00
28fbb75b47 alacritty: use nordic and night owlish light themes; vis use default theme 2025-09-10 00:17:43 +02:00
829804f2ed vis: add key for fzf change directory 2025-09-09 22:11:33 +02:00
ebec63e48c add vis config 2025-09-08 23:30:43 +02:00
b600226065 nvim: add arrow go to keys (without displaying menu), change blame toggle key 2025-09-08 23:30:43 +02:00
4398125c7b add dk and polybar 2025-09-08 23:30:43 +02:00
9064a389e9 dwm: reformat config.h 2025-08-01 00:10:33 +02:00
e507e258e3 nvim: add lazyjj 2025-07-22 23:09:32 +02:00
d138f4c1da nvim, alacritty: switch to kanagawa-paper 2025-07-21 23:59:21 +02:00
fa085ae00c nvim: add snipe 2025-06-25 23:59:37 +02:00
d8a21e78c4 nvim: switch to sweetie colorscheme, also update alacritty themes 2025-06-25 22:05:48 +02:00
213a93acd9 nvim: remove telescope persisted key and grep_string 2025-06-24 22:51:01 +02:00
bdde8238c9 nvim: use snacks, remove lisp related and replaced packages 2025-06-12 09:38:21 +02:00
d21fdc925c nvim: add key for session change and change keys for namu 2025-06-07 21:51:54 +02:00
dba234077e nvim: add commands FormatDisable and FormatEnable 2025-06-07 11:08:57 +02:00
867e3d6991 nvim: move arrow, add namu and odin 2025-06-04 22:55:37 +02:00
ecb466f230 nvim: lazy update 2025-06-03 23:36:38 +02:00
f5302fc646 nvim/zsh: remove jj key mapping, add two aliases, nvim: back to arrow 2025-06-03 23:16:50 +02:00
3eaba86825 nvim: remove hardtime 2025-05-14 00:02:42 +02:00
1b0d0597b0 zsh: change escape bind key 2025-05-13 23:35:24 +02:00
63860cd661 nvim: color scheme nightfox 2025-05-13 23:35:24 +02:00
d122f56ab6 nvim: handle lisp file type, change local leader 2025-05-13 23:35:11 +02:00
a5c491d1ce awesome: use dmenu 2025-05-13 23:00:18 +02:00
d6ba2a78b9 tmux: bind tmux-session-menu 2025-05-13 23:00:18 +02:00
29608ff8c4 nvim: support different dark and light colorschemes 2025-04-02 00:00:53 +02:00
1513d23ec4 nvim: remove nvim-various-textobjs 2025-04-01 21:47:27 +02:00
28de145180 nvim: which-key: preset helix, delay 1000 2025-03-30 23:26:51 +02:00
17997c0550 nvim: add rest.nvim plugin 2025-03-30 23:26:51 +02:00
d47467e161 nvim: bump package versions 2025-03-30 23:26:51 +02:00
8033f2e2a9 nvim: change vim-ReplaceWithRegister mapping 2025-03-30 23:26:51 +02:00
3fa1a018ee awesome: change to green colors 2025-03-30 23:26:51 +02:00
dd9de18aa7 awesome: detect theme on (re)start 2025-03-30 23:26:32 +02:00
6d8e00fabf zsh: use zoxide if available otherwise use zsh-z
WIP zoxide: use z not cd
2025-03-30 23:26:32 +02:00
b54ece050d nvim: add lsp_signature plugin 2025-03-30 23:26:32 +02:00
437ca39309 alacritty: change colors, nvim: change rabbit file color 2025-03-30 23:26:32 +02:00
1835f61e49 awesome: change font and colors of help window 2025-03-30 23:26:32 +02:00
7caf112500 alacritty: increase font to 10 2025-03-30 23:26:32 +02:00
6b84ae6f3a xsession: add xrandr for white 2025-03-30 23:26:20 +02:00
d3b8e76787 nvim: add zen-mode plugin
toggles hyperland and awesome fullscreen mode
2025-03-29 12:38:21 +01:00
24d031c214 nvim: add slimline horizontal line (as slimline by default has no background) 2025-03-29 12:34:58 +01:00
bfa2c6313f nvim add melange (now default) and nordic colorschemes 2025-03-29 12:29:55 +01:00
cfb882fdc9 nvim: auto switch light/dark background 2025-03-29 12:24:16 +01:00
b6bc1de7af nvim: add tmux integration 2025-03-22 14:14:00 +01:00
48664abc41 nvim: add hardtime plugin 2025-03-22 12:02:08 +01:00
3fc6280267 nvim: non-floating Oil in the key bind 2025-03-22 12:02:08 +01:00
ef95853433 nvim: replace feline with slimline and incline plugin
display only bottom status line
2025-03-22 12:02:08 +01:00
3146aeee3e nvim: bump plugin versions 2025-03-22 12:02:08 +01:00
f685ebee2c nvim: notimeout 2025-03-22 12:02:08 +01:00
5a40a5b3ab nvim: add marks.nvim and mini.ai plugins 2025-03-22 12:02:08 +01:00
c06364cd27 nvim: replace arrow with rabbit plugin 2025-03-22 12:02:08 +01:00
f2f29762a4 nvim: add toggleterm plugin 2025-03-22 12:02:08 +01:00
7f850d115f nvim add iswap and treewaker plugins 2025-03-22 12:02:08 +01:00
fc88cb9801 nvim: add hlsearch plugin 2025-03-22 12:02:08 +01:00
75c39a5613 nvim: simplify nvim-surround config
note: you need to type ys, cs, ds fast to activate surround bindings
2025-03-22 12:02:08 +01:00
e90c2c7e4a nvim: add quicker plugin 2025-03-22 12:02:08 +01:00
24966cfc69 nvim: change arrow leader key 2025-03-17 00:34:41 +01:00
78ab1671ab nvim: add tardis plugin 2025-03-17 00:34:41 +01:00
d38ae42668 nvim: add yankbank plugin 2025-03-17 00:34:30 +01:00
240d466e3d nvim: add godoc plugin 2025-03-16 23:17:20 +01:00
9e8f036f62 nvim: fix trouble conf, remove hierarchy-tree-go, split init.lua 2025-03-16 21:14:03 +01:00
8a6ecfe7b9 nvim: remap leap and oil, move leap to editing 2025-03-16 21:14:03 +01:00
8714b847a7 alacritty: change dark theme to meliora to match nvim dark colorscheme 2025-03-11 21:40:19 +01:00
2c672e497c nvim: change default colorscheme to mellifluous 2025-03-11 21:40:19 +01:00
6d22ed0187 nvim: lazy update 2025-03-11 21:40:16 +01:00
f5397295d3 update for newer versions of alacritty and hyprland 2025-03-10 23:14:17 +01:00
2a14edd39c nvim: lazy update, persisted: add exact ~ to ignored directories 2024-09-09 21:47:42 +02:00
00a77bf58a use Hyprland as first option with alacritty and master layout 2024-09-09 21:45:56 +02:00
9e9ccd0fde river: repeat randr and restart sandbar if needed 2024-08-11 00:18:58 +02:00
d72a4540b9 shell: minimal fzf colors change working on dark and light backgrounds 2024-08-10 14:07:01 +02:00
b0385dc277 river: second bind for alacritty, run two wlr-randr using subshell 2024-08-09 22:51:35 +02:00
f3f859d9a1 add river wm 2024-08-06 23:11:11 +02:00
5b421c7999 nvim: update which-key naming groups to new format 2024-08-04 23:02:15 +02:00
cf729da8ef nvim: lazy update 2024-08-04 22:52:56 +02:00
341499f9a7 nvim: add go tr snippet and bind key for find translation key 2024-08-04 22:52:00 +02:00
10ba42cb1d kitty: rebind tab change keys, make ctrl+shift+6 no_op 2024-08-04 22:42:58 +02:00
154b1a11be zsh: fzf add and change colors 2024-07-08 23:42:35 +02:00
ec9c92ab9f zsh: fzf colors with dark background 2024-07-07 11:59:25 +02:00
c321000834 tmux: window current status bring back window flags and resize pane keys 2024-07-06 22:22:47 +02:00
06218e16d4 nvim: more text objects 2024-07-06 20:48:07 +02:00
a7c29799b8 nvim: conditional text objects 2024-07-06 20:41:45 +02:00
3035ab9acb kitty shell key and check for wayland clipboard dependency 2024-07-06 20:22:27 +02:00
e6216fb3cd nvim: add replace with register 2024-07-06 20:21:58 +02:00
24d4f9e638 nvim: lazy update 2024-07-06 14:26:38 +02:00
ab1a7df7f4 zsh: add fv alias 2024-07-06 14:26:38 +02:00
4a666b8d21 nvim: colorscheme one nord 2024-07-06 14:26:38 +02:00
3324aae2d6 add kitty 2024-07-06 14:26:38 +02:00
10e03987be waybar/feline/alacritty: use my colors 2024-07-06 13:31:08 +02:00
728b00c2ca update README.md and check_dependencies.sh, use Hyprland without path 2024-06-29 18:41:26 +02:00
30793b5a46 nvim: load persisted plugin in telescope configuration 2024-06-29 16:41:21 +02:00
8fb8e43f59 nvim: use keys to lazy load 2024-06-29 16:41:21 +02:00
1f040c70ab nvim: use config second opts option when calling setup 2024-06-29 13:41:33 +02:00
e03d46c3ab nvim: lazy update 2024-06-29 12:52:16 +02:00
d9f7f0961f nvim: add vim-dadbod with UI and completion 2024-06-29 12:42:17 +02:00
b73ebaf338 nvim: use zenbones theme, adjust feline, alacritty and waybar 2024-06-29 12:37:13 +02:00
da18d28504 bash (no vi mode at line start), hyperland (term key), yazi (zathura) 2024-06-28 22:56:39 +02:00
e50284111b nvim: go to arrow on <leader>Digit 2024-06-25 23:51:53 +02:00
faaf5807d5 alacritty/waybar: decrease font size 2024-06-25 19:13:18 +02:00
7d4b8f4f7a alacritty: remove yaml config 2024-06-25 19:10:54 +02:00
98e69defac bash: remove exec new, improve prompt, block cursor during command 2024-06-24 22:59:59 +02:00
9062aeb17a hyprland: lock with Meta4+Alt+O/S 2024-06-24 22:59:59 +02:00
e1610e3874 nvim: lazy update 2024-06-22 14:45:53 +02:00
8c303ca0d1 tmux switch select window with Alt+Digit and swap with Alt+Shift+Digit
also bind S to new session
2024-06-21 21:43:20 +02:00
b032608fd9 hyprland: use mod4+alt as alternative to mod4+shift
also add key for fullscreen mode with gaps and bar
2024-06-21 20:24:15 +02:00
1dfb8e7e7b yazi: add config 2024-06-20 21:39:27 +02:00
4d7bd1a487 nvim/zsh/tmux: better-escape, starship prompt and plugins, tmux rounded corners
- zsh: add plugins: zsh-history-substring-search, zsh-z
2024-06-20 20:48:51 +02:00
ad79dc5bbf nvim: fix git blame 2024-06-19 23:01:20 +02:00
d522104407 nvim: use ccc for highlighting colors and color pickers 2024-06-19 22:40:42 +02:00
01f6327e9e nvim: own feline theme 2024-06-19 22:01:04 +02:00
ad9aacbbcb waybar: change light background 2024-06-19 00:21:21 +02:00
7373c7b653 alacritty: use dark and light themes from folke/tokyonight.nvim 2024-06-19 00:01:02 +02:00
a1736b33e0 nvim: add persisted 2024-06-18 21:23:55 +02:00
f10efa6808 nvim: switch colorscheme to tokyonight 2024-06-18 00:05:40 +02:00
3810c83e14 waybar: toggle light and dark theme 2024-06-16 10:47:58 +02:00
e08245989a alacritty: change dark theme to nightfly 2024-06-15 23:52:45 +02:00
492adae580 nvim: add global-note 2024-06-15 23:37:14 +02:00
09ffb3b2d9 nvim: replace harpoon with arrow 2024-06-15 23:37:14 +02:00
a8bf055a0b nvim: fix function name typo 2024-06-15 22:08:40 +02:00
a22b7125a5 hyperland: switch workspace back and forth 2024-06-15 22:07:47 +02:00
72f2a053c0 hyprland: change background and active and inactive border and gaps 2024-06-15 21:09:55 +02:00
7111817d6f hyprland: add vim file type 2024-06-15 19:38:49 +02:00
0c0a1a9f9c nvim: change harpoon keys 2024-06-15 16:07:34 +02:00
e1ba513fa6 nvim: add go.nvim 2024-06-15 16:07:09 +02:00
1ce7cac540 nvim: remove lspsaga jump do diagnostic 2024-06-15 13:51:23 +02:00
ec7153193b nvim: add bookmarks 2024-06-15 13:41:38 +02:00
a2a13c901a alacritty: change themes 2024-06-15 13:14:46 +02:00
afc7829f1f nvim: select colorscheme based on alacritty theme
the theme is read from file so this also works in tmux
2024-06-15 12:16:01 +02:00
bfe74b7499 nvim: lazy update 2024-06-15 11:34:00 +02:00
fa84b139af nvim: bamboo colorscheme 2024-06-15 11:33:13 +02:00
557bb04d71 hyprland(white): swap monitors 2024-06-15 10:41:41 +02:00
55e747eec2 nvim: zenbones colorscheme; use Fira Code Nerd Font 2024-06-14 22:35:13 +02:00
d3b783cb55 nvim: update lazy packages 2024-06-13 19:52:24 +02:00
f6e3c9acb4 zsh: add zsh-you-should-use 2024-06-13 19:52:24 +02:00
c68109aa92 nvim: replace lualine with feline, remove noice 2024-06-13 19:52:24 +02:00
f87bdec4eb hyprland: add seven.conf 2024-05-11 07:44:47 +02:00
1d77cf6c1e hyprland: rename five.conf to five-rotated.conf, add nonrotated five.conf 2024-05-11 06:18:15 +02:00
85e31b13c1 hyprland: more gaps, shadow, animations, lighter bg color 2024-05-10 21:45:15 +02:00
ac26cef63a nvim: change bindings to Oil, remove some old 2024-04-17 23:03:08 +02:00
f72f18f5c7 nvim: add lspsaga 2024-04-17 23:03:08 +02:00
ccf3dcc500 nvim: add noice last and history key bindings 2024-04-17 23:02:30 +02:00
a987843e95 nvim: add nightfox colorscheme 2024-04-17 23:02:30 +02:00
fef6cbc6bb nvim: add noice.nvim 2024-04-16 23:41:08 +02:00
118211652b nvim: add oil.nvim 2024-04-16 00:12:32 +02:00
c9ccef2f8a nvim: lazy update 2024-04-13 12:25:01 +02:00
3c34d8942e nvim: switch to everforest color scheme, also add NeoSolarized 2024-04-13 12:19:24 +02:00
7dbe42b087 nvim: use html snippets in templ files 2024-04-13 12:15:31 +02:00
60cd08c395 nvim: add blame.nvim 2024-04-11 23:37:40 +02:00
c47799a7e1 hyprland: white both screens horizontal 2024-04-09 22:54:48 +02:00
73bfbcc3a3 nvim: add telescope git_grep 2024-04-09 22:53:24 +02:00
7dbf926206 nvim: key for tabclose, consistent use of <cmd> and <CR> 2024-04-09 22:45:41 +02:00
4995ac177b nvim: treesj, neogit, and diffview keys 2024-04-09 22:45:41 +02:00
56abd08940 nvim: use Neogit 2024-04-07 21:20:57 +02:00
d86e4ec4a3 nvim: leap: remap gs/gS instead of s/S/gs 2024-04-05 00:28:04 +02:00
b774bb44d9 nvim: add lazy-lock.json, fix orgmode config 2024-04-04 21:01:22 +02:00
b8cd095b8b nvim: add treesj (for toggle one-line) 2024-03-24 22:13:42 +01:00
021226fc80 nvim: add trouble and keys for copen and cclose 2024-03-24 21:46:07 +01:00
a84dac1b3d nvim: add leap 2024-03-24 00:06:22 +01:00
7110966df9 hyprland: use wofi 2024-03-23 15:07:34 +01:00
9c1613f567 nvim: switch to harpoon2, change menu/add keys 2024-03-16 18:47:14 +01:00
93 changed files with 3601 additions and 1403 deletions

2
.gitignore vendored
View File

@@ -9,3 +9,5 @@ lupan-wm/target
__pycache__
/dwm
/st
/vis/.config/vis/plugins/
/tools/.local/bin/

View File

@@ -1,7 +1,7 @@
all:
@echo "run: make clone build install"
clone: ~/.local/share/zap dwm st
clone: dwm st
build: build-dwm build-st build-lupan-clock
@@ -14,32 +14,38 @@ install: install-dwm install-st install-lupan-clock install-other
dwm:
git clone https://git.suckless.org/dwm
cp -i patches/dwm/config.h dwm/
cd dwm && \
git remote add lupan.pl https://gitea.lupan.pl/lupan/dwm.git && \
git fetch lupan.pl && \
git checkout -b wip --track lupan.pl/wip
build-dwm:
make -C dwm
install-dwm:
make -C dwm install PREFIX="${HOME}/.local"
make -C dwm install PREFIX="${HOME}/.local/stow/dwm"
stow -d ~/.local/stow dwm
st:
git clone https://git.suckless.org/st
cd st && \
git remote add lupan.pl https://gitea.lupan.pl/lupan/st.git && \
git fetch lupan.pl && \
git checkout -b patched --track lupan.pl/patched
git checkout -b patched-4 --track lupan.pl/patched-4
build-st:
make -C st
install-st:
make -C st install PREFIX="${HOME}/.local"
make -C st install PREFIX="${HOME}/.local/stow/st"
stow -d ~/.local/stow st
build-lupan-clock:
make -C lupan-clock
install-lupan-clock:
make -C lupan-clock install PREFIX="${HOME}/.local"
make -C lupan-clock install PREFIX="${HOME}/.local/stow/lupan-clock"
stow -d ~/.local/stow lupan-clock
install-other:
stow -Rv shell tmux xsession nvim
stow -Rv lazygit shell tmux nvim vis xsession

View File

@@ -4,11 +4,40 @@ Lupan's config files
Installation
------------
Install Hyprland
----------------
To reproduce my environment clone this repo into `~/dotfiles` and check
that you have required programs in your `PATH` with
```
$ sh check_dependencies.sh
$ sh check_dependencies.sh hypr
```
Install font `ttf-firacode-nerd` (https://github.com/ryanoasis/nerd-fonts/releases/download/v3.0.2/FiraCode.zip).
Install proper configurations with
```
$ stow shell hyprland alacritty xsession nvim yazi
```
Where `xsession` is just to install `lupan-set-theme` script, `nvim` and `yazi` may be skipped if you do not use them.
Change to `zsh` as your login shell with
```
$ chsh -s /usr/bin/zsh
```
Install DWM (old)
-----------------
To reproduce my environment clone this repo into `~/dotfiles` and check
that you have required programs in your `PATH` with
```
$ sh check_dependencies.sh dwm
```
Install font `ttf-firacode-nerd` (https://github.com/ryanoasis/nerd-fonts/releases/download/v3.0.2/FiraCode.zip).

View File

@@ -1,5 +1,3 @@
import = ["~/.config/alacritty/dark.toml"]
[colors]
draw_bold_text_with_bright_colors = false
@@ -7,15 +5,13 @@ draw_bold_text_with_bright_colors = false
TERM = "xterm-256color"
[font]
size = 10.5
size = 10
[font.bold]
family = "GoMono Nerd Font"
family = "Fira Code Nerd Font"
[font.normal]
family = "GoMono Nerd Font"
family = "Fira Code Nerd Font"
[keyboard]
bindings = [
{ key = ";", mods = "Control", chars = "\u001bOR" }
]
[general]
import = ["~/.config/alacritty/dark.toml"]

View File

@@ -1,306 +0,0 @@
# See: /usr/share/doc/alacritty/example/alacritty.yml
env:
TERM: xterm-256color
# From https://gist.github.com/sainnhe/6432f83181c4520ea87b5211fed27950
# Changed only to &dark and YAML &light labels
schemes:
dark: &dark
# Default colors
primary:
background: '#2E3440'
foreground: '#C8D0E0'
# Normal colors
normal:
black: '#3B4252'
red: '#BF616A'
green: '#A3BE8C'
yellow: '#EBCB8B'
blue: '#81A1C1'
magenta: '#B988B0'
cyan: '#88C0D0'
white: '#E5E9F0'
# Bright colors
bright:
black: '#4C566A'
red: '#BF616A'
green: '#A3BE8C'
yellow: '#EBCB8B'
blue: '#81A1C1'
magenta: '#B988B0'
cyan: '#8FBCBB'
white: '#ECEFF4'
search:
matches:
foreground: '#81A1C1'
background: '#4C566A'
focused_match:
foreground: '#EBCB8B'
background: '#4C566A'
footer_bar:
background: '#434C5E'
foreground: '#88C0D0'
hints:
start:
foreground: '#B988B0'
background: '#4C566A'
end:
foreground: '#81A1C1'
background: '#4C566A'
selection:
text: CellForeground
background: '#3F4758'
light: &light
# Default colors
primary:
background: '#F7F8FA'
foreground: '#2E3440'
# Normal colors
normal:
black: '#2E3440'
red: '#CB4F53'
green: '#48A53D'
yellow: '#EE5E25'
blue: '#3879C5'
magenta: '#9F4ACA'
cyan: '#3EA1AD'
white: '#E5E9F0'
# Bright colors
bright:
black: '#646A76'
red: '#D16366'
green: '#5F9E9D'
yellow: '#BA793E'
blue: '#1B40A6'
magenta: '#9665AF'
cyan: '#8FBCBB'
white: '#ECEFF4'
search:
matches:
foreground: '#3879C5'
background: '#646A76'
focused_match:
foreground: '#EE5E25'
background: '#646A76'
footer_bar:
background: '#DFE1E4'
foreground: '#3EA1AD'
hints:
start:
foreground: '#9665AF'
background: '#646A76'
end:
foreground: '#3879C5'
background: '#646A76'
selection:
text: CellForeground
background: '#EAEBED'
lupan-dark: &lupan-dark
primary:
background: '#2c393c'
foreground: '#b1babd'
normal:
black: '#232e31'
red: '#d8aeb5'
green: '#9bc48e'
yellow: '#ceb58e'
blue: '#94c0ca'
magenta: '#ceaed6'
cyan: '#93c2bb'
white: '#9ea7aa'
bright:
black: '#597177'
red: '#dcb8be'
green: '#a2cd94'
yellow: '#d7bd95'
blue: '#9bc8d3'
magenta: '#d4b8da'
cyan: '#99cac4'
white: '#b9c3c5'
lupan-light: &lupan-light
primary:
background: '#e9f2f5'
foreground: '#6d797c'
normal:
black: '#1b1c1c'
red: '#d0426a'
green: '#52833e'
yellow: '#8e733f'
blue: '#44808b'
magenta: '#b14cc1'
cyan: '#42827a'
white: '#c2c7c9'
bright:
black: '#454748'
red: '#e34d76'
green: '#5b9146'
yellow: '#9d8046'
blue: '#4c8d99'
magenta: '#c455d5'
cyan: '#4a8f87'
white: '#eff1f1'
everforest_dark_hard: &everforest_dark_hard
primary:
background: '#272e33'
foreground: '#d3c6aa'
normal:
black: '#414b50'
red: '#e67e80'
green: '#a7c080'
yellow: '#dbbc7f'
blue: '#7fbbb3'
magenta: '#d699b6'
cyan: '#83c092'
white: '#d3c6aa'
bright:
black: '#475258'
red: '#e67e80'
green: '#a7c080'
yellow: '#dbbc7f'
blue: '#7fbbb3'
magenta: '#d699b6'
cyan: '#83c092'
white: '#d3c6aa'
everforest_dark_medium: &everforest_dark_medium
primary:
background: '#2d353b'
foreground: '#d3c6aa'
normal:
black: '#475258'
red: '#e67e80'
green: '#a7c080'
yellow: '#dbbc7f'
blue: '#7fbbb3'
magenta: '#d699b6'
cyan: '#83c092'
white: '#d3c6aa'
bright:
black: '#475258'
red: '#e67e80'
green: '#a7c080'
yellow: '#dbbc7f'
blue: '#7fbbb3'
magenta: '#d699b6'
cyan: '#83c092'
white: '#d3c6aa'
everforest_dark_soft: &everforest_dark_soft
primary:
background: '#333c43'
foreground: '#d3c6aa'
normal:
black: '#4d5960'
red: '#e67e80'
green: '#a7c080'
yellow: '#dbbc7f'
blue: '#7fbbb3'
magenta: '#d699b6'
cyan: '#83c092'
white: '#d3c6aa'
bright:
black: '#4d5960'
red: '#e67e80'
green: '#a7c080'
yellow: '#dbbc7f'
blue: '#7fbbb3'
magenta: '#d699b6'
cyan: '#83c092'
white: '#d3c6aa'
everforest_light_hard: &everforest_light_hard
primary:
background: '#fffbef'
foreground: '#5c6a72'
normal:
black: '#5c6a72'
red: '#f85552'
green: '#8da101'
yellow: '#dfa000'
blue: '#3a94c5'
magenta: '#df69ba'
cyan: '#35a77c'
white: '#e8e5d5'
bright:
black: '#5c6a72'
red: '#f85552'
green: '#8da101'
yellow: '#dfa000'
blue: '#3a94c5'
magenta: '#df69ba'
cyan: '#35a77c'
white: '#e8e5d5'
everforest_light_medium: &everforest_light_medium
primary:
background: '#fdf6e3'
foreground: '#5c6a72'
normal:
black: '#5c6a72'
red: '#f85552'
green: '#8da101'
yellow: '#dfa000'
blue: '#3a94c5'
magenta: '#df69ba'
cyan: '#35a77c'
white: '#e0dcc7'
bright:
black: '#5c6a72'
red: '#f85552'
green: '#8da101'
yellow: '#dfa000'
blue: '#3a94c5'
magenta: '#df69ba'
cyan: '#35a77c'
white: '#e0dcc7'
everforest_light_soft: &everforest_light_soft
primary:
background: '#f3ead3'
foreground: '#5c6a72'
normal:
black: '#5c6a72'
red: '#f85552'
green: '#8da101'
yellow: '#dfa000'
blue: '#3a94c5'
magenta: '#df69ba'
cyan: '#35a77c'
white: '#d8d3ba'
bright:
black: '#5c6a72'
red: '#f85552'
green: '#8da101'
yellow: '#dfa000'
blue: '#3a94c5'
magenta: '#df69ba'
cyan: '#35a77c'
white: '#d8d3ba'
draw_bold_text_with_bright_colors: false
colors: *dark
font:
size: 10.5
normal:
family: GoMono Nerd Font
bold:
family: GoMono Nerd Font
key_bindings:
- key: F6
mods: Control|Shift
command: { program: "/bin/sh", args: ["-c", "~/.config/alacritty/set_theme.sh --next"] }

View File

@@ -1,3 +1,31 @@
import = [
"~/.config/alacritty/themes/themes/nord.toml"
]
# https://github.com/alacritty/alacritty-theme/blob/master/themes/nordic.toml
# Colors (Nordic)
[colors.primary]
background = '#242933'
foreground = '#BBBDAF'
[colors.normal]
black = '#191C1D'
red = '#BD6062'
green = '#A3D6A9'
yellow = '#F0DFAF'
blue = '#8FB4D8'
magenta = '#C7A9D9'
cyan = '#B6D7A8'
white = '#BDC5BD'
[colors.bright]
black = '#727C7C'
red = '#D18FAF'
green = '#B7CEB0'
yellow = '#BCBCBC'
blue = '#E0CF9F'
magenta = '#C7A9D9'
cyan = '#BBDA97'
white = '#BDC5BD'
[colors.selection]
text = '#000000'
background = '#F0DFAF'

View File

@@ -1,3 +1,35 @@
import = [
"~/.config/alacritty/themes/themes/ayu_light.toml"
]
# https://github.com/alacritty/alacritty-theme/blob/master/themes/night_owlish_light.toml
# Colors (Night Owlish Light)
[colors.primary]
background = '#ffffff'
foreground = '#403f53'
[colors.normal]
black = '#011627'
red = '#d3423e'
green = '#2aa298'
yellow = '#daaa01'
blue = '#4876d6'
magenta = '#403f53'
cyan = '#08916a'
white = '#7a8181'
[colors.bright]
black = '#7a8181'
red = '#f76e6e'
green = '#49d0c5'
yellow = '#dac26b'
blue = '#5ca7e4'
magenta = '#697098'
cyan = '#00c990'
white = '#989fb1'
[colors.cursor]
cursor = '#403f53'
text = '#fbfbfb'
[colors.selection]
background = '#f2f2f2'
text = '#403f53'

View File

@@ -1,30 +0,0 @@
#!/bin/sh
case "$1" in
lupan-dark|lupan-dark-blue|lupan-dark-gray|lupan-light|lupan-material-dark|lupan-material-light)
sed -i "s/^colors: [*].*/colors: *$1/" ~/.config/alacritty/alacritty.yml
;;
--next)
case $(grep colors: ~/.config/alacritty/alacritty.yml) in
'colors: *lupan-dark')
THEME=lupan-dark-blue
;;
'colors: *lupan-dark-blue')
THEME=lupan-dark-gray
;;
'colors: *lupan-dark-gray')
THEME=lupan-light
;;
'colors: *lupan-light')
THEME=lupan-material-dark
;;
'colors: *lupan-material-dark')
THEME=lupan-material-light
;;
*)
THEME=lupan-dark
;;
esac
sed -i "s/^colors: [*].*/colors: *$THEME/" ~/.config/alacritty/alacritty.yml
;;
esac

View File

@@ -51,7 +51,20 @@ end
-- {{{ Variable definitions
-- Themes define colours, icons, font and wallpapers.
local theme = "theme_dark.lua"
local function read_theme()
local theme = "theme_dark.lua"
local f = io.open(os.getenv('HOME') .. '/.config/alacritty/alacritty.toml')
if f then
if string.find(f:read('*all'), 'light') then
theme = 'theme_light.lua'
end
f:close()
return theme
end
end
local theme = read_theme()
beautiful.init(gears.filesystem.get_configuration_dir() .. theme)
local function set_wallpaper(s)
@@ -75,7 +88,7 @@ local function switch_theme()
end
-- This is used later as the default terminal and editor to run.
local terminal = "alacritty"
local terminal = "st"
-- Default modkey.
local modkey = "Mod4"
@@ -110,7 +123,7 @@ local mykeyboardlayout = awful.widget.keyboardlayout()
-- {{{ Wibar
-- Create a textclock widget
local mytextclock = wibox.widget.textclock()
local mytextclock = wibox.widget.textclock('%H:%M ')
-- Create a wibox for each screen and add it
local taglist_buttons = gears.table.join(
@@ -223,6 +236,15 @@ local function layout_menu()
awful.menu(layouts):show()
end
local function focus_nth_window (n)
local cc = {}
for _, c in ipairs(client.get()) do
if awful.widget.tasklist.filter.currenttags(c, mouse.screen) then cc[#cc + 1] = c end
end
local new_focused = cc[n]
if new_focused then client.focus = new_focused; new_focused:raise() end
end
-- {{{ Key bindings
local globalkeys = gears.table.join(
awful.key({ modkey, }, "s", hotkeys_popup.show_help,
@@ -325,8 +347,8 @@ local globalkeys = gears.table.join(
end,
{ description = "lua execute prompt", group = "awesome" }),
-- Menubar
awful.key({ modkey, }, "p", function() menubar.show() end,
{ description = "show the menubar", group = "launcher" })
awful.key({ modkey }, "p", function() awful.spawn("dmenu_run -fn 'FiraCode Nerd Font Ret:size=10'") end,
{ description = "run command", group = "launcher" })
)
local clientkeys = gears.table.join(
@@ -355,8 +377,11 @@ local clientkeys = gears.table.join(
{ description = "minimize", group = "client" }),
awful.key({ modkey, }, "m",
function(c)
c.maximized = not c.maximized
c:raise()
if awful.layout.getname() == "max" then
awful.layout.set(awful.layout.suit.tile)
else
awful.layout.set(awful.layout.suit.max)
end
end,
{ description = "(un)maximize", group = "client" }),
awful.key({ modkey, }, "v",
@@ -419,7 +444,11 @@ for i = 1, 9 do
end
end
end,
{ description = "toggle focused client on tag #" .. i, group = "tag" })
{ description = "toggle focused client on tag #" .. i, group = "tag" }),
--- Focus nth window
awful.key({ "Control" }, "#" .. i + 9,
function() focus_nth_window(i) end,
{ description = "focus window index #" .. i, group = "client" })
)
end
@@ -455,7 +484,8 @@ awful.rules.rules = {
keys = clientkeys,
buttons = clientbuttons,
screen = awful.screen.preferred,
placement = awful.placement.no_overlap + awful.placement.no_offscreen
placement = awful.placement.no_overlap + awful.placement.no_offscreen,
size_hints_honor = false,
}
},
@@ -507,6 +537,19 @@ awful.rules.rules = {
-- }}}
-- {{{ Signals
local function set_border_width(c)
local t = awful.screen.focused().selected_tag
if #t:clients() == 1 or t.layout.name == 'max' then
c = c or client.focus
c.border_width = 0
else
for _, cl in ipairs(t:clients()) do
cl.border_width = beautiful.border_width
end
end
end
-- Signal function to execute when a new client appears.
client.connect_signal("manage", function(c)
-- Set the windows at the slave,
@@ -519,6 +562,7 @@ client.connect_signal("manage", function(c)
-- Prevent clients from being unreachable after screen count changes.
awful.placement.no_offscreen(c)
end
set_border_width(c)
end)
-- Enable sloppy focus, so that focus follows mouse.
@@ -526,6 +570,23 @@ client.connect_signal("mouse::enter", function(c)
c:emit_signal("request::activate", "mouse_enter", { raise = false })
end)
client.connect_signal("focus", function(c) c.border_color = beautiful.border_focus end)
client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_normal end)
-- local function set_border(c)
-- local s = awful.screen.focused()
-- if c.maximized
-- or (#s.tiled_clients == 1 and not c.floating)
-- or (s.selected_tag and s.selected_tag.layout.name == 'max')
-- then
-- c.border_width = 0
-- else
-- c.border_width = beautiful.border_width
-- end
-- end
client.connect_signal("focus", function(c)
c.border_color = beautiful.border_focus
set_border_width(c)
end)
client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_normal; end)
tag.connect_signal("property::layout", function() set_border_width(nil) end)
-- }}}

View File

@@ -1,51 +1,57 @@
local themes_path = require("gears.filesystem").get_themes_dir()
local themes_path = require("gears.filesystem").get_themes_dir()
local xresources = require("beautiful.xresources")
local dpi = xresources.apply_dpi
local xresources = require("beautiful.xresources")
local dpi = xresources.apply_dpi
local theme = {}
local theme = {}
theme.font = "GoMono Nerd Font 10.5"
theme.tasklist_disable_icon = true
theme.wibar_height = 40
theme.font = "Fira Code Nerd Font 10"
theme.tasklist_disable_icon = true
theme.wibar_height = 30
theme.bg_normal = "#283538"
theme.bg_focus = "#36537d" -- hsl(215deg 40% 35%)
theme.bg_urgent = "#d8aeb5"
theme.bg_minimize = "#363e49" -- hsl(215deg 15% 25%)
theme.bg_systray = theme.bg_normal
theme.tasklist_bg_focus = "#263c59" -- hsl(215deg 40% 25%)
theme.bg_normal = "#111c22" -- hsl(200 35% 10%)
theme.bg_focus = "#316781" -- hsl(200 45% 35%)
theme.bg_urgent = "#814c31" -- hsl(20 45% 35%)
theme.bg_minimize = "#454f54" -- hsl(200 10% 30%)
theme.bg_systray = theme.bg_normal
theme.tasklist_bg_focus = "#1c3b4a" -- hsl(200 45% 20%)
theme.fg_normal = "#9ea7aa"
theme.fg_focus = "#b1babd"
theme.fg_urgent = theme.bg_focus
theme.fg_minimize = "#8a9294"
theme.taglist_fg_empty = "#798082"
theme.fg_normal = "#8f9ca3" -- hsl(200 10% 60%)
theme.fg_focus = "#abb5ba" -- hsl(200 10% 70%)
theme.fg_urgent = theme.bg_focus
theme.fg_minimize = theme.fg_normal
theme.taglist_fg_empty = "#454f54" -- hsl(200 10% 30%)
theme.useless_gap = dpi(1)
theme.border_width = dpi(2)
theme.border_normal = "#708090"
theme.border_focus = "#a0522d"
theme.border_marked = "#91231c"
theme.gap_single_client = false
theme.useless_gap = dpi(1)
theme.border_width = dpi(2)
theme.border_normal = "#73848c" -- hsl(200 10% 50%)
theme.border_focus = "#b25e34" -- hsl(20 55% 45%)
theme.border_marked = "#3488b2" -- hsl(200 55% 45%)
theme.bg_wallpaper = "#424a4c"
theme.bg_wallpaper = "#454f54" -- hsl(200 10% 30%)
theme.hotkeys_font = theme.font
theme.hotkeys_description_font = theme.font
theme.hotkeys_bg = theme.bg_minimize
theme.hotkeys_modifiers_fg = theme.border_focus
-- You can use your own layout icons like this:
theme.layout_fairh = themes_path .. "default/layouts/fairhw.png"
theme.layout_fairv = themes_path .. "default/layouts/fairvw.png"
theme.layout_floating = themes_path .. "default/layouts/floatingw.png"
theme.layout_magnifier = themes_path .. "default/layouts/magnifierw.png"
theme.layout_max = themes_path .. "default/layouts/maxw.png"
theme.layout_fullscreen = themes_path .. "default/layouts/fullscreenw.png"
theme.layout_tilebottom = themes_path .. "default/layouts/tilebottomw.png"
theme.layout_tileleft = themes_path .. "default/layouts/tileleftw.png"
theme.layout_tile = themes_path .. "default/layouts/tilew.png"
theme.layout_tiletop = themes_path .. "default/layouts/tiletopw.png"
theme.layout_spiral = themes_path .. "default/layouts/spiralw.png"
theme.layout_dwindle = themes_path .. "default/layouts/dwindlew.png"
theme.layout_cornernw = themes_path .. "default/layouts/cornernww.png"
theme.layout_cornerne = themes_path .. "default/layouts/cornernew.png"
theme.layout_cornersw = themes_path .. "default/layouts/cornersww.png"
theme.layout_cornerse = themes_path .. "default/layouts/cornersew.png"
theme.layout_fairh = themes_path .. "default/layouts/fairhw.png"
theme.layout_fairv = themes_path .. "default/layouts/fairvw.png"
theme.layout_floating = themes_path .. "default/layouts/floatingw.png"
theme.layout_magnifier = themes_path .. "default/layouts/magnifierw.png"
theme.layout_max = themes_path .. "default/layouts/maxw.png"
theme.layout_fullscreen = themes_path .. "default/layouts/fullscreenw.png"
theme.layout_tilebottom = themes_path .. "default/layouts/tilebottomw.png"
theme.layout_tileleft = themes_path .. "default/layouts/tileleftw.png"
theme.layout_tile = themes_path .. "default/layouts/tilew.png"
theme.layout_tiletop = themes_path .. "default/layouts/tiletopw.png"
theme.layout_spiral = themes_path .. "default/layouts/spiralw.png"
theme.layout_dwindle = themes_path .. "default/layouts/dwindlew.png"
theme.layout_cornernw = themes_path .. "default/layouts/cornernww.png"
theme.layout_cornerne = themes_path .. "default/layouts/cornernew.png"
theme.layout_cornersw = themes_path .. "default/layouts/cornersww.png"
theme.layout_cornerse = themes_path .. "default/layouts/cornersew.png"
return theme

View File

@@ -1,51 +1,57 @@
local themes_path = require("gears.filesystem").get_themes_dir()
local themes_path = require("gears.filesystem").get_themes_dir()
local xresources = require("beautiful.xresources")
local dpi = xresources.apply_dpi
local xresources = require("beautiful.xresources")
local dpi = xresources.apply_dpi
local theme = {}
local theme = {}
theme.font = "GoMono Nerd Font 10.5"
theme.tasklist_disable_icon = true
theme.wibar_height = 40
theme.font = "Fira Code Nerd Font 10"
theme.tasklist_disable_icon = true
theme.wibar_height = 30
theme.bg_normal = "#283538"
theme.bg_focus = "#82a0c9" -- hsl(215deg 40% 65%)
theme.bg_urgent = "#d0426a"
theme.bg_minimize = "#7b899d" -- hsl(215deg 15% 55%)
theme.bg_systray = theme.bg_normal
theme.tasklist_bg_focus = "#5e85ba" -- hsl(215deg 40% 55%)
theme.bg_normal = "#111c22" -- hsl(200 35% 10%)
theme.bg_focus = "#d0e3fb" -- hsl(214 85% 90%)
theme.bg_urgent = "#f2d1a6" -- hsl(34 75% 80%)
theme.bg_minimize = "#8596ad" -- hsl(214 20% 60%)
theme.bg_systray = theme.bg_normal
theme.tasklist_bg_focus = "#a6c7f2" -- hsl(214 75% 80%)
theme.fg_normal = "#616c6f"
theme.fg_focus = "#363d3e"
theme.fg_urgent = "#e9f2f5"
theme.fg_minimize = "#4b5456"
theme.taglist_fg_empty = "#566063"
theme.fg_normal = "#8f9ca3" -- hsl(200 10% 60%)
theme.fg_focus = "#454b54" -- hsl(214 10% 30%)
theme.fg_urgent = "#70675c" -- hsl(34 10% 40%)
theme.fg_minimize = "#70675c" -- hsl(34 10% 40%)
theme.taglist_fg_empty = theme.fg_minimize
theme.useless_gap = dpi(1)
theme.border_width = dpi(2)
theme.border_normal = "#bebebe"
theme.border_focus = "#ff7f50"
theme.border_marked = "#91231c"
theme.gap_single_client = false
theme.useless_gap = dpi(1)
theme.border_width = dpi(2)
theme.border_normal = theme.bg_minimize
theme.border_focus = "#df8c20" -- hsl(34 75% 50%)
theme.border_marked = "#2073df" -- hsl(214 75% 50%)
theme.bg_wallpaper = "#b0bec2"
theme.bg_wallpaper = theme.fg_normal
theme.hotkeys_font = theme.font
theme.hotkeys_description_font = theme.font
theme.hotkeys_bg = theme.border_normal
theme.hotkeys_modifiers_fg = theme.bg_focus
-- You can use your own layout icons like this:
theme.layout_fairh = themes_path .. "default/layouts/fairhw.png"
theme.layout_fairv = themes_path .. "default/layouts/fairvw.png"
theme.layout_floating = themes_path .. "default/layouts/floatingw.png"
theme.layout_magnifier = themes_path .. "default/layouts/magnifierw.png"
theme.layout_max = themes_path .. "default/layouts/maxw.png"
theme.layout_fullscreen = themes_path .. "default/layouts/fullscreenw.png"
theme.layout_tilebottom = themes_path .. "default/layouts/tilebottomw.png"
theme.layout_tileleft = themes_path .. "default/layouts/tileleftw.png"
theme.layout_tile = themes_path .. "default/layouts/tilew.png"
theme.layout_tiletop = themes_path .. "default/layouts/tiletopw.png"
theme.layout_spiral = themes_path .. "default/layouts/spiralw.png"
theme.layout_dwindle = themes_path .. "default/layouts/dwindlew.png"
theme.layout_cornernw = themes_path .. "default/layouts/cornernww.png"
theme.layout_cornerne = themes_path .. "default/layouts/cornernew.png"
theme.layout_cornersw = themes_path .. "default/layouts/cornersww.png"
theme.layout_cornerse = themes_path .. "default/layouts/cornersew.png"
theme.layout_fairh = themes_path .. "default/layouts/fairhw.png"
theme.layout_fairv = themes_path .. "default/layouts/fairvw.png"
theme.layout_floating = themes_path .. "default/layouts/floatingw.png"
theme.layout_magnifier = themes_path .. "default/layouts/magnifierw.png"
theme.layout_max = themes_path .. "default/layouts/maxw.png"
theme.layout_fullscreen = themes_path .. "default/layouts/fullscreenw.png"
theme.layout_tilebottom = themes_path .. "default/layouts/tilebottomw.png"
theme.layout_tileleft = themes_path .. "default/layouts/tileleftw.png"
theme.layout_tile = themes_path .. "default/layouts/tilew.png"
theme.layout_tiletop = themes_path .. "default/layouts/tiletopw.png"
theme.layout_spiral = themes_path .. "default/layouts/spiralw.png"
theme.layout_dwindle = themes_path .. "default/layouts/dwindlew.png"
theme.layout_cornernw = themes_path .. "default/layouts/cornernww.png"
theme.layout_cornerne = themes_path .. "default/layouts/cornernew.png"
theme.layout_cornersw = themes_path .. "default/layouts/cornersww.png"
theme.layout_cornerse = themes_path .. "default/layouts/cornersew.png"
return theme

View File

@@ -1,37 +1,53 @@
#!/bin/sh
REQUIRED="$1"
check_dependency() {
local CMD="$1"
shift
for REQ in "$@"; do
if [ "$REQ" = "$REQUIRED" ]; then
which "$CMD"
break
fi
done
}
echo '# required:'
for CMD in \
zsh \
git \
cc \
make \
setxkbmap \
slock \
systemctl \
xmodmap \
xrandr \
xrdb \
xset \
xsetroot \
hsetroot \
xsettingsd \
sed \
pkill \
dmenu \
dmenu_run \
xss-lock \
exa \
fzf \
; do
which "$CMD"
done
check_dependency zsh dwm hypr
check_dependency git dwm hypr
check_dependency cc dwm
check_dependency make dwm
check_dependency setxkbmap dwm
check_dependency slock dwm
check_dependency systemctl dwm hypr
check_dependency xmodmap dwm
check_dependency xrandr dwm
check_dependency xrdb dwm
check_dependency xset dwm
check_dependency xsetroot dwm
check_dependency hsetroot dwm
check_dependency xsettingsd dwm
check_dependency sed dwm hypr
check_dependency pkill dwm
check_dependency dmenu dwm
check_dependency dmenu_run dwm
check_dependency xss-lock dwm
check_dependency exa dwm hypr
check_dependency fzf dwm hypr
check_dependency Hyprland hypr
check_dependency hyprctl hypr
check_dependency alacritty hypr
check_dependency swaylock hypr
check_dependency waybar hypr
check_dependency wofi hypr
echo -e '\n# optional:'
for CMD in \
sx \
picom \
compton \
xbacklight; do
which "$CMD"
done
check_dependency sx dwm
check_dependency picom dwm
check_dependency compton dwm
check_dependency xbacklight dwm
check_dependency wl-copy hypr
check_dependency wl-paste hypr

43
compile_tools.sh Executable file
View File

@@ -0,0 +1,43 @@
#!/bin/sh
mkdir -p tools/.local/bin
uid=$(id -u):$(id -g)
go-install() {
echo "build $1"
docker exec -u "$uid" dotfiles-go go install -ldflags="-s -w" "$@"
}
cargo-install() {
B="$1"
shift
echo "build $B"
docker exec -u "$uid" dotfiles-rust cargo install --quiet "$@"
docker exec -u "$uid" dotfiles-rust cp "/usr/local/cargo/bin/$B" /rust/bin
strip "tools/.local/bin/$B"
}
docker kill dotfiles-go && sleep 3 || :
docker run --rm -d --name dotfiles-go -e HOME=/go -v ./tools/.local/bin:/go/bin golang:1.25.1-alpine3.22 tail -f /dev/null
docker exec dotfiles-go chown "$uid" /go
go-install github.com/junegunn/fzf@latest
go-install github.com/gokcehan/lf@latest
go-install github.com/rs/curlie@latest
docker kill dotfiles-go
docker kill dotfiles-rust && sleep 3 || :
docker run --rm -d --name dotfiles-rust -v ./tools/.local/bin:/rust/bin rust:1.90-bullseye tail -f /dev/null
cargo-install zoxide zoxide --locked
cargo-install rg ripgrep
cargo-install fd fd-find
cargo-install bat bat --locked
cargo-install eza eza
cargo-install delta git-delta
cargo-install jj --bin jj jj-cli --locked
cargo-install lazyjj lazyjj --locked
docker kill dotfiles-rust

175
dk/.config/dk/dkrc Executable file
View File

@@ -0,0 +1,175 @@
#!/bin/sh
# determine where to place the log file
logfile="$HOME/.dkrc.log"
[ -d "$HOME/.local/share/xorg" ] && logfile="$HOME/.local/share/xorg/dkrc.log"
: > "$logfile"
# load sxhkd for keybinds
pgrep sxhkd || sxhkd -c "$HOME/.config/dk/sxhkdrc" &
# spawn a scratchpad terminal if not already (see sxhkdrc and rules for binds/setup)
# pgrep -f "st -c scratchpad" || st -c scratchpad &
# adjust border widths based on the DPI of the monitor
px=$(xrandr | grep ' connected' | tail -n1 | grep -o '[0-9]\+x[0-9]\+' | cut -d'x' -f2)
mm=$(xrandr | grep ' connected' | tail -n1 | grep -o '[0-9]\+mm' | tail -n1 | sed 's/mm//')
dpi=$(( (px / mm) * 25 ))
if [ $dpi -ge 140 ]; then
border_width=5
border_outer_width=3
elif [ $dpi -ge 120 ]; then
border_width=4
border_outer_width=2
else
border_width=2
border_outer_width=1
fi
{ # compound command to redirect all output
# workspace settings
# ------------------------
# initialize 6 workspaces (1-6) (default: 1/monitor)
dkcmd set numws=10
# default workspace '_' values used when allocating new workspaces
# can be applied to all existing workspaces when passed 'apply' after ws=_
dkcmd set ws=_ apply layout=tile master=1 stack=3 gap=0 msplit=0.5 ssplit=0.5
# use grid layout, padding, and gaps on last workspace
#dkcmd set ws=6 layout=grid pad left=200 right=200 top=100 bottom=100 gap=50
# change workspace names (default: number == name -> 1:1, 2:2, 3:3....)
# dkcmd set \
# ws=1 name="edit" \
# ws=2 name="web" \
# ws=3 name="😀" \
# ws=4 name="😠" \
# ws=5 name="5" \
# ws=6 name="6" \
# enable static workspaces assigned to monitors (relevant for multiple monitors)
monitors=$(polybar -m | sed 's/+/:/g' | awk -F: '{print $3, $1}' | sort -n | cut -d' ' -f2 | xargs)
mon1=$(echo $monitors | cut -d' ' -f1)
mon2=$(echo $monitors | cut -d' ' -f2)
mon3=$(echo $monitors | cut -d' ' -f3)
if [ -z "$mon2" ]; then
mon2="$mon1"
mon3="$mon1"
elif [ -z "$mon3" ]; then
mon3="$mon1"
fi
dkcmd set static_ws=true \
ws=1 mon=$mon2 \
ws=2 mon=$mon2 \
ws=3 mon=$mon2 \
ws=4 mon=$mon2 \
ws=5 mon=$mon2 \
ws=6 mon=$mon2 \
ws=7 mon=$mon2 \
ws=8 mon=$mon2 \
ws=9 mon=$mon1 \
ws=10 mon=$mon3
# global settings
# ---------------------
# focus windows when receiving activation and enable focus-follows-mouse
dkcmd set focus_open=true focus_urgent=true focus_mouse=true
# place clients at the tail and ignore size hints on tiled windows
dkcmd set tile_tohead=0 tile_hints=false
# minimum width/height for resizing, and minimum allowed on-screen when moving
dkcmd set win_minwh=50 win_minxy=10
# disable gaps and borders in single window layouts
dkcmd set smart_gap=true smart_border=true
# define mouse mod and move/resize buttons
dkcmd set mouse mod=mod4 move=button1 resize=button3
# obey motif border hints on windows that draw their own (steam, easyeffects, etc.)
dkcmd set obey_motif=true
# borders
# ---------
# traditional
# set border width and colour for each window state
# dkcmd set border width=$border_width colour focus='#6699cc' unfocus='#000000' urgent='#ee5555'
# alternative
# enable split borders and colours, width is overall width, outer_width consumes some of width.
# outer_width must be less than width, outer_width of 0 will be single borders
dkcmd set border width=$border_width outer_width=$border_outer_width \
colour \
focus='#6699cc' \
unfocus='#444444' \
urgent='#ee5555' \
outer_focus='#222222' \
outer_unfocus='#222222' \
outer_urgent='#222222'
# window rules
# --------------
# rule class, instance, and title regex are *always* case INSENSITIVE
# open window(s) on a specific workspace (assigned monitor)
# dkcmd rule class="^gimp$" ws=2
# open window(s) on a monitor by number or name (active workspace on monitor)
# dkcmd rule class="^chromium$" mon="HDMI-A-0"
# open window(s) and use a callback function (user defined in config.h)
# we also ignore_cfg=true to stop the window from being resized on it's own from events
# eg. mpv --x11-name=albumart /path/to/media
# dkcmd rule class="^mpv$" instance="^albumart$" float=true ignore_cfg=true callback=albumart bw=0
# open window(s) in a floating state
dkcmd rule class="^(pavucontrol|transmission-gtk|steam|lxappearance)$" float=true
# open window(s) with a specific geometry and coordinates (floating only!)
# dkcmd rule class="^google-chrome$" title="^open files$" float=true w=1280 h=720
# open window(s) with ignore_msg=true to avoid focus being grabbed and changing workspace
# dkcmd rule class="^TelegramDesktop$" ignore_msg=true
# define some terminals and allow them to be absorbed by spawned windows
dkcmd rule class="^(st|st-256color|urxvt|kitty|alacritty|xterm|xterm-256color)$" terminal=true
# set a window to never absorb other windows, like the xev event tester
dkcmd rule title="^Event Tester$" no_absorb=true
# send a window to the scratchpad
dkcmd rule class="^scratchpad$" scratch=true
# focus window and workspace on opening
# dkcmd rule class="^firefox$" ws=1 focus=true
# update or remove an existing rule with the same match patterns
# dkcmd rule class="^firefox$" mon="HDMI-A-0"
# dkcmd rule remove class="^firefox$"
# apply current rule set to all existing windows (used mainly for WM restart)
dkcmd rule apply '*'
# delete all rules
# dkcmd rule remove '*'
} >> "$logfile" 2>&1 # append responses
# inform of any errors in a notification
if grep -q 'error:' "$logfile"; then
hash notify-send && notify-send -t 0 -u critical "dkrc has errors" \
"$(awk '/error:/ {sub(/^error: /, ""); gsub(/</, "\<"); print}' "$logfile")"
exit 1
fi
exit 0

117
dk/.config/dk/sxhkdrc Normal file
View File

@@ -0,0 +1,117 @@
# sxhkdrc for use with dk
#########################################################
# launcher
mod4 + p
dmenu_run -fn 'Fira Code Nerd Font Ret:size=13'
# terminal
mod4 + shift + Return
st
mod4 + ctrl + shift + Return
st-abduco-tabbed
# screenshot and selection capture
{_,mod4 + }@Print
scrot {_,-s}
# dedicated volume keys
{XF86AudioRaiseVolume,XF86AudioLowerVolume}
pamixer {-i,-d} 2
# dedicated backlight keys
{XF86MonBrightnessUp,XF86MonBrightnessDown}
xbacklight {+10,-10}
# alt volume keys
mod4 + {Insert,Delete}
pamixer {-i,-d} 2
# reload sxhkd
mod4 + shift + x
pkill -USR1 -x sxhkd
# quit dk
mod4 + shift + q
dkcmd exit
# reload dkrc
mod4 + shift + r
$HOME/.config/dk/dkrc
# restart dk
mod4 + ctrl + shift + r
dkcmd restart
# focus next or previous window
mod4 + {j,k}
dkcmd win focus {next,prev}
# close window, swap tiled window in/out of master, cycle tiled windows in place
mod4 + {q,space,Tab}
dkcmd win {kill,swap,cycle}
# toggle fullscreen and fake fullscreen (enable manipulating fullscreen window)
{_,mod4 + }F11
dkcmd win {full,fakefull}
# toggle floating, sticky, or scratchpad
mod4 + shift + {space,s,u}
dkcmd win {float,stick,scratch}
# alternatively to scratch a window by class "scratchpad"
#dkcmd win {float,stick,scratchpad scratch}
# move window, signed (+/-) for relative changes, for tiled windows
# y coord changes will move the window up/down the stack
mod4 + shift + {h,j,k,l}
dkcmd win resize {x=-20,y=+20,y=-20,x=+20}
# resize window, signed (+/-) for relative changes
mod4 + ctrl + {h,j,k,l}
dkcmd win resize {w=-20,h=+20,h=-20,w=+20}
# view, send, or follow to a workspace (by number)
mod4 + {_,shift + ,ctrl + }{1-9,0}
dkcmd ws {view,send,follow} {1-9,10}
# view, send, or follow to the next, previous, last active,
# next non-empty, or prev non-empty workspace
mod4 + {_,shift + ,ctrl + }{bracketleft,bracketright,BackSpace,Left,Right}
dkcmd ws {view,send,follow} {prev,next,last,prevne,nextne}
# view, send, or follow to the next, previous, or last active monitor
mod4 + {_,shift + ,ctrl + }{comma,period,backslash}
dkcmd mon {view,send,follow} {prev,next,last}
# change active workspace layout or cycle between them
mod4 + {t,r,m,g,s,w,f,u,c}
dkcmd set layout {tile,rtile,mono,grid,spiral,dwindle,none,tstack,cycle}
# change number of windows in master or first stack
mod4 + {_,shift + }{i,d}
dkcmd set {master,stack} {+1,-1}
# change gap width
mod4 + {equal,minus}
dkcmd set gap {+5,-5}
# change border widths
mod4 + ctrl + {_,shift + }{equal,minus}
dkcmd set border {width,outer_width} {+1,-1}
# lock screen
mod4 + ctrl + shift + l
slock
# suspend
mod4 + ctrl + shift + s
systemctl suspend
# toggle light/dark theme
mod4 + F6
lupan-set-theme toggle
# vim:ft=sxhkdrc

View File

@@ -1,4 +1,4 @@
[main]
font = GoMono Nerd Font:size=11
font = Fira Code Nerd Font:size=11
include = /usr/share/foot/themes/nord

View File

@@ -0,0 +1,4 @@
monitor=DP-1,highres,0x0,2,transform,1
monitor=HDMI-A-2,highres,1080x0,2
# vim: ft=hyprlang

View File

@@ -1,2 +1,4 @@
monitor=DP-1,highres,0x0,2,transform,1
monitor=HDMI-A-2,highres,1080x0,2
monitor=DP-1,highres,0x0,2
monitor=HDMI-A-2,highres,1920x0,2
# vim: ft=hyprlang

View File

@@ -1,4 +1,4 @@
#source = ~/.config/hypr/white.conf
source = ~/.config/hypr/white.conf
input {
kb_layout = pl
@@ -6,12 +6,12 @@ input {
}
general {
gaps_in = 1
gaps_out = 3
layout = dwindle
border_size = 2
col.inactive_border = 0xff808080
col.active_border = 0xffbf6a40
gaps_in = 3
gaps_out = 4
layout = master
border_size = 3
col.inactive_border = 0xff5387ac
col.active_border = 0xffac7853
}
dwindle {
@@ -19,7 +19,7 @@ dwindle {
}
decoration {
drop_shadow = false
rounding = 4
}
animations {
@@ -30,27 +30,37 @@ misc {
disable_hyprland_logo = true
disable_splash_rendering = true
disable_autoreload = true
background_color = rgb(404040)
background_color = 0xff808080
}
$menu = rofi -show drun -theme Arc-Dark
$terminal = alacritty
binds {
workspace_back_and_forth = true
}
$menu = wofi -S run
$terminal = alacritty || kitty
$mainMod = SUPER
bind = $mainMod, P, exec, $menu
bind = $mainMod SHIFT, Return, exec, $terminal
bind = $mainMod ALT, Return, exec, $terminal
bind = $mainMod, Return, layoutmsg,swapwithmaster master
bind = $mainMod CONTROL SHIFT, Q, exit
bind = $mainMod, Q, exec, hyprctl reload
bind = $mainMod CONTROL SHIFT, C, killactive
bind = $mainMod CONTROL SHIFT, L, exec, swaylock -c 263c59
bind = $mainMod ALT, O, exec, swaylock -c 263c59
bind = $mainMod CONTROL SHIFT, S, exec, swaylock -c 263c59
bind = $mainMod CONTROL SHIFT, S, exec, systemctl suspend
bind = $mainMod ALT, S, exec, swaylock -c 263c59
bind = $mainMod ALT, S, exec, systemctl suspend
bind = $mainMod CONTROL, Space, togglefloating
bind = $mainMod, D, exec, hyprctl keyword general:layout "dwindle"
bind = $mainMod, M, exec, hyprctl keyword general:layout "master"
bind = $mainMod, F, fullscreen, 0
bind = $mainMod SHIFT, F, fullscreen, 1
bind = $mainMod ALT, F, fullscreen, 1
bind = $mainMod, U, layoutmsg, togglesplit
bind = $mainMod, I, layoutmsg, cycleprev
bind = $mainMod, O, layoutmsg, cyclenext
@@ -60,6 +70,7 @@ bind = $mainMod SHIFT, O, layoutmsg, swapnext
bind = $mainMod CONTROL, I, layoutmsg, removemaster
bind = $mainMod CONTROL, O, layoutmsg, addmaster
bind = $mainMod SHIFT, F6, exec, ~/bin/lupan-set-theme toggle
bind = $mainMod ALT, T, exec, ~/bin/lupan-set-theme toggle
bind = $mainMod, h, movefocus, l
bind = $mainMod, j, movefocus, d
@@ -71,6 +82,11 @@ bind = $mainMod SHIFT, j, swapwindow, d
bind = $mainMod SHIFT, k, swapwindow, u
bind = $mainMod SHIFT, l, swapwindow, r
bind = $mainMod ALT, h, swapwindow, l
bind = $mainMod ALT, j, swapwindow, d
bind = $mainMod ALT, k, swapwindow, u
bind = $mainMod ALT, l, swapwindow, r
bind = $mainMod CONTROL, h, layoutmsg, orientationleft
bind = $mainMod CONTROL, j, layoutmsg, orientationbottom
bind = $mainMod CONTROL, k, layoutmsg, orientationtop
@@ -100,10 +116,21 @@ bind = $mainMod SHIFT, 8, movetoworkspace, 8
bind = $mainMod SHIFT, 9, movetoworkspace, 9
bind = $mainMod SHIFT, 0, movetoworkspace, 10
bind = $mainMod ALT, 1, movetoworkspace, 1
bind = $mainMod ALT, 2, movetoworkspace, 2
bind = $mainMod ALT, 3, movetoworkspace, 3
bind = $mainMod ALT, 4, movetoworkspace, 4
bind = $mainMod ALT, 5, movetoworkspace, 5
bind = $mainMod ALT, 6, movetoworkspace, 6
bind = $mainMod ALT, 7, movetoworkspace, 7
bind = $mainMod ALT, 8, movetoworkspace, 8
bind = $mainMod ALT, 9, movetoworkspace, 9
bind = $mainMod ALT, 0, movetoworkspace, 10
bind = $mainMod, right, workspace, m+1
bind = $mainMod, left, workspace, m-1
# Switch workspaces on current monitor with mainMod CONTROL + Control + [0-9]
# Switch workspaces on current monitor with mainMod + Control + [0-9]
bind = $mainMod CONTROL, 1, focusworkspaceoncurrentmonitor, 1
bind = $mainMod CONTROL, 2, focusworkspaceoncurrentmonitor, 2
bind = $mainMod CONTROL, 3, focusworkspaceoncurrentmonitor, 3
@@ -120,3 +147,5 @@ bindm = $mainMod,mouse:273,resizewindow
exec-once = waybar
exec-once = swayidle -w timeout 300 'swaylock -f -c 263c59' before-sleep 'swaylock -f -c 263c59'
# vim: ft=hyprlang

View File

@@ -0,0 +1,5 @@
monitor=eDP-1,prefered,0x0,1.5
monitor=DP-1,highres,1280x0,2
monitor=HDMI-A-1,highres,3200x0,2
# vim: ft=hyprlang

View File

@@ -4,5 +4,7 @@ env = GBM_BACKEND,nvidia-drm
env = __GLX_VENDOR_LIBRARY_NAME,nvidia
env = WLR_NO_HARDWARE_CURSORS,1
monitor=DP-2,highres,0x0,2,transform,1
monitor=DP-1,highres,1080x0,2
monitor=DP-1,highres,0x0,2
monitor=DP-2,highres,1920x0,2
# vim: ft=hyprlang

View File

@@ -9,4 +9,5 @@
"tray",
"clock"
],
"reload_style_on_change": true,
}

View File

@@ -0,0 +1,12 @@
* {
background-color: #3f4947;
color: #9bafac;
}
#workspaces button.active {
border-bottom: 3px solid #9bafac;
}
#workspaces button.urgent {
border-bottom: 3px solid #a65959;
}

View File

@@ -0,0 +1,13 @@
* {
background-color: #dde4e3;
color: #2c3131;
}
#workspaces button.active {
border-bottom: 3px solid #2c3131;
}
#workspaces button.urgent {
border-bottom: 3px solid #9e412e;
}

View File

@@ -1,12 +1,12 @@
@import url("file:///home/lupan/.config/waybar/dark.css");
* {
font-family: GoMono Nerd Font;
font-size: 14;
background-color: #263c59;
color: #7b899d;
font-family: Fira Code Nerd Font;
font-size: 12px;
}
#workspaces {
padding: 0 1rem;
padding: 0 0.5rem;
}
#workspaces button {
@@ -15,19 +15,11 @@
border-bottom: 3px solid transparent;
}
#workspaces button.active {
border-bottom: 3px solid #7b899d;
}
#workspaces button.urgent {
border-bottom: 3px solid #a65959;
}
#window {
border-bottom: 3px solid transparent;
}
#clock {
padding: 0 1rem;
padding: 0 0.5rem;
border-bottom: 3px solid transparent;
}

View File

@@ -0,0 +1,32 @@
font_family FiraCode Nerd
font_size 11
cursor_blink_interval 0
tab_title_template "{fmt.fg.red}{bell_symbol}{activity_symbol}{fmt.fg.tab}{title} {index}"
action_alias launch_tab launch --type=tab --cwd=current
map ctrl+shift+n launch_tab tmux
map ctrl+shift+t launch_tab tmux attach
map ctrl+shift+s launch_tab zsh
map ctrl+shift+6 no_op
map ctrl+shift+h previous_tab
map ctrl+shift+l next_tab
map ctrl+shift+p goto_tab -1
map ctrl+alt+1 goto_tab 1
map ctrl+alt+2 goto_tab 2
map ctrl+alt+3 goto_tab 3
map ctrl+alt+4 goto_tab 4
map ctrl+alt+5 goto_tab 5
map ctrl+alt+6 goto_tab 6
map ctrl+alt+7 goto_tab 7
map ctrl+alt+8 goto_tab 8
map ctrl+alt+9 goto_tab 9
map ctrl+alt+0 goto_tab 10
# BEGIN_KITTY_THEME
# Afterglow
include current-theme.conf
# END_KITTY_THEME

View File

@@ -0,0 +1,9 @@
os:
edit: 'nvim {{filename}}'
editAtLine: 'nvim +{{line}} {{filename}}'
editAtLineAndWait: 'nvim +{{line}} {{filename}}'
editInTerminal: true
openDirInEditor: 'nvim {{dir}}'
gui:
nerdFontsVersion: "3"

View File

@@ -1 +1,57 @@
require("lupan")
require("config.options")
require("config.remap")
require("config.lsp")
local ok, paq = pcall(require, "paq")
if ok then
paq({
"EdenEast/nightfox.nvim",
"stevearc/conform.nvim",
"otavioschwanck/arrow.nvim",
"folke/flash.nvim",
"folke/snacks.nvim",
"stevearc/oil.nvim",
{
"jake-stewart/multicursor.nvim",
branch = "1.0",
},
{
"nvim-treesitter/nvim-treesitter-textobjects",
branch = "master",
},
{
"nvim-treesitter/nvim-treesitter",
branch = "master",
build = ":TSUpdate",
},
})
else
print("plugin paq missing")
end
local function load_plugin(name, setup)
local cfg = require(setup)
name = cfg.main or name
local ok, plugin = pcall(require, name)
if ok then
if cfg.config then
cfg.config(cfg.opts)
else
plugin.setup(cfg.opts)
end
if cfg.init then
cfg.init(plugin)
end
else
print("plugin " .. name .. " missing")
end
end
load_plugin("arrow", "plugins.arrow")
load_plugin("nightfox", "plugins.colorscheme")
load_plugin("conform", "plugins.conform")
load_plugin("flash", "plugins.flash")
load_plugin("multicursor-nvim", "plugins.multicursor")
load_plugin("oil", "plugins.oil")
load_plugin("snacks", "plugins.snacks")
load_plugin("treesitter", "plugins.treesitter")

View File

@@ -0,0 +1,12 @@
{
"arrow.nvim": { "branch": "master", "commit": "6e0f726f55f99332dd726a53effd6813786b6d49" },
"conform.nvim": { "branch": "master", "commit": "1bf8b5b9caee51507aa51eaed3da5b0f2595c6b9" },
"flash.nvim": { "branch": "main", "commit": "fcea7ff883235d9024dc41e638f164a450c14ca2" },
"lazy.nvim": { "branch": "main", "commit": "85c7ff3711b730b4030d03144f6db6375044ae82" },
"multicursor.nvim": { "branch": "1.0", "commit": "a6cf4e7daaf10a6b14bb7838caf779f0de5070cd" },
"nightfox.nvim": { "branch": "main", "commit": "ba47d4b4c5ec308718641ba7402c143836f35aa9" },
"nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" },
"nvim-treesitter-textobjects": { "branch": "master", "commit": "5ca4aaa6efdcc59be46b95a3e876300cfead05ef" },
"oil.nvim": { "branch": "master", "commit": "7e1cd7703ff2924d7038476dcbc04b950203b902" },
"snacks.nvim": { "branch": "main", "commit": "fe7cfe9800a182274d0f868a74b7263b8c0c020b" }
}

View File

@@ -0,0 +1,5 @@
return {
cmd = { "clangd" },
filetypes = { "c", "cpp" },
root_markers = { ".git" },
}

View File

@@ -0,0 +1,5 @@
return {
cmd = { "gopls" },
filetypes = { "go", "gomod", "gowork", "gosum", "gotmpl" },
root_markers = { "go.mod", "go.work", ".git" },
}

View File

@@ -0,0 +1,5 @@
return {
cmd = 'lua-language-server',
filetypes = { 'lua' },
rootmarkers = { '.git' },
}

View File

@@ -0,0 +1,5 @@
return {
cmd = { "ols" },
filetypes = { "odin" },
root_markers = { ".git" },
}

View File

@@ -0,0 +1,5 @@
return {
cmd = { "typescript-language-server", "--stdio" },
filetypes = { "javascript", "typescript", "javascriptreact", "typescriptreact" },
root_markers = { "package.json", "tsconfig.json", ".git" },
}

View File

@@ -0,0 +1,57 @@
local M = {}
local home = os.getenv("HOME")
local filename = home .. "/.lightmode"
local colorschemes = nil
function M.set_colorschemes(dark, light)
colorschemes = { dark = dark, light = light }
end
function M.terminalbg()
if vim.uv.fs_stat(filename) then
return "light"
else
return "dark"
end
end
function M.update_colorscheme(only_if_changed)
local next = M.terminalbg()
if not only_if_changed or next ~= vim.o.background then
vim.o.background = next
if colorschemes then
vim.cmd.colorscheme(colorschemes[next])
end
end
end
function M.toggle_colorscheme()
if vim.o.background == "dark" then
vim.o.background = "light"
else
vim.o.background = "dark"
end
if colorschemes then
vim.cmd.colorscheme(colorschemes[vim.o.background])
end
end
local w = vim.uv.new_fs_event()
local function watch(fname)
w:start(
fname,
{},
vim.schedule_wrap(function(...)
M.update_colorscheme(true)
w:stop()
watch(fname)
end)
)
end
watch(home)
return M

View File

@@ -0,0 +1,17 @@
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not (vim.uv or vim.loop).fs_stat(lazypath) then
local lazyrepo = "https://github.com/folke/lazy.nvim.git"
local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
if vim.v.shell_error ~= 0 then
vim.api.nvim_echo({
{ "Failed to clone lazy.nvim:\n", "ErrorMsg" },
{ out, "WarningMsg" },
{ "\nPress any key to exit..." },
}, true, {})
vim.fn.getchar()
os.exit(1)
end
end
vim.opt.rtp:prepend(lazypath)
require("lazy").setup({ { import = "plugins" } })

View File

@@ -0,0 +1,26 @@
vim.lsp.enable({
"clangd",
"gopls",
"lua_ls",
"ols",
"typescript-language-server",
})
vim.api.nvim_create_autocmd("LspAttach", {
group = vim.api.nvim_create_augroup("lsp-keys-complete", { clear = true }),
callback = function(event)
vim.lsp.completion.enable(true, event.data.client_id, event.data.bufnr, {
convert = function(item)
return { abbr = item.label:gsub("%b()", "") }
end,
})
vim.keymap.set("n", "<leader>A", vim.lsp.buf.code_action)
vim.keymap.set("i", "<C-space>", vim.lsp.completion.get)
vim.keymap.set("n", "<leader>k", function()
vim.diagnostic.jump({ float = true, count = -1 })
end)
vim.keymap.set("n", "<leader>j", function()
vim.diagnostic.jump({ float = true, count = 1 })
end)
end,
})

View File

@@ -0,0 +1,10 @@
vim.opt.shortmess = vim.opt.shortmess + "I"
vim.g.mapleader = " "
vim.g.maplocalleader = " \\"
vim.opt.number = true
vim.opt.relativenumber = true
vim.opt.signcolumn = "yes"
vim.opt.timeout = false

View File

@@ -0,0 +1,6 @@
vim.keymap.set("n", "<M-h>", "<C-w>h")
vim.keymap.set("n", "<M-k>", "<C-w>k")
vim.keymap.set("n", "<M-j>", "<C-w>j")
vim.keymap.set("n", "<M-l>", "<C-w>l")
vim.keymap.set("n", "<Esc>", "<cmd>nohlsearch<cr>")

View File

@@ -1,18 +0,0 @@
-- [[ Highlight on yank ]]
-- See `:help vim.highlight.on_yank()`
vim.api.nvim_create_autocmd('TextYankPost', {
desc = 'Highlight when yanking (copying) text',
group = vim.api.nvim_create_augroup('YankHighlight', { clear = true }),
callback = function()
vim.highlight.on_yank()
end,
})
vim.api.nvim_create_autocmd('BufWritePre', {
desc = 'Format on saving buffer',
callback = function()
vim.lsp.buf.format()
end,
group = vim.api.nvim_create_augroup('BufWriteFormat', { clear = true }),
pattern = { '*.go', '*.lua', '*.rs' },
})

View File

@@ -1,5 +0,0 @@
require("lupan.remap")
require("lupan.lazy")
require("lupan.options")
require("lupan.autocmd")
require('lazy').setup('plugins')

View File

@@ -1,13 +0,0 @@
-- Install package manager (`:help lazy.nvim.txt`)
local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim'
if not vim.loop.fs_stat(lazypath) then
vim.fn.system {
'git',
'clone',
'--filter=blob:none',
'https://github.com/folke/lazy.nvim.git',
'--branch=stable',
lazypath,
}
end
vim.opt.rtp:prepend(lazypath)

View File

@@ -1,54 +0,0 @@
-- See `:help vim.o`
-- Disable intro message
vim.opt.shortmess = vim.opt.shortmess + 'I'
vim.opt.showmode = false
-- Set highlight on search
vim.o.hlsearch = true -- false
vim.keymap.set('n', '<Esc>', '<cmd>nohlsearch<CR>')
-- Make line numbers default
vim.wo.number = true
vim.wo.relativenumber = true
-- Enable mouse mode
vim.o.mouse = 'a'
-- Enable break indent
vim.o.breakindent = true
-- Save undo history
vim.o.undofile = true
-- Case-insensitive searching UNLESS \C or capital in search
vim.o.ignorecase = true
vim.o.smartcase = true
-- Keep signcolumn on by default
vim.wo.signcolumn = 'yes'
-- Decrease update time
vim.o.updatetime = 250
vim.o.timeoutlen = 300
-- Set completeopt to have a better completion experience
vim.o.completeopt = 'menuone,noselect'
-- NOTE: You should make sure your terminal supports this
vim.o.termguicolors = true
vim.o.scrolloff = 8
vim.o.tabstop = 8
vim.o.softtabstop = 4
vim.o.shiftwidth = 4
vim.o.expandtab = true
vim.o.expandtab = true
vim.g.lightspeed_no_default_keymaps = true
vim.o.cursorline = true
vim.opt.foldcolumn = '1'

View File

@@ -1,153 +0,0 @@
vim.g.mapleader = ' '
vim.g.maplocalleader = ' '
local key = vim.keymap.set
local opts = { silent = true, noremap = true }
key('v', '<Space>', '<Nop>', { silent = true })
-- Remap for dealing with word wrap
key('n', 'k', "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true })
key('n', 'j', "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true })
key("n", "<leader>dd", ":Explore<cr>", { desc = "[D]isplay [d]irectory" })
key("n", "<leader>dv", ":Vexplore<cr>", { desc = "[D]isplay directory ([v]ertical split)" })
key("n", "<leader>dh", ":Sexplore<cr>", { desc = "[D]isplay [d]irectory ([h]orizontal split)" })
key("n", "<leader>dt", ":Lexplore 30<cr>", { desc = "[D]isplay directory [t]oggle" })
key("n", "<leader>ct", ":ColorizerToggle<cr>", { desc = "[C]olorizer [t]oggle" })
key("n", "<leader>ut", ":UndotreeToggle<cr>", { desc = "[U]undotree [t]oggle" })
-- telescope
key('n', '<leader>gg', ':Git grep ', { desc = '[G]it [g]rep' })
key('n', '<leader>td', function()
require('lupan.ui').tab_change_dir()
end, { desc = '[T]ab change [d]irectory' })
key('n', '<leader>tD', function()
require('lupan.ui').tab_change_dir_newtab()
end, { desc = '[T]ab change [D]irectory (new tab)' })
key('n', '<leader>tm', function()
require('telescope-tabs').list_tabs(require 'telescope.themes'.get_dropdown())
end, { desc = '[T]ab change [D]irectory (new tab)' })
key('n', '<leader>tt', function()
require('telescope-tabs').go_to_previous()
end, { desc = '[T]ab [t]oggle previous' })
for i = 1, 9, 1 do
key('n', '<leader>t' .. i, '<cmd>' .. i .. 'tabnext<cr>', { desc = '[T]ab nr [' .. i .. ']' })
end
-- Diagnostic keymaps
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = 'Go to previous [D]iagnostic message' })
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = 'Go to next [D]iagnostic message' })
vim.keymap.set('n', '<leader>e', vim.diagnostic.open_float, { desc = 'Show diagnostic [E]rror messages' })
vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagnostic [Q]uickfix list' })
key('n', '<leader>N', ':bn<cr>', { desc = '[N]ext buffer' })
key('n', '<leader>P', ':bp<cr>', { desc = '[P]revious buffer' })
key('n', '<leader>tc', ':tabnew<cr>', { desc = '[T]ab [c]reate' })
key('n', '<leader>ts', ':tab split<cr>', { desc = '[T]ab [s]plit' })
key('n', '<leader>tn', ':tabnext<cr>', { desc = '[T]ab [n]ext' })
key('n', '<leader>tp', ':tabprevious<cr>', { desc = '[T]ab [p]revious' })
key('n', '<leader>tf', ':tabfirst<cr>', { desc = '[T]ab [f]irst' })
key('n', '<leader>tl', ':tablast<cr>', { desc = '[T]tab [l]ast' })
key('v', 'J', ":m '>+1<cr>gv=gv", { desc = "Move lines down" })
key('v', 'K', ":m '<-2<cr>gv=gv", { desc = "Move lines up" })
-- Change window
key('n', '<C-j>', '<C-w>j', opts)
key('n', '<C-k>', '<C-w>k', opts)
key('n', '<C-h>', '<C-w>h', opts)
key('n', '<C-l>', '<C-w>l', opts)
-- Stay in key mode
key('v', '<', '<gv', opts)
key('v', '>', '>gv', opts)
-- Keep old value of register
key('v', 'P', '"_dP', opts)
-- LightSpeed
key('n', 'g/', '<Plug>Lightspeed_s', { desc = "Lightspeed forward search" })
key('n', 'g?', '<Plug>Lightspeed_S', { desc = "Lightspeed backward search" })
-- Clipboard and quickfix
key({ 'n', 'v' }, '<leader>y', '"+y', { desc = "Yank to clipboard" })
key('n', '<leader>j', ':cn<CR>', { desc = "Quickfix next" })
key('n', '<leader>k', ':cp<CR>', { desc = "Quickfix previous" })
-- luasnip
vim.keymap.set({ 'i', 's' }, "<c-k>", function()
local ls = require "luasnip"
if ls.expand_or_jumpable() then
ls.expand_or_jump()
end
end, { silent = true })
vim.keymap.set({ 'i', 's' }, "<c-j>", function()
local ls = require "luasnip"
if ls.jumpable(-1) then
ls.jump(-1)
end
end, { silent = true })
vim.keymap.set({ 'i', 's' }, "<c-l>", function()
local ls = require "luasnip"
if ls.choice_active() then
ls.change_choice(1)
end
end, { silent = true })
vim.keymap.set("n", "<leader>ss", "<cmd>source ~/.config/nvim/after/plugin/luasnip.lua<CR>",
{ desc = "[S]nippets [s]ource" })
-- terminal
key('t', '<C-_>', '<C-\\><C-n>')
-- harpoon
key('n', '<leader>ha', function()
require("harpoon.mark").add_file()
end, { desc = '[H]arpoon [a]dd' })
key('n', '<leader>hm', function()
require("harpoon.ui").toggle_quick_menu()
end, { desc = '[H]arpoon toggle quick [m]enu' })
key('n', '<leader>hj', function()
require("harpoon.ui").nav_next()
end, { desc = '[H]arpoon next (j)' })
key('n', '<leader>hk', function()
require("harpoon.ui").nav_prev()
end, { desc = '[H]arpoon prev (k)' })
for i = 1, 9, 1 do
key('n', '<M-' .. i .. '>', function()
require("harpoon.ui").nav_file(i)
end, { desc = '[H]arpoon nav_file [' .. i .. ']' })
end
for i = 1, 9, 1 do
key('n', '<leader>T' .. i, function()
require("harpoon.term").gotoTerminal(i)
end, { desc = '[H]arpoon nav_file [' .. i .. ']' })
end
-- colors
key('n', '<F6>', function()
if vim.o.background == "dark" then
vim.o.background = "light"
else
vim.o.background = "dark"
end
end)

View File

@@ -1,44 +0,0 @@
local actions = require "telescope.actions"
local action_state = require "telescope.actions.state"
local finders = require "telescope.finders"
local pickers = require "telescope.pickers"
local sorters = require "telescope.sorters"
local themes = require "telescope.themes"
local M = {}
local function enter(prompt_bufnr, action)
local selected = action_state.get_selected_entry()
actions.close(prompt_bufnr)
action(selected[1])
end
function M.tab_change_dir(opts)
opts = opts or {}
local action = opts.action or vim.cmd.tc
local prompt_title = opts.prompt_title or "Tab change directory"
local cmd = { 'find', os.getenv('HOME'), '-maxdepth', '5', '-type', 'd', '-not', '-path', '*/.git*' }
local dropdown = themes.get_dropdown();
local picker_opts = {
prompt_title = prompt_title,
finder = finders.new_oneshot_job(cmd, {}),
sorter = sorters.get_fuzzy_file({}),
attach_mappings = function(_, map)
map({ "i", "n" }, "<CR>", function(prompt_bufnr) enter(prompt_bufnr, action) end)
return true
end
}
local change_dir = pickers.new(dropdown, picker_opts)
change_dir:find()
end
local function tabnew_tcd(dir)
vim.cmd.tabnew(dir)
vim.cmd.tc(dir)
end
function M.tab_change_dir_newtab()
M.tab_change_dir({ action = tabnew_tcd, prompt_title = "Tab change directory (new tab)" })
end
return M

View File

@@ -1,41 +0,0 @@
local function cwd()
return vim.fn.getcwd()
end
return {
-- Colorscheme
{
'rmehri01/onenord.nvim',
config = function()
vim.cmd.colorscheme("onenord")
end
},
{
-- Statusline (see `:help lualine.txt`)
'nvim-lualine/lualine.nvim',
opts = {
options = {
icons_enabled = false,
theme = 'auto',
component_separators = '|',
section_separators = '',
},
sections = {
lualine_x = { cwd, 'encoding', 'fileformat', 'filetype' }
}
},
},
{
-- Indentation guides (see `:help indent_blankline.txt`)
'lukas-reineke/indent-blankline.nvim',
main = "ibl",
opts = {},
},
{
'norcalli/nvim-colorizer.lua',
cmd = 'ColorizerToggle'
},
}

View File

@@ -0,0 +1,7 @@
return {
opts = {
show_icons = false,
leader_key = "_",
buffer_leader_key = " m",
},
}

View File

@@ -1,71 +0,0 @@
return {
'hrsh7th/nvim-cmp',
event = 'InsertEnter',
dependencies = {
-- Snippet Engine & its associated nvim-cmp source
{
'L3MON4D3/LuaSnip',
build = (function()
if vim.fn.has 'win32' == 1 or vim.fn.executable 'make' == 0 then
return
end
return 'make install_jsregexp'
end)(),
},
'saadparwaiz1/cmp_luasnip',
-- Adds LSP completion capabilities
'hrsh7th/cmp-nvim-lsp',
'hrsh7th/cmp-path',
-- Adds a number of user-friendly snippets
'rafamadriz/friendly-snippets',
},
config = function()
-- See `:help cmp`
local cmp = require 'cmp'
local luasnip = require 'luasnip'
require('luasnip.loaders.from_vscode').lazy_load()
require('luasnip.loaders.from_lua').lazy_load({ paths = '~/.config/nvim/snippets' })
luasnip.config.setup {}
cmp.setup {
snippet = {
expand = function(args)
luasnip.lsp_expand(args.body)
end,
},
-- completion = { autocomplete = false },
completion = { completeopt = 'menu,menuone,noinsert' },
-- See `:help ins-completion`
mapping = cmp.mapping.preset.insert {
-- ['<C-l>'] = cmp.mapping.confirm({ select = true }),
['<C-n>'] = cmp.mapping.select_next_item(),
['<C-p>'] = cmp.mapping.select_prev_item(),
['<C-d>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-y>'] = cmp.mapping.confirm { select = true },
['<C-Space>'] = cmp.mapping.complete {},
-- <c-l> will move you to the right of each of the expansion locations.
-- <c-h> is similar, except moving you backwards.
['<C-l>'] = cmp.mapping(function()
if luasnip.expand_or_locally_jumpable() then
luasnip.expand_or_jump()
end
end, { 'i', 's' }),
['<C-h>'] = cmp.mapping(function()
if luasnip.locally_jumpable(-1) then
luasnip.jump(-1)
end
end, { 'i', 's' }),
},
sources = {
{ name = 'nvim_lsp' },
{ name = 'luasnip' },
{ name = 'path' },
},
}
end,
}

View File

@@ -0,0 +1,16 @@
return {
opts = {
specs = {
all = {
syntax = {
operator = "#bf8040",
},
},
},
},
init = function()
local cs = require("config.colorscheme")
cs.set_colorschemes("nightfox", "dayfox")
cs.update_colorscheme()
end,
}

View File

@@ -0,0 +1,11 @@
return {
opts = {
formatters_by_ft = {
lua = { "stylua" },
},
format_on_save = {
timeout_ms = 500,
lsp_format = "fallback",
},
},
}

View File

@@ -1,18 +0,0 @@
return {
{
'folke/which-key.nvim',
event = 'VimEnter',
config = function()
require('which-key').setup()
-- Document existing key chains
require('which-key').register {
['<leader>c'] = { name = '[C]ode/Color', _ = 'which_key_ignore' },
['<leader>d'] = { name = '[D]ocument', _ = 'which_key_ignore' },
['<leader>r'] = { name = '[R]ename', _ = 'which_key_ignore' },
['<leader>s'] = { name = '[S]earch', _ = 'which_key_ignore' },
['<leader>w'] = { name = '[W]orkspace', _ = 'which_key_ignore' },
}
end,
},
}

View File

@@ -1,22 +0,0 @@
return {
-- "gc" to comment visual regions/lines
{
'numToStr/Comment.nvim',
opts = {}
},
-- Undo browsing
'mbbill/undotree',
-- Tabstops autodetected
'tpope/vim-sleuth',
{
"kylechui/nvim-surround",
version = "*", -- Use for stability; omit to use `main` branch for the latest features
event = "VeryLazy",
config = function()
require("nvim-surround").setup({})
end
},
}

View File

@@ -0,0 +1,24 @@
return {
opts = {
modes = {
char = {
enabled = false,
},
},
},
init = function()
local set = vim.keymap.set
set({ "n", "x", "o" }, "\\", function()
require("flash").jump()
end, { desc = "Flash" })
set({ "n", "x", "o" }, "=", function()
require("flash").treesitter()
end, { desc = "Flash Treesitter" })
set({ "o" }, "r", function()
require("flash").remote()
end, { desc = "Remote Flash" })
set({ "n", "x", "o" }, " t", function()
require("flash").treesitter_search()
end, { desc = "Treesitter Search" })
end,
}

View File

@@ -1,32 +0,0 @@
return {
-- Git
'tpope/vim-fugitive',
{
-- Adds git releated signs to the gutter, as well as utilities for managing changes
'lewis6991/gitsigns.nvim',
opts = {
-- See `:help gitsigns.txt`
signs = {
add = { text = '+' },
change = { text = '~' },
delete = { text = '_' },
topdelete = { text = '' },
changedelete = { text = '~' },
},
on_attach = function(bufnr)
local gs = require('gitsigns')
vim.keymap.set('n', '<leader>gp', gs.prev_hunk,
{ buffer = bufnr, desc = '[G]o to [P]revious Hunk' })
vim.keymap.set('n', '<leader>gn', gs.next_hunk,
{ buffer = bufnr, desc = '[G]o to [N]ext Hunk' })
vim.keymap.set('n', '<leader>ph', gs.preview_hunk,
{ buffer = bufnr, desc = '[P]review [H]unk' })
vim.keymap.set('n', '<leader>sh', gs.stage_hunk,
{ buffer = bufnr, desc = '[S]tage [H]unk' })
vim.keymap.set('n', '<leader>HD', function() gs.diffthis('~') end,
{ buffer = bufnr, desc = '[H]unk [D]iff' })
end,
},
},
}

View File

@@ -1,13 +0,0 @@
return {
{
'ThePrimeagen/harpoon',
dependencies = { 'nvim-lua/plenary.nvim' },
lazy = true,
},
{
'crusj/hierarchy-tree-go.nvim',
dependencies = 'neovim/nvim-lspconfig',
lazy = true,
},
}

View File

@@ -1,115 +0,0 @@
return {
{
'neovim/nvim-lspconfig',
dependencies = {
-- Automatically install LSPs and related tools to stdpath for neovim
'williamboman/mason.nvim',
'williamboman/mason-lspconfig.nvim',
'WhoIsSethDaniel/mason-tool-installer.nvim',
'folke/neodev.nvim',
-- Useful status updates for LSP.
{ 'j-hui/fidget.nvim', opts = {} },
},
config = function()
vim.api.nvim_create_autocmd('LspAttach', {
group = vim.api.nvim_create_augroup('my-lsp-attach', { clear = true }),
callback = function(event)
local map = function(keys, func, desc)
vim.keymap.set('n', keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc })
end
map('gd', require('telescope.builtin').lsp_definitions, '[G]oto [D]efinition')
map('gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences')
map('gI', require('telescope.builtin').lsp_implementations, '[G]oto [I]mplementation')
map('<leader>D', require('telescope.builtin').lsp_type_definitions, 'Type [D]efinition')
map('<leader>ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols')
map('<leader>ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols')
map('<leader>rn', vim.lsp.buf.rename, '[R]e[n]ame')
map('<leader>ca', vim.lsp.buf.code_action, '[C]ode [A]ction')
map('K', vim.lsp.buf.hover, 'Hover Documentation')
map('<leader>K', vim.lsp.buf.signature_help, 'Signature Documentation')
map('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration')
-- Highlight references under cursor (clear highlight when cursor moves).
local client = vim.lsp.get_client_by_id(event.data.client_id)
if client and client.server_capabilities.documentHighlightProvider then
vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, {
buffer = event.buf,
callback = vim.lsp.buf.document_highlight,
})
vim.api.nvim_create_autocmd({ 'CursorMoved', 'CursorMovedI' }, {
buffer = event.buf,
callback = vim.lsp.buf.clear_references,
})
end
end,
})
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities = vim.tbl_deep_extend('force', capabilities, require('cmp_nvim_lsp').default_capabilities())
local servers = {
clangd = {},
gopls = {},
-- pyright = {},
rust_analyzer = {},
tsserver = {},
lua_ls = {
settings = {
Lua = {
runtime = { version = 'LuaJIT' },
workspace = { checkThirdParty = false },
telemetry = { enable = false },
completion = {
callSnippet = 'Replace',
},
},
},
},
html = {},
htmx = {},
unocss = {},
}
require 'lspconfig'.html.setup {
filetypes = { "html", "templ" },
}
require 'lspconfig'.htmx.setup {
filetypes = { "html", "templ" },
}
require 'lspconfig'.unocss.setup {
filetypes = { "html", "templ" },
}
-- Setup neovim lua configuration
require('neodev').setup()
require('mason').setup()
local ensure_installed = vim.tbl_keys(servers or {})
vim.list_extend(ensure_installed, {
'stylua', -- Used to format lua code
})
require('mason-tool-installer').setup { ensure_installed = ensure_installed }
require('mason-lspconfig').setup {
handlers = {
function(server_name)
local server = servers[server_name] or {}
-- This handles overriding only values explicitly passed
-- by the server configuration above. Useful when disabling
-- certain features of an LSP (for example, turning off formatting for tsserver)
server.capabilities = vim.tbl_deep_extend('force', {}, capabilities, server.capabilities or {})
require('lspconfig')[server_name].setup(server)
end,
},
}
end,
},
}

View File

@@ -0,0 +1,71 @@
return {
init = function(mc)
local set = vim.keymap.set
-- Add or skip cursor above/below the main cursor.
set({ "n", "x" }, "<c-k>", function()
mc.lineAddCursor(-1)
end)
set({ "n", "x" }, "<c-j>", function()
mc.lineAddCursor(1)
end)
set({ "n", "x" }, "<leader><c-k>", function()
mc.lineSkipCursor(-1)
end)
set({ "n", "x" }, "<leader><c-j>", function()
mc.lineSkipCursor(1)
end)
-- Add or skip adding a new cursor by matching word/selection
set({ "n", "x" }, "<c-n>", function()
mc.matchAddCursor(1)
end)
set({ "n", "x" }, "<leader><c-n>", function()
mc.matchSkipCursor(1)
end)
set({ "n", "x" }, "<c-p>", function()
mc.matchAddCursor(-1)
end)
set({ "n", "x" }, "<leader><c-p>", function()
mc.matchSkipCursor(-1)
end)
-- Add and remove cursors with control + left click.
set("n", "<c-leftmouse>", mc.handleMouse)
set("n", "<c-leftdrag>", mc.handleMouseDrag)
set("n", "<c-leftrelease>", mc.handleMouseRelease)
-- Disable and enable cursors.
set({ "n", "x" }, "<leader><c-q>", mc.toggleCursor)
-- Mappings defined in a keymap layer only apply when there are
-- multiple cursors. This lets you have overlapping mappings.
mc.addKeymapLayer(function(layerSet)
-- Select a different cursor as the main one.
layerSet({ "n", "x" }, "<left>", mc.prevCursor)
layerSet({ "n", "x" }, "<right>", mc.nextCursor)
-- Delete the main cursor.
layerSet({ "n", "x" }, "<leader>x", mc.deleteCursor)
-- Enable and clear cursors using escape.
layerSet("n", "<esc>", function()
if not mc.cursorsEnabled() then
mc.enableCursors()
else
mc.clearCursors()
end
end)
end)
-- Customize how cursors look.
local hl = vim.api.nvim_set_hl
hl(0, "MultiCursorCursor", { reverse = true })
hl(0, "MultiCursorVisual", { link = "Visual" })
hl(0, "MultiCursorSign", { link = "SignColumn" })
hl(0, "MultiCursorMatchPreview", { link = "Search" })
hl(0, "MultiCursorDisabledCursor", { reverse = true })
hl(0, "MultiCursorDisabledVisual", { link = "Visual" })
hl(0, "MultiCursorDisabledSign", { link = "SignColumn" })
end,
}

View File

@@ -0,0 +1,5 @@
return {
init = function()
vim.keymap.set("n", "<leader>-", "<cmd>Oil<cr>", { desc = "Oil file manager" })
end,
}

View File

@@ -0,0 +1,177 @@
return {
init = function()
local set = vim.keymap.set
set("n", "<leader><space>", function()
Snacks.picker.smart()
end, { desc = "Smart Find Files" })
set("n", "<leader><space>", function()
Snacks.picker.smart()
end, { desc = "Smart Find Files" })
set("n", "<leader>a", function()
Snacks.picker.buffers()
end, { desc = "Buffers" })
set("n", "<leader>r", function()
Snacks.picker.recent()
end, { desc = "Recent files" })
set("n", "<leader>R", function()
Snacks.picker.resume()
end, { desc = "Resume" })
set("n", "<leader>b", function()
Snacks.picker.lines()
end, { desc = "Buffer lines" })
set("n", "<leader>B", function()
Snacks.picker.grep_buffers()
end, { desc = "Grep Open Buffers" })
set("n", "<leader>f", function()
Snacks.picker.files()
end, { desc = "Find Files" })
set("n", "<leader>s", function()
Snacks.picker.grep()
end, { desc = "Grep" })
set("n", "<leader>S", function()
Snacks.picker.git_status()
end, { desc = "Git Status" })
set("n", "<leader>g", function()
Snacks.picker.git_files()
end, { desc = "Find Git Files" })
set("n", "<leader>G", function()
Snacks.picker.git_grep()
end, { desc = "Git Grep" })
set("n", "<leader>l", function()
Snacks.lazygit()
end, { desc = "Lazygit" })
set("n", "<leader>L", function()
Snacks.lazygit.log_file()
end, { desc = "Lazygit log file" })
set("n", "<leader>n", function()
Snacks.notifier.show_history()
end, { desc = "Notification History" })
set("n", "<leader>N", function()
Snacks.picker.notifications()
end, { desc = "Notifications" })
set("n", "<leader>C", function()
Snacks.picker.commands()
end, { desc = "Commands" })
set("n", "<leader>h", function()
Snacks.picker.keymaps()
end, { desc = "Keymaps" })
set("n", "<leader>:", function()
Snacks.picker.command_history()
end, { desc = "Command History" })
set("n", '<leader>"', function()
Snacks.picker.registers()
end, { desc = "Registers" })
set("n", "<leader>$", function()
Snacks.rename.rename_file()
end, { desc = "Rename File" })
set("n", "<leader>z", function()
Snacks.zen.zoom()
end, { desc = "Toggle Zoom" })
-- LSP
set("n", "gd", function()
Snacks.picker.lsp_definitions()
end, { desc = "Goto Definition" })
set("n", "gD", function()
Snacks.picker.lsp_declarations()
end, { desc = "Goto Declaration" })
set("n", "gr", function()
Snacks.picker.lsp_references()
end, { desc = "References" })
set("n", "gI", function()
Snacks.picker.lsp_implementations()
end, { desc = "Goto Implementation" })
set("n", "gy", function()
Snacks.picker.lsp_type_definitions()
end, { desc = "Goto T[y]pe Definition" })
set("n", "<leader>w", function()
Snacks.picker.lsp_symbols()
end, { desc = "LSP Symbols" })
set("n", "<leader>d", function()
Snacks.picker.diagnostics_buffer()
end, { desc = "Buffer Diagnostics" })
set("n", "<leader>D", function()
Snacks.picker.diagnostics()
end, { desc = "Diagnostics" })
set("n", "<leader>W", function()
Snacks.picker.lsp_workspace_symbols()
end, { desc = "LSP Workspace Symbols" })
-- Terminal
set({ "n", "t" }, "<c-/>", function()
Snacks.terminal()
end, { desc = "Toggle Terminal" })
set({ "n", "t" }, "<c-_>", function()
Snacks.terminal()
end, { desc = "which_key_ignore" })
vim.api.nvim_create_autocmd("VimEnter", {
callback = function()
-- Setup some globals for debugging (lazy-loaded)
_G.dd = function(...)
Snacks.debug.inspect(...)
end
_G.bt = function()
Snacks.debug.backtrace()
end
-- Override print to use snacks for `:=` command
if vim.fn.has("nvim-0.11") == 1 then
vim._print = function(_, ...)
dd(...)
end
else
vim.print = _G.dd
end
-- Create some toggle mappings
Snacks.toggle.option("spell", { name = "Spelling" }):map("<leader>us")
Snacks.toggle.option("wrap", { name = "Wrap" }):map("<leader>uw")
Snacks.toggle.option("relativenumber", { name = "Relative Number" }):map("<leader>uL")
Snacks.toggle.diagnostics():map("<leader>ud")
Snacks.toggle.line_number():map("<leader>ul")
Snacks.toggle
.option("conceallevel", { off = 0, on = vim.o.conceallevel > 0 and vim.o.conceallevel or 2 })
:map("<leader>uc")
Snacks.toggle.treesitter():map("<leader>uT")
Snacks.toggle
.option("background", { off = "light", on = "dark", name = "Dark Background" })
:map("<leader>ub")
Snacks.toggle.inlay_hints():map("<leader>uh")
Snacks.toggle.indent():map("<leader>ug")
Snacks.toggle.dim():map("<leader>uD")
end,
})
end,
}

View File

@@ -1,28 +0,0 @@
local function get_tab_idx(tab_id)
for i, tabnr in ipairs(vim.api.nvim_list_tabpages()) do
if tabnr == tab_id then
return i
end
end
return -1
end
return {
'LukasPietzschmann/telescope-tabs',
dependencies = { 'nvim-telescope/telescope.nvim' },
lazy = true,
config = function()
require 'telescope-tabs'.setup {
entry_formatter = function(tab_id, buffer_ids, file_names, file_paths, is_current)
local cwd = vim.fn.getcwd(-1, get_tab_idx(tab_id))
local entry_string = table.concat(file_names, ', ')
return string.format('%d: %s %s%s', tab_id, cwd, entry_string, is_current and ' <' or '')
end,
entry_ordinal = function(tab_id, buffer_ids, file_names, file_paths, is_current)
local cwd = vim.fn.getcwd(-1, get_tab_idx(tab_id))
local entry_string = table.concat(file_names, ', ')
return string.format('%s %s', cwd, entry_string)
end,
}
end
}

View File

@@ -1,94 +0,0 @@
return {
{ -- Fuzzy Finder (files, lsp, etc)
'nvim-telescope/telescope.nvim',
event = 'VimEnter',
branch = '0.1.x',
dependencies = {
'nvim-lua/plenary.nvim',
{ -- If encountering errors, see telescope-fzf-native README for install instructions
'nvim-telescope/telescope-fzf-native.nvim',
build = 'make',
cond = function()
return vim.fn.executable 'make' == 1
end,
},
{ 'nvim-telescope/telescope-ui-select.nvim' },
-- change directory with telescope from a list of directories
{
"SalOrak/whaler",
opts = {
directories = { "/home/lupan/src" },
oneoff_directories = { "/home/lupan/dotfiles" },
auto_file_explorer = false,
auto_cwd = true,
}
},
-- Icons, requires Nerd font.
{ 'nvim-tree/nvim-web-devicons' },
},
config = function()
local telescope = require 'telescope'
-- To list available key bindings inside given telescope picker:
-- - Insert mode: <c-/>
-- - Normal mode: ?
telescope.setup {
extensions = {
['ui-select'] = {
require('telescope.themes').get_dropdown(),
},
whaler = {
directories = { "/home/lupan/src" },
oneoff_directories = { "/home/lupan/dotfiles" },
auto_file_explorer = false,
auto_cwd = true,
}
},
}
pcall(telescope.load_extension, 'fzf')
pcall(telescope.load_extension, 'ui-select')
pcall(telescope.load_extension, 'whaler')
-- See `:help telescope.builtin`
local builtin = require 'telescope.builtin'
vim.keymap.set('n', '<leader>sh', builtin.help_tags, { desc = '[S]earch [H]elp' })
vim.keymap.set('n', '<leader>sk', builtin.keymaps, { desc = '[S]earch [K]eymaps' })
vim.keymap.set('n', '<leader>sf', builtin.find_files, { desc = '[S]earch [F]iles' })
vim.keymap.set('n', '<leader>ss', builtin.builtin, { desc = '[S]earch [S]elect Telescope' })
vim.keymap.set('n', '<leader>sw', builtin.grep_string, { desc = '[S]earch current [W]ord' })
vim.keymap.set('n', '<leader>sg', builtin.live_grep, { desc = '[S]earch by [G]rep' })
vim.keymap.set('n', '<leader>sd', builtin.diagnostics, { desc = '[S]earch [D]iagnostics' })
vim.keymap.set('n', '<leader>sr', builtin.resume, { desc = '[S]earch [R]esume' })
vim.keymap.set('n', '<leader>s.', builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' })
vim.keymap.set('n', '<leader><leader>', builtin.buffers, { desc = '[ ] Find existing buffers' })
vim.keymap.set('n', '<leader>sF', function() builtin.find_files { hidden = true } end,
{ desc = '[S]earch [F]iles (with hidden)' })
vim.keymap.set('n', '<leader>sl', function() telescope.extensions.whaler.whaler() end,
{ desc = '[S]earch with wha[L]er' })
vim.keymap.set('n', '<leader>gf', builtin.git_files, { desc = '[G]it [F]iles' })
vim.keymap.set('n', '<leader>gs', builtin.git_status, { desc = '[G]it [S]tatus' })
vim.keymap.set('n', '<leader>/', function()
builtin.current_buffer_fuzzy_find(require('telescope.themes').get_dropdown {
winblend = 10,
previewer = false,
})
end, { desc = '[/] Fuzzily search in current buffer' })
vim.keymap.set('n', '<leader>s/', function()
builtin.live_grep {
grep_open_files = true,
prompt_title = 'Live Grep in Open Files',
}
end, { desc = '[S]earch [/] in Open Files' })
vim.keymap.set('n', '<leader>sn', function()
builtin.find_files { cwd = vim.fn.stdpath 'config' }
end, { desc = '[S]earch [N]eovim files' })
end,
}
}

View File

@@ -1,94 +1,62 @@
return {
{ -- Highlight, edit, and navigate code
'nvim-treesitter/nvim-treesitter',
dependencies = {
'nvim-treesitter/nvim-treesitter-textobjects',
'nvim-orgmode/orgmode', -- as configured together
'vrischmann/tree-sitter-templ',
"nushell/tree-sitter-nu", -- additional parser
},
build = ':TSUpdate',
config = function()
-- See `:help nvim-treesitter`
local org = require('orgmode')
org.setup_ts_grammar()
---@diagnostic disable-next-line: missing-fields
require('nvim-treesitter.configs').setup {
ensure_installed = { 'c', 'cpp', 'go', 'haskell', 'lua', 'org', 'python', 'rust', 'tsx', 'templ', 'typescript', 'vimdoc', 'vim' },
auto_install = false,
highlight = {
enable = true,
additional_vim_regex_highlighting = { 'org' },
},
indent = { enable = true },
incremental_selection = {
enable = true,
keymaps = {
init_selection = '<c-space>',
node_incremental = '<c-space>',
scope_incremental = '<c-s>',
node_decremental = '<C-p>',
},
},
textobjects = {
select = {
enable = true,
lookahead = true,
keymaps = {
['aa'] = '@parameter.outer',
['ia'] = '@parameter.inner',
['af'] = '@function.outer',
['if'] = '@function.inner',
['ac'] = '@class.outer',
['ic'] = '@class.inner',
['al'] = '@call.outer',
['il'] = '@call.inner',
['ao'] = '@loop.outer',
['io'] = '@loop.inner',
['ar'] = '@return.outer',
['ir'] = '@return.inner',
['as'] = '@statement.outer',
['ag'] = '@assignment.outer',
['ig'] = '@assignment.inner',
},
},
move = {
enable = true,
set_jumps = true,
goto_next_start = {
[']m'] = '@function.outer',
[']]'] = '@class.outer',
},
goto_next_end = {
[']M'] = '@function.outer',
[']['] = '@class.outer',
},
goto_previous_start = {
['[m'] = '@function.outer',
['[['] = '@class.outer',
},
goto_previous_end = {
['[M'] = '@function.outer',
['[]'] = '@class.outer',
},
},
swap = {
enable = true,
swap_next = {
['<leader>a'] = '@parameter.inner',
},
swap_previous = {
['<leader>A'] = '@parameter.inner',
},
},
},
}
org.setup({
org_agenda_files = { '~/org/*.org' },
org_default_notes_file = '~/org/capture.org',
})
end,
}
main = "nvim-treesitter.configs",
opts = {
highlight = {
enable = true,
},
textobjects = {
select = {
enable = true,
lookahead = true,
keymaps = {
["aa"] = "@parameter.outer",
["ia"] = "@parameter.inner",
["af"] = "@function.outer",
["if"] = "@function.inner",
["ac"] = "@class.outer",
["ic"] = "@class.inner",
["al"] = "@call.outer",
["il"] = "@call.inner",
["ao"] = "@loop.outer",
["io"] = "@loop.inner",
["ad"] = "@conditional.outer",
["id"] = "@conditional.inner",
["ar"] = "@return.outer",
["ir"] = "@return.inner",
["as"] = "@statement.outer",
["ag"] = "@assignment.outer",
["ig"] = "@assignment.inner",
},
},
move = {
enable = true,
set_jumps = true,
goto_next_start = {
["]m"] = "@function.outer",
["]]"] = "@class.outer",
},
goto_next_end = {
["]M"] = "@function.outer",
["]["] = "@class.outer",
},
goto_previous_start = {
["[m"] = "@function.outer",
["[["] = "@class.outer",
},
goto_previous_end = {
["[M"] = "@function.outer",
["[]"] = "@class.outer",
},
},
swap = {
enable = true,
swap_next = {
["<leader>p"] = "@parameter.inner",
},
swap_previous = {
["<leader>P"] = "@parameter.inner",
},
},
},
},
}

View File

@@ -1,3 +0,0 @@
return {
s("ct", t "-- TODO: ")
}

View File

@@ -16,7 +16,7 @@ static const char col_cyan[] = "#7dcfff";
static const char *colors[][3] = {
/* fg bg border */
[SchemeNorm] = { col_gray3, col_gray1, col_gray2 },
[SchemeSel] = { col_gray4, col_blue, col_cyan },
[SchemeSel] = { col_gray4, col_blue, col_cyan },
};
/* tagging */
@@ -46,7 +46,7 @@ static const Layout layouts[] = {
};
/* key definitions */
#define MODKEY Mod1Mask
#define MODKEY Mod4Mask
#define TAGKEYS(KEY,TAG) \
{ MODKEY, KEY, view, {.ui = 1 << TAG} }, \
{ MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \
@@ -58,32 +58,32 @@ static const Layout layouts[] = {
/* commands */
static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */
static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_blue, "-sf", col_gray4, NULL };
static const char *termcmd[] = { "st", NULL };
static const char *lockcmd[] = { "slock", NULL };
static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_blue, "-sf", col_gray4, NULL };
static const char *termcmd[] = { "st", NULL };
static const char *lockcmd[] = { "slock", NULL };
static const char *suspendcmd[] = { "systemctl", "suspend", NULL };
static const char *toggletheme[] = { "lupan-set-theme", "toggle", NULL };
static const Key keys[] = {
/* modifier key function argument */
{ MODKEY|ControlMask, XK_p, spawn, {.v = dmenucmd } },
{ MODKEY, XK_p, spawn, {.v = dmenucmd } },
{ MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } },
{ MODKEY|ControlMask|ShiftMask, XK_l, spawn, {.v = lockcmd } },
{ MODKEY|ControlMask|ShiftMask, XK_s, spawn, {.v = suspendcmd } },
{ MODKEY|ShiftMask, XK_F6, spawn, {.v = toggletheme } },
{ MODKEY|ControlMask, XK_b, togglebar, {0} },
{ MODKEY|ControlMask, XK_j, focusstack, {.i = +1 } },
{ MODKEY|ControlMask, XK_k, focusstack, {.i = -1 } },
{ MODKEY|ControlMask, XK_i, incnmaster, {.i = +1 } },
{ MODKEY|ControlMask, XK_d, incnmaster, {.i = -1 } },
{ MODKEY|ControlMask, XK_h, setmfact, {.f = -0.05} },
{ MODKEY|ControlMask, XK_l, setmfact, {.f = +0.05} },
{ MODKEY, XK_b, togglebar, {0} },
{ MODKEY, XK_j, focusstack, {.i = +1 } },
{ MODKEY, XK_k, focusstack, {.i = -1 } },
{ MODKEY, XK_i, incnmaster, {.i = +1 } },
{ MODKEY, XK_d, incnmaster, {.i = -1 } },
{ MODKEY, XK_h, setmfact, {.f = -0.05} },
{ MODKEY, XK_l, setmfact, {.f = +0.05} },
{ MODKEY, XK_Return, zoom, {0} },
{ MODKEY, XK_Tab, view, {0} },
{ MODKEY|ControlMask|ShiftMask, XK_c, killclient, {0} },
{ MODKEY|ControlMask, XK_t, setlayout, {.v = &layouts[0]} },
{ MODKEY|ControlMask, XK_f, setlayout, {.v = &layouts[1]} },
{ MODKEY|ControlMask, XK_m, setlayout, {.v = &layouts[2]} },
{ MODKEY|ShiftMask, XK_c, killclient, {0} },
{ MODKEY, XK_t, setlayout, {.v = &layouts[0]} },
{ MODKEY, XK_f, setlayout, {.v = &layouts[1]} },
{ MODKEY, XK_m, setlayout, {.v = &layouts[2]} },
{ MODKEY, XK_space, setlayout, {0} },
{ MODKEY|ShiftMask, XK_space, togglefloating, {0} },
{ MODKEY, XK_0, view, {.ui = ~0 } },
@@ -101,7 +101,7 @@ static const Key keys[] = {
TAGKEYS( XK_7, 6)
TAGKEYS( XK_8, 7)
TAGKEYS( XK_9, 8)
{ MODKEY|ControlMask|ShiftMask, XK_q, quit, {0} },
{ MODKEY|ShiftMask, XK_q, quit, {0} },
};
/* button definitions */

View File

@@ -0,0 +1,197 @@
;==========================================================
;
;
; ██████╗ ██████╗ ██╗ ██╗ ██╗██████╗ █████╗ ██████╗
; ██╔══██╗██╔═══██╗██║ ╚██╗ ██╔╝██╔══██╗██╔══██╗██╔══██╗
; ██████╔╝██║ ██║██║ ╚████╔╝ ██████╔╝███████║██████╔╝
; ██╔═══╝ ██║ ██║██║ ╚██╔╝ ██╔══██╗██╔══██║██╔══██╗
; ██║ ╚██████╔╝███████╗██║ ██████╔╝██║ ██║██║ ██║
; ╚═╝ ╚═════╝ ╚══════╝╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝
;
;
; To learn more about how to configure Polybar
; go to https://github.com/polybar/polybar
;
; The README contains a lot of information
;
;==========================================================
[common]
priv = false
[colors]
background = #282A2E
background-alt = #373B41
foreground = #C5C8C6
primary = #F0C674
secondary = #8ABEB7
alert = #A54242
disabled = #707880
[bar/bar]
monitor = ${env:MONITOR:}
width = 100%
height = 24pt
radius = 6
; dpi = 96
background = ${colors.background}
foreground = ${colors.foreground}
line-size = 3pt
border-size = 4pt
border-color = #00000000
padding-left = 0
padding-right = 1
module-margin = 1
separator = |
separator-foreground = ${colors.disabled}
font-0 = Fira Code Nerd Font:size=18;4
modules-left = xworkspaces xwindow
modules-right = filesystem pulseaudio xkeyboard memory cpu wlan eth date
cursor-click = pointer
cursor-scroll = ns-resize
enable-ipc = true
; wm-restack = generic
; wm-restack = bspwm
; wm-restack = i3
; override-redirect = true
; This module is not active by default (to enable it, add it to one of the
; modules-* list above).
; Please note that only a single tray can exist at any time. If you launch
; multiple bars with this module, only a single one will show it, the others
; will produce a warning. Which bar gets the module is timing dependent and can
; be quite random.
; For more information, see the documentation page for this module:
; https://polybar.readthedocs.io/en/stable/user/modules/tray.html
[module/systray]
type = internal/tray
format-margin = 8pt
tray-spacing = 16pt
[module/xworkspaces]
type = internal/xworkspaces
group-by-monitor = false
label-active = %name%
label-active-background = ${colors.background-alt}
label-active-underline= ${colors.primary}
label-active-padding = 1
label-occupied = %name%
label-occupied-padding = 1
label-urgent = %name%
label-urgent-background = ${colors.alert}
label-urgent-padding = 1
label-empty = %name%
label-empty-foreground = ${colors.disabled}
label-empty-padding = 1
[module/xwindow]
type = internal/xwindow
label = %title:0:60:...%
[module/filesystem]
type = internal/fs
interval = 25
mount-0 = /
label-mounted = %{F#F0C674}%mountpoint%%{F-} %percentage_used%%
label-unmounted = %mountpoint% not mounted
label-unmounted-foreground = ${colors.disabled}
[module/pulseaudio]
type = internal/pulseaudio
format-volume-prefix = "VOL "
format-volume-prefix-foreground = ${colors.primary}
format-volume = <label-volume>
label-volume = %percentage%%
label-muted = muted
label-muted-foreground = ${colors.disabled}
click-middle = "polybar-msg action eth module_toggle; polybar-msg action wlan module_toggle"
click-right = pavucontrol
[module/xkeyboard]
type = internal/xkeyboard
blacklist-0 = num lock
label-layout = %layout%
label-layout-foreground = ${colors.primary}
label-indicator-padding = 2
label-indicator-margin = 1
label-indicator-foreground = ${colors.background}
label-indicator-background = ${colors.secondary}
[module/memory]
type = internal/memory
interval = 2
format-prefix = "RAM "
format-prefix-foreground = ${colors.primary}
label = %percentage_used:2%%
[module/cpu]
type = internal/cpu
interval = 2
format-prefix = "CPU "
format-prefix-foreground = ${colors.primary}
label = %percentage:2%%
[module/temperature]
type = internal/temperature
[network-base]
type = internal/network
interval = 5
format-connected = <label-connected>
format-disconnected = <label-disconnected>
label-disconnected = %{F#F0C674}%ifname%%{F#707880} disconnected
hidden = ${common.priv}
[module/wlan]
inherit = network-base
interface-type = wireless
label-connected = %{F#F0C674}%ifname%%{F-} %essid% %local_ip%
[module/eth]
inherit = network-base
interface-type = wired
label-connected = %{F#F0C674}%ifname%%{F-} %local_ip%
[module/date]
type = internal/date
interval = 1
date = %H:%M
date-alt = %Y-%m-%d %H:%M:%S
label = %date%
label-foreground = ${colors.primary}
[settings]
screenchange-reload = true
pseudo-transparency = true
; vim:ft=dosini

33
river/.config/river/bar Executable file
View File

@@ -0,0 +1,33 @@
#!/usr/bin/env sh
FIFO="$XDG_RUNTIME_DIR/sandbar"
run() {
echo run
[ -e "$FIFO" ] && rm -f "$FIFO"
mkfifo "$FIFO"
"$HOME/.config/river/status" &
while cat "$FIFO"; do :; done | sandbar \
-font "FiraCode Nerd Font Ret:size=10" \
-active-fg-color "#000000" \
-active-bg-color "#e8c47d" \
-inactive-fg-color "#e8c47d" \
-inactive-bg-color "#000000" \
-urgent-fg-color "#000000" \
-urgent-bg-color "#cc241d" \
-title-fg-color "#000000" \
-title-bg-color "#e8c47d"
}
while true; do
run
CODE=$?
if [ $CODE -ne 139 && $CODE -ne 134 ]; then
echo exit because $CODE
exit
fi
echo sleep and continue
sleep 1
done

20
river/.config/river/init Executable file
View File

@@ -0,0 +1,20 @@
#!/bin/sh
LOCK_COMMAND='swaylock -f -c 1f7693'
RANDR_COMMAND='${HOME}/.config/river/randr --on'
RANDR_OFF_COMMAND='${HOME}/.config/river/randr --off'
riverctl spawn "${RANDR_COMMAND}"
"${HOME}/.config/river/keymap"
# Set the default layout generator to be rivertile and start it.
# River will send the process group of the init executable SIGTERM on exit.
riverctl default-layout rivertile
rivertile -view-padding 1 -outer-padding 0 &
riverctl spawn "${HOME}/.config/river/bar"
riverctl spawn "swayidle -w timeout 300 '${LOCK_COMMAND}' \
timeout 330 '${RANDR_OFF_COMMAND}' resume '${RANDR_COMMAND}' \
before-sleep '${LOCK_COMMAND}' after-resume '${RANDR_COMMAND}'"

164
river/.config/river/keymap Executable file
View File

@@ -0,0 +1,164 @@
#!/bin/sh
LOCK_COMMAND='swaylock -f -c 1f7693'
# Note: the "Super" modifier is also known as Logo, GUI, Windows, Mod4, etc.
# Super+Shift+Return to start an instance of foot (https://codeberg.org/dnkl/foot)
riverctl map normal Super+Shift Return spawn alacritty
riverctl map normal Super+Alt Return spawn alacritty
riverctl map normal Super P spawn "wofi -S run"
# Super+Q to close the focused view
riverctl map normal Super Q close
# Super+Shift+E to exit river
riverctl map normal Super+Shift E exit
# Super+J and Super+K to focus the next/previous view in the layout stack
riverctl map normal Super J focus-view next
riverctl map normal Super K focus-view previous
# Super+Shift+J and Super+Shift+K to swap the focused view with the next/previous
# view in the layout stack
riverctl map normal Super+Shift J swap next
riverctl map normal Super+Shift K swap previous
# Super+Period and Super+Comma to focus the next/previous output
riverctl map normal Super Period focus-output next
riverctl map normal Super Comma focus-output previous
# Super+Shift+{Period,Comma} to send the focused view to the next/previous output
riverctl map normal Super+Shift Period send-to-output next
riverctl map normal Super+Shift Comma send-to-output previous
# Super+Return to bump the focused view to the top of the layout stack
riverctl map normal Super Return zoom
# Super+H and Super+L to decrease/increase the main ratio of rivertile(1)
riverctl map normal Super H send-layout-cmd rivertile "main-ratio -0.05"
riverctl map normal Super L send-layout-cmd rivertile "main-ratio +0.05"
# Super+Shift+H and Super+Shift+L to increment/decrement the main count of rivertile(1)
riverctl map normal Super+Shift H send-layout-cmd rivertile "main-count +1"
riverctl map normal Super+Shift L send-layout-cmd rivertile "main-count -1"
# Super+Alt+{H,J,K,L} to move views
riverctl map normal Super+Alt H move left 100
riverctl map normal Super+Alt J move down 100
riverctl map normal Super+Alt K move up 100
riverctl map normal Super+Alt L move right 100
# Super+Alt+Control+{H,J,K,L} to snap views to screen edges
riverctl map normal Super+Alt+Control H snap left
riverctl map normal Super+Alt+Control J snap down
riverctl map normal Super+Alt+Control K snap up
riverctl map normal Super+Alt+Control L snap right
# Super+Alt+Shift+{H,J,K,L} to resize views
riverctl map normal Super+Alt+Shift H resize horizontal -100
riverctl map normal Super+Alt+Shift J resize vertical 100
riverctl map normal Super+Alt+Shift K resize vertical -100
riverctl map normal Super+Alt+Shift L resize horizontal 100
# Super + Left Mouse Button to move views
riverctl map-pointer normal Super BTN_LEFT move-view
# Super + Right Mouse Button to resize views
riverctl map-pointer normal Super BTN_RIGHT resize-view
# Super + Middle Mouse Button to toggle float
riverctl map-pointer normal Super BTN_MIDDLE toggle-float
for i in $(seq 1 9)
do
tags=$((1 << ($i - 1)))
# Super+[1-9] to focus tag [0-8]
riverctl map normal Super $i set-focused-tags $tags
# Super+Shift+[1-9] to tag focused view with tag [0-8]
riverctl map normal Super+Shift $i set-view-tags $tags
# Super+Control+[1-9] to toggle focus of tag [0-8]
riverctl map normal Super+Control $i toggle-focused-tags $tags
# Super+Shift+Control+[1-9] to toggle tag [0-8] of focused view
riverctl map normal Super+Shift+Control $i toggle-view-tags $tags
done
# Super+0 to focus all tags
# Super+Shift+0 to tag focused view with all tags
all_tags=$(((1 << 32) - 1))
riverctl map normal Super 0 set-focused-tags $all_tags
riverctl map normal Super+Shift 0 set-view-tags $all_tags
# Super+Space to toggle float
riverctl map normal Super Space toggle-float
# Super+F to toggle fullscreen
riverctl map normal Super F toggle-fullscreen
# Super+{Up,Right,Down,Left} to change layout orientation
riverctl map normal Super Up send-layout-cmd rivertile "main-location top"
riverctl map normal Super Right send-layout-cmd rivertile "main-location right"
riverctl map normal Super Down send-layout-cmd rivertile "main-location bottom"
riverctl map normal Super Left send-layout-cmd rivertile "main-location left"
# Declare a passthrough mode. This mode has only a single mapping to return to
# normal mode. This makes it useful for testing a nested wayland compositor
riverctl declare-mode passthrough
# Super+F11 to enter passthrough mode
riverctl map normal Super F11 enter-mode passthrough
# Super+F11 to return to normal mode
riverctl map passthrough Super F11 enter-mode normal
# Various media key mapping examples for both normal and locked mode which do
# not have a modifier
for mode in normal locked
do
# Eject the optical drive (well if you still have one that is)
riverctl map $mode None XF86Eject spawn 'eject -T'
# Control pulse audio volume with pamixer (https://github.com/cdemoulins/pamixer)
riverctl map $mode None XF86AudioRaiseVolume spawn 'pamixer -i 5'
riverctl map $mode None XF86AudioLowerVolume spawn 'pamixer -d 5'
riverctl map $mode None XF86AudioMute spawn 'pamixer --toggle-mute'
# Control MPRIS aware media players with playerctl (https://github.com/altdesktop/playerctl)
riverctl map $mode None XF86AudioMedia spawn 'playerctl play-pause'
riverctl map $mode None XF86AudioPlay spawn 'playerctl play-pause'
riverctl map $mode None XF86AudioPrev spawn 'playerctl previous'
riverctl map $mode None XF86AudioNext spawn 'playerctl next'
# Control screen backlight brightness with brightnessctl (https://github.com/Hummer12007/brightnessctl)
riverctl map $mode None XF86MonBrightnessUp spawn 'brightnessctl set +5%'
riverctl map $mode None XF86MonBrightnessDown spawn 'brightnessctl set 5%-'
done
riverctl map normal Super A focus-previous-tags
riverctl map normal Super+Control+Shift L spawn "${LOCK_COMMAND}"
riverctl map normal Super+Control+Shift S spawn "systemctl suspend"
riverctl map normal Super+Alt O spawn "${LOCK_COMMAND}"
riverctl map normal Super+Alt S spawn "systemctl suspend"
riverctl map normal Super+Alt T spawn "${HOME}/bin/lupan-set-theme toggle"
# Set background and border color
riverctl background-color 0x002b36
riverctl border-color-focused 0xac7853
riverctl border-color-unfocused 0x5387ac
riverctl keyboard-layout -options ctrl:nocaps pl
# Set keyboard repeat rate
riverctl set-repeat 50 300
# Make all views with an app-id that starts with "float" and title "foo" start floating.
riverctl rule-add -app-id 'float*' -title 'foo' float
# Make all views with app-id "bar" and any title use client-side decorations
riverctl rule-add -app-id "bar" csd

21
river/.config/river/randr Executable file
View File

@@ -0,0 +1,21 @@
#!/usr/bin/env sh
repeat() {
for x in {0..10}; do
echo "$@"
"$@"
sleep 1
done
}
case "$1" in
--on)
repeat wlr-randr --output DP-1 --on --scale 2 --pos 0,0 &
repeat wlr-randr --output DP-2 --on --scale 2 --pos 1920,0 &
sleep 10
;;
--off)
wlr-randr --output DP-1 --off
wlr-randr --output DP-2 --off
;;
esac

52
river/.config/river/status Executable file
View File

@@ -0,0 +1,52 @@
#!/bin/env sh
cpu() {
cpu="$(grep -o "^[^ ]*" /proc/loadavg)"
}
memory() {
memory="$(free -h | sed -n "2s/\([^ ]* *\)\{2\}\([^ ]*\).*/\2/p")"
}
disk() {
disk="$(df -h | awk 'NR==2{print $4}')"
}
datetime() {
datetime="$(date "+%F %H:%M")"
}
bat() {
read -r bat_status </sys/class/power_supply/BAT0/status
read -r bat_capacity </sys/class/power_supply/BAT0/capacity
bat="$bat_status $bat_capacity%"
}
vol() {
vol="$([ "$(pamixer --get-mute)" = "false" ] && printf "%s%%" "$(pamixer --get-volume)" || printf '-')"
}
display() {
echo "all status [$memory $cpu $disk] [$bat] [$vol] [$datetime]" >"$FIFO"
}
printf "%s" "$$" > "$XDG_RUNTIME_DIR/status_pid"
FIFO="$XDG_RUNTIME_DIR/sandbar"
[ -e "$FIFO" ] || mkfifo "$FIFO"
sec=0
while true; do
sleep 1 &
wait && {
[ $((sec % 15)) -eq 0 ] && memory
[ $((sec % 15)) -eq 0 ] && cpu
[ $((sec % 15)) -eq 0 ] && disk
[ $((sec % 60)) -eq 0 ] && bat
[ $((sec % 5)) -eq 0 ] && vol
[ $((sec % 5)) -eq 0 ] && datetime
[ $((sec % 5)) -eq 0 ] && display
sec=$((sec + 1))
}
done

View File

@@ -5,7 +5,12 @@
# If not running interactively, don't do anything
[[ $- != *i* ]] && return
which nu >/dev/null && exec nu
alias ls='ls --color=auto'
PS1='[\u@\h \W]\$ '
PS1='\e[34m\u@\h\e[0m \e[32m\W\e[0m \$ '
function before_command() { echo -ne '\e[2 q'; }
trap before_command DEBUG
if [[ -f /usr/share/bash-completion/bash_completion ]]; then
. /usr/share/bash-completion/bash_completion
fi

View File

@@ -1,13 +1,64 @@
alias v=nvim
alias ll='ls -l'
alias ta='tmux attach -t'
alias tl='tmux list-sessions'
alias tn='tmux new -s'
alias rgh='rg -.'
alias fdh='fd -H'
alias lg=lazygit
if which exa > /dev/null; then
if alias st > /dev/null; then
alias gst='_vcs status'
unalias st
fi
if alias r > /dev/null; then
unalias r
fi
if which eza > /dev/null; then
alias ls='eza --icons'
alias tree='eza --tree --icons'
elif which exa > /dev/null; then
alias ls='exa --icons'
alias tree='exa --tree --icons'
fi
alias nocaps='setxkbmap pl -option ctrl:nocaps'
alias fixdp='xrandr --output DP-0 --right-of DP-2'
tn() {
if [ $# -eq 0 ]; then
tmux new
else
tmux new -A -s "$@"
fi
}
tni() {
local Q="${@:-}"
local DIR=$(zoxide query -l | vis-menu -p 'Dir:' -l 10 "$Q")
if [ -n "$DIR" ]; then
local NAME=$(echo | vis-menu -p 'Session name:' $(basename $DIR))
if [ -n "$DIR" ]; then
tmux new -A -s "$NAME" -c "$DIR"
fi
fi
}
ta() {
if [ $# -eq 0 ]; then
tmux attach
else
tmux attach -t "$@"
fi
}
tai() {
local Q="${@:-}"
local NAME=$(tmux ls | vis-menu -p 'Session:' -l 10 "$Q" | cut -d: -f1)
if [ -n "$NAME" ]; then
tmux attach -t "$NAME"
fi
}
vf() {
nvim $(fzf --multi)
}

View File

@@ -0,0 +1,3 @@
#!/bin/sh
[ -e ~/.profile ] && . ~/.profile

17
shell/.config/yash/rc Normal file
View File

@@ -0,0 +1,17 @@
# Firstly, load the common customization script.
. --autoload --no-alias initialization/common
LANG=pl_PL.UTF-8
set -o vi
[ -e ~/.config/shellconfig/aliases.sh ] && . ~/.config/shellconfig/aliases.sh
# Clear the screen with Ctrl-L.
bindkey --emacs '\^L' clear-and-redraw-all
bindkey --vi-insert '\^L' clear-and-redraw-all
bindkey --vi-command '\^L' clear-and-redraw-all
# And add your own customization below.
eval "$(zoxide init posix --hook prompt)"

View File

@@ -3,3 +3,9 @@ set show-mode-in-prompt on
set vi-ins-mode-string \1\e[6 q\2
set vi-cmd-mode-string \1\e[2 q\2
set keymap vi-command
"k": history-substring-search-backward
"j": history-substring-search-forward
set keymap vi-insert
"\C-l": clear-screen

View File

@@ -8,8 +8,10 @@
# for ssh logins, install and configure the libpam-umask package.
#umask 022
export EDITOR=nvim
export VISUAL=nvim
export LANG=pl_PL.UTF-8
export EDITOR=vis
export VISUAL=vis
# if running bash
if [ -n "$BASH_VERSION" ]; then
@@ -28,10 +30,14 @@ done
export PATH
# start X or Hyprland at login
if [[ -z "$DISPLAY" && -z "$WAYLAND_DISPLAY" && "$XDG_VTNR" -eq 1 ]]; then
if which /usr/bin/Hyprland > /dev/null; then
exec /usr/bin/Hyprland
elif which /usr/bin/sx > /dev/null; then
if [ -z "$DISPLAY" -a -z "$WAYLAND_DISPLAY" -a "$(tty)" = /dev/tty1 ]; then
if which /usr/bin/sx > /dev/null; then
exec /usr/bin/sx ~/.xsession
elif which /usr/bin/startx > /dev/null; then
exec /usr/bin/startx ~/.xsession
elif which Hyprland > /dev/null && [ -d ~/.config/hypr ]; then
exec Hyprland
elif which river > /dev/null && [ -d ~/.config/river ]; then
exec river
fi
fi

View File

@@ -2,9 +2,11 @@
# % cd ~/.local/share
# % git clone https://github.com/zap-zsh/zap.git --branch=release-v1
export FZF_DEFAULT_OPTS='--color=bw,hl:green,hl+:green'
export FZF_DEFAULT_OPTS='--color=bg+:#808080'
zstyle ':fzf-tab:*' fzf-flags $FZF_DEFAULT_OPTS
export BAT_THEME=ansi
[ -f "${XDG_DATA_HOME:-$HOME/.local/share}/zap/zap.zsh" ] && source "${XDG_DATA_HOME:-$HOME/.local/share}/zap/zap.zsh"
plug "jeffreytse/zsh-vi-mode"
@@ -15,21 +17,42 @@ plug "Aloxaf/fzf-tab"
plug "zap-zsh/fzf"
plug "zsh-users/zsh-autosuggestions"
plug "zsh-users/zsh-syntax-highlighting"
plug "MichaelAquilina/zsh-you-should-use"
plug "zsh-users/zsh-history-substring-search"
if which zoxide > /dev/null; then
eval "$(zoxide init zsh)"
else
plug "agkozak/zsh-z"
ZSHZ_ECHO=1
setopt autocd
fi
ZSH_HIGHLIGHT_STYLES[comment]=fg=blue
HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND=bg=magenta,fg=black,bold
HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND=bg=red,fg=black,bold
bindkey '^[[A' history-substring-search-up
bindkey '^[[B' history-substring-search-down
bindkey -M vicmd 'k' history-substring-search-up
bindkey -M vicmd 'j' history-substring-search-down
# Prompt.
autoload -Uz vcs_info
precmd () { vcs_info }
setopt prompt_subst
zstyle ':vcs_info:git:*' check-for-changes true
zstyle ':vcs_info:git:*' formats '%F{green}%r%f/%F{yellow}%S%f %F{magenta}(%b)%u%c%f '
zstyle ':vcs_info:git:*' actionformats '%F{green}%r%f/%F{yellow}%S%f %F{magenta}(%b|%a)%u%c%f '
zstyle ':vcs_info:*' nvcsformats '%F{green}%~%f%b '
zstyle ':vcs_info:*' enable git
PS1='%B%F{blue}%n@%m%f ${vcs_info_msg_0_}%B%#%f%b '
RPROMPT='%(?..%B%F{red}%?%f%b)'
if which starship > /dev/null; then
eval "$(starship init zsh)"
else
autoload -Uz vcs_info
precmd () { vcs_info }
setopt prompt_subst
zstyle ':vcs_info:git:*' check-for-changes true
zstyle ':vcs_info:git:*' formats '%F{green}%r%f/%F{yellow}%S%f %F{magenta}(%b)%u%c%f '
zstyle ':vcs_info:git:*' actionformats '%F{green}%r%f/%F{yellow}%S%f %F{magenta}(%b|%a)%u%c%f '
zstyle ':vcs_info:*' nvcsformats '%F{green}%~%f%b '
zstyle ':vcs_info:*' enable git
PS1='%B%F{blue}%n@%m%f ${vcs_info_msg_0_}%B%#%f%b '
RPROMPT='%(?..%B%F{red}%?%f%b)'
fi
# History.
@@ -48,7 +71,6 @@ setopt share_history
# Convenience.
setopt autocd
bindkey -M vicmd '^[h' run-help
bindkey -M viins '^[h' run-help

View File

@@ -3,33 +3,53 @@ set -g status-fg colour7
set -sg escape-time 0
bind-key -n M-j select-pane -D
bind-key -n M-k select-pane -U
bind-key -n M-h select-pane -L
bind-key -n M-l select-pane -R
bind-key -n M-J switch-client -n
bind-key -n M-K switch-client -p
bind-key -n M-H previous-window
bind-key -n M-L next-window
bind-key -n M-1 select-window -t 1
bind-key -n M-2 select-window -t 2
bind-key -n M-3 select-window -t 3
bind-key -n M-4 select-window -t 4
bind-key -n M-5 select-window -t 5
bind-key -n M-6 select-window -t 6
bind-key -n M-7 select-window -t 7
bind-key -n M-8 select-window -t 8
bind-key -n M-9 select-window -t 9
#bind-key -n M-0 select-window -t 10
bind-key -n M-! swap-window -t 1
bind-key -n M-@ swap-window -t 2
bind-key -n M-# swap-window -t 3
bind-key -n M-$ swap-window -t 4
bind-key -n M-% swap-window -t 5
bind-key -n M-^ swap-window -t 6
bind-key -n M-& swap-window -t 7
bind-key -n M-* swap-window -t 8
bind-key -n M-( swap-window -t 9
bind-key -n M-) swap-window -t 10
bind-key S new-session
bind-key T switch-client -l
bind -n C-S-Left swap-window -t -1
bind -n C-S-Right swap-window -t 1
bind-key Right resize-pane -R 8
bind-key Left resize-pane -L 8
bind-key Up resize-pane -U 4
bind-key Down resize-pane -D 4
set -g default-terminal "screen-256color"
set -g default-terminal "xterm-256color"
set -as terminal-features ",*:RGB"
set -g base-index 1
setw -g base-index 1
set -g set-titles on
set -g set-titles-string "#H [#S]"
set -g set-titles-string "#H [#S] #W"
set -g status-justify centre
set -g status-left "#[bg=green]#[fg=black] #H #[bg=default]#[fg=default] #S"
set -g status-left " #[fg=#316781]#[bg=#316781]#[fg=#abb5ba] #H #[bg=default]#[fg=#316781]#[fg=default] #S"
set -g status-left-length 50
set -g status-right "#[bg=green]#[fg=black] %H:%M "
set -g status-right "#[fg=#316781]#[bg=#316781]#[fg=#abb5ba] %H:%M #[bg=default]#[fg=#316781] "
set-window-option -g window-status-current-format '#[fg=#316781]#[bg=#316781]#[fg=#abb5ba] #I:#W#F #[fg=#316781]#[bg=black]'
set-window-option -g window-status-current-style bg=green
set-window-option -ga window-status-current-style fg=black
bind-key -n M-0 run-shell tmux-session-menu
bind -T copy-mode-vi v send -X begin-selection
bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel
bind P paste-buffer

5
tmux/bin/tmux-session-menu Executable file
View File

@@ -0,0 +1,5 @@
#!/bin/sh
tmux list-sessions -F '#S' \
| awk 'BEGIN {ORS=" "; print "toggle t \"switch-client -l\""} {print $1, NR, "\"switch-client -t", $1 "\""}' \
| xargs tmux display-menu -T "Switch session"

View File

@@ -0,0 +1,185 @@
require('vis')
local lpeg = vis.lpeg
local P = lpeg.P
local Cp = lpeg.Cp
local Ct = lpeg.Ct
local function search(p)
return Ct(((1 - p)^0 * Cp() * p)^0)
end
local up_keys = {
'a', 's', 'd', 'f' ,
'q', 'w', 'e', 'r', 't', 'g',
'z', 'x', 'c', 'v', 'b',
'1', '2', '3', '4', '5',
'A', 'S', 'D', 'F' ,
'Q', 'W', 'E', 'R', 'T', 'G',
'Z', 'X', 'C', 'V', 'B',
'!', '@', '#', '$', '%',
'`', '~',
}
local down_keys = {
'j', 'k', 'l', ';',
'y', 'u', 'i', 'o', 'p',
'n', 'm', ',', '.', '/',
'6', '7', '8', '9', '0',
'J', 'K', 'L', ':',
'Y', 'U', 'I', 'O', 'P',
'N', 'M', '<', '>', '?',
'^', '&', '*', '(', ')',
"'", '"', '\\', '|',
}
local function merge(a, b)
local c = {}
for i = 1, #a do
c[i] = a[i]
end
for i = 1, #b do
c[#a + i] = b[i]
end
return c
end
local function layout()
local l, r, t, n = 0, 0, 0, 0
local opt = vis.win.options
if opt.numbers or opt.relativenumbers then
n = #tostring(vis.win.viewport.lines.finish)
end
if vis.ui.layout == vis.ui.layouts.HORIZONTAL then
for win in vis:windows() do
if win == vis.win then
break
end
t = t + win.height
end
elseif vis.ui.layout == vis.ui.layouts.VERTICAL then
local left = true
for win in vis:windows() do
if win == vis.win then
left = false
if opt.wrapcolumn ~= 0 then
r = r + win.width - n - opt.wrapcolumn
end
elseif left then
l = l + win.width + 1
else
r = r + win.width
end
end
end
return '--wrap --padding=' .. t .. ',' .. r .. ',0,' .. (l + n) .. ' --tabstop=' .. opt.tabwidth
end
local mu = #up_keys
local md = #down_keys
local up = merge(up_keys, down_keys)
local down = merge(down_keys, up_keys)
local jumps = {}
local function jump(keys)
local _, esc = keys:find('<Escape>')
if esc then
return esc
end
local ret = #keys
keys = keys:gsub('<Enter>', '\n')
if #keys < 2 then
return -1
end
if #keys > 2 then
vis:info('not found')
return ret
end
local v = vis.win.viewport.bytes
local data = vis.win.file:content(v)
local p = search(P(keys))
local lst = p:match(data)
if not lst or #lst == 0 then
vis:info('not found')
return ret
end
if #lst == 1 then
vis.win.selection.pos = v.start + lst[1] - 1
return ret
end
local pos = vis.win.selection.pos - v.start
local prev = 0
local next = #lst + 1
local t = {}
jumps = {}
for i = 1, #lst do
local a = lst[i]
if a < pos then
prev = i
end
if a > pos then
next = i
break
end
end
local nu = prev
local nd = #lst - next
local j = 1
for i = prev, 1, -1 do
if j == mu + 1 then
j = j + nd
end
if not up[j] then
break
end
t[i] = up[j]
jumps[t[i]] = v.start + lst[i] - 1
j = j + 1
end
j = 1
for i = next, #lst do
if j == md + 1 then
j = j + nu
end
if not down[j] then
break
end
t[i] = down[j]
jumps[t[i]] = v.start + lst[i] - 1
j = j + 1
end
local input = ''
local k = 1
for i = 1, #lst do
input = input .. data:sub(k, lst[i] - 1)
if t[i] then
input = input .. '\x1b[1;37;44m' .. keys .. '\x1b[42m' .. t[i] .. '\x1b[0m'
k = lst[i] + 3
if data:sub(k - 1, k - 1) == '\n' then
k = k - 1
end
else
input = input .. '\x1b[1;37;44m' .. keys .. '\x1b[0m'
k = lst[i] + 2
end
end
input = input .. data:sub(k)
local code, out, err = vis:pipe(input, 'fzf --ansi --layout=reverse-list --no-info --no-separator --color gutter:-1,bg+:-1 --marker="" ' .. layout() .. ' --print-query --bind change:accept')
if code ~= 0 then
vis:info(err or ('fzf exit code ' .. code))
else
local p = jumps[out:sub(1, 1)]
if p then
vis.win.selection.pos = p
else
vis:info('not found')
end
end
return ret
end
vis:map(vis.modes.NORMAL, '\\', jump)

291
vis/.config/vis/fzf.sh Executable file
View File

@@ -0,0 +1,291 @@
#!/bin/sh
prompt=${FZF_PROMPT%> }
cmd=${prompt%+*}
hidden=${prompt#$cmd}
ripgrep='rg --column --line-number --color=always --smart-case'
if [ "$1" = list ]; then
case "$FZF_HEADER_LABEL" in
:?*)
dir=${FZF_HEADER_LABEL#?}
;;
*)
dir=
;;
esac
case "$prompt" in
dir:*)
dir=${FZF_HEADER_LABEL#?}
fd -t d '' ~/src ~/dotfiles 2 -H -E '\.git' -E node_modules
zoxide query -l
echo $dir
exit
;;
files)
exec fd --type f '' $dir
;;
files+hidden)
exec fd --type f -H '' $dir
;;
find-files*)
exec find $dir -type f
;;
search)
exec $ripgrep "$FZF_QUERY" $dir
;;
search+hidden)
exec $ripgrep -. "$FZF_QUERY" $dir
;;
git-files*)
if [ -z "$dir" ]; then
exec git ls-files
else
exec git -C $dir ls-files --format "$dir/%(path)"
fi
;;
git-search*)
if [ -z "$dir" ]; then
exec git grep --column --line-number --color=always "$FZF_QUERY"
else
exec git -C $dir grep --column --line-number --color=always "$FZF_QUERY" | sed "s:^:$dir/:"
fi
;;
jj-files*)
if [ -z "$dir" ]; then
exec jj file list --ignore-working-copy
else
jj=$(cd $dir && jj root --ignore-working-copy 2> /dev/null)
exec jj -R $jj file list --ignore-working-copy $dir
fi
;;
jj-search*)
if [ -z "$dir" ]; then
exec $ripgrep "$FZF_QUERY" $(jj file list --ignore-working-copy)
else
jj=$(cd $dir && jj root --ignore-working-copy 2> /dev/null)
exec $ripgrep "$FZF_QUERY" $(jj -R $jj file list --ignore-working-copy $dir)
fi
;;
esac
exit
fi
if [ "$1" = preview ]; then
if [ -n "$3" ]; then
start=$(( $3 - $FZF_PREVIEW_LINES / 2 ))
if [ $start -lt 1 ]; then
start=1
fi
end=$(( $start + $FZF_PREVIEW_LINES ))
exec bat --style=numbers --color=always --highlight-line $3 --line-range $start:$end $2
else
exec bat --style=numbers --color=always $2
fi
fi
reload="reload(sh $0 list || true)"
no_search="rebind(change)+disable-search"
search="unbind(change)+enable-search"
if [ "$1" = key ]; then
case "$FZF_KEY" in
alt-a)
prompt=${FZF_PROMPT#dir:}
if [ $prompt = $FZF_PROMPT ]; then
echo "change-prompt(dir:$FZF_PROMPT)+$search+$reload"
else
case "$cmd" in
*files)
infix="$search"
;;
*)
infix="$no_search"
;;
esac
echo "change-prompt($prompt)+$infix+$reload"
fi
;;
alt-d)
dir=${FZF_HEADER_LABEL#?}
case "$FZF_HEADER_LABEL" in
.?*)
echo "change-header(path: $dir)+change-header-label(:$dir)+$reload"
;;
*)
echo "change-header()+change-header-label(.$dir)+$reload"
;;
esac
;;
alt-f)
case "$cmd" in
files)
prompt="find-files$hidden"
;;
*files|search)
prompt="files$hidden"
;;
*search)
prompt="${cmd%-*}-files$hidden"
;;
esac
echo "change-prompt($prompt> )+$search+$reload"
;;
alt-g)
case "$cmd" in
*files)
prompt="git-files$hidden"
echo "change-prompt($prompt> )+$search+$reload"
;;
*search)
prompt="git-search$hidden"
echo "change-prompt($prompt> )+$no_search+$reload"
;;
esac
;;
alt-h)
if [ -z "$hidden" ]; then
prompt="$cmd+hidden"
else
prompt="$cmd"
fi
echo "change-prompt($prompt> )+$reload"
;;
alt-j)
case "$cmd" in
*files)
prompt="jj-files$hidden"
echo "change-prompt($prompt> )+$search+$reload"
;;
*search)
prompt="jj-search$hidden"
echo "change-prompt($prompt> )+$no_search+$reload"
;;
esac
;;
alt-s)
case "$cmd" in
*search|files)
prompt="search$hidden"
;;
*files)
prompt="${cmd%-*}-search$hidden"
;;
esac
echo "change-prompt($prompt> )+$no_search+$reload"
;;
esac
exit
fi
if [ "$1" = chdir ]; then
dir="$2"
prompt=${FZF_PROMPT#dir:}
case "$cmd" in
*files)
infix="$search"
;;
*)
infix="$no_search"
;;
esac
echo "change-header(path: $dir)+change-header-label(:$dir)+change-prompt($prompt)+$infix+$reload"
exit
fi
if [ -n "$2" ]; then
label=".$2"
else
label=".."
fi
case ${1%+hidden} in
auto-files)
git=$(git rev-parse --show-toplevel 2> /dev/null)
jj=$(jj root --ignore-working-copy 2> /dev/null)
if [ -n "$jj" ] && [ "${git#$jj}" = "$git" -o "$git" = "$jj" ]; then
cmd="jj-files$hidden"
elif [ -n "$git" ] && [ "${jj#$git}" = "$jj" ]; then
cmd="git-files$hidden"
else
cmd="files"
fi
action="$search"
prompt="$cmd> "
;;
auto-search)
git=$(git rev-parse --show-toplevel 2> /dev/null)
jj=$(jj root --ignore-working-copy 2> /dev/null)
if [ -n "$jj" ] && [ "${git#$jj}" = "$git" -o "$git" = "$jj" ]; then
cmd="jj-search$hidden"
elif [ -n "$git" ] && [ "${jj#$git}" = "$jj" ]; then
cmd="git-search$hidden"
else
cmd="search"
fi
action="$no_search"
prompt="$cmd> "
;;
files|git-files|jj-files|find-files)
cmd="$1"
action="$search"
prompt="$1> "
;;
search|git-search|jj-search)
cmd="$1"
action="$no_search"
prompt="$1> "
;;
*)
cmd="files"
action="$search"
prompt="files> "
;;
esac
key="transform(sh $0 key)"
HELP='Keys:
alt-? help
alt-a select alternative directory
alt-d toggle alternative directory
alt-f switch to files (twice for plain files)
alt-g switch to git
alt-j switch to jj
alt-h toggle hidden
alt-p toggle preview (also to turn off help)
alt-s switch to search (twice for plain search)
alt-u toggle preview window position (right or up)
'
accept="
if [ \${FZF_PROMPT#dir:} = \$FZF_PROMPT ]; then
echo accept
else
sh $0 chdir {1}
fi
"
exec fzf --query "$3" \
--prompt "$prompt" \
--header-label "$label" \
--multi \
--ansi \
--scheme path \
--delimiter : \
--ghost ' (Use alt-? for help)' \
--bind "enter:transform($accept)" \
--bind "change:$reload" \
--bind "start:$reload+$action" \
--bind "alt-a:$key" \
--bind "alt-d:$key" \
--bind "alt-f:$key" \
--bind "alt-g:$key" \
--bind "alt-j:$key" \
--bind "alt-h:$key" \
--bind "alt-s:$key" \
--bind "alt-p:change-preview(sh $0 preview {1} {2})+toggle-preview" \
--bind "alt-u:change-preview-window(up|right)" \
--bind "alt-?:change-preview(echo '$HELP')+show-preview" \
--bind "alt-enter:unbind(change,alt-enter)+enable-search+clear-query"

View File

@@ -0,0 +1,31 @@
-- Copyright 2006-2025 Mitchell. See LICENSE.
-- go with SQL LPeg lexer.
local lexer = lexer
local starts_line = lexer.starts_line
local B, P, S = lpeg.B, lpeg.P, lpeg.S
local lex = lexer.new(..., {inherit = lexer.load('go')})
local open_brace = lex:tag(lexer.OPERATOR, P('{'))
local close_brace = lex:tag(lexer.OPERATOR, P('}'))
local backtick = lex:tag(lexer.CODE, P('`'))
local ws = lex:get_rule('whitespace')
local tpl = lexer.new("template")
tpl:add_rule('keyword', lex:tag(lexer.KEYWORD, lexer.word_match('if else end with range break define continue template block')))
tpl:add_rule('constant', lex:get_rule('constant'))
tpl:add_rule('operator', lex:get_rule('operator') + lex:tag(lexer.OPERATOR, S('$')))
local func = lexer.after_set(' \t\n{|', lexer.word)
tpl:add_rule('function', lex:tag(lexer.FUNCTION, func))
tpl:add_rule('identifier', lex:get_rule('identifier'))
tpl:add_rule('string', lex:get_rule('string'))
tpl:add_rule('number', lex:get_rule('number'))
local sql = lexer.load('sql')
local sql_kwd = lexer.word_match('ALTER CREATE DELETE DROP GRANT INSERT SELECT UPDATE WITH')
sql:embed(tpl, open_brace * open_brace, close_brace * close_brace)
lex:embed(sql, backtick * #(ws^0 * sql_kwd), backtick)
return lex

View File

@@ -0,0 +1,87 @@
-- Copyright 2006-2024 Mitchell. See LICENSE.
-- Odin LPeg lexer.
local lexer = lexer
local P, S = lpeg.P, lpeg.S
local lex = lexer.new(...)
-- Keywords.
lex:add_rule('keyword', lex:tag(lexer.KEYWORD, lex:word_match(lexer.KEYWORD)))
-- Constants.
lex:add_rule('constant', lex:tag(lexer.CONSTANT_BUILTIN, lex:word_match(lexer.CONSTANT_BUILTIN)))
-- Types.
lex:add_rule('type', lex:tag(lexer.TYPE, lex:word_match(lexer.TYPE)))
-- Functions.
local builtin_proc = -lpeg.B('.') *
lex:tag(lexer.FUNCTION_BUILTIN, lex:word_match(lexer.FUNCTION_BUILTIN))
local proc = lex:tag(lexer.FUNCTION, lexer.word)
lex:add_rule('function', (builtin_proc + proc) * #(lexer.space^0 * '(') +
proc * #(lexer.space^0 * '::' * lexer.space^0 * "proc"))
-- Identifiers.
lex:add_rule('identifier', lex:tag(lexer.IDENTIFIER, lexer.word))
-- Strings.
local sq_str = lexer.range("'", true)
local dq_str = lexer.range('"', true)
local raw_str = lexer.range('`', false, false)
lex:add_rule('string', lex:tag(lexer.STRING, sq_str + dq_str + raw_str))
-- Comments.
local line_comment = lexer.to_eol('//')
local block_comment = lexer.range('/*', '*/')
lex:add_rule('comment', lex:tag(lexer.COMMENT, line_comment + block_comment))
-- Numbers.
lex:add_rule('number', lex:tag(lexer.NUMBER, lexer.number * P('i')^-1))
-- Operators.
lex:add_rule('operator', lex:tag(lexer.OPERATOR,
P('%%=') + P('&~=') + P('<<=') + P('>>=') + P('&&=') + P('||=') + P('---') + P('..=') +
P('..<') + P('%%') + P('&~') + P('<<') + P('>>') + P('&&') + P('||') + P('+=') + P('-=') +
P('*=') + P('/=') + P('%=') + P('&=') + P('|=') + P('~=') + P('++') + P('--') + P('->') +
P('==') + P('!=') + P('<=') + P('>=') + P('..') + S('=!#@$^?+-*/%&|~<>()[]{}:;.,')))
-- Fold points.
lex:add_fold_point(lexer.OPERATOR, '{', '}')
lex:add_fold_point(lexer.COMMENT, '/*', '*/')
-- Word lists.
lex:set_word_list(lexer.KEYWORD, {
'import', 'foreign', 'package', 'typeid', 'when', 'where', 'if', 'else', 'for', 'switch', 'in',
'not_in', 'do', 'case', 'break', 'continue', 'fallthrough', 'defer', 'return', 'proc', 'struct',
'union', 'enum', 'bit_set', 'bit_field', 'map', 'dynamic', 'auto_cast', 'cast', 'transmute',
'distinct', 'using', 'context', 'or_else', 'or_return', 'or_break', 'or_continue', 'asm', 'matrix'
})
lex:set_word_list(lexer.CONSTANT_BUILTIN, {
'ODIN_ARCH', 'ODIN_BUILD_MODE', 'ODIN_COMPILE_TIMESTAMP', 'ODIN_DEBUG',
'ODIN_DEFAULT_TO_NIL_ALLOCATOR', 'ODIN_DEFAULT_TO_PANIC_ALLOCATOR', 'ODIN_DISABLE_ASSERT',
'ODIN_ENDIAN', 'ODIN_ERROR_POS_STYLE', 'ODIN_NO_CRT', 'ODIN_NO_ENTRY_POINT', 'ODIN_NO_RTTI',
'ODIN_OS', 'ODIN_PLATFORM_SUBTARGET', 'ODIN_ROOT', 'ODIN_VENDOR', 'ODIN_VERSION',
'ODIN_WINDOWS_SUBSYSTEM', 'false', 'nil', 'true'
})
lex:set_word_list(lexer.TYPE, {
'b16', 'b32', 'b64', 'b8', 'bool', 'byte', 'complex128', 'complex32', 'complex64', 'cstring',
'cstring16', 'f16', 'f16be', 'f16le', 'f32', 'f32be', 'f32le', 'f64', 'f64be', 'f64le', 'i128',
'i128be', 'i128le', 'i16', 'i16be', 'i16le', 'i32', 'i32be', 'i32le', 'i64', 'i64be', 'i64le',
'i8', 'int', 'quaternion128', 'quaternion256', 'quaternion64', 'rawptr', 'rune', 'string',
'string16', 'typeid', 'u128', 'u128be', 'u128le', 'u16', 'u16be', 'u16le', 'u32', 'u32be',
'u32le', 'u64', 'u64be', 'u64le', 'u8', 'uint', 'uintptr', 'Maybe', 'Objc_Block'
})
lex:set_word_list(lexer.FUNCTION_BUILTIN, {
'abs', 'align_of', 'cap', 'clamp', 'complex', 'compress_values', 'conj', 'expand_values', 'imag',
'jmag', 'kmag', 'len', 'max', 'min', 'offset_of', 'offset_of_by_string', 'offset_of_member',
'offset_of_selector', 'quaternion', 'raw_data', 'real', 'size_of', 'soa_unzip', 'soa_zip',
'swizzle', 'type_info_of', 'type_of', 'typeid_of'
})
lexer.property['scintillua.comment'] = '//'
return lex

View File

@@ -0,0 +1,65 @@
-- Copyright 2006-2025 Mitchell. See LICENSE.
-- templ LPeg lexer.
local lexer = lexer
local starts_line = lexer.starts_line
local P, S = lpeg.P, lpeg.S
local lex = lexer.new(..., {inherit = lexer.load('go')})
local close_paren = lex:tag(lexer.OPERATOR, P(')'))
local open_brace = lex:tag(lexer.OPERATOR, P('{'))
local close_brace = lex:tag(lexer.OPERATOR, P('}'))
local colon = lex:tag(lexer.OPERATOR, P(':'))
local at = lex:tag(lexer.OPERATOR, P('@'))
local ws = lex:get_rule('whitespace')
local ident = lex:get_rule('identifier')
local html = lexer.load('html')
local go_expr = lexer.load('go', 'go.expr')
local go_stmt1 = lexer.load('go', 'go.stmt1')
local go_stmt2 = lexer.load('go', 'go.stmt2')
local go_stmt3 = lexer.load('go', 'go.stmt3')
local for_ = lex:tag(lexer.KEYWORD, lexer.word_match('for if switch'))
local else_ = close_brace * ws^0 * lex:tag(lexer.KEYWORD, P('else'))
local case_ = lex:tag(lexer.KEYWORD, lexer.word_match('case default'))
html:embed(go_expr, open_brace, close_brace * close_brace^-1)
html:embed(go_stmt1, starts_line(for_ + else_, true), open_brace * #lexer.newline)
html:embed(go_stmt2, starts_line(case_, true), colon * #lexer.newline)
html:embed(go_stmt3, starts_line(at, true), (ident + open_brace + close_paren) * #lexer.newline)
local func_block_start = close_paren * ws^0 * open_brace
lex:set_word_list(lexer.KEYWORD, 'templ css script', true)
local function starts_with(keyword)
local prefix = '\n' .. keyword .. '%s'
return function(input, index)
local i = index - 1024
if i < 1 then
i = 1
end
local s = input:sub(i, index)
local k = 0
repeat
i = s:find('\n%w', i)
if i then
k = i
i = i + 2
end
until not i
return k > 0 and s:find(prefix, k) and true
end
end
lex:embed(html, func_block_start * P(starts_with("templ")), starts_line(close_brace))
local css = lexer.load('css')
local css_go_expr = lexer.load('go', 'go.expr2')
css:embed(css_go_expr, open_brace, close_brace)
lex:embed(css, func_block_start * P(starts_with("css")), starts_line(close_brace))
local js = lexer.load('javascript')
lex:embed(js, func_block_start * P(starts_with("script")), starts_line(close_brace))
return lex

64
vis/.config/vis/plugins.sh Executable file
View File

@@ -0,0 +1,64 @@
#!/bin/sh
if [ $# -eq 0 ]; then
echo 'error: argument required (action), one of: clone, fetch, merge' >&2
exit 1
fi
ACTION="$1"
PLUGINS_DIR=$(dirname $(realpath "$0"))/plugins
cd "$PLUGINS_DIR"
action() {
case "$1" in
*:*)
P="$1"
;;
*)
P="https://github.com/$1"
;;
esac
B=$(basename "$1")
B="${B%.git}"
case "$ACTION" in
clone)
if [ ! -e "$B" ]; then
echo "$ACTION $B"
git clone "$P"
fi
;;
fetch)
if [ -e "$B" ]; then
echo "$ACTION $B"
git -C "$B" fetch
fi
;;
merge)
if [ -e "$B" ]; then
echo "$ACTION $B"
git -C "$B" merge
fi
;;
*)
echo "error: unsupported action: $ACTION" >&2
exit 1
;;
esac
}
for plugin in \
'https://gitlab.com/muhq/vis-lspc' \
'lutobler/vis-commentary' \
'https://repo.or.cz/vis-surround.git' \
'peaceant/vis-fzf-mru' \
'https://gitlab.com/muhq/vis-build' \
'erf/vis-cursors' \
'thimc/vis-colorizer' \
'https://repo.or.cz/vis-quickfix.git' \
'https://repo.or.cz/vis-pairs.git' \
'https://gitea.lupan.pl/lupan/vis-pin-files.git'; \
do
action "$plugin"
done

View File

@@ -0,0 +1,158 @@
-- Eight-color scheme
local lexers = vis.lexers
lexers.STYLE_DEFAULT ='back:#1f212e,fore:#9da0af'
lexers.STYLE_NOTHING = ''
lexers.STYLE_ATTRIBUTE = 'fore:#a1a3aa,bold'
lexers.STYLE_CLASS = 'fore:yellow,bold'
lexers.STYLE_COMMENT = 'fore:#334d40,bold'
lexers.STYLE_CONSTANT = 'fore:cyan,bold'
lexers.STYLE_DEFINITION = 'fore:blue,bold'
lexers.STYLE_ERROR = 'fore:red,italics'
lexers.STYLE_FUNCTION = 'fore:#6b8ac7,bold'
lexers.STYLE_HEADING = 'fore:#d1d147'
lexers.STYLE_KEYWORD = 'fore:#bf8040,bold'
lexers.STYLE_LABEL = 'fore:green,bold'
lexers.STYLE_NUMBER = 'fore:#acac53,bold'
lexers.STYLE_OPERATOR = 'fore:#93806c,bold'
lexers.STYLE_REGEX = 'fore:#59862d,bold'
lexers.STYLE_STRING = 'fore:#3d8f66,bold'
lexers.STYLE_PREPROCESSOR = 'fore:#cc66cc,bold'
lexers.STYLE_TAG = 'fore:#705943,bold'
lexers.STYLE_TYPE = 'fore:#7461d1,bold'
lexers.STYLE_VARIABLE = 'fore:#8c5eba,bold'
lexers.STYLE_WHITESPACE = ''
lexers.STYLE_EMBEDDED = 'back:#2d3353,bold'
lexers.STYLE_IDENTIFIER = ''
lexers.STYLE_LINENUMBER = ''
lexers.STYLE_LINENUMBER_CURSOR = 'fore:#bf8040'
lexers.STYLE_CURSOR = 'back:#bf8040,fore:#1f212e'
lexers.STYLE_CURSOR_PRIMARY = lexers.STYLE_CURSOR..',fore:#e6fefe'
lexers.STYLE_CURSOR_LINE = 'underlined'
lexers.STYLE_COLOR_COLUMN = 'back:red'
lexers.STYLE_SELECTION = 'back:#4d5580,bold'
lexers.STYLE_STATUS = 'back:#1c3b4a,fore:#73848c'
lexers.STYLE_STATUS_FOCUSED = 'back:#1c3b4a,fore:#abb5ba,bold'
lexers.STYLE_SEPARATOR = lexers.STYLE_DEFAULT
lexers.STYLE_INFO = 'bold'
lexers.STYLE_EOF = ''
-- lexer specific styles
-- Diff
lexers.STYLE_ADDITION = 'fore:#3a783a'
lexers.STYLE_DELETION = 'fore:#862d2d'
lexers.STYLE_CHANGE = 'fore:#2d3353'
-- CSS
lexers.STYLE_PROPERTY = lexers.STYLE_ATTRIBUTE
lexers.STYLE_PSEUDOCLASS = ''
lexers.STYLE_PSEUDOELEMENT = ''
-- HTML
lexers.STYLE_TAG_UNKNOWN = lexers.STYLE_TAG .. ',italics'
lexers.STYLE_TAG_SINGLE = lexers.STYLE_TAG
lexers.STYLE_TAG_DOCTYPE = lexers.STYLE_TAG .. ',bold'
lexers.STYLE_ATTRIBUTE_UNKNOWN = lexers.STYLE_ATTRIBUTE .. ',italics'
-- Latex, TeX, and Texinfo
lexers.STYLE_COMMAND = lexers.STYLE_KEYWORD
lexers.STYLE_COMMAND_SECTION = lexers.STYLE_CLASS
lexers.STYLE_ENVIRONMENT = lexers.STYLE_TYPE
lexers.STYLE_ENVIRONMENT_MATH = lexers.STYLE_NUMBER
-- Makefile
lexers.STYLE_TARGET = ''
-- Markdown
lexers.STYLE_HR = ''
for i = 1,6 do lexers['STYLE_HEADING_H'..i] = lexers.STYLE_HEADING end
lexers.STYLE_BOLD = 'bold'
lexers.STYLE_ITALIC = 'italics'
lexers.STYLE_LIST = lexers.STYLE_KEYWORD
lexers.STYLE_LINK = lexers.STYLE_KEYWORD
lexers.STYLE_REFERENCE = lexers.STYLE_KEYWORD
lexers.STYLE_CODE = lexers.STYLE_EMBEDDED
-- Output
lexers.STYE_FILENAME = ''
lexers.STYLE_LINE = ''
lexers.STYLE_COLUMN = ''
lexers.STYLE_MESSAGE = ''
-- Python
lexers.STYLE_KEYWORD_SOFT = ''
-- Taskpaper
lexers.STYLE_NOTE = ''
lexers.STYLE_TAG_EXTENDED = ''
lexers.STYLE_TAG_DAY = 'fore:yellow'
lexers.STYLE_TAG_OVERDUE = 'fore:red'
lexers.STYLE_TAG_PLAIN = ''
-- XML
lexers.STYLE_CDATA = ''
-- YAML
lexers.STYLE_ERROR_INDENT = 'back:red'
-- The following are temporary styles until their legacy lexers are migrated.
-- Antlr
lexers.STYLE_ACTION = ''
-- Clojure
lexers.STYLE_CLOJURE_KEYWORD = lexers.STYLE_TYPE
lexers.STYLE_CLOJURE_SYMBOL = lexers.STYLE_TYPE .. ',bold'
-- Crystal
--lexers.STYLE_SYMBOL = lexers.STYLE_STRING
-- Gleam
lexers.STYLE_MODULE = lexers.STYLE_CONSTANT
lexers.STYLE_DISCARD = lexers.STYLE_COMMENT
-- Icon
lexers.STYLE_SPECIAL_KEYWORD = lexers.STYLE_TYPE
-- jq
lexers.STYLE_FORMAT = lexers.STYLE_CONSTANT
lexers.STYLE_SYSVAR = lexers.STYLE_CONSTANT .. ',bold'
-- Julia
-- lexers.STYLE_SYMBOL = lexers.STYLE_STRING
lexers.STYLE_CHARACTER = lexers.STYLE_CONSTANT
-- Mediawiki
lexers.STYLE_BEHAVIOR_SWITCH = lexers.STYLE_KEYWORD
-- Moonscript
lexers.STYLE_TBL_KEY = lexers.STYLE_REGEX
lexers.STYLE_SELF_REF = lexers.STYLE_LABEL
lexers.STYLE_PROPER_IDENT = lexers.STYLE_CLASS
lexers.STYLE_FNDEF = lexers.STYLE_PREPROCESSOR
-- lexers.STYLE_SYMBOL = lexers.STYLE_EMBEDDED
-- reST
lexers.STYLE_LITERAL_BLOCK = lexers.STYLE_EMBEDDED
lexers.STYLE_FOOTNOTE_BLOCK = lexers.STYLE_LABEL
lexers.STYLE_CITATION_BLOCK = lexers.STYLE_LABEL
lexers.STYLE_LINK_BLOCK = lexers.STYLE_LABEL
lexers.STYLE_CODE_BLOCK = lexers.STYLE_CODE
lexers.STYLE_DIRECTIVE = lexers.STYLE_KEYWORD
lexers.STYLE_SPHINX_DIRECTIVE = lexers.STYLE_KEYWORD
lexers.STYLE_UNKNOWN_DIRECTIVE = lexers.STYLE_KEYWORD
lexers.STYLE_SUBSTITUTION = lexers.STYLE_VARIABLE
lexers.STYLE_INLINE_LITERAL = lexers.STYLE_EMBEDDED
lexers.STYLE_ROLE = lexers.STYLE_CLASS
lexers.STYLE_INTERPRETED = lexers.STYLE_STRING
-- txt2tags
lexers.STYLE_LINE = 'bold'
for i = 1,5 do lexers['STYLE_H'..i] = lexers.STYLE_HEADING end
lexers.STYLE_IMAGE = 'fore:green'
lexers.STYLE_STRIKE = 'italics'
lexers.STYLE_TAGGED = lexers.STYLE_EMBEDDED
lexers.STYLE_TAGGED_AREA = lexers.STYLE_EMBEDDED
lexers.STYLE_TABLE_SEP = 'fore:green'
lexers.STYLE_HEADER_CELL_CONTENT = 'fore:green'

View File

@@ -0,0 +1,158 @@
-- Eight-color scheme
local lexers = vis.lexers
lexers.STYLE_DEFAULT ='back:#f2f2f3,#e0e5eb,fore:#1f212e'
lexers.STYLE_NOTHING = ''
lexers.STYLE_ATTRIBUTE = 'fore:#a1a3aa,bold'
lexers.STYLE_CLASS = 'fore:yellow,bold'
lexers.STYLE_COMMENT = 'fore:#334d40,bold'
lexers.STYLE_CONSTANT = 'fore:cyan,bold'
lexers.STYLE_DEFINITION = 'fore:blue,bold'
lexers.STYLE_ERROR = 'fore:red,italics'
lexers.STYLE_FUNCTION = 'fore:#6b8ac7,bold'
lexers.STYLE_HEADING = 'fore:#d1d147'
lexers.STYLE_KEYWORD = 'fore:#bf8040,bold'
lexers.STYLE_LABEL = 'fore:green,bold'
lexers.STYLE_NUMBER = 'fore:#acac53,bold'
lexers.STYLE_OPERATOR = 'fore:#93806c,bold'
lexers.STYLE_REGEX = 'fore:#59862d,bold'
lexers.STYLE_STRING = 'fore:#3d8f66,bold'
lexers.STYLE_PREPROCESSOR = 'fore:#cc66cc,bold'
lexers.STYLE_TAG = 'fore:#705943,bold'
lexers.STYLE_TYPE = 'fore:#7461d1,bold'
lexers.STYLE_VARIABLE = 'fore:#8c5eba,bold'
lexers.STYLE_WHITESPACE = ''
lexers.STYLE_EMBEDDED = 'back:#e0e5eb,bold'
lexers.STYLE_IDENTIFIER = ''
lexers.STYLE_LINENUMBER = ''
lexers.STYLE_LINENUMBER_CURSOR = 'fore:#bf8040'
lexers.STYLE_CURSOR = 'back:#bf8040,fore:#1f212e'
lexers.STYLE_CURSOR_PRIMARY = lexers.STYLE_CURSOR..',fore:#e6fefe'
lexers.STYLE_CURSOR_LINE = 'underlined'
lexers.STYLE_COLOR_COLUMN = 'back:red'
lexers.STYLE_SELECTION = 'back:#a6c7f2,bold'
lexers.STYLE_STATUS = 'reverse'
lexers.STYLE_STATUS_FOCUSED = 'reverse,bold'
lexers.STYLE_SEPARATOR = lexers.STYLE_DEFAULT
lexers.STYLE_INFO = 'bold'
lexers.STYLE_EOF = ''
-- lexer specific styles
-- Diff
lexers.STYLE_ADDITION = 'fore:#3a783a'
lexers.STYLE_DELETION = 'fore:#862d2d'
lexers.STYLE_CHANGE = 'fore:#2d3353'
-- CSS
lexers.STYLE_PROPERTY = lexers.STYLE_ATTRIBUTE
lexers.STYLE_PSEUDOCLASS = ''
lexers.STYLE_PSEUDOELEMENT = ''
-- HTML
lexers.STYLE_TAG_UNKNOWN = lexers.STYLE_TAG .. ',italics'
lexers.STYLE_TAG_SINGLE = lexers.STYLE_TAG
lexers.STYLE_TAG_DOCTYPE = lexers.STYLE_TAG .. ',bold'
lexers.STYLE_ATTRIBUTE_UNKNOWN = lexers.STYLE_ATTRIBUTE .. ',italics'
-- Latex, TeX, and Texinfo
lexers.STYLE_COMMAND = lexers.STYLE_KEYWORD
lexers.STYLE_COMMAND_SECTION = lexers.STYLE_CLASS
lexers.STYLE_ENVIRONMENT = lexers.STYLE_TYPE
lexers.STYLE_ENVIRONMENT_MATH = lexers.STYLE_NUMBER
-- Makefile
lexers.STYLE_TARGET = ''
-- Markdown
lexers.STYLE_HR = ''
for i = 1,6 do lexers['STYLE_HEADING_H'..i] = lexers.STYLE_HEADING end
lexers.STYLE_BOLD = 'bold'
lexers.STYLE_ITALIC = 'italics'
lexers.STYLE_LIST = lexers.STYLE_KEYWORD
lexers.STYLE_LINK = lexers.STYLE_KEYWORD
lexers.STYLE_REFERENCE = lexers.STYLE_KEYWORD
lexers.STYLE_CODE = lexers.STYLE_EMBEDDED
-- Output
lexers.STYE_FILENAME = ''
lexers.STYLE_LINE = ''
lexers.STYLE_COLUMN = ''
lexers.STYLE_MESSAGE = ''
-- Python
lexers.STYLE_KEYWORD_SOFT = ''
-- Taskpaper
lexers.STYLE_NOTE = ''
lexers.STYLE_TAG_EXTENDED = ''
lexers.STYLE_TAG_DAY = 'fore:yellow'
lexers.STYLE_TAG_OVERDUE = 'fore:red'
lexers.STYLE_TAG_PLAIN = ''
-- XML
lexers.STYLE_CDATA = ''
-- YAML
lexers.STYLE_ERROR_INDENT = 'back:red'
-- The following are temporary styles until their legacy lexers are migrated.
-- Antlr
lexers.STYLE_ACTION = ''
-- Clojure
lexers.STYLE_CLOJURE_KEYWORD = lexers.STYLE_TYPE
lexers.STYLE_CLOJURE_SYMBOL = lexers.STYLE_TYPE .. ',bold'
-- Crystal
--lexers.STYLE_SYMBOL = lexers.STYLE_STRING
-- Gleam
lexers.STYLE_MODULE = lexers.STYLE_CONSTANT
lexers.STYLE_DISCARD = lexers.STYLE_COMMENT
-- Icon
lexers.STYLE_SPECIAL_KEYWORD = lexers.STYLE_TYPE
-- jq
lexers.STYLE_FORMAT = lexers.STYLE_CONSTANT
lexers.STYLE_SYSVAR = lexers.STYLE_CONSTANT .. ',bold'
-- Julia
-- lexers.STYLE_SYMBOL = lexers.STYLE_STRING
lexers.STYLE_CHARACTER = lexers.STYLE_CONSTANT
-- Mediawiki
lexers.STYLE_BEHAVIOR_SWITCH = lexers.STYLE_KEYWORD
-- Moonscript
lexers.STYLE_TBL_KEY = lexers.STYLE_REGEX
lexers.STYLE_SELF_REF = lexers.STYLE_LABEL
lexers.STYLE_PROPER_IDENT = lexers.STYLE_CLASS
lexers.STYLE_FNDEF = lexers.STYLE_PREPROCESSOR
-- lexers.STYLE_SYMBOL = lexers.STYLE_EMBEDDED
-- reST
lexers.STYLE_LITERAL_BLOCK = lexers.STYLE_EMBEDDED
lexers.STYLE_FOOTNOTE_BLOCK = lexers.STYLE_LABEL
lexers.STYLE_CITATION_BLOCK = lexers.STYLE_LABEL
lexers.STYLE_LINK_BLOCK = lexers.STYLE_LABEL
lexers.STYLE_CODE_BLOCK = lexers.STYLE_CODE
lexers.STYLE_DIRECTIVE = lexers.STYLE_KEYWORD
lexers.STYLE_SPHINX_DIRECTIVE = lexers.STYLE_KEYWORD
lexers.STYLE_UNKNOWN_DIRECTIVE = lexers.STYLE_KEYWORD
lexers.STYLE_SUBSTITUTION = lexers.STYLE_VARIABLE
lexers.STYLE_INLINE_LITERAL = lexers.STYLE_EMBEDDED
lexers.STYLE_ROLE = lexers.STYLE_CLASS
lexers.STYLE_INTERPRETED = lexers.STYLE_STRING
-- txt2tags
lexers.STYLE_LINE = 'bold'
for i = 1,5 do lexers['STYLE_H'..i] = lexers.STYLE_HEADING end
lexers.STYLE_IMAGE = 'fore:green'
lexers.STYLE_STRIKE = 'italics'
lexers.STYLE_TAGGED = lexers.STYLE_EMBEDDED
lexers.STYLE_TAGGED_AREA = lexers.STYLE_EMBEDDED
lexers.STYLE_TABLE_SEP = 'fore:green'
lexers.STYLE_HEADER_CELL_CONTENT = 'fore:green'

370
vis/.config/vis/visrc.lua Normal file
View File

@@ -0,0 +1,370 @@
require('vis')
require('fast-jump')
local lspc = require('plugins/vis-lspc')
require('plugins/vis-commentary')
require('plugins/vis-surround')
local fzfmru = require('plugins/vis-fzf-mru/fzf-mru')
require('plugins/vis-build')
require('plugins/vis-cursors')
require('plugins/vis-colorizer')
local qf = require('plugins/vis-quickfix')
local pairs = require('plugins/vis-pairs')
require('plugins/vis-pin-files')
pairs.autopairs = false
vis.ftdetect.filetypes.go_ext = vis.ftdetect.filetypes.go
vis.ftdetect.filetypes.go = nil
lspc.ls_map.go_ext = lspc.ls_map.go
vis.ftdetect.filetypes.templ = {
ext = { "%.templ$" },
}
vis.ftdetect.filetypes.odin = {
ext = { "%.odin$" },
}
lspc.message_level = 2
lspc.ls_map.templ = {
name = 'templ-lsp',
cmd = 'templ lsp',
}
lspc.ls_map.odin = {
name = 'ols',
cmd = 'ols',
}
fzfmru.fzfmru_history = 60
local function open_file(file, cmd)
vis:command((cmd or 'o') .. ' ' .. file)
end
local function nil_or_tonumber(s)
return s and tonumber(s)
end
local function open_file_pos(line, open_cmd)
local iter = line:gmatch('[^:]+')
local file = iter()
local ln = iter()
local col = nil_or_tonumber(iter()) or 1
local i = ln and ln:find(' ')
if i then
ln = ln:sub(0, i)
col = 1
end
local line_num = nil_or_tonumber(ln)
if open_cmd ~= 'e' or vis.win.file ~= file then
open_file(file, open_cmd)
end
if line_num ~= nil then
vis.win.selection:to(line_num, col)
end
end
local function open_file_current_line(open_cmd, keys)
local line = vis.win.file.lines[vis.win.selection.line]
vis:info(line)
if keys then
vis:feedkeys(keys)
end
open_file_pos(line, open_cmd)
end
local function escape_and_quoted(s)
return "'" .. s:gsub("'", [['"'"']]) .. "'"
end
local function cmd_action(cmd, action)
local code, out, err = vis:pipe(cmd, true)
if code == 0 then
action(out)
elseif err ~= nil then
vis:info(err)
elseif code ~= 0 then
vis:info('Program exit code ' .. code)
end
end
local function fzf_sh(arg, query)
action = function(out)
if (out:find('\n') or #out) == #out then
open_file_pos(out, vis.win.file.modified and 'o' or 'e')
else
vis:message(out)
end
end
local home = os.getenv('HOME')
local path = vis.win.file.path or ''
local dir = path:match('^.*/') or ''
if not query and vis.register ~= '"' then
query = string.gsub(vis.registers[vis.register][1], '%z', '')
end
local cmd = home ..
'/.config/vis/fzf.sh ' ..
escape_and_quoted(arg) .. ' ' .. escape_and_quoted(dir) .. ' ' .. escape_and_quoted(query or '')
cmd_action(cmd, action)
end
vis:command_register('fzf-files', function(argv, force, win, selection, range)
fzf_sh(argv[1] or 'auto-files', argv[2])
end)
local function search(cmd, action)
if action == nil then
action = function(out)
if (out:find('\n') or #out) == #out then
open_file_pos(out, 'e')
else
vis:message(out)
end
end
end
if cmd:match('^fzf ') and vis.register ~= '"' then
local reg = string.gsub(vis.registers[vis.register][1], '%z', '')
if reg ~= '' then
cmd = cmd .. ' --query=' .. escape_and_quoted(reg)
end
end
cmd_action(cmd, action)
end
local function fzf_reload(cmd)
local prompt = escape_and_quoted('1. ' .. cmd:match('^%w*') .. '> ')
if not cmd:match('{q}') then
cmd = cmd .. ' {q}'
end
return 'fzf --ansi --bind "start:reload:' .. cmd .. '" --bind "change:reload:' .. cmd .. ' || true"' ..
' --prompt ' .. prompt ..
' --bind "alt-enter:unbind(change,alt-enter)+change-prompt(2. fzf> )+enable-search+clear-query"'
end
local function add_global_mark()
local file = vis.win.file.path
if file ~= nil then
local code, out, err = vis:pipe('vis-menu -p "global mark comment:"', true)
if code == 0 then
local prefix = file .. ':' .. vis.win.selection.line .. ':' .. vis.win.selection.col .. ': '
local line = vis.win.file.lines[vis.win.selection.line]
out = out:gsub('\n$', '')
if out ~= '' then
prefix = prefix .. '(' .. out .. '): '
end
out = io.open(os.getenv('HOME') .. '/.config/vis/global-marks.txt', 'a')
out:write(prefix .. line .. '\n')
out:close()
elseif err ~= nil then
vis:info(err)
elseif code ~= 0 then
vis:info('Program exit code ' .. code)
end
else
vis:info('Save file first')
end
end
local function set_current_theme()
local path = os.getenv('HOME') .. '/.lightmode'
local theme = 'lupan-dark'
local f = io.open(path)
if f then
f:close()
theme = 'lupan-light'
end
vis:command('set theme ' .. theme)
end
local ripgrep = 'rg --column --line-number --color=always --smart-case'
local function close_prev_win()
vis:feedkeys('<vis-window-prev>')
if vis.win == win then
vis:info('Last window')
elseif not vis.win:close() then
if vis.win.file.modified then
vis:info('No write since last change')
else
vis:command('q')
end
end
end
local function close_next_win()
vis:feedkeys('<vis-window-next>')
if vis.win == win then
vis:info('Last window')
elseif not vis.win:close() then
if vis.win.file.modified then
vis:info('No write since last change')
else
vis:command('q')
end
end
end
local function ensure_last_line_empty()
local size = vis.win.file.size
if size > 0 then
if vis.win.file:content(size - 1, size) ~= '\n' then
vis.win.file:insert(size, '\n')
end
local lines = vis.win.file.lines
if string.find(lines[#lines], '%S') then
lines[#lines + 1] = ''
end
end
end
local function add_note()
local path = vis.win.file.path
local line = path and path .. ':' .. vis.win.selection.line .. ':' .. vis.win.selection.col .. ': ' .. vis.win.file.lines[vis.win.selection.line]
vis:command('o ~/notes/notes.md')
ensure_last_line_empty()
local lines = vis.win.file.lines
lines[#lines + 1] = '## '
local pos = vis.win.file.size - 1
lines[#lines + 1] = '* time: ' .. os.date('%Y-%m-%d %X')
if line then
lines[#lines + 1] = '* line: ' .. line
end
vis.win.selection.pos = pos
end
vis.events.subscribe(vis.events.INIT, function()
vis:command('set autoindent')
vis:command_register('search', function(argv, force, win, selection, range)
search(argv[1])
end)
vis:map(vis.modes.NORMAL, '<M-k>', '<vis-window-prev>')
vis:map(vis.modes.NORMAL, '<M-j>', '<vis-window-next>')
vis:map(vis.modes.NORMAL, '<M-n>', '<vis-prompt-show>open<Enter>')
vis:map(vis.modes.NORMAL, ' K', close_prev_win)
vis:map(vis.modes.NORMAL, ' J', close_next_win)
vis:map(vis.modes.NORMAL, ' k', qf.action.cp)
vis:map(vis.modes.NORMAL, ' j', qf.action.cn)
vis:map(vis.modes.NORMAL, ' [', '<vis-prompt-show>lspc-prev-diagnostic<Enter>')
vis:map(vis.modes.NORMAL, ' ]', '<vis-prompt-show>lspc-next-diagnostic<Enter>')
vis:map(vis.modes.NORMAL, ' =', '<vis-prompt-show>lspc-format<Enter>')
vis:map(vis.modes.NORMAL, ' s', '<vis-prompt-show>fzf-files auto-search<Enter>', 'fzf: search')
vis:map(vis.modes.NORMAL, ' f', '<vis-prompt-show>fzf-files auto-files<Enter>', 'fzf: files')
vis:map(vis.modes.NORMAL, ' S', '<vis-prompt-show>fzf-files search<Enter>', 'fzf: search with rg')
vis:map(vis.modes.NORMAL, ' F', '<vis-prompt-show>fzf-files files<Enter>', 'fzf: files with fd')
vis:map(vis.modes.NORMAL, ' /', function()
search(fzf_reload(ripgrep .. ' --with-filename {q} ' .. escape_and_quoted(vis.win.file.path)))
end, 'fzf: rg current file')
vis:map(vis.modes.NORMAL, ' d', function()
local shell = os.getenv('SHELL')
vis:command('!' .. shell)
end, 'run shell')
vis:map(vis.modes.NORMAL, ' D', function()
local shell = os.getenv('SHELL')
local path = vis.win.file.path
if path then
local dir = path:match('^.*/')
local arg = escape_and_quoted(dir)
vis:command('!cd ' .. arg .. ' && ' .. shell)
else
vis:command('!' .. shell)
end
end, 'run shell in file directory')
vis:map(vis.modes.NORMAL, ' gl', function()
vis:command('!lazygit')
end, 'lazygit')
vis:map(vis.modes.NORMAL, ' gj', function()
vis:command('!lazyjj')
end, 'lazyjj')
vis:map(vis.modes.NORMAL, ' ', function()
vis:command('fzfmru')
end, 'fzf recent')
vis:map(vis.modes.NORMAL, ' w', function()
open_file_current_line('e')
end, 'open file from current line in current window (with optional line and col)')
vis:map(vis.modes.NORMAL, ' o', function()
open_file_current_line('o')
end, 'open file from current line in new window (with optional line and col)')
vis:map(vis.modes.NORMAL, ' zk', function()
open_file_current_line('e', '<vis-window-prev>')
end, 'open file from current line in above window (with optional line and col)')
vis:map(vis.modes.NORMAL, ' zj', function()
open_file_current_line('e', '<vis-window-next>')
end, 'open file from current line in below window (with optional line and col)')
vis:map(vis.modes.NORMAL, ' c', function()
search('( fd -t d "" ~/src ~/dotfiles -H -E "\\.git" -E node_modules ; zoxide query -l ) | fzf --scheme path', function(path)
vis:command('cd ' .. path)
end)
end, 'fzf change directory')
vis:map(vis.modes.NORMAL, ' l', '<vis-prompt-show>!lf<Enter>', 'lf file manager')
vis:map(vis.modes.NORMAL, ' L', function()
local path = vis.win.file.path
if path then
vis:command('!lf ' .. escape_and_quoted(path:match('^.*/')))
else
vis:command('!lf')
end
end, 'lf file manager in current file directory')
vis:map(vis.modes.NORMAL, ' m', add_global_mark, 'global marks: add')
vis:map(vis.modes.NORMAL, ' M', function()
search('cat ~/.config/vis/global-marks.txt | fzf --tac')
end, 'global marks: jump')
vis:map(vis.modes.NORMAL, ' zm', function()
vis:command('o ~/.config/vis/global-marks.txt')
end, 'global marks: edit')
vis:map(vis.modes.NORMAL, ' n', add_note)
vis:map(vis.modes.NORMAL, ' N', function()
search(fzf_reload(ripgrep .. ' --with-filename {q} ~/notes'))
end, 'search notes')
vis:map(vis.modes.NORMAL, ' td', function()
vis:command('set theme lupan-dark')
end, 'change to dark theme')
vis:map(vis.modes.NORMAL, ' tl', function()
vis:command('set theme lupan-light')
end, 'change to light theme')
vis:map(vis.modes.NORMAL, '<C-l>', function()
vis:feedkeys('<vis-selections-remove-column-except>')
set_current_theme()
end, 'Remove all but the count selection column and update theme if needed')
set_current_theme()
end)
vis.events.subscribe(vis.events.WIN_OPEN, function(win)
vis:command('set relativenumber')
end)
vis.events.subscribe(vis.events.FILE_SAVE_PRE, function(file, path)
if path:find('[.]go$') then
-- formatting is async, so when reformated you should write file again
vis:command('lspc-format')
end
return true
end)

View File

@@ -1,3 +1,5 @@
#define THEME_DARK
#if HEIGHT >= 2160
Xft.dpi: 160
Xcursor.size: 48
@@ -53,3 +55,51 @@ XTerm.vt100.color14: #8FBCBB
! white
XTerm.vt100.color7: #E5E9F0
XTerm.vt100.color15: #ECEFF4
st.font: FiraCode Nerd Font:size=10
#ifdef THEME_DARK
st.lightmode: 0
st.background: #1f212e
st.foreground: #9da0af
st.cursorColor: #bf8040
st.reverse-cursor: #1f212e
st.color0: #1f212e
st.color1: #862d2d
st.color2: #3a783a
st.color3: #707010
st.color4: #345eb2
st.color5: #cc66cc
st.color6: #3a7878
st.color7: #a1a3aa
st.color8: #4d4d4d
st.color9: #c27070
st.color10: #40bf40
st.color11: #acac53
st.color12: #6b8ac7
st.color13: #8f248f
st.color14: #509595
st.color15: #dbdff0
#else
st.lightmode: 1
st.background: #f2f2f3
st.foreground: #1f212e
st.cursorColor: #bf8040
st.reverse-cursor: #1f212e
st.color0: #1f212e
st.color1: #862d2d
st.color2: #3a783a
st.color3: #707010
st.color4: #345eb2
st.color5: #cc66cc
st.color6: #3a7878
st.color7: #a1a3aa
st.color8: #73778c
st.color9: #c27070
st.color10: #40bf40
st.color11: #acac53
st.color12: #6b8ac7
st.color13: #8f248f
st.color14: #509595
st.color15: #dae4f1
#endif

View File

@@ -6,7 +6,8 @@ fi
xset b off
xrandr --auto
xrandr --output HDMI1 --right-of DP1
xrandr --output DP-0 --left-of DP-2 --primary
xrandr --output HDMI-0 --left-of DP-0
xrdb -merge ~/.Xresources
setxkbmap pl -option ctrl:nocaps
@@ -29,13 +30,21 @@ xsetroot -cursor_name left_ptr
picom -b -I 1 -O 1 -i 1 -e 1 --no-fading-openclose || compton -b --no-fading-openclose
if which dwm > /dev/null; then
lupan-clock &
exec dwm
fi
if which awesome > /dev/null; then
exec awesome
fi
if which dwm > /dev/null; then
lupan-clock &
exec dwm
if which dk > /dev/null; then
for m in $(polybar --list-monitors | cut -d: -f1); do
MONITOR=$m polybar --reload bar &
done
fi
exec dk
fi
if which xmonad > /dev/null && test -f ~/.config/xmonad/xmonad.hs; then

View File

@@ -3,33 +3,63 @@
THEME="$1"
if [ "$THEME" = "toggle" ]; then
if grep Materia-dark ~/.config/xsettingsd/xsettingsd.conf > /dev/null; then
THEME=light
else
if [ -e ~/.lightmode ]; then
THEME=dark
else
THEME=light
fi
fi
if [ "$THEME" = dark ]; then
GTK_THEME=Materia-dark
rm -f ~/.lightmode
elif [ "$THEME" = light ]; then
GTK_THEME=Materia-light
touch ~/.lightmode
else
echo "error: unknown theme: should be either dark, light or toggle" >&2
exit 1
fi
# Alacritty
if [ -f ~/.config/alacritty/alacritty.yml ]; then
sed -i "s/^colors: [*].*/colors: *$THEME/" ~/.config/alacritty/alacritty.yml
pkill -USR1 '^dwm$'
XRES=$(readlink -e ~/.Xresources)
if [ -n "$XRES" ]; then
if [ "$THEME" = dark ]; then
sed -i 's/^#undef THEME_DARK/#define THEME_DARK/' "$XRES"
elif [ "$THEME" = light ]; then
sed -i 's/^#define THEME_DARK/#undef THEME_DARK/' "$XRES"
fi
xrdb -merge "$XRES"
pkill -USR1 '^st$'
fi
if [ -f ~/.config/alacritty/alacritty.toml ]; then
sed -i "s#^import =.*#import = [\"~/.config/alacritty/$THEME.toml\"]#" ~/.config/alacritty/alacritty.toml
# Alacritty
AYML=$(readlink -e ~/.config/alacritty/alacritty.yml)
if [ -n "$AYML" ]; then
sed -i "s/^colors: [*].*/colors: *$THEME/" "$AYML"
fi
ATOML=$(readlink -e ~/.config/alacritty/alacritty.toml)
if [ -f "$ATOML" ]; then
sed -i "s#^import =.*#import = [\"~/.config/alacritty/$THEME.toml\"]#" "$ATOML"
fi
XSET=$(readlink -e ~/.config/xsettingsd/xsettingsd.conf)
if [ "$THEME" = dark ]; then
kitten themes --reload-in=all Afterglow
elif [ "$THEME" = light ]; then
kitten themes --reload-in=all One Half Light
fi
# GTK
if [ -f ~/.config/xsettingsd/xsettingsd.conf ]; then
sed -i -E "s#(Net/ThemeName) .*#\\1 \"${GTK_THEME}\"#" ~/.config/xsettingsd/xsettingsd.conf
if [ -n "$XSET" ]; then
sed -i -E "s#(Net/ThemeName) .*#\\1 \"${GTK_THEME}\"#" "$XSET"
pkill -HUP -x xsettingsd
gsettings set org.gnome.desktop.interface gtk-theme "${GTK_THEME}"
fi
# waybar
WCSS=$(readlink -e ~/.config/waybar/style.css)
if [ -f "$WCSS" ]; then
sed -i -E "s#file:///.*/(light|dark)[.]css#file://$HOME/.config/waybar/$THEME.css#" "$WCSS"
fi

15
xsession/bin/st-abduco-tabbed Executable file
View File

@@ -0,0 +1,15 @@
#!/bin/sh
if [ $# -eq 0 ]; then
exec tabbed "$0" -w
fi
if [ "$1" = "-w" ] && [ -n "$2" ]; then
name=$(abduco | tail +2 | awk -F'\t' '{ print $NF }' | dmenu -p session: -l 10)
if [ -n "$name" ]; then
exec st -w "$2" -t "$name" -e abduco -A "$name" "$SHELL"
fi
else
echo error: requires either no arguments or single option -w with and argument >&2
exit 1
fi

View File

@@ -0,0 +1,17 @@
[opener]
imv = [
{ run = 'imv "$@"', orphan = true },
]
zathura = [
{ run = 'zathura "$@"', orphan = true },
]
fzf_vis = [
{ run = 'cd "$@" && fd --type f | fzf --bind "enter:become(vis {})"', block = true }
]
[open]
prepend_rules = [
{ mime = "image/*", use = "imv" },
{ mime = "application/pdf", use = "zathura" },
{ mime = "inode/directory", use = "fzf_vis" }
]