Compare commits

..

2 Commits

Author SHA1 Message Date
001860e40f hyprland: lock on suspend, mouse move/resize 2024-02-16 00:05:11 +01:00
9c057cd96b add hyperland 2024-02-14 00:16:11 +01:00
113 changed files with 1777 additions and 4503 deletions

2
.gitignore vendored
View File

@@ -9,5 +9,3 @@ 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: dwm st
clone: ~/.local/share/zap dwm st
build: build-dwm build-st build-lupan-clock
@@ -14,38 +14,32 @@ install: install-dwm install-st install-lupan-clock install-other
dwm:
git clone https://git.suckless.org/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
cp -i patches/dwm/config.h dwm/
build-dwm:
make -C dwm
install-dwm:
make -C dwm install PREFIX="${HOME}/.local/stow/dwm"
stow -d ~/.local/stow dwm
make -C dwm install PREFIX="${HOME}/.local"
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-4 --track lupan.pl/patched-4
git checkout -b patched --track lupan.pl/patched
build-st:
make -C st
install-st:
make -C st install PREFIX="${HOME}/.local/stow/st"
stow -d ~/.local/stow st
make -C st install PREFIX="${HOME}/.local"
build-lupan-clock:
make -C lupan-clock
install-lupan-clock:
make -C lupan-clock install PREFIX="${HOME}/.local/stow/lupan-clock"
stow -d ~/.local/stow lupan-clock
make -C lupan-clock install PREFIX="${HOME}/.local"
install-other:
stow -Rv lazygit shell tmux nvim vis xsession
stow -Rv shell tmux xsession nvim

View File

@@ -4,40 +4,11 @@ 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 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
$ sh check_dependencies.sh
```
Install font `ttf-firacode-nerd` (https://github.com/ryanoasis/nerd-fonts/releases/download/v3.0.2/FiraCode.zip).

View File

@@ -1,3 +1,5 @@
import = ["~/.config/alacritty/dark.toml"]
[colors]
draw_bold_text_with_bright_colors = false
@@ -5,13 +7,10 @@ draw_bold_text_with_bright_colors = false
TERM = "xterm-256color"
[font]
size = 10
size = 10.5
[font.bold]
family = "Fira Code Nerd Font"
family = "GoMono Nerd Font"
[font.normal]
family = "Fira Code Nerd Font"
[general]
import = ["~/.config/alacritty/dark.toml"]
family = "GoMono Nerd Font"

View File

@@ -0,0 +1,306 @@
# 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,31 +1,3 @@
# 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'
import = [
"~/.config/alacritty/themes/themes/nightfox.toml"
]

View File

@@ -1,35 +1,3 @@
# 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'
import = [
"~/.config/alacritty/themes/themes/ayu_light.toml"
]

View File

@@ -0,0 +1,30 @@
#!/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,20 +51,7 @@ end
-- {{{ Variable definitions
-- Themes define colours, icons, font and wallpapers.
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()
local theme = "theme_dark.lua"
beautiful.init(gears.filesystem.get_configuration_dir() .. theme)
local function set_wallpaper(s)
@@ -88,7 +75,7 @@ local function switch_theme()
end
-- This is used later as the default terminal and editor to run.
local terminal = "st"
local terminal = "alacritty"
-- Default modkey.
local modkey = "Mod4"
@@ -123,7 +110,7 @@ local mykeyboardlayout = awful.widget.keyboardlayout()
-- {{{ Wibar
-- Create a textclock widget
local mytextclock = wibox.widget.textclock('%H:%M ')
local mytextclock = wibox.widget.textclock()
-- Create a wibox for each screen and add it
local taglist_buttons = gears.table.join(
@@ -236,15 +223,6 @@ 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,
@@ -347,8 +325,8 @@ local globalkeys = gears.table.join(
end,
{ description = "lua execute prompt", group = "awesome" }),
-- Menubar
awful.key({ modkey }, "p", function() awful.spawn("dmenu_run -fn 'FiraCode Nerd Font Ret:size=10'") end,
{ description = "run command", group = "launcher" })
awful.key({ modkey, }, "p", function() menubar.show() end,
{ description = "show the menubar", group = "launcher" })
)
local clientkeys = gears.table.join(
@@ -377,11 +355,8 @@ local clientkeys = gears.table.join(
{ description = "minimize", group = "client" }),
awful.key({ modkey, }, "m",
function(c)
if awful.layout.getname() == "max" then
awful.layout.set(awful.layout.suit.tile)
else
awful.layout.set(awful.layout.suit.max)
end
c.maximized = not c.maximized
c:raise()
end,
{ description = "(un)maximize", group = "client" }),
awful.key({ modkey, }, "v",
@@ -444,11 +419,7 @@ for i = 1, 9 do
end
end
end,
{ 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" })
{ description = "toggle focused client on tag #" .. i, group = "tag" })
)
end
@@ -484,8 +455,7 @@ awful.rules.rules = {
keys = clientkeys,
buttons = clientbuttons,
screen = awful.screen.preferred,
placement = awful.placement.no_overlap + awful.placement.no_offscreen,
size_hints_honor = false,
placement = awful.placement.no_overlap + awful.placement.no_offscreen
}
},
@@ -537,19 +507,6 @@ 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,
@@ -562,7 +519,6 @@ 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.
@@ -570,23 +526,6 @@ client.connect_signal("mouse::enter", function(c)
c:emit_signal("request::activate", "mouse_enter", { raise = false })
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)
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)
-- }}}

View File

@@ -5,36 +5,30 @@ local dpi = xresources.apply_dpi
local theme = {}
theme.font = "Fira Code Nerd Font 10"
theme.font = "GoMono Nerd Font 10.5"
theme.tasklist_disable_icon = true
theme.wibar_height = 30
theme.wibar_height = 40
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_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 = "#1c3b4a" -- hsl(200 45% 20%)
theme.tasklist_bg_focus = "#263c59" -- hsl(215deg 40% 25%)
theme.fg_normal = "#8f9ca3" -- hsl(200 10% 60%)
theme.fg_focus = "#abb5ba" -- hsl(200 10% 70%)
theme.fg_normal = "#9ea7aa"
theme.fg_focus = "#b1babd"
theme.fg_urgent = theme.bg_focus
theme.fg_minimize = theme.fg_normal
theme.taglist_fg_empty = "#454f54" -- hsl(200 10% 30%)
theme.fg_minimize = "#8a9294"
theme.taglist_fg_empty = "#798082"
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.border_normal = "#708090"
theme.border_focus = "#a0522d"
theme.border_marked = "#91231c"
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
theme.bg_wallpaper = "#424a4c"
-- You can use your own layout icons like this:
theme.layout_fairh = themes_path .. "default/layouts/fairhw.png"

View File

@@ -5,36 +5,30 @@ local dpi = xresources.apply_dpi
local theme = {}
theme.font = "Fira Code Nerd Font 10"
theme.font = "GoMono Nerd Font 10.5"
theme.tasklist_disable_icon = true
theme.wibar_height = 30
theme.wibar_height = 40
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_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 = "#a6c7f2" -- hsl(214 75% 80%)
theme.tasklist_bg_focus = "#5e85ba" -- hsl(215deg 40% 55%)
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.fg_normal = "#616c6f"
theme.fg_focus = "#363d3e"
theme.fg_urgent = "#e9f2f5"
theme.fg_minimize = "#4b5456"
theme.taglist_fg_empty = "#566063"
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.border_normal = "#bebebe"
theme.border_focus = "#ff7f50"
theme.border_marked = "#91231c"
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
theme.bg_wallpaper = "#b0bec2"
-- You can use your own layout icons like this:
theme.layout_fairh = themes_path .. "default/layouts/fairhw.png"

View File

@@ -1,53 +1,37 @@
#!/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:'
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
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
echo -e '\n# optional:'
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
for CMD in \
sx \
picom \
compton \
xbacklight; do
which "$CMD"
done

View File

@@ -1,43 +0,0 @@
#!/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

View File

@@ -1,175 +0,0 @@
#!/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

View File

@@ -1,117 +0,0 @@
# 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 +0,0 @@
[main]
font = Fira Code Nerd Font:size=11
include = /usr/share/foot/themes/nord

View File

@@ -0,0 +1,85 @@
env = LIBVA_DRIVER_NAME,nvidia
env = XDG_SESSION_TYPE,wayland
env = GBM_BACKEND,nvidia-drm
env = __GLX_VENDOR_LIBRARY_NAME,nvidia
env = WLR_NO_HARDWARE_CURSORS,1
monitor=DP-2,highres,0x0,1.666667,transform,1
monitor=DP-1,highres,1295x0,1.666667
input {
kb_layout = pl
kb_options = ctrl:nocaps
}
general {
gaps_in = 2
gaps_out = 5
}
animations {
enabled = false
}
misc {
disable_hyprland_logo = true
disable_splash_rendering = true
}
$menu = rofi -show drun -theme Arc-Dark
$terminal = alacritty
$mainMod = SUPER
bind = $mainMod, P, exec, $menu
bind = $mainMod SHIFT, Return, exec, $terminal
bind = $mainMod CONTROL SHIFT, Q, exit
bind = $mainMod CONTROL SHIFT, L, exec, swaylock -c 263c59
bind = $mainMod CONTROL SHIFT, S, exec, swaylock -c 263c59
bind = $mainMod CONTROL SHIFT, S, exec, systemctl suspend
bind = $mainMod, F, fullscreen, 0
bind = $mainMod, N, cyclenext,
bind = $mainMod, P, cyclenext, prev
bind = $mainMod, h, movefocus, l
bind = $mainMod, j, movefocus, d
bind = $mainMod, k, movefocus, u
bind = $mainMod, l, movefocus, r
bind = $mainMod SHIFT, h, swapwindow, l
bind = $mainMod SHIFT, j, swapwindow, d
bind = $mainMod SHIFT, k, swapwindow, u
bind = $mainMod SHIFT, l, swapwindow, r
# Switch workspaces with mainMod + [0-9]
bind = $mainMod, 1, workspace, 1
bind = $mainMod, 2, workspace, 2
bind = $mainMod, 3, workspace, 3
bind = $mainMod, 4, workspace, 4
bind = $mainMod, 5, workspace, 5
bind = $mainMod, 6, workspace, 6
bind = $mainMod, 7, workspace, 7
bind = $mainMod, 8, workspace, 8
bind = $mainMod, 9, workspace, 9
bind = $mainMod, 0, workspace, 10
# Move active window to a workspace with mainMod + SHIFT + [0-9]
bind = $mainMod SHIFT, 1, movetoworkspace, 1
bind = $mainMod SHIFT, 2, movetoworkspace, 2
bind = $mainMod SHIFT, 3, movetoworkspace, 3
bind = $mainMod SHIFT, 4, movetoworkspace, 4
bind = $mainMod SHIFT, 5, movetoworkspace, 5
bind = $mainMod SHIFT, 6, movetoworkspace, 6
bind = $mainMod SHIFT, 7, movetoworkspace, 7
bind = $mainMod SHIFT, 8, movetoworkspace, 8
bind = $mainMod SHIFT, 9, movetoworkspace, 9
bind = $mainMod SHIFT, 0, movetoworkspace, 10
bind = $mainMod, right, workspace, m+1
bind = $mainMod, left, workspace, m-1
bindm = $mainMod,mouse:272,movewindow
bindm = $mainMod,mouse:273,resizewindow
exec-once = waybar
exec-once = swayidle -w timeout 300 'swaylock -f -c 263c59' before-sleep 'swaylock -f -c 263c59'

View File

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

View File

@@ -0,0 +1,22 @@
* {
font-family: GoMono Nerd Font;
font-size: 14;
background-color: #263c59;
color: #7b899d;
}
#workspaces {
padding: 0 1rem;
}
#workspaces button {
padding: 0 3px;
}
#workspaces button.active {
background-color: #7b899d;
}
#clock {
padding: 0 1rem;
}

View File

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

View File

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

View File

@@ -1,151 +0,0 @@
source = ~/.config/hypr/white.conf
input {
kb_layout = pl
kb_options = ctrl:nocaps
}
general {
gaps_in = 3
gaps_out = 4
layout = master
border_size = 3
col.inactive_border = 0xff5387ac
col.active_border = 0xffac7853
}
dwindle {
preserve_split = true
}
decoration {
rounding = 4
}
animations {
enabled = false
}
misc {
disable_hyprland_logo = true
disable_splash_rendering = true
disable_autoreload = true
background_color = 0xff808080
}
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
bind = $mainMod, A, focuscurrentorlast
bind = $mainMod SHIFT, I, layoutmsg, swapprev
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
bind = $mainMod, k, movefocus, u
bind = $mainMod, l, movefocus, r
bind = $mainMod SHIFT, h, swapwindow, l
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
bind = $mainMod CONTROL, l, layoutmsg, orientationright
# Switch workspaces with mainMod + [0-9]
bind = $mainMod, 1, workspace, 1
bind = $mainMod, 2, workspace, 2
bind = $mainMod, 3, workspace, 3
bind = $mainMod, 4, workspace, 4
bind = $mainMod, 5, workspace, 5
bind = $mainMod, 6, workspace, 6
bind = $mainMod, 7, workspace, 7
bind = $mainMod, 8, workspace, 8
bind = $mainMod, 9, workspace, 9
bind = $mainMod, 0, workspace, 10
# Move active window to a workspace with mainMod + SHIFT + [0-9]
bind = $mainMod SHIFT, 1, movetoworkspace, 1
bind = $mainMod SHIFT, 2, movetoworkspace, 2
bind = $mainMod SHIFT, 3, movetoworkspace, 3
bind = $mainMod SHIFT, 4, movetoworkspace, 4
bind = $mainMod SHIFT, 5, movetoworkspace, 5
bind = $mainMod SHIFT, 6, movetoworkspace, 6
bind = $mainMod SHIFT, 7, movetoworkspace, 7
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 + [0-9]
bind = $mainMod CONTROL, 1, focusworkspaceoncurrentmonitor, 1
bind = $mainMod CONTROL, 2, focusworkspaceoncurrentmonitor, 2
bind = $mainMod CONTROL, 3, focusworkspaceoncurrentmonitor, 3
bind = $mainMod CONTROL, 4, focusworkspaceoncurrentmonitor, 4
bind = $mainMod CONTROL, 5, focusworkspaceoncurrentmonitor, 5
bind = $mainMod CONTROL, 6, focusworkspaceoncurrentmonitor, 6
bind = $mainMod CONTROL, 7, focusworkspaceoncurrentmonitor, 7
bind = $mainMod CONTROL, 8, focusworkspaceoncurrentmonitor, 8
bind = $mainMod CONTROL, 9, focusworkspaceoncurrentmonitor, 9
bind = $mainMod CONTROL, 0, focusworkspaceoncurrentmonitor, 10
bindm = $mainMod,mouse:272,movewindow
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

@@ -1,5 +0,0 @@
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

@@ -1,10 +0,0 @@
env = LIBVA_DRIVER_NAME,nvidia
env = XDG_SESSION_TYPE,wayland
env = GBM_BACKEND,nvidia-drm
env = __GLX_VENDOR_LIBRARY_NAME,nvidia
env = WLR_NO_HARDWARE_CURSORS,1
monitor=DP-1,highres,0x0,2
monitor=DP-2,highres,1920x0,2
# vim: ft=hyprlang

View File

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

View File

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

View File

@@ -1,25 +0,0 @@
@import url("file:///home/lupan/.config/waybar/dark.css");
* {
font-family: Fira Code Nerd Font;
font-size: 12px;
}
#workspaces {
padding: 0 0.5rem;
}
#workspaces button {
padding: 0 3px;
border-radius: 0;
border-bottom: 3px solid transparent;
}
#window {
border-bottom: 3px solid transparent;
}
#clock {
padding: 0 0.5rem;
border-bottom: 3px solid transparent;
}

View File

@@ -1,32 +0,0 @@
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

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

View File

@@ -0,0 +1,140 @@
-- [[ Configure LSP ]]
-- This function gets run when an LSP connects to a particular buffer.
local on_attach = function(_, bufnr)
local nmap = function(keys, func, desc)
if desc then
desc = 'LSP: ' .. desc
end
vim.keymap.set('n', keys, func, { buffer = bufnr, desc = desc })
end
nmap('<leader>rn', vim.lsp.buf.rename, '[R]e[n]ame')
nmap('<leader>ca', vim.lsp.buf.code_action, '[C]ode [A]ction')
nmap('gd', vim.lsp.buf.definition, '[G]oto [D]efinition')
nmap('gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences')
nmap('gI', vim.lsp.buf.implementation, '[G]oto [I]mplementation')
nmap('<leader>D', vim.lsp.buf.type_definition, 'Type [D]efinition')
nmap('<leader>ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols')
nmap('<leader>ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols')
-- See `:help K` for why this keymap
nmap('K', vim.lsp.buf.hover, 'Hover Documentation')
nmap('<leader>K', vim.lsp.buf.signature_help, 'Signature Documentation')
-- Lesser used LSP functionality
nmap('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration')
nmap('<leader>wa', vim.lsp.buf.add_workspace_folder, '[W]orkspace [A]dd Folder')
nmap('<leader>wr', vim.lsp.buf.remove_workspace_folder, '[W]orkspace [R]emove Folder')
nmap('<leader>wl', function()
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
end, '[W]orkspace [L]ist Folders')
-- Create a command `:Format` local to the LSP buffer
vim.api.nvim_buf_create_user_command(bufnr, 'Format', function(_)
vim.lsp.buf.format()
end, { desc = 'Format current buffer with LSP' })
end
-- Enable the following language servers. They will automatically be installed.
local servers = {
clangd = {},
gopls = {},
-- pyright = {},
rust_analyzer = {},
tsserver = {},
lua_ls = {
Lua = {
workspace = { checkThirdParty = false },
telemetry = { enable = false },
},
},
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()
-- nvim-cmp supports additional completion capabilities, so broadcast that to servers
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities)
-- Ensure the servers above are installed
local mason_lspconfig = require 'mason-lspconfig'
mason_lspconfig.setup {
ensure_installed = vim.tbl_keys(servers),
}
mason_lspconfig.setup_handlers {
function(server_name)
require('lspconfig')[server_name].setup {
capabilities = capabilities,
on_attach = on_attach,
settings = servers[server_name],
}
end,
}
-- [[ Configure nvim-cmp ]]
-- See `:help cmp`
local cmp = require 'cmp'
local luasnip = require 'luasnip'
require('luasnip.loaders.from_vscode').lazy_load()
luasnip.config.setup {}
cmp.setup {
completion = { autocomplete = false },
snippet = {
expand = function(args)
luasnip.lsp_expand(args.body)
end,
},
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-Space>'] = cmp.mapping.complete {},
['<Tab>'] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif luasnip.expand_or_locally_jumpable() then
luasnip.expand_or_jump()
else
fallback()
end
end, { 'i', 's' }),
['<S-Tab>'] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif luasnip.locally_jumpable(-1) then
luasnip.jump(-1)
else
fallback()
end
end, { 'i', 's' }),
},
sources = {
{ name = 'nvim_lsp' },
{ name = 'luasnip' },
},
}

View File

@@ -0,0 +1,8 @@
local ls = require "luasnip"
ls.config.set_config {
history = true,
updateevents = "TextChanged,TextChangedI",
}
require("luasnip.loaders.from_lua").load({ paths = "~/.config/nvim/snippets" })

View File

@@ -0,0 +1,14 @@
local telescope = require 'telescope'
telescope.setup({
extensions = {
whaler = {
directories = { "/home/lupan/src" },
oneoff_directories = { "/home/lupan/dotfiles" },
auto_file_explorer = false,
auto_cwd = true,
}
}
})
telescope.load_extension("whaler")

View File

@@ -0,0 +1,78 @@
local org = require('orgmode')
org.setup_ts_grammar()
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',
})

View File

@@ -1,20 +1 @@
require("config.options")
require("config.remap")
require("config.lsp")
require("plugins.arrow")
require("plugins.auto-session")
require("plugins.colorscheme")
require("plugins.conform")
require("plugins.flash")
require("plugins.guess-indent")
require("plugins.luasnip")
require("plugins.multicursor")
require("plugins.nvim-various-textobjs")
require("plugins.oil")
require("plugins.slimline")
require("plugins.snacks")
require("plugins.telescope")
require("plugins.surround")
require("plugins.treesitter")
require("plugins.which-key")
require("lupan")

View File

@@ -1,12 +0,0 @@
{
"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

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

View File

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

View File

@@ -1,12 +0,0 @@
return {
cmd = { "lua-language-server" },
filetypes = { "lua" },
root_markers = { ".luarc.json", ".git" },
settings = {
Lua = {
runtime = {
version = "LuaJIT",
},
},
},
}

View File

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

View File

@@ -1,5 +0,0 @@
return {
cmd = { "templ", "lsp" },
filetypes = { "templ" },
root_markers = { "go.mod", "go.work", ".git" },
}

View File

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

View File

@@ -1,57 +0,0 @@
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

@@ -1,17 +0,0 @@
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

@@ -1,27 +0,0 @@
vim.lsp.enable({
"clangd",
"gopls",
"templ-lsp",
"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>ca", 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

@@ -1,13 +0,0 @@
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.title = true
vim.opt.timeout = false
vim.o.undofile = true

View File

@@ -1,12 +0,0 @@
local set = vim.keymap.set
set("n", "<M-h>", "<C-w>h")
set("n", "<M-k>", "<C-w>k")
set("n", "<M-j>", "<C-w>j")
set("n", "<M-l>", "<C-w>l")
set("n", "<Esc>", "<cmd>nohlsearch<cr>")
set("n", "<leader>K", "<cmd>cp<cr>")
set("n", "<leader>J", "<cmd>cn<cr>")
set("n", "<leader>x", "<cmd>copen<cr>")
set("n", "<leader>X", "<cmd>cclose<cr>")

View File

@@ -0,0 +1,17 @@
-- [[ Highlight on yank ]]
-- See `:help vim.highlight.on_yank()`
local highlight_group = vim.api.nvim_create_augroup('YankHighlight', { clear = true })
vim.api.nvim_create_autocmd('TextYankPost', {
callback = function()
vim.highlight.on_yank()
end,
group = highlight_group,
pattern = '*',
})
vim.api.nvim_create_autocmd('BufWritePre', {
callback = function()
vim.lsp.buf.format()
end,
pattern = { '*.go', '*.lua' },
})

View File

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

View File

@@ -0,0 +1,13 @@
-- 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

@@ -0,0 +1,48 @@
-- See `:help vim.o`
-- Set highlight on search
vim.o.hlsearch = false
-- 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

@@ -0,0 +1,173 @@
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><space>', '<cmd>Telescope buffers<cr>', { desc = '[ ] Find existing buffers' })
key('n', '<leader>?', '<cmd>Telescope oldfiles<cr>', { desc = '[?] Find recently opened buffers' })
key('n', '<leader>/', function()
require('telescope.builtin').current_buffer_fuzzy_find(require("telescope.themes").get_dropdown { previewer = false })
end, { desc = '[/] Find in current buffer' })
key('n', '<leader>gf', '<cmd>Telescope git_files<cr>', { desc = '[G]it [f]iles' })
key('n', '<leader>gs', '<cmd>Telescope git_status<cr>', { desc = '[G]it [s]tatus' })
key('n', '<leader>gg', ':Git grep ', { desc = '[G]it [g]rep' })
key('n', '<leader>ff', '<cmd>Telescope find_files<cr>', { desc = '[F]ind [f]iles' })
key('n', '<leader>fg', '<cmd>Telescope live_grep<cr>', { desc = '[F]ind [g]rep' })
key('n', '<leader>fw', '<cmd>Telescope grep_string<cr>', { desc = '[F]ind [w]ord' })
key('n', '<leader>fh', '<cmd>Telescope help_tags<cr>', { desc = '[F]ind [h]elp (tags)' })
key('n', '<leader>fd', '<cmd>Telescope diagnostics<cr>', { desc = '[F]ind [d]iagnostics' })
key('n', '<leader>fk', '<cmd>Telescope keymaps<cr>', { desc = '[F]ind [k]eymaps' })
key('n', '<leader>fF', function()
require('telescope.builtin').find_files { hidden = true }
end, { desc = '[F]ind [F]iles (with hidden)' })
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
key("n", "<leader>fl", '<cmd>Telescope whaler<cr>', { desc = '[F]ind with wha[l]er' })
-- Diagnostic keymaps
key('n', '[d', vim.diagnostic.goto_prev, { desc = 'Go to previous diagnostic message' })
key('n', ']d', vim.diagnostic.goto_next, { desc = 'Go to next diagnostic message' })
key('n', '<leader>e', vim.diagnostic.open_float, { desc = 'Open floating diagnostic message' })
key('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagnostics 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

@@ -0,0 +1,44 @@
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

@@ -0,0 +1,54 @@
local function cwd()
return vim.fn.getcwd()
end
local function set_bg()
if vim.o.background == 'dark' then
vim.cmd.colorscheme("nightfox")
else
vim.cmd.colorscheme("dayfox")
end
end
vim.api.nvim_create_autocmd('OptionSet', {
callback = set_bg,
pattern = { 'background' },
})
return {
-- Colorscheme
{
'EdenEast/nightfox.nvim',
config = function()
set_bg()
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

@@ -1,12 +0,0 @@
vim.pack.add({ "https://github.com/otavioschwanck/arrow.nvim" })
local ok, arrow = pcall(require, "arrow")
if ok then
arrow.setup({
show_icons = false,
leader_key = "_",
buffer_leader_key = " m",
})
else
print("plugin arrow missing")
end

View File

@@ -1,12 +0,0 @@
vim.pack.add({ "https://github.com/rmagatti/auto-session" })
vim.keymap.set("n", "<leader>wa", "<cmd>AutoSession search<cr>")
local ok, sess = pcall(require, "auto-session")
if ok then
sess.setup({
suppressed_dirs = { "~/", "~/src", "~/Downloads", "/" },
})
else
print("plugin auto-session missing")
end

View File

@@ -1,5 +0,0 @@
vim.pack.add({ "https://github.com/EdenEast/nightfox.nvim", "https://github.com/rebelot/kanagawa.nvim" })
local cs = require("config.colorscheme")
cs.set_colorschemes("kanagawa-wave", "dayfox")
cs.update_colorscheme()

View File

@@ -1,36 +0,0 @@
vim.pack.add({ "https://github.com/stevearc/conform.nvim" })
local ok, conform = pcall(require, "conform")
if ok then
conform.setup({
formatters_by_ft = {
lua = { "stylua" },
},
format_on_save = function(bufnr)
-- Disable with a global or buffer-local variable
if vim.g.disable_autoformat or vim.b[bufnr].disable_autoformat then
return
end
return { timeout_ms = 500, lsp_format = "fallback" }
end,
})
vim.api.nvim_create_user_command("FormatDisable", function(args)
if args.bang then
-- FormatDisable! will disable formatting just for this buffer
vim.b.disable_autoformat = true
else
vim.g.disable_autoformat = true
end
end, {
desc = "Disable autoformat-on-save",
bang = true,
})
vim.api.nvim_create_user_command("FormatEnable", function()
vim.b.disable_autoformat = false
vim.g.disable_autoformat = false
end, {
desc = "Re-enable autoformat-on-save",
})
else
print("plugin conform missing")
end

View File

@@ -0,0 +1,26 @@
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
},
-- change directory with telescope from a list of dierectories
"SalOrak/whaler",
}

View File

@@ -1,30 +0,0 @@
vim.pack.add({ "https://github.com/folke/flash.nvim" })
local ok, flash = pcall(require, "flash")
if ok then
flash.setup({
modes = {
char = {
enabled = false,
},
},
})
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" })
else
print("plugin flash missing")
end

View File

@@ -0,0 +1,32 @@
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,8 +0,0 @@
vim.pack.add({ "https://github.com/NMAC427/guess-indent.nvim" })
local ok, guess_indent = pcall(require, "guess-indent")
if ok then
guess_indent.setup()
else
print("plugin guess-indent missing")
end

View File

@@ -0,0 +1,71 @@
return {
-- Fuzzy finder
{
'nvim-telescope/telescope.nvim',
branch = '0.1.x',
dependencies = {
'nvim-lua/plenary.nvim' },
config = function()
pcall(require('telescope').load_extension, 'fzf')
end,
cmd = 'Telescope',
},
{
'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'
},
{
-- LSP Configuration & Plugins
'neovim/nvim-lspconfig',
dependencies = {
-- Automatically install LSPs to stdpath for neovim
{ 'williamboman/mason.nvim', config = true },
'williamboman/mason-lspconfig.nvim',
-- Useful status updates for LSP
{ 'j-hui/fidget.nvim', tag = 'legacy', opts = {} },
-- Additional lua configuration, makes nvim stuff amazing!
'folke/neodev.nvim',
},
},
{
-- Autocompletion
'hrsh7th/nvim-cmp',
dependencies = {
-- Snippet Engine & its associated nvim-cmp source
'L3MON4D3/LuaSnip',
'saadparwaiz1/cmp_luasnip',
-- Adds LSP completion capabilities
'hrsh7th/cmp-nvim-lsp',
-- Adds a number of user-friendly snippets
'rafamadriz/friendly-snippets',
},
},
-- Show pending keybinds
{ 'folke/which-key.nvim', opts = {} },
{
'ThePrimeagen/harpoon',
dependencies = { 'nvim-lua/plenary.nvim' },
lazy = true,
},
{
'crusj/hierarchy-tree-go.nvim',
dependencies = 'neovim/nvim-lspconfig',
},
}

View File

@@ -1,48 +0,0 @@
vim.api.nvim_create_autocmd("PackChanged", {
group = vim.api.nvim_create_augroup("luasnip-update", { clear = true }),
callback = function(ev)
local name, kind = ev.data.spec.name, ev.data.kind
if name == "luasnip" and (kind == "install" or kind == "update") then
vim.system({ "make install_jsregexp" }, { cwd = ev.data.path }):wait()
print("luasnip make done.")
end
end,
})
vim.pack.add({ { src = "https://github.com/L3MON4D3/LuaSnip", version = vim.version.range("^2.0.0") } })
local ok, ls = pcall(require, "luasnip")
if ok then
vim.keymap.set({ "i" }, "<C-K>", function()
ls.expand()
end, { silent = true })
vim.keymap.set({ "i", "s" }, "<C-L>", function(fallback)
if ls.locally_jumpable() then
ls.jump(1)
else
local key = vim.api.nvim_replace_termcodes("<C-L>", true, false, true)
vim.api.nvim_feedkeys(key, "n", false)
end
end, { silent = true })
vim.keymap.set({ "i", "s" }, "<C-J>", function()
if ls.locally_jumpable() then
ls.jump(-1)
else
local key = vim.api.nvim_replace_termcodes("<C-J>", true, false, true)
vim.api.nvim_feedkeys(key, "n", false)
end
end, { silent = true })
vim.keymap.set({ "i", "s" }, "<C-E>", function()
if ls.choice_active() then
ls.change_choice(1)
else
local key = vim.api.nvim_replace_termcodes("<C-E>", true, false, true)
vim.api.nvim_feedkeys(key, "n", false)
end
end, { silent = true })
require("luasnip.loaders.from_lua").load({ paths = vim.fs.joinpath(vim.fn.stdpath("config"), "lua", "snippets") })
else
print("plugin luasnip missing")
end

View File

@@ -1,76 +0,0 @@
vim.pack.add({ { src = "https://github.com/jake-stewart/multicursor.nvim", version = "1.0" } })
local ok, mc = pcall(require, "multicursor-nvim")
if ok then
mc.setup()
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" })
else
print("plugin multicursor-nvim missing")
end

View File

@@ -1,8 +0,0 @@
vim.pack.add({ "https://github.com/chrisgrieser/nvim-various-textobjs" })
local ok, oil = pcall(require, "various-textobjs")
if ok then
oil.setup({ keymaps = { useDefaults = true } })
else
print("plugin nvim-various-textobjs missing")
end

View File

@@ -1,10 +0,0 @@
vim.pack.add({ "https://github.com/stevearc/oil.nvim" })
local ok, oil = pcall(require, "oil")
if ok then
oil.setup()
else
print("plugin oil missing")
end
vim.keymap.set("n", "<leader>-", "<cmd>Oil<cr>", { desc = "Oil file manager" })

View File

@@ -1,8 +0,0 @@
vim.pack.add({ "https://github.com/sschleemilch/slimline.nvim" })
local ok, slimline = pcall(require, "slimline")
if ok then
slimline.setup()
else
print("plugin slimline missing")
end

View File

@@ -1,136 +0,0 @@
vim.pack.add({ "https://github.com/folke/snacks.nvim" })
local ok, snacks = pcall(require, "snacks")
if ok then
snacks.setup({
picker = { enabled = true },
})
else
print("plugin snacks missing")
end
local set = vim.keymap.set
set("n", "<leader>ea", function()
Snacks.explorer()
end, { desc = "File Explorer" })
set("n", "<leader>ga", function()
Snacks.lazygit()
end, { desc = "Lazygit" })
set("n", "<leader>gh", function()
Snacks.picker.git_diff()
end, { desc = "Git Diff (Hunks)" })
set("n", "<leader>gl", function()
Snacks.picker.git_log_line()
end, { desc = "Git Log Line" })
set("n", "<leader>gL", function()
Snacks.picker.git_log()
end, { desc = "Git Log" })
set("n", "<leader>gr", function()
Snacks.lazygit.log_file()
end, { desc = "Git Log File (reflog)" })
set({ "n", "v" }, "<leader>gw", function()
Snacks.picker.grep_word()
end, { desc = "Grep Visual Selection or Word" })
set({ "n", "v" }, "<leader>gx", function()
Snacks.gitbrowse()
end, { desc = "Git Browse" })
set("n", "<leader>xr", function()
Snacks.picker.recent()
end, { desc = "Recent files" })
set("n", "<leader>xR", function()
Snacks.picker.resume()
end, { desc = "Resume" })
set("n", "<leader>U", function()
Snacks.picker.undo()
end, { desc = "Undo History" })
set("n", "<leader>xC", function()
Snacks.picker.colorschemes()
end, { desc = "Colorschemes" })
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>$", function()
Snacks.rename.rename_file()
end, { desc = "Rename File" })
set("n", "<leader>z", function()
Snacks.zen.zoom()
end, { desc = "Toggle Zoom" })
set("n", "<leader>.", function()
Snacks.scratch()
end, { desc = "Toggle Scratch Buffer" })
set("n", "<leader>x.", function()
Snacks.scratch.select()
end, { desc = "Select Scratch Buffer" })
-- LSP
set("n", "gD", function()
Snacks.picker.lsp_declarations()
end, { desc = "Goto Declaration" })
-- 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,
})

View File

@@ -1,13 +0,0 @@
vim.pack.add({
{
src = "https://github.com/kylechui/nvim-surround",
version = vim.version.range("^3.0.0"),
},
})
local ok, surround = pcall(require, "nvim-surround")
if ok then
surround.setup()
else
print("plugin surround missing")
end

View File

@@ -0,0 +1,28 @@
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,99 +0,0 @@
vim.api.nvim_create_autocmd("PackChanged", {
group = vim.api.nvim_create_augroup("telescope-fzf-native-update", { clear = true }),
callback = function(ev)
local name, kind = ev.data.spec.name, ev.data.kind
if name == "telescope-fzf-native.nvim" and (kind == "install" or kind == "update") then
vim.system({ "make" }, { cwd = ev.data.path }):wait()
print("telescope-fzf-native make done.")
end
end,
})
vim.pack.add({
{ src = "https://github.com/nvim-telescope/telescope.nvim", version = "v0.2.1" },
"https://github.com/nvim-lua/plenary.nvim",
"https://github.com/nvim-telescope/telescope-fzf-native.nvim",
"https://gitlab.com/davvid/telescope-git-grep.nvim",
{ src = "https://github.com/nvim-telescope/telescope-frecency.nvim", version = vim.version.range("^1.0.0") },
})
local ok, builtin = pcall(require, "telescope.builtin")
if ok then
require("telescope").setup({
defaults = require("telescope.themes").get_ivy(),
})
local set = vim.keymap.set
require("telescope").load_extension("fzf")
require("telescope").load_extension("git_grep")
require("telescope").load_extension("frecency")
set("n", "<leader><space>", function()
require("telescope-frecency").start()
end, { desc = "Telescope frecency" })
set("n", "<leader>;", function()
require("telescope-frecency").start({ workspace = "CWD" })
end, { desc = "Telescope frecency" })
set("n", "<leader>b", builtin.buffers, { desc = "Telescope buffers" })
set("n", "<leader>cc", builtin.commands, { desc = "Telescope commands" })
set("n", "<leader>ch", builtin.command_history, { desc = "Telescope command history" })
set("n", "<leader>cH", builtin.highlights, { desc = "Telescope highlights" })
set("n", "<leader>da", builtin.diagnostics, { desc = "Telescope diagnostics" })
set("n", "<leader>ec", function()
builtin.find_files({ cwd = vim.fn.stdpath("config") })
end, { desc = "Telescope nvim config files" })
set("n", "<leader>ep", function()
builtin.find_files({ cwd = vim.fs.joinpath(vim.fn.stdpath("data"), "site") })
end, { desc = "Telescope find files" })
set("n", "<leader>fa", builtin.git_files, { desc = "Telescope nvim package files" })
set("n", "<leader>F", builtin.find_files, { desc = "Telescope find files" })
set("n", "<leader>fh", function()
builtin.find_files({ hidden = true })
end, { desc = "Telescope find files (hidden)" })
set("n", "<leader>gB", builtin.git_branches, { desc = "Telescope git branches" })
set("n", "<leader>gc", builtin.git_bcommits, { desc = "Telescope git buffer commits" })
set("n", "<leader>gC", builtin.git_commits, { desc = "Telescope git commits" })
set("n", "<leader>gs", builtin.git_status, { desc = "Telescope git status" })
set("n", "<leader>gS", builtin.git_stash, { desc = "Telescope git stash" })
set("n", "<leader>ha", builtin.help_tags, { desc = "Telescope help tags" })
set("n", "<leader>hk", builtin.keymaps, { desc = "Telescope keymaps" })
set("n", "<leader>l", builtin.current_buffer_fuzzy_find, { desc = "Telescope current buffer fuzzy find" })
set("n", "<leader>L", function()
builtin.live_grep({ grep_open_files = true })
end, { desc = "Telescope grep open files" })
set("n", "<leader>m", builtin.marks, { desc = "Telescope marks" })
set("n", "<leader>M", builtin.man_pages, { desc = "Telescope man pages" })
set("n", "<leader>o", builtin.oldfiles, { desc = "Telescope oldfiles" })
set("n", "<leader>qa", builtin.quickfix, { desc = "Telescope quickfix" })
set("n", "<leader>qh", builtin.quickfixhistory, { desc = "Telescope quickfix history" })
set("n", "<leader>ql", builtin.loclist, { desc = "Telescope loclist" })
set("n", "<leader>r", builtin.resume, { desc = "Telescope resume" })
set("n", "<leader>t", builtin.treesitter, { desc = "Telescope treesitter symbols" })
set("n", "<leader>R", builtin.registers, { desc = "Telescope registers" })
set("n", "<leader>sa", function()
require("git_grep").live_grep()
end, { desc = "Telescope git live grep" })
set("n", "<leader>S", builtin.live_grep, { desc = "Telescope live grep" })
set("n", "<leader>sh", builtin.search_history, { desc = "Telescope search history" })
set("n", "<leader>so", function()
builtin.grep_string({ grep_open_files = true })
end, { desc = "Telescope grep open files" })
set({ "n", "v" }, "<leader>sw", function()
require("git_grep").grep()
end, { desc = "Telescope git grep word" })
set("n", "<leader>wd", builtin.lsp_document_symbols, { desc = "Telescope document symbols" })
set("n", "<leader>wp", builtin.lsp_workspace_symbols, { desc = "Telescope workspace symbols" })
set("n", "<leader>ws", function()
require("git_grep").workspace_live_grep()
end, { desc = "Telescope workspace git live grep" })
set("n", "<leader>wy", function()
require("git_grep").workspace_grep()
end, { desc = "Telescope workspace git grep word" })
set("n", "<leader>:", builtin.builtin, { desc = "Telescope builtin" })
set("n", "gd", builtin.lsp_definitions, { desc = "Goto Definition" })
set("n", "grr", builtin.lsp_references, { desc = "References" })
set("n", "gI", builtin.lsp_implementations, { desc = "Goto Implementation" })
set("n", "gy", builtin.lsp_type_definitions, { desc = "Goto T[y]pe Definition" })
else
print("plugin builtin missing")
end

View File

@@ -1,84 +0,0 @@
-- run ":TSUpdate" after plugin update
-- If hooks need to run on install, run this before `vim.pack.add()`
vim.api.nvim_create_autocmd("PackChanged", {
group = vim.api.nvim_create_augroup("nvim-treesitter-update", { clear = true }),
callback = function(ev)
local name, kind = ev.data.spec.name, ev.data.kind
if name == "nvim-treesitter" and kind == "update" then
if not ev.data.active then
vim.cmd.packadd("nvim-treesitter")
end
vim.cmd("TSUpdate")
print("TSUpdate done.")
end
end,
})
vim.pack.add({
{ src = "https://github.com/nvim-treesitter/nvim-treesitter-textobjects", version = "master" },
{ src = "https://github.com/nvim-treesitter/nvim-treesitter", version = "master" },
})
local ok, configs = pcall(require, "nvim-treesitter.configs")
if ok then
configs.setup({
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",
},
},
},
})
else
print("plugin nvim-treesitter.configs missing")
end

View File

@@ -1,8 +0,0 @@
vim.pack.add({ "https://github.com/folke/which-key.nvim" })
local ok, whichkey = pcall(require, "which-key")
if ok then
whichkey.setup({ preset = "helix", delay = 1000 })
else
print("plugin whichkey missing")
end

View File

@@ -1,43 +0,0 @@
return {
s(
"ife",
fmt(
[[
if err != nil {
<>
}
]],
{
i(0),
},
{ delimiters = "<>" }
)
),
s(
"ifse",
fmt(
[[
if <><>err = <>; err != nil {
<>
}
]],
{
i(1),
f(function(args)
local a = args[1][1]
if string.sub(a, -2) == ", " or a == "" then
return ""
elseif string.sub(a, -1) == "," then
return " "
else
return ", "
end
end, { 1 }),
i(2),
i(0),
},
{ delimiters = "<>" }
)
),
}

View File

@@ -1,99 +0,0 @@
{
"plugins": {
"LuaSnip": {
"rev": "5a1e39223db9a0498024a77b8441169d260c8c25",
"src": "https://github.com/L3MON4D3/LuaSnip",
"version": "2.0.0 - 3.0.0"
},
"arrow.nvim": {
"rev": "6e0f726f55f99332dd726a53effd6813786b6d49",
"src": "https://github.com/otavioschwanck/arrow.nvim"
},
"auto-session": {
"rev": "292492ab7af4bd8b9e37e28508bc8ce995722fd5",
"src": "https://github.com/rmagatti/auto-session"
},
"conform.nvim": {
"rev": "8314f4c9e205e7f30b62147069729f9a1227d8bf",
"src": "https://github.com/stevearc/conform.nvim"
},
"flash.nvim": {
"rev": "fcea7ff883235d9024dc41e638f164a450c14ca2",
"src": "https://github.com/folke/flash.nvim"
},
"guess-indent.nvim": {
"rev": "84a4987ff36798c2fc1169cbaff67960aed9776f",
"src": "https://github.com/NMAC427/guess-indent.nvim"
},
"kanagawa.nvim": {
"rev": "aef7f5cec0a40dbe7f3304214850c472e2264b10",
"src": "https://github.com/rebelot/kanagawa.nvim"
},
"multicursor.nvim": {
"rev": "993c6eda70077c5619388900dcffefff73b40c96",
"src": "https://github.com/jake-stewart/multicursor.nvim",
"version": "'1.0'"
},
"nightfox.nvim": {
"rev": "ba47d4b4c5ec308718641ba7402c143836f35aa9",
"src": "https://github.com/EdenEast/nightfox.nvim"
},
"nvim-surround": {
"rev": "1098d7b3c34adcfa7feb3289ee434529abd4afd1",
"src": "https://github.com/kylechui/nvim-surround",
"version": "3.0.0 - 4.0.0"
},
"nvim-treesitter": {
"rev": "42fc28ba918343ebfd5565147a42a26580579482",
"src": "https://github.com/nvim-treesitter/nvim-treesitter",
"version": "'master'"
},
"nvim-treesitter-textobjects": {
"rev": "5ca4aaa6efdcc59be46b95a3e876300cfead05ef",
"src": "https://github.com/nvim-treesitter/nvim-treesitter-textobjects",
"version": "'master'"
},
"nvim-various-textobjs": {
"rev": "1532de4649c81b88ee0b4e53bdd17e551dd4589a",
"src": "https://github.com/chrisgrieser/nvim-various-textobjs"
},
"oil.nvim": {
"rev": "81b8a91735ad5cd24a6b3137f14a89f19176364f",
"src": "https://github.com/stevearc/oil.nvim"
},
"plenary.nvim": {
"rev": "b9fd5226c2f76c951fc8ed5923d85e4de065e509",
"src": "https://github.com/nvim-lua/plenary.nvim"
},
"slimline.nvim": {
"rev": "b23d6239ae06d7b422b30b227756971348ffcd68",
"src": "https://github.com/sschleemilch/slimline.nvim"
},
"snacks.nvim": {
"rev": "fe7cfe9800a182274d0f868a74b7263b8c0c020b",
"src": "https://github.com/folke/snacks.nvim"
},
"telescope-frecency.nvim": {
"rev": "d4f1bb2a939cc02720bceb635095246751db144f",
"src": "https://github.com/nvim-telescope/telescope-frecency.nvim",
"version": "1.0.0 - 2.0.0"
},
"telescope-fzf-native.nvim": {
"rev": "6fea601bd2b694c6f2ae08a6c6fab14930c60e2c",
"src": "https://github.com/nvim-telescope/telescope-fzf-native.nvim"
},
"telescope-git-grep.nvim": {
"rev": "0936967941a6e7b3875d1b1bfff41b8bcd75bdf5",
"src": "https://gitlab.com/davvid/telescope-git-grep.nvim"
},
"telescope.nvim": {
"rev": "3333a52ff548ba0a68af6d8da1e54f9cd96e9179",
"src": "https://github.com/nvim-telescope/telescope.nvim",
"version": "'v0.2.1'"
},
"which-key.nvim": {
"rev": "3aab2147e74890957785941f0c1ad87d0a44c15a",
"src": "https://github.com/folke/which-key.nvim"
}
}
}

View File

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

View File

@@ -1,5 +0,0 @@
{
"workspace.library" : [
"/usr/local/share/oxwm"
]
}

View File

@@ -1,321 +0,0 @@
---@meta
---Load type definitions for LSP
---@module 'oxwm'
-- Modifier key: "Mod4" is the Super/Windows key, "Mod1" is Alt
local modkey = "Mod4"
-- Terminal emulator command (defaults to alacritty)
local terminal = "st"
local colors
local f = io.open(os.getenv("HOME") .. "/.lightmode")
if f ~= nil then
io.close(f)
colors = require("light")
else
colors = require("dark")
end
os.execute("hsetroot -solid '" .. colors.bg .. "'")
-- Workspace tags - can be numbers, names, or icons (requires a Nerd Font)
local tags = { "1", "2", "3", "4", "5", "6", "7", "8", "9" }
-- Font for the status bar (use "fc-list" to see available fonts)
local bar_font = "monospace:style=Bold:size=10"
-- Define your blocks
-- Similar to widgets in qtile, or dwmblocks
local blocks = {
oxwm.bar.block.ram({
format = "Ram: {used}/{total} GB",
interval = 5,
color = colors.light_blue,
underline = false,
}),
oxwm.bar.block.static({
text = "",
interval = 999999999,
color = colors.lavender,
underline = false,
}),
oxwm.bar.block.shell({
format = "{}",
command = "uname -r",
interval = 999999999,
color = colors.red,
underline = false,
}),
-- oxwm.bar.block.static({
-- text = " │ ",
-- interval = 999999999,
-- color = colors.lavender,
-- underline = false,
-- }),
-- oxwm.bar.block.battery({
-- format = "Bat: {}%",
-- charging = "⚡ Bat: {}%",
-- discharging = "- Bat: {}%",
-- full = "✓ Bat: {}%",
-- interval = 30,
-- color = colors.green,
-- underline = false,
-- }),
oxwm.bar.block.static({
text = "",
interval = 999999999,
color = colors.lavender,
underline = false,
}),
oxwm.bar.block.datetime({
format = "{}",
date_format = "%a, %b %d - %H:%M",
interval = 1,
color = colors.cyan,
underline = false,
}),
}
-------------------------------------------------------------------------------
-- Basic Settings
-------------------------------------------------------------------------------
oxwm.set_terminal(terminal)
oxwm.set_modkey(modkey) -- This is for Mod + mouse binds, such as drag/resize
oxwm.set_tags(tags)
-------------------------------------------------------------------------------
-- Layouts
-------------------------------------------------------------------------------
-- Set custom symbols for layouts (displayed in the status bar)
-- Available layouts: "tiling", "normie" (floating), "grid", "monocle", "tabbed"
oxwm.set_layout_symbol("tiling", "[T]")
oxwm.set_layout_symbol("normie", "[F]")
oxwm.set_layout_symbol("tabbed", "[=]")
-------------------------------------------------------------------------------
-- Appearance
-------------------------------------------------------------------------------
-- Border configuration
-- Width in pixels
oxwm.border.set_width(3)
-- Color of focused window border
oxwm.border.set_focused_color(colors.orange)
-- Color of unfocused window borders
oxwm.border.set_unfocused_color(colors.grey)
-- Smart Enabled = No border if 1 window
oxwm.gaps.set_smart(true)
-- Inner gaps (horizontal, vertical) in pixels
oxwm.gaps.set_inner(5, 5)
-- Outer gaps (horizontal, vertical) in pixels
oxwm.gaps.set_outer(5, 5)
-------------------------------------------------------------------------------
-- Window Rules
-------------------------------------------------------------------------------
-- Rules allow you to automatically configure windows based on their properties
-- You can match windows by class, instance, title, or role
-- Available properties: floating, tag, fullscreen, etc.
--
-- Common use cases:
-- - Force floating for certain applications (dialogs, utilities)
-- - Send specific applications to specific workspaces
-- - Configure window behavior based on title or class
-- Examples (uncomment to use):
oxwm.rule.add({ instance = "gimp", floating = true })
-- oxwm.rule.add({ class = "Alacritty", tag = 9, focus = true })
-- oxwm.rule.add({ class = "firefox", title = "Library", floating = true })
-- oxwm.rule.add({ class = "firefox", tag = 2 })
-- oxwm.rule.add({ instance = "mpv", floating = true })
-- To find window properties, use xprop and click on the window
-- WM_CLASS(STRING) shows both instance and class (instance, class)
-------------------------------------------------------------------------------
-- Status Bar Configuration
-------------------------------------------------------------------------------
-- Font configuration
oxwm.bar.set_font(bar_font)
-- Set your blocks here (defined above)
oxwm.bar.set_blocks(blocks)
-- Bar color schemes (for workspace tag display)
-- Parameters: foreground, background, border
-- Unoccupied tags
oxwm.bar.set_scheme_normal(colors.fg, colors.bg, "#444444")
-- Occupied tags
oxwm.bar.set_scheme_occupied(colors.cyan, colors.bg, colors.cyan)
-- Currently selected tag
oxwm.bar.set_scheme_selected(colors.orange, colors.bg, colors.orange)
-- Urgent tags (windows requesting attention)
oxwm.bar.set_scheme_urgent(colors.red, colors.bg, colors.red)
-- Hide tags that have no windows and are not selected
-- oxwm.bar.set_hide_vacant_tags(true)
--
function shell_quote(s)
return '"' .. string.gsub(s, '[$"!`\\]', "\\%1") .. '"'
end
-------------------------------------------------------------------------------
-- Keybindings
-------------------------------------------------------------------------------
-- Keybindings are defined using oxwm.key.bind(modifiers, key, action)
-- Modifiers: {"Mod4"}, {"Mod1"}, {"Shift"}, {"Control"}, or combinations like {"Mod4", "Shift"}
-- Keys: Use uppercase for letters (e.g., "Return", "H", "J", "K", "L")
-- Actions: Functions that return actions (e.g., oxwm.spawn(), oxwm.client.kill())
--
-- A list of available keysyms can be found in the X11 keysym definitions.
-- Common keys: Return, Space, Tab, Escape, Backspace, Delete, Left, Right, Up, Down
-- Basic window management
oxwm.key.bind({ modkey }, "Return", oxwm.spawn_terminal())
-- Launch Dmenu
oxwm.key.bind(
{ modkey },
"P",
oxwm.spawn({
"sh",
"-c",
"dmenu_run -l 10 -fn " .. shell_quote(bar_font) .. " -nb " .. shell_quote(colors.bg) .. " -nf " .. shell_quote(
colors.fg
) .. " -sb " .. shell_quote(colors.orange) .. " -sf " .. shell_quote(colors.black),
})
)
-- Copy screenshot to clipboard
oxwm.key.bind({ modkey }, "S", oxwm.spawn({ "sh", "-c", "maim -s | xclip -selection clipboard -t image/png" }))
oxwm.key.bind({ modkey }, "X", oxwm.client.kill())
-- Keybind overlay - Shows important keybindings on screen
oxwm.key.bind({ modkey, "Shift" }, "Slash", oxwm.show_keybinds())
-- Window state toggles
oxwm.key.bind({ modkey }, "F", oxwm.client.toggle_fullscreen())
oxwm.key.bind({ modkey, "Shift" }, "Space", oxwm.client.toggle_floating())
-- Layout management
oxwm.key.bind({ modkey, "Shift" }, "F", oxwm.layout.set("normie"))
oxwm.key.bind({ modkey }, "T", oxwm.layout.set("tiling"))
oxwm.key.bind({ modkey }, "G", oxwm.layout.set("grid"))
oxwm.key.bind({ modkey }, "M", oxwm.layout.set("monocle"))
oxwm.key.bind({ modkey }, "B", oxwm.layout.set("tabbed"))
oxwm.key.bind({ modkey, "Shift" }, "S", oxwm.layout.set("scrolling"))
oxwm.key.bind({ modkey }, "N", oxwm.layout.cycle())
oxwm.key.bind({ modkey, "Shift" }, "T", oxwm.spawn({ "lupan-set-theme", "toggle" }))
-- Master area controls (tiling layout)
-- Decrease/Increase master area width
oxwm.key.bind({ modkey }, "H", oxwm.set_master_factor(-5))
oxwm.key.bind({ modkey }, "L", oxwm.set_master_factor(5))
-- Increment/Decrement number of master windows
oxwm.key.bind({ modkey }, "I", oxwm.inc_num_master(1))
oxwm.key.bind({ modkey, "Shift" }, "I", oxwm.inc_num_master(-1))
-- Gaps toggle
oxwm.key.bind({ modkey }, "A", oxwm.toggle_gaps())
-- Window manager controls
oxwm.key.bind({ modkey, "Shift" }, "Q", oxwm.quit())
oxwm.key.bind({ modkey, "Shift" }, "R", oxwm.restart())
-- Focus movement [1 for up in the stack, -1 for down]
oxwm.key.bind({ modkey }, "J", oxwm.client.focus_stack(1))
oxwm.key.bind({ modkey }, "K", oxwm.client.focus_stack(-1))
-- Window movement (swap position in stack)
oxwm.key.bind({ modkey, "Shift" }, "J", oxwm.client.move_stack(1))
oxwm.key.bind({ modkey, "Shift" }, "K", oxwm.client.move_stack(-1))
-- Multi-monitor support
-- Focus next/previous Monitors
oxwm.key.bind({ modkey }, "Comma", oxwm.monitor.focus(-1))
oxwm.key.bind({ modkey }, "Period", oxwm.monitor.focus(1))
-- Move window to next/previous Monitors
oxwm.key.bind({ modkey, "Shift" }, "Comma", oxwm.monitor.tag(-1))
oxwm.key.bind({ modkey, "Shift" }, "Period", oxwm.monitor.tag(1))
-- Workspace (tag) navigation
-- Switch to workspace N (tags are 0-indexed, so tag "1" is index 0)
oxwm.key.bind({ modkey }, "1", oxwm.tag.view(0))
oxwm.key.bind({ modkey }, "2", oxwm.tag.view(1))
oxwm.key.bind({ modkey }, "3", oxwm.tag.view(2))
oxwm.key.bind({ modkey }, "4", oxwm.tag.view(3))
oxwm.key.bind({ modkey }, "5", oxwm.tag.view(4))
oxwm.key.bind({ modkey }, "6", oxwm.tag.view(5))
oxwm.key.bind({ modkey }, "7", oxwm.tag.view(6))
oxwm.key.bind({ modkey }, "8", oxwm.tag.view(7))
oxwm.key.bind({ modkey }, "9", oxwm.tag.view(8))
-- Move focused window to workspace N
oxwm.key.bind({ modkey, "Shift" }, "1", oxwm.tag.move_to(0))
oxwm.key.bind({ modkey, "Shift" }, "2", oxwm.tag.move_to(1))
oxwm.key.bind({ modkey, "Shift" }, "3", oxwm.tag.move_to(2))
oxwm.key.bind({ modkey, "Shift" }, "4", oxwm.tag.move_to(3))
oxwm.key.bind({ modkey, "Shift" }, "5", oxwm.tag.move_to(4))
oxwm.key.bind({ modkey, "Shift" }, "6", oxwm.tag.move_to(5))
oxwm.key.bind({ modkey, "Shift" }, "7", oxwm.tag.move_to(6))
oxwm.key.bind({ modkey, "Shift" }, "8", oxwm.tag.move_to(7))
oxwm.key.bind({ modkey, "Shift" }, "9", oxwm.tag.move_to(8))
-- Combo view (view multiple tags at once) {argos_nothing}
-- Example: Mod+Ctrl+2 while on tag 1 will show BOTH tags 1 and 2
oxwm.key.bind({ modkey, "Control" }, "1", oxwm.tag.toggleview(0))
oxwm.key.bind({ modkey, "Control" }, "2", oxwm.tag.toggleview(1))
oxwm.key.bind({ modkey, "Control" }, "3", oxwm.tag.toggleview(2))
oxwm.key.bind({ modkey, "Control" }, "4", oxwm.tag.toggleview(3))
oxwm.key.bind({ modkey, "Control" }, "5", oxwm.tag.toggleview(4))
oxwm.key.bind({ modkey, "Control" }, "6", oxwm.tag.toggleview(5))
oxwm.key.bind({ modkey, "Control" }, "7", oxwm.tag.toggleview(6))
oxwm.key.bind({ modkey, "Control" }, "8", oxwm.tag.toggleview(7))
oxwm.key.bind({ modkey, "Control" }, "9", oxwm.tag.toggleview(8))
-- Multi tag (window on multiple tags)
-- Example: Mod+Ctrl+Shift+2 puts focused window on BOTH current tag and tag 2
oxwm.key.bind({ modkey, "Control", "Shift" }, "1", oxwm.tag.toggletag(0))
oxwm.key.bind({ modkey, "Control", "Shift" }, "2", oxwm.tag.toggletag(1))
oxwm.key.bind({ modkey, "Control", "Shift" }, "3", oxwm.tag.toggletag(2))
oxwm.key.bind({ modkey, "Control", "Shift" }, "4", oxwm.tag.toggletag(3))
oxwm.key.bind({ modkey, "Control", "Shift" }, "5", oxwm.tag.toggletag(4))
oxwm.key.bind({ modkey, "Control", "Shift" }, "6", oxwm.tag.toggletag(5))
oxwm.key.bind({ modkey, "Control", "Shift" }, "7", oxwm.tag.toggletag(6))
oxwm.key.bind({ modkey, "Control", "Shift" }, "8", oxwm.tag.toggletag(7))
oxwm.key.bind({ modkey, "Control", "Shift" }, "9", oxwm.tag.toggletag(8))
-------------------------------------------------------------------------------
-- Advanced: Keychords
-------------------------------------------------------------------------------
-- Keychords allow you to bind multiple-key sequences (like Emacs or Vim)
-- Format: {{modifiers}, key1}, {{modifiers}, key2}, ...
-- Example: Press Mod4+Space, then release and press T to spawn a terminal
oxwm.key.chord({
{ { modkey }, "Space" },
{ {}, "T" },
}, oxwm.spawn_terminal())
oxwm.key.chord({
{ { modkey }, "Space" },
{ {}, "F" },
}, oxwm.spawn({ "firefox" }))
oxwm.key.chord({
{ { modkey }, "Space" },
{ {}, "L" },
}, oxwm.spawn({ "slock" }))
-------------------------------------------------------------------------------
-- Autostart
-------------------------------------------------------------------------------
-- Commands to run once when OXWM starts
-- Uncomment and modify these examples, or add your own
-- oxwm.autostart("picom")
-- oxwm.autostart("feh --bg-scale ~/wallpaper.jpg")
-- oxwm.autostart("dunst")
-- oxwm.autostart("nm-applet")

View File

@@ -1,14 +0,0 @@
return {
fg = "#aaaaaa",
red = "#f7768e",
bg = "#1a1b26",
black = "#1a1b26",
cyan = "#0db9d7",
green = "#9ece6a",
lavender = "#a9b1d6",
light_blue = "#7aa2f7",
grey = "#737373",
blue = "#6dade3",
purple = "#ad8ee6",
orange = "#bd6628",
}

View File

@@ -1,14 +0,0 @@
return {
fg = "#1a1b26",
red = "#b94646",
bg = "#dddddd",
black = "#1a1b26",
cyan = "#4d8080",
green = "#9ece6a",
lavender = "#a9b1d6",
light_blue = "#7aa2f7",
grey = "#bbbbbb",
blue = "#6dade3",
purple = "#ad8ee6",
orange = "#d78042",
}

View File

@@ -46,7 +46,7 @@ static const Layout layouts[] = {
};
/* key definitions */
#define MODKEY Mod4Mask
#define MODKEY Mod1Mask
#define TAGKEYS(KEY,TAG) \
{ MODKEY, KEY, view, {.ui = 1 << TAG} }, \
{ MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \
@@ -66,24 +66,24 @@ static const char *toggletheme[] = { "lupan-set-theme", "toggle", NULL };
static const Key keys[] = {
/* modifier key function argument */
{ MODKEY, XK_p, spawn, {.v = dmenucmd } },
{ MODKEY|ControlMask, 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, 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|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_Return, zoom, {0} },
{ MODKEY, XK_Tab, view, {0} },
{ 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|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, 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|ShiftMask, XK_q, quit, {0} },
{ MODKEY|ControlMask|ShiftMask, XK_q, quit, {0} },
};
/* button definitions */

View File

@@ -1,197 +0,0 @@
;==========================================================
;
;
; ██████╗ ██████╗ ██╗ ██╗ ██╗██████╗ █████╗ ██████╗
; ██╔══██╗██╔═══██╗██║ ╚██╗ ██╔╝██╔══██╗██╔══██╗██╔══██╗
; ██████╔╝██║ ██║██║ ╚████╔╝ ██████╔╝███████║██████╔╝
; ██╔═══╝ ██║ ██║██║ ╚██╔╝ ██╔══██╗██╔══██║██╔══██╗
; ██║ ╚██████╔╝███████╗██║ ██████╔╝██║ ██║██║ ██║
; ╚═╝ ╚═════╝ ╚══════╝╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝
;
;
; 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

View File

@@ -1,33 +0,0 @@
#!/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

View File

@@ -1,20 +0,0 @@
#!/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}'"

View File

@@ -1,164 +0,0 @@
#!/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

View File

@@ -1,21 +0,0 @@
#!/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

View File

@@ -1,52 +0,0 @@
#!/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,12 +5,7 @@
# If not running interactively, don't do anything
[[ $- != *i* ]] && return
which nu >/dev/null && exec nu
alias ls='ls --color=auto'
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
PS1='[\u@\h \W]\$ '

View File

@@ -25,13 +25,12 @@ def create_left_prompt [] {
let separator_color = (if (is-admin) { ansi light_red_bold } else { ansi light_green_bold })
let path_segment = $"($path_color)($dir)"
let userhost = $'(ansi blue_bold)(id -un)@(hostname)(ansi reset)'
let base = $path_segment | str replace --all (char path_sep) $"($separator_color)(char path_sep)($path_color)"
let branch = do { git rev-parse --abbrev-ref HEAD } | complete
if $branch.exit_code == 0 {
$"($userhost) ($base) ($separator_color)\((ansi magenta)($branch.stdout | str trim)($separator_color)) "
$"($base) ($separator_color)\((ansi magenta)($branch.stdout | str trim)($separator_color)) "
} else {
$'($userhost) ($base) '
$base
}
}

View File

@@ -1,64 +1,13 @@
alias v=nvim
alias ll='ls -l'
alias ta='tmux attach -t'
alias tl='tmux list-sessions'
alias rgh='rg -.'
alias fdh='fd -H'
alias lg=lazygit
alias tn='tmux new -s'
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
if 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

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

View File

@@ -1,17 +0,0 @@
# 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,9 +3,3 @@ 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,6 @@
# for ssh logins, install and configure the libpam-umask package.
#umask 022
export LANG=pl_PL.UTF-8
export EDITOR=nvim
export VISUAL=nvim
@@ -29,15 +27,5 @@ done
export PATH
# start X or Hyprland at login
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
# start X at login
[[ -z "$DISPLAY" && "$XDG_VTNR" -eq 1 ]] && which /bin/sx > /dev/null && exec sx ~/.xsession

View File

@@ -1 +1,6 @@
source ~/.profile
# start X at login on first console or otherwise source ~/.profile
if [[ -z "$DISPLAY" && "$XDG_VTNR" -eq 1 ]] && which /bin/sx > /dev/null; then
exec sx ~/.xsession
else
source ~/.profile
fi

View File

@@ -2,13 +2,11 @@
# % cd ~/.local/share
# % git clone https://github.com/zap-zsh/zap.git --branch=release-v1
export FZF_DEFAULT_OPTS='--color=bg+:#808080'
export FZF_DEFAULT_OPTS='--color=bw,hl:green,hl+:green'
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"
plug "zap-zsh/vim"
autoload -Uz compinit
compinit
@@ -17,42 +15,19 @@ 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.
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
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)'
# History.
@@ -71,6 +46,7 @@ setopt share_history
# Convenience.
setopt autocd
bindkey -M vicmd '^[h' run-help
bindkey -M viins '^[h' run-help

View File

@@ -1,55 +1,38 @@
set -g status-bg colour0
set -g status-fg colour7
set -sg escape-time 0
bind-key C-j select-pane -D
bind-key C-k select-pane -U
bind-key C-h select-pane -L
bind-key C-l select-pane -R
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 j switch-client -n
bind-key k switch-client -p
bind-key h previous-window
bind-key l next-window
bind-key t last-window
bind-key T switch-client -l
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
bind -n S-Left previous-window
bind -n S-Right next-window
bind -n C-S-Left swap-window -t -1
bind -n C-S-Right swap-window -t 1
bind -n S-Up switch-client -p
bind -n S-Down switch-client -n
set -g default-terminal "xterm-256color"
set -as terminal-features ",*:RGB"
set -g default-terminal "screen-256color"
set -as terminal-features ",xterm-256color:RGB"
set -g base-index 1
setw -g base-index 1
set -g set-titles on
set -g set-titles-string "#H [#S] #W"
set -g set-titles-string "#H [#S]"
set -g status-justify centre
set -g status-left " #[fg=#316781]#[bg=#316781]#[fg=#abb5ba] #H #[bg=default]#[fg=#316781]#[fg=default] #S"
set -g status-left "#[bg=green]#[fg=black] #H #[bg=default]#[fg=default] #S"
set -g status-left-length 50
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 -g status-right "#[bg=green]#[fg=black] %H:%M "
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
set-window-option -g window-status-current-style bg=green
set-window-option -ga window-status-current-style fg=black

View File

@@ -1,5 +0,0 @@
#!/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

@@ -1,185 +0,0 @@
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)

View File

@@ -1,291 +0,0 @@
#!/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"

Some files were not shown because too many files have changed in this diff Show More