Compare commits
8 Commits
wip
...
94fc8c036c
| Author | SHA1 | Date | |
|---|---|---|---|
| 94fc8c036c | |||
| 84d26c68a5 | |||
| d03dda4979 | |||
| 5464d111d0 | |||
| bd15a7b443 | |||
| 2024651e33 | |||
| ff66a92104 | |||
| 7fef9a8760 |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -10,4 +10,3 @@ __pycache__
|
||||
/dwm
|
||||
/st
|
||||
/vis/.config/vis/plugins/
|
||||
/tools/.local/bin/
|
||||
|
||||
20
Makefile
20
Makefile
@@ -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
|
||||
|
||||
@@ -88,7 +88,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 +123,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 +236,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,
|
||||
@@ -377,11 +368,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 +432,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 +468,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 +520,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 +532,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 +539,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)
|
||||
-- }}}
|
||||
|
||||
@@ -9,27 +9,26 @@ theme.font = "Fira Code Nerd Font 10"
|
||||
theme.tasklist_disable_icon = true
|
||||
theme.wibar_height = 30
|
||||
|
||||
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 = "#293d38" -- hsl(165deg 20% 20%)
|
||||
theme.bg_focus = "#478575" -- hsl(165deg 30% 40%)
|
||||
theme.bg_urgent = "#5c3d45" -- hsl(345deg 20% 30%)
|
||||
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 = "#3d5c54" -- hsl(165deg 20% 30%)
|
||||
|
||||
theme.fg_normal = "#8f9ca3" -- hsl(200 10% 60%)
|
||||
theme.fg_focus = "#abb5ba" -- hsl(200 10% 70%)
|
||||
theme.fg_normal = "#a9d6ca" -- hsl(165deg 35% 75%)"
|
||||
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 = "#62847b" -- hsl(165deg 15% 45%)"
|
||||
|
||||
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.bg_wallpaper = "#424a4c"
|
||||
|
||||
theme.hotkeys_font = theme.font
|
||||
theme.hotkeys_description_font = theme.font
|
||||
|
||||
@@ -9,27 +9,26 @@ theme.font = "Fira Code Nerd Font 10"
|
||||
theme.tasklist_disable_icon = true
|
||||
theme.wibar_height = 30
|
||||
|
||||
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 = "#293d38" -- hsl(165deg 20% 20%)
|
||||
theme.bg_focus = "#a9d6ca" -- hsl(165deg 35% 75%)
|
||||
theme.bg_urgent = "#bc8f9b" -- hsl(345deg 25% 65%)
|
||||
theme.bg_minimize = "#62847b" -- hsl(165deg 15% 45%)
|
||||
theme.bg_systray = theme.bg_normal
|
||||
theme.tasklist_bg_focus = "#a6c7f2" -- hsl(214 75% 80%)
|
||||
theme.tasklist_bg_focus = "#8fbcb1" -- hsl(165deg 25% 65%)
|
||||
|
||||
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 = "#a9d6ca" -- hsl(165deg 35% 75%)"
|
||||
theme.fg_focus = "#363d3e"
|
||||
theme.fg_urgent = "#e9f2f5"
|
||||
theme.fg_minimize = "#4b5456"
|
||||
theme.taglist_fg_empty = "#62847b" -- hsl(165deg 15% 45%)"
|
||||
|
||||
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.bg_wallpaper = "#b0bec2"
|
||||
|
||||
theme.hotkeys_font = theme.font
|
||||
theme.hotkeys_description_font = theme.font
|
||||
|
||||
@@ -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
|
||||
@@ -1,9 +0,0 @@
|
||||
os:
|
||||
edit: 'nvim {{filename}}'
|
||||
editAtLine: 'nvim +{{line}} {{filename}}'
|
||||
editAtLineAndWait: 'nvim +{{line}} {{filename}}'
|
||||
editInTerminal: true
|
||||
openDirInEditor: 'nvim {{dir}}'
|
||||
|
||||
gui:
|
||||
nerdFontsVersion: "3"
|
||||
@@ -1,57 +1 @@
|
||||
require("config.options")
|
||||
require("config.remap")
|
||||
require("config.lsp")
|
||||
|
||||
local ok, paq = pcall(require, "paq")
|
||||
if ok then
|
||||
paq({
|
||||
"EdenEast/nightfox.nvim",
|
||||
"stevearc/conform.nvim",
|
||||
"otavioschwanck/arrow.nvim",
|
||||
"folke/flash.nvim",
|
||||
"folke/snacks.nvim",
|
||||
"stevearc/oil.nvim",
|
||||
{
|
||||
"jake-stewart/multicursor.nvim",
|
||||
branch = "1.0",
|
||||
},
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter-textobjects",
|
||||
branch = "master",
|
||||
},
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
branch = "master",
|
||||
build = ":TSUpdate",
|
||||
},
|
||||
})
|
||||
else
|
||||
print("plugin paq missing")
|
||||
end
|
||||
|
||||
local function load_plugin(name, setup)
|
||||
local cfg = require(setup)
|
||||
name = cfg.main or name
|
||||
local ok, plugin = pcall(require, name)
|
||||
if ok then
|
||||
if cfg.config then
|
||||
cfg.config(cfg.opts)
|
||||
else
|
||||
plugin.setup(cfg.opts)
|
||||
end
|
||||
if cfg.init then
|
||||
cfg.init(plugin)
|
||||
end
|
||||
else
|
||||
print("plugin " .. name .. " missing")
|
||||
end
|
||||
end
|
||||
|
||||
load_plugin("arrow", "plugins.arrow")
|
||||
load_plugin("nightfox", "plugins.colorscheme")
|
||||
load_plugin("conform", "plugins.conform")
|
||||
load_plugin("flash", "plugins.flash")
|
||||
load_plugin("multicursor-nvim", "plugins.multicursor")
|
||||
load_plugin("oil", "plugins.oil")
|
||||
load_plugin("snacks", "plugins.snacks")
|
||||
load_plugin("treesitter", "plugins.treesitter")
|
||||
require("lupan")
|
||||
|
||||
@@ -1,12 +1,75 @@
|
||||
{
|
||||
"Comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" },
|
||||
"LuaSnip": { "branch": "master", "commit": "faf3c94a44508cec1b961406d36cc65113ff3b98" },
|
||||
"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" },
|
||||
"blame.nvim": { "branch": "main", "commit": "b87b8c820e4cec06fbbd2f946b7b35c45906ee0c" },
|
||||
"ccc.nvim": { "branch": "main", "commit": "9d1a256e006decc574789dfc7d628ca11644d4c2" },
|
||||
"cmp-nvim-lsp": { "branch": "main", "commit": "a8912b88ce488f411177fc8aed358b04dc246d7b" },
|
||||
"cmp-path": { "branch": "main", "commit": "c6635aae33a50d6010bf1aa756ac2398a2d54c32" },
|
||||
"cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" },
|
||||
"conform.nvim": { "branch": "master", "commit": "f643d1b51d1d3d14c8641a46ce44f6bce73c2697" },
|
||||
"diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" },
|
||||
"fidget.nvim": { "branch": "main", "commit": "d9ba6b7bfe29b3119a610892af67602641da778e" },
|
||||
"friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" },
|
||||
"gitsigns.nvim": { "branch": "main", "commit": "d0f90ef51d4be86b824b012ec52ed715b5622e51" },
|
||||
"global-note.nvim": { "branch": "main", "commit": "1e0d4bba425d971ed3ce40d182c574a25507115c" },
|
||||
"go.nvim": { "branch": "master", "commit": "a3455f48cff718a86275115523dcc735535a13aa" },
|
||||
"godoc.nvim": { "branch": "main", "commit": "356f79853dbb3b3e200064367603751895153c29" },
|
||||
"guihua.lua": { "branch": "master", "commit": "87bea7b98429405caf2a0ce4d029b027bb017c70" },
|
||||
"hererocks": { "branch": "master", "commit": "344c46ed54df9a4dbc2d2bf510dcd9a9d90497bf" },
|
||||
"hlsearch.nvim": { "branch": "main", "commit": "fdeb60b890d15d9194e8600042e5232ef8c29b0e" },
|
||||
"incline.nvim": { "branch": "main", "commit": "27040695b3bbfcd3257669037bd008d1a892831d" },
|
||||
"iswap.nvim": { "branch": "master", "commit": "e02cc91f2a8feb5c5a595767d208c54b6e3258ec" },
|
||||
"kanagawa-paper.nvim": { "branch": "master", "commit": "b0df20cca3b7087c06f241983b488190cc8e23af" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" },
|
||||
"lazyjj.nvim": { "branch": "main", "commit": "bba66a1351ff1f1bd078c8a1b00b8d12b3ed0017" },
|
||||
"leap.nvim": { "branch": "main", "commit": "08ca7ec9e859856251d56c22ea107f82f563ff3c" },
|
||||
"lsp_signature.nvim": { "branch": "master", "commit": "d50e40b3bf9324128e71b0b7e589765ce89466d2" },
|
||||
"lspsaga.nvim": { "branch": "main", "commit": "920b1253e1a26732e53fac78412f6da7f674671d" },
|
||||
"marks.nvim": { "branch": "master", "commit": "f353e8c08c50f39e99a9ed474172df7eddd89b72" },
|
||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "c2682b0d9732bf52cbc34862056f143e71dc4a6d" },
|
||||
"mason-tool-installer.nvim": { "branch": "main", "commit": "93a9ff9b34c91c0cb0f7de8d5f7e4abce51d8903" },
|
||||
"mason.nvim": { "branch": "main", "commit": "8024d64e1330b86044fed4c8494ef3dcd483a67c" },
|
||||
"namu.nvim": { "branch": "main", "commit": "a3a3d81d12b61a38f131253bcd3ce5e2c6599850" },
|
||||
"neodev.nvim": { "branch": "main", "commit": "46aa467dca16cf3dfe27098042402066d2ae242d" },
|
||||
"neogit": { "branch": "master", "commit": "7fe60f9aa6eacf2eb730c4e9b83d06a36d028161" },
|
||||
"nvim-cmp": { "branch": "main", "commit": "b5311ab3ed9c846b585c0c15b7559be131ec4be9" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "3ea99227e316c5028f57a4d86a1a7fd01dd876d0" },
|
||||
"nvim-surround": { "branch": "main", "commit": "8dd9150ca7eae5683660ea20cec86edcd5ca4046" },
|
||||
"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" }
|
||||
"nvim-treesitter-textobjects": { "branch": "master", "commit": "0f051e9813a36481f48ca1f833897210dbcfffde" },
|
||||
"nvim-web-devicons": { "branch": "master", "commit": "1fb58cca9aebbc4fd32b086cb413548ce132c127" },
|
||||
"oil.nvim": { "branch": "master", "commit": "5b6068aad7d2057dd399fac73b7fb2cdf23ccd6e" },
|
||||
"orgmode": { "branch": "master", "commit": "32ef9e95f43a6e951fb931b438372546a4f0c524" },
|
||||
"persisted.nvim": { "branch": "main", "commit": "d35a3ed973e17defd8800acd46a0c893498a2671" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" },
|
||||
"quicker.nvim": { "branch": "master", "commit": "51d3926f183c2d98fbc237cc237ae0926839af3a" },
|
||||
"rest.nvim": { "branch": "main", "commit": "2ded89dbda1fd3c1430685ffadf2df8beb28336d" },
|
||||
"slimline.nvim": { "branch": "main", "commit": "10dd807685997d1b72b950dfb4ec1a01cb259101" },
|
||||
"snacks.nvim": { "branch": "main", "commit": "bc0630e43be5699bb94dadc302c0d21615421d93" },
|
||||
"snipe.nvim": { "branch": "main", "commit": "2a1b738dfae8502e6162eddfc774da65ed404142" },
|
||||
"sqlite.lua": { "branch": "master", "commit": "50092d60feb242602d7578398c6eb53b4a8ffe7b" },
|
||||
"tardis.nvim": { "branch": "main", "commit": "a6ee00a217529490e79d349b1f1a9cf5831180d3" },
|
||||
"telescope-fzf-native.nvim": { "branch": "main", "commit": "1f08ed60cafc8f6168b72b80be2b2ea149813e55" },
|
||||
"telescope-git-grep.nvim": { "branch": "main", "commit": "d2e1322934e334ee9eb8e838c30f3afb3e7a730e" },
|
||||
"telescope-tabs": { "branch": "master", "commit": "9ca0800d4e9c2610d5cac4d121cde0d9fbd89a64" },
|
||||
"telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" },
|
||||
"telescope.nvim": { "branch": "0.1.x", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" },
|
||||
"tmux.nvim": { "branch": "main", "commit": "2c1c3be0ef287073cef963f2aefa31a15c8b9cd8" },
|
||||
"toggleterm.nvim": { "branch": "main", "commit": "50ea089fc548917cc3cc16b46a8211833b9e3c7c" },
|
||||
"tree-sitter-nu": { "branch": "main", "commit": "100d06e29d13a8ebfc3f29173c07a5c4f2050586" },
|
||||
"tree-sitter-templ": { "branch": "master", "commit": "de35706f89beed5087670a9c4421b7794ef02411" },
|
||||
"treesj": { "branch": "main", "commit": "3b4a2bc42738a63de17e7485d4cc5e49970ddbcc" },
|
||||
"treewalker.nvim": { "branch": "main", "commit": "86ae3cf9896b43f3cfa35b962428f32fed8b5ee8" },
|
||||
"trouble.nvim": { "branch": "main", "commit": "85bedb7eb7fa331a2ccbecb9202d8abba64d37b3" },
|
||||
"undotree": { "branch": "master", "commit": "b951b87b46c34356d44aa71886aecf9dd7f5788a" },
|
||||
"vim-ReplaceWithRegister": { "branch": "master", "commit": "a487af6efd1be3fc6fac8da47d00efc9d1f6f724" },
|
||||
"vim-dadbod": { "branch": "master", "commit": "e95afed23712f969f83b4857a24cf9d59114c2e6" },
|
||||
"vim-dadbod-completion": { "branch": "master", "commit": "a8dac0b3cf6132c80dc9b18bef36d4cf7a9e1fe6" },
|
||||
"vim-dadbod-ui": { "branch": "master", "commit": "2900a1617b3df1a48683d872eadbe1101146a49a" },
|
||||
"vim-repeat": { "branch": "master", "commit": "65846025c15494983dafe5e3b46c8f88ab2e9635" },
|
||||
"vim-sleuth": { "branch": "master", "commit": "be69bff86754b1aa5adcbb527d7fcd1635a84080" },
|
||||
"whaler": { "branch": "main", "commit": "b3a4257f6225a9a6c42f33b56ca316325e395f22" },
|
||||
"which-key.nvim": { "branch": "main", "commit": "370ec46f710e058c9c1646273e6b225acf47cbed" },
|
||||
"yankbank-nvim": { "branch": "main", "commit": "ded8f01bd6a7887310e14d463c8aa55eb79ec281" }
|
||||
}
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
return {
|
||||
cmd = { "clangd" },
|
||||
filetypes = { "c", "cpp" },
|
||||
root_markers = { ".git" },
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
return {
|
||||
cmd = { "gopls" },
|
||||
filetypes = { "go", "gomod", "gowork", "gosum", "gotmpl" },
|
||||
root_markers = { "go.mod", "go.work", ".git" },
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
return {
|
||||
cmd = 'lua-language-server',
|
||||
filetypes = { 'lua' },
|
||||
rootmarkers = { '.git' },
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
return {
|
||||
cmd = { "ols" },
|
||||
filetypes = { "odin" },
|
||||
root_markers = { ".git" },
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
return {
|
||||
cmd = { "typescript-language-server", "--stdio" },
|
||||
filetypes = { "javascript", "typescript", "javascriptreact", "typescriptreact" },
|
||||
root_markers = { "package.json", "tsconfig.json", ".git" },
|
||||
}
|
||||
@@ -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
|
||||
@@ -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" } })
|
||||
@@ -1,26 +0,0 @@
|
||||
vim.lsp.enable({
|
||||
"clangd",
|
||||
"gopls",
|
||||
"lua_ls",
|
||||
"ols",
|
||||
"typescript-language-server",
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd("LspAttach", {
|
||||
group = vim.api.nvim_create_augroup("lsp-keys-complete", { clear = true }),
|
||||
callback = function(event)
|
||||
vim.lsp.completion.enable(true, event.data.client_id, event.data.bufnr, {
|
||||
convert = function(item)
|
||||
return { abbr = item.label:gsub("%b()", "") }
|
||||
end,
|
||||
})
|
||||
vim.keymap.set("n", "<leader>A", vim.lsp.buf.code_action)
|
||||
vim.keymap.set("i", "<C-space>", vim.lsp.completion.get)
|
||||
vim.keymap.set("n", "<leader>k", function()
|
||||
vim.diagnostic.jump({ float = true, count = -1 })
|
||||
end)
|
||||
vim.keymap.set("n", "<leader>j", function()
|
||||
vim.diagnostic.jump({ float = true, count = 1 })
|
||||
end)
|
||||
end,
|
||||
})
|
||||
@@ -1,10 +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.timeout = false
|
||||
@@ -1,6 +0,0 @@
|
||||
vim.keymap.set("n", "<M-h>", "<C-w>h")
|
||||
vim.keymap.set("n", "<M-k>", "<C-w>k")
|
||||
vim.keymap.set("n", "<M-j>", "<C-w>j")
|
||||
vim.keymap.set("n", "<M-l>", "<C-w>l")
|
||||
|
||||
vim.keymap.set("n", "<Esc>", "<cmd>nohlsearch<cr>")
|
||||
18
nvim/.config/nvim/lua/lupan/autocmd.lua
Normal file
18
nvim/.config/nvim/lua/lupan/autocmd.lua
Normal file
@@ -0,0 +1,18 @@
|
||||
-- [[ Highlight on yank ]]
|
||||
-- See `:help vim.highlight.on_yank()`
|
||||
vim.api.nvim_create_autocmd('TextYankPost', {
|
||||
desc = 'Highlight when yanking (copying) text',
|
||||
group = vim.api.nvim_create_augroup('YankHighlight', { clear = true }),
|
||||
callback = function()
|
||||
vim.highlight.on_yank()
|
||||
end,
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd('BufWritePre', {
|
||||
desc = 'Format on saving buffer',
|
||||
callback = function()
|
||||
vim.lsp.buf.format()
|
||||
end,
|
||||
group = vim.api.nvim_create_augroup('BufWriteFormat', { clear = true }),
|
||||
pattern = { '*.go', '*.lua', '*.rs' },
|
||||
})
|
||||
5
nvim/.config/nvim/lua/lupan/init.lua
Normal file
5
nvim/.config/nvim/lua/lupan/init.lua
Normal file
@@ -0,0 +1,5 @@
|
||||
require("lupan.remap")
|
||||
require("lupan.lazy")
|
||||
require("lupan.options")
|
||||
require("lupan.autocmd")
|
||||
require('lazy').setup('plugins')
|
||||
13
nvim/.config/nvim/lua/lupan/lazy.lua
Normal file
13
nvim/.config/nvim/lua/lupan/lazy.lua
Normal 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)
|
||||
56
nvim/.config/nvim/lua/lupan/options.lua
Normal file
56
nvim/.config/nvim/lua/lupan/options.lua
Normal file
@@ -0,0 +1,56 @@
|
||||
-- See `:help vim.o`
|
||||
|
||||
-- Disable intro message
|
||||
vim.opt.shortmess = vim.opt.shortmess + 'I'
|
||||
|
||||
vim.opt.showmode = false
|
||||
|
||||
-- Set highlight on search
|
||||
vim.o.hlsearch = true -- false
|
||||
vim.keymap.set('n', '<Esc>', '<cmd>nohlsearch<CR>')
|
||||
|
||||
-- Make line numbers default
|
||||
vim.wo.number = true
|
||||
vim.wo.relativenumber = true
|
||||
|
||||
-- Enable mouse mode
|
||||
vim.o.mouse = 'a'
|
||||
|
||||
-- Enable break indent
|
||||
vim.o.breakindent = true
|
||||
|
||||
-- Save undo history
|
||||
vim.o.undofile = true
|
||||
|
||||
-- Case-insensitive searching UNLESS \C or capital in search
|
||||
vim.o.ignorecase = true
|
||||
vim.o.smartcase = true
|
||||
|
||||
-- Keep signcolumn on by default
|
||||
vim.wo.signcolumn = 'yes'
|
||||
|
||||
-- Decrease update time
|
||||
vim.o.updatetime = 250
|
||||
vim.o.timeout = false
|
||||
|
||||
-- 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'
|
||||
|
||||
vim.opt.laststatus = 3
|
||||
117
nvim/.config/nvim/lua/lupan/remap.lua
Normal file
117
nvim/.config/nvim/lua/lupan/remap.lua
Normal file
@@ -0,0 +1,117 @@
|
||||
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>ut", "<cmd>UndotreeToggle<CR>", { desc = "[U]undotree [t]oggle" })
|
||||
|
||||
-- tabs
|
||||
|
||||
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
|
||||
|
||||
-- translations
|
||||
|
||||
key('n', '<leader>tr', function()
|
||||
require('lupan.ui').find_translation_key()
|
||||
end, { desc = '[T][r]anlation key find' })
|
||||
|
||||
-- Diagnostic keymaps
|
||||
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = 'Go to previous [D]iagnostic message' })
|
||||
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = 'Go to next [D]iagnostic message' })
|
||||
vim.keymap.set('n', '<leader>e', vim.diagnostic.open_float, { desc = 'Show diagnostic [E]rror messages' })
|
||||
vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagnostic [Q]uickfix list' })
|
||||
|
||||
key('n', '<leader>N', '<cmd>bn<CR>', { desc = '[N]ext buffer' })
|
||||
key('n', '<leader>P', '<cmd>bp<CR>', { desc = '[P]revious buffer' })
|
||||
|
||||
key('n', '<leader>tc', '<cmd>tabnew<CR>', { desc = '[T]ab [c]reate' })
|
||||
key('n', '<leader>tx', '<cmd>tabclose<CR>', { desc = '[T]ab close' })
|
||||
key('n', '<leader>tS', '<cmd>tab split<CR>', { desc = '[T]ab [s]plit' })
|
||||
key('n', '<leader>tn', '<cmd>tabnext<CR>', { desc = '[T]ab [n]ext' })
|
||||
key('n', '<leader>tp', '<cmd>tabprevious<CR>', { desc = '[T]ab [p]revious' })
|
||||
key('n', '<leader>tf', '<cmd>tabfirst<CR>', { desc = '[T]ab [f]irst' })
|
||||
key('n', '<leader>tl', '<cmd>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', '<cmd>cn<CR>', { desc = "Quickfix next" })
|
||||
key('n', '<leader>k', '<cmd>cp<CR>', { desc = "Quickfix previous" })
|
||||
key('n', '<leader>co', '<cmd>copen<CR>', { desc = "Quickfix [O]pen" })
|
||||
key('n', '<leader>cc', '<cmd>cclose<CR>', { desc = "Quickfix [C]lose" })
|
||||
|
||||
key('n', '<leader>s;', '<cmd>SessionSelect<CR>', { desc = '[S]ession Select' })
|
||||
|
||||
-- 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" })
|
||||
|
||||
-- colors
|
||||
|
||||
key('n', '<F6>', function() require('lupan.utils').toggle_color_scheme() end, { desc = 'Toggle background' })
|
||||
69
nvim/.config/nvim/lua/lupan/ui.lua
Normal file
69
nvim/.config/nvim/lua/lupan/ui.lua
Normal file
@@ -0,0 +1,69 @@
|
||||
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
|
||||
|
||||
local function append_text(text)
|
||||
text = string.gsub(text, "^ + %w+%.([%w%p]+) +.*", "%1")
|
||||
local row, col = unpack(vim.api.nvim_win_get_cursor(0))
|
||||
vim.api.nvim_buf_set_text(0, row - 1, col, row - 1, col, { text })
|
||||
end
|
||||
|
||||
function M.find_translation_key(opts)
|
||||
opts = opts or {}
|
||||
local action = opts.action or append_text
|
||||
local prompt_title = opts.prompt_title or "Get translation key"
|
||||
local cmd = { 'list-translation-keys' }
|
||||
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 find_translation_key = pickers.new(dropdown, picker_opts)
|
||||
find_translation_key:find()
|
||||
end
|
||||
|
||||
return M
|
||||
53
nvim/.config/nvim/lua/lupan/utils.lua
Normal file
53
nvim/.config/nvim/lua/lupan/utils.lua
Normal file
@@ -0,0 +1,53 @@
|
||||
local M = {}
|
||||
|
||||
local filename = os.getenv('HOME') .. '/.config/alacritty/alacritty.toml'
|
||||
|
||||
local colorschemes = nil
|
||||
|
||||
function M.set_color_schemes(dark, light)
|
||||
colorschemes = { dark = dark, light = light }
|
||||
end
|
||||
|
||||
function M.terminalbg()
|
||||
local ok, lines = pcall(io.lines, filename)
|
||||
if ok then
|
||||
for line in lines do
|
||||
if string.find(line, 'light.toml') then
|
||||
return "light"
|
||||
end
|
||||
end
|
||||
end
|
||||
return "dark"
|
||||
end
|
||||
|
||||
function M.update_color_scheme()
|
||||
vim.o.background = M.terminalbg()
|
||||
if colorschemes then
|
||||
vim.cmd.colorscheme(colorschemes[vim.o.background])
|
||||
end
|
||||
end
|
||||
|
||||
function M.toggle_color_scheme()
|
||||
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(filename, {}, vim.schedule_wrap(function(...)
|
||||
M.update_color_scheme()
|
||||
w:stop()
|
||||
watch(fname)
|
||||
end))
|
||||
end
|
||||
|
||||
watch(filename)
|
||||
|
||||
return M
|
||||
20
nvim/.config/nvim/lua/plugins/appearance.lua
Normal file
20
nvim/.config/nvim/lua/plugins/appearance.lua
Normal file
@@ -0,0 +1,20 @@
|
||||
return {
|
||||
{
|
||||
'thesimonho/kanagawa-paper.nvim',
|
||||
config = function()
|
||||
vim.cmd.colorscheme('kanagawa-paper')
|
||||
end
|
||||
},
|
||||
{
|
||||
--- Create Color Code
|
||||
'uga-rosa/ccc.nvim',
|
||||
config = function(_, opts)
|
||||
require('ccc').setup(opts)
|
||||
end,
|
||||
cmd = { 'CccPick', 'CccHighlighterToggle' },
|
||||
keys = {
|
||||
{ "<leader>ct", "<cmd>CccHighlighterToggle<cr>", desc = "[C]olorizer [T]oggle" },
|
||||
{ "<leader>cp", "<cmd>CccPick<cr>", desc = "[C]olor [P]ick" },
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
return {
|
||||
opts = {
|
||||
show_icons = false,
|
||||
leader_key = "_",
|
||||
buffer_leader_key = " m",
|
||||
},
|
||||
}
|
||||
81
nvim/.config/nvim/lua/plugins/autocompletion.lua
Normal file
81
nvim/.config/nvim/lua/plugins/autocompletion.lua
Normal file
@@ -0,0 +1,81 @@
|
||||
return {
|
||||
'hrsh7th/nvim-cmp',
|
||||
event = 'InsertEnter',
|
||||
dependencies = {
|
||||
-- Snippet Engine & its associated nvim-cmp source
|
||||
{
|
||||
'L3MON4D3/LuaSnip',
|
||||
build = (function()
|
||||
if vim.fn.has 'win32' == 1 or vim.fn.executable 'make' == 0 then
|
||||
return
|
||||
end
|
||||
return 'make install_jsregexp'
|
||||
end)(),
|
||||
},
|
||||
'saadparwaiz1/cmp_luasnip',
|
||||
|
||||
-- Adds LSP completion capabilities
|
||||
'hrsh7th/cmp-nvim-lsp',
|
||||
'hrsh7th/cmp-path',
|
||||
|
||||
-- Adds a number of user-friendly snippets
|
||||
'rafamadriz/friendly-snippets',
|
||||
},
|
||||
config = function()
|
||||
-- See `:help cmp`
|
||||
local cmp = require 'cmp'
|
||||
local luasnip = require 'luasnip'
|
||||
require('luasnip.loaders.from_vscode').lazy_load()
|
||||
require('luasnip.loaders.from_lua').lazy_load({ paths = '~/.config/nvim/snippets' })
|
||||
luasnip.config.setup {}
|
||||
luasnip.filetype_extend('templ', { "html" })
|
||||
|
||||
cmp.setup {
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
luasnip.lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
-- completion = { autocomplete = false },
|
||||
completion = { completeopt = 'menu,menuone,noinsert' },
|
||||
|
||||
-- See `:help ins-completion`
|
||||
mapping = cmp.mapping.preset.insert {
|
||||
-- ['<C-l>'] = cmp.mapping.confirm({ select = true }),
|
||||
['<C-n>'] = cmp.mapping.select_next_item(),
|
||||
['<C-p>'] = cmp.mapping.select_prev_item(),
|
||||
['<C-d>'] = cmp.mapping.scroll_docs(-4),
|
||||
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
||||
['<C-y>'] = cmp.mapping.confirm { select = true },
|
||||
['<C-Space>'] = cmp.mapping.complete {},
|
||||
|
||||
-- <c-l> will move you to the right of each of the expansion locations.
|
||||
-- <c-h> is similar, except moving you backwards.
|
||||
['<C-l>'] = cmp.mapping(function()
|
||||
if luasnip.expand_or_locally_jumpable() then
|
||||
luasnip.expand_or_jump()
|
||||
end
|
||||
end, { 'i', 's' }),
|
||||
['<C-h>'] = cmp.mapping(function()
|
||||
if luasnip.locally_jumpable(-1) then
|
||||
luasnip.jump(-1)
|
||||
end
|
||||
end, { 'i', 's' }),
|
||||
},
|
||||
sources = {
|
||||
{ name = 'nvim_lsp' },
|
||||
{ name = 'luasnip' },
|
||||
{ name = 'path' },
|
||||
},
|
||||
}
|
||||
cmp.setup.filetype('sql', {
|
||||
sources = {
|
||||
{ name = 'vim-dadbod-completion' },
|
||||
{ name = 'buffer' },
|
||||
},
|
||||
})
|
||||
cmp.setup.filetype('lisp', {
|
||||
sources = cmp.config.sources({ { name = 'nvlime' } })
|
||||
})
|
||||
end,
|
||||
}
|
||||
67
nvim/.config/nvim/lua/plugins/bookmarks.lua
Normal file
67
nvim/.config/nvim/lua/plugins/bookmarks.lua
Normal file
@@ -0,0 +1,67 @@
|
||||
return {
|
||||
{
|
||||
"otavioschwanck/arrow.nvim",
|
||||
dependencies = {
|
||||
{ "nvim-tree/nvim-web-devicons" },
|
||||
},
|
||||
opts = {
|
||||
show_icons = true,
|
||||
leader_key = '-', -- Recommended to be a single key
|
||||
buffer_leader_key = '+', -- Per Buffer Mappings
|
||||
},
|
||||
keys = {
|
||||
{ "<leader>1", function() require("arrow.persist").go_to(1) end, desc = "Arrow go to 1" },
|
||||
{ "<leader>2", function() require("arrow.persist").go_to(2) end, desc = "Arrow go to 2" },
|
||||
{ "<leader>3", function() require("arrow.persist").go_to(3) end, desc = "Arrow go to 3" },
|
||||
{ "<leader>4", function() require("arrow.persist").go_to(4) end, desc = "Arrow go to 4" },
|
||||
{ "<leader>5", function() require("arrow.persist").go_to(5) end, desc = "Arrow go to 5" },
|
||||
{ "<leader>6", function() require("arrow.persist").go_to(6) end, desc = "Arrow go to 6" },
|
||||
{ "<leader>7", function() require("arrow.persist").go_to(7) end, desc = "Arrow go to 7" },
|
||||
{ "<leader>8", function() require("arrow.persist").go_to(8) end, desc = "Arrow go to 8" },
|
||||
{ "<leader>9", function() require("arrow.persist").go_to(9) end, desc = "Arrow go to 9" },
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
"leath-dub/snipe.nvim",
|
||||
keys = {
|
||||
{ "_", function() require("snipe").open_buffer_menu() end, desc = "Open Snipe buffer menu" }
|
||||
},
|
||||
opts = {}
|
||||
},
|
||||
|
||||
{
|
||||
"chentoast/marks.nvim",
|
||||
event = "VeryLazy",
|
||||
config = true,
|
||||
keys = {
|
||||
{ '<leader>ma', '<cmd>MarksListAll<CR>' },
|
||||
{ '<leader>mb', '<cmd>MarksListBuf<CR>' },
|
||||
{ '<leader>mg', '<cmd>MarksListGlobal<CR>' },
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
"bassamsdata/namu.nvim",
|
||||
config = function()
|
||||
require("namu").setup({
|
||||
-- Enable the modules you want
|
||||
namu_symbols = {
|
||||
enable = true,
|
||||
options = {}, -- here you can configure namu
|
||||
},
|
||||
-- Optional: Enable other modules if needed
|
||||
ui_select = { enable = false }, -- vim.ui.select() wrapper
|
||||
})
|
||||
-- === Suggested Keymaps: ===
|
||||
vim.keymap.set("n", "<leader>;", ":Namu symbols<cr>", {
|
||||
desc = "Jump to LSP symbol",
|
||||
silent = true,
|
||||
})
|
||||
vim.keymap.set("n", "<leader>.", ":Namu workspace<cr>", {
|
||||
desc = "LSP Symbols - Workspace",
|
||||
silent = true,
|
||||
})
|
||||
end,
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
return {
|
||||
opts = {
|
||||
specs = {
|
||||
all = {
|
||||
syntax = {
|
||||
operator = "#bf8040",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
init = function()
|
||||
local cs = require("config.colorscheme")
|
||||
cs.set_colorschemes("nightfox", "dayfox")
|
||||
cs.update_colorscheme()
|
||||
end,
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
return {
|
||||
opts = {
|
||||
formatters_by_ft = {
|
||||
lua = { "stylua" },
|
||||
},
|
||||
format_on_save = {
|
||||
timeout_ms = 500,
|
||||
lsp_format = "fallback",
|
||||
},
|
||||
},
|
||||
}
|
||||
23
nvim/.config/nvim/lua/plugins/convenience.lua
Normal file
23
nvim/.config/nvim/lua/plugins/convenience.lua
Normal file
@@ -0,0 +1,23 @@
|
||||
return {
|
||||
{
|
||||
'folke/which-key.nvim',
|
||||
event = 'VimEnter',
|
||||
opts = {
|
||||
preset = 'helix',
|
||||
delay = 1000,
|
||||
},
|
||||
config = function(_, opts)
|
||||
require('which-key').setup(opts)
|
||||
|
||||
-- Document existing key chains
|
||||
require('which-key').add {
|
||||
{ "<leader>c", group = "[C]ode/Color" },
|
||||
{ "<leader>d", group = "[D]ocument" },
|
||||
{ "<leader>g", group = "[G]it" },
|
||||
{ "<leader>r", group = "[R]ename" },
|
||||
{ "<leader>s", group = "[S]earch" },
|
||||
{ "<leader>w", group = "[W]orkspace" },
|
||||
}
|
||||
end,
|
||||
},
|
||||
}
|
||||
87
nvim/.config/nvim/lua/plugins/editing.lua
Normal file
87
nvim/.config/nvim/lua/plugins/editing.lua
Normal file
@@ -0,0 +1,87 @@
|
||||
return {
|
||||
-- "gc" to comment visual regions/lines
|
||||
{
|
||||
'numToStr/Comment.nvim',
|
||||
opts = {}
|
||||
},
|
||||
|
||||
-- Undo browsing
|
||||
'mbbill/undotree',
|
||||
|
||||
-- Tabstops autodetected
|
||||
'tpope/vim-sleuth',
|
||||
|
||||
{
|
||||
"kylechui/nvim-surround",
|
||||
version = "^3.0.0", -- Use for stability; omit to use `main` branch for the latest features
|
||||
event = "VeryLazy",
|
||||
config = true,
|
||||
},
|
||||
|
||||
{
|
||||
'inkarkat/vim-ReplaceWithRegister',
|
||||
keys = {
|
||||
{ '<leader>rp', '<Plug>ReplaceWithRegisterOperator' },
|
||||
{ '<leader>rpp', '<Plug>ReplaceWithRegisterLine' },
|
||||
{ '<leader>rp', '<Plug>ReplaceWithRegisterVisual', mode = 'x' },
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
'ggandor/leap.nvim',
|
||||
opts = {
|
||||
safe_labels = {},
|
||||
},
|
||||
dependencies = {
|
||||
"tpope/vim-repeat",
|
||||
},
|
||||
keys = {
|
||||
{ '\\', '<Plug>(leap)', mode = { 'n', 'x', 'o' } },
|
||||
{ 'gs', '<Plug>(leap-from-window)', mode = { 'n', 'x', 'o' } },
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
'Wansmer/treesj',
|
||||
dependencies = { 'nvim-treesitter/nvim-treesitter' },
|
||||
opts = {
|
||||
use_default_keymaps = false,
|
||||
},
|
||||
keys = {
|
||||
{ '<leader>tg', function() require('treesj').toggle() end, desc = "[T]ree to[g]gle one-line" },
|
||||
{ '<leader>tj', function() require('treesj').join() end, desc = "[T]ree [J]oin one-line" },
|
||||
{ '<leader>ts', function() require('treesj').split() end, desc = "[T]ree [S]plit one-line" },
|
||||
},
|
||||
},
|
||||
|
||||
-- rehighlight search on n or N
|
||||
{
|
||||
'nvimdev/hlsearch.nvim',
|
||||
event = 'BufRead',
|
||||
config = true,
|
||||
},
|
||||
|
||||
{
|
||||
'mizlan/iswap.nvim',
|
||||
event = 'VeryLazy',
|
||||
keys = {
|
||||
{ '<leader>cs', '<cmd>ISwapWith<CR>', desc = 'I[S]wap' },
|
||||
{ '<leader>cS', '<cmd>ISwap<CR>', desc = 'I[S]wapWith' },
|
||||
{ '<leader>cn', '<cmd>ISwapNodeWith<CR>', desc = 'ISwap[N]ode' },
|
||||
{ '<leader>cN', '<cmd>ISwapNode<CR>', desc = 'ISwap[N]ode' },
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
'aaronik/treewalker.nvim',
|
||||
keys = {
|
||||
{ '<leader>ch', '<cmd>Treewalker Left<CR>', desc = 'Tree Left' },
|
||||
{ '<leader>cj', '<cmd>Treewalker Down<CR>', desc = 'Tree Down' },
|
||||
{ '<leader>ck', '<cmd>Treewalker Up<CR>', desc = 'Tree Up' },
|
||||
{ '<leader>cl', '<cmd>Treewalker Right<CR>', desc = 'Tree Right' },
|
||||
{ '<leader>cJ', '<cmd>Treewalker SwapDown<CR>', desc = 'Tree Swap Down' },
|
||||
{ '<leader>cK', '<cmd>Treewalker SwapUp<CR>', desc = 'Tree Swap Up' },
|
||||
},
|
||||
},
|
||||
|
||||
}
|
||||
13
nvim/.config/nvim/lua/plugins/file-explorer.lua
Normal file
13
nvim/.config/nvim/lua/plugins/file-explorer.lua
Normal file
@@ -0,0 +1,13 @@
|
||||
return {
|
||||
{
|
||||
'stevearc/oil.nvim',
|
||||
dependencies = { "nvim-tree/nvim-web-devicons" },
|
||||
opts = {
|
||||
default_file_explorer = true,
|
||||
delete_to_trash = true,
|
||||
},
|
||||
keys = {
|
||||
{ "<leader>-", "<cmd>Oil<CR>", desc = "Open parent directory" },
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
return {
|
||||
opts = {
|
||||
modes = {
|
||||
char = {
|
||||
enabled = false,
|
||||
},
|
||||
},
|
||||
},
|
||||
init = function()
|
||||
local set = vim.keymap.set
|
||||
set({ "n", "x", "o" }, "\\", function()
|
||||
require("flash").jump()
|
||||
end, { desc = "Flash" })
|
||||
set({ "n", "x", "o" }, "=", function()
|
||||
require("flash").treesitter()
|
||||
end, { desc = "Flash Treesitter" })
|
||||
set({ "o" }, "r", function()
|
||||
require("flash").remote()
|
||||
end, { desc = "Remote Flash" })
|
||||
set({ "n", "x", "o" }, " t", function()
|
||||
require("flash").treesitter_search()
|
||||
end, { desc = "Treesitter Search" })
|
||||
end,
|
||||
}
|
||||
74
nvim/.config/nvim/lua/plugins/git.lua
Normal file
74
nvim/.config/nvim/lua/plugins/git.lua
Normal file
@@ -0,0 +1,74 @@
|
||||
return {
|
||||
-- Git
|
||||
{
|
||||
'NeogitOrg/neogit',
|
||||
dependencies = {
|
||||
'nvim-lua/plenary.nvim',
|
||||
'sindrets/diffview.nvim',
|
||||
'nvim-telescope/telescope.nvim',
|
||||
},
|
||||
opts = {
|
||||
graph_style = 'unicode',
|
||||
use_per_project_settings = false,
|
||||
},
|
||||
keys = {
|
||||
{
|
||||
'<leader>go',
|
||||
function() require('neogit').open() end,
|
||||
desc = 'Neo[g]it [O]pen'
|
||||
},
|
||||
{
|
||||
'<leader>g.',
|
||||
function() require('neogit').open({ cwd = '%:p:h' }) end,
|
||||
desc = 'Neo[g]it open in current file repository'
|
||||
},
|
||||
{
|
||||
'<leader>gh',
|
||||
function() require('diffview').file_history() end,
|
||||
desc = '[G]it [H]istory',
|
||||
},
|
||||
{
|
||||
'<leader>g%',
|
||||
function() require('diffview').file_history(nil, { '%' }) end,
|
||||
desc = '[G]it history for [%] current file'
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
'FabijanZulj/blame.nvim',
|
||||
config = true,
|
||||
cmd = 'BlameToggle',
|
||||
keys = {
|
||||
{ '<leader>bt', '<cmd>BlameToggle<cr>', desc = 'Git [B]lame [T]oggle' },
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
-- 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>sA', gs.stage_hunk,
|
||||
{ buffer = bufnr, desc = '[S]tage Hunk' })
|
||||
vim.keymap.set('n', '<leader>HD', function() gs.diffthis('~') end,
|
||||
{ buffer = bufnr, desc = '[H]unk [D]iff' })
|
||||
end,
|
||||
},
|
||||
},
|
||||
}
|
||||
12
nvim/.config/nvim/lua/plugins/global-note.lua
Normal file
12
nvim/.config/nvim/lua/plugins/global-note.lua
Normal file
@@ -0,0 +1,12 @@
|
||||
return {
|
||||
'backdround/global-note.nvim',
|
||||
keys = {
|
||||
{
|
||||
"<leader>tn",
|
||||
function()
|
||||
require('global-note').toggle_note()
|
||||
end,
|
||||
desc = '[T]oggle global [N]ote',
|
||||
},
|
||||
},
|
||||
}
|
||||
13
nvim/.config/nvim/lua/plugins/go.lua
Normal file
13
nvim/.config/nvim/lua/plugins/go.lua
Normal file
@@ -0,0 +1,13 @@
|
||||
return {
|
||||
"ray-x/go.nvim",
|
||||
dependencies = {
|
||||
"ray-x/guihua.lua",
|
||||
"neovim/nvim-lspconfig",
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
},
|
||||
config = function(_, opts)
|
||||
require("go").setup(opts)
|
||||
end,
|
||||
event = { "CmdlineEnter" },
|
||||
ft = { "go", 'gomod' },
|
||||
}
|
||||
24
nvim/.config/nvim/lua/plugins/godoc.lua
Normal file
24
nvim/.config/nvim/lua/plugins/godoc.lua
Normal file
@@ -0,0 +1,24 @@
|
||||
return {
|
||||
{
|
||||
'fredrikaverpil/godoc.nvim',
|
||||
version = '*',
|
||||
dependencies = {
|
||||
{ 'nvim-telescope/telescope.nvim' },
|
||||
{
|
||||
'nvim-treesitter/nvim-treesitter',
|
||||
opts = {
|
||||
ensure_installed = { 'go' },
|
||||
},
|
||||
},
|
||||
},
|
||||
event = 'VeryLazy',
|
||||
cmd = 'GoDoc',
|
||||
keys = {
|
||||
{ '<leader>gd', '<cmd>GoDoc<CR>', desc = '[G]o[D]oc' },
|
||||
},
|
||||
build = 'go install github.com/lotusirous/gostdsym/stdsym@latest',
|
||||
opts = {
|
||||
picker = { type = 'telescope' },
|
||||
},
|
||||
},
|
||||
}
|
||||
16
nvim/.config/nvim/lua/plugins/http.lua
Normal file
16
nvim/.config/nvim/lua/plugins/http.lua
Normal file
@@ -0,0 +1,16 @@
|
||||
return {
|
||||
{
|
||||
"rest-nvim/rest.nvim",
|
||||
dependencies = {
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
opts = function(_, opts)
|
||||
opts.ensure_installed = opts.ensure_installed or {}
|
||||
table.insert(opts.ensure_installed, "http")
|
||||
end,
|
||||
},
|
||||
ft = 'http',
|
||||
keys = {
|
||||
{ '<leader>S', '<cmd>Rest run<CR>', ft = 'http' },
|
||||
},
|
||||
},
|
||||
}
|
||||
9
nvim/.config/nvim/lua/plugins/jj.lua
Normal file
9
nvim/.config/nvim/lua/plugins/jj.lua
Normal file
@@ -0,0 +1,9 @@
|
||||
return {
|
||||
{
|
||||
'swaits/lazyjj.nvim',
|
||||
dependencies = 'nvim-lua/plenary.nvim',
|
||||
opts = {
|
||||
mapping = '<leader>gj'
|
||||
}
|
||||
},
|
||||
}
|
||||
25
nvim/.config/nvim/lua/plugins/line.lua
Normal file
25
nvim/.config/nvim/lua/plugins/line.lua
Normal file
@@ -0,0 +1,25 @@
|
||||
vim.opt.fillchars = {
|
||||
stl = "─",
|
||||
}
|
||||
|
||||
return {
|
||||
{
|
||||
"sschleemilch/slimline.nvim",
|
||||
opts = {
|
||||
spaces = {
|
||||
components = "─",
|
||||
left = "─",
|
||||
right = "─",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
'b0o/incline.nvim',
|
||||
config = function()
|
||||
require('incline').setup()
|
||||
end,
|
||||
-- Optional: Lazy load Incline
|
||||
event = 'VeryLazy',
|
||||
},
|
||||
}
|
||||
167
nvim/.config/nvim/lua/plugins/lsp.lua
Normal file
167
nvim/.config/nvim/lua/plugins/lsp.lua
Normal file
@@ -0,0 +1,167 @@
|
||||
return {
|
||||
{
|
||||
'neovim/nvim-lspconfig',
|
||||
version = '*',
|
||||
dependencies = {
|
||||
-- Automatically install LSPs and related tools to stdpath for neovim
|
||||
'williamboman/mason.nvim',
|
||||
'williamboman/mason-lspconfig.nvim',
|
||||
'WhoIsSethDaniel/mason-tool-installer.nvim',
|
||||
'folke/neodev.nvim',
|
||||
|
||||
-- Useful status updates for LSP.
|
||||
{ 'j-hui/fidget.nvim', opts = {} },
|
||||
},
|
||||
config = function()
|
||||
vim.api.nvim_create_autocmd('LspAttach', {
|
||||
group = vim.api.nvim_create_augroup('my-lsp-attach', { clear = true }),
|
||||
callback = function(event)
|
||||
local map = function(keys, func, desc)
|
||||
vim.keymap.set('n', keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc })
|
||||
end
|
||||
|
||||
map('<leader>rn', '<cmd>Lspsaga rename<CR>', '[R]e[n]ame')
|
||||
map('<leader>ca', vim.lsp.buf.code_action, '[C]ode [A]ction')
|
||||
map('K', '<cmd>Lspsaga hover_doc<CR>', 'Hover Documentation')
|
||||
map('<leader>K', vim.lsp.buf.signature_help, 'Signature Documentation')
|
||||
|
||||
-- Highlight references under cursor (clear highlight when cursor moves).
|
||||
local client = vim.lsp.get_client_by_id(event.data.client_id)
|
||||
if client and client.server_capabilities.documentHighlightProvider then
|
||||
vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, {
|
||||
buffer = event.buf,
|
||||
callback = function()
|
||||
local clients = vim.lsp.get_clients({ bufnr = event.buf })
|
||||
for _, cl in ipairs(clients) do
|
||||
if cl.name == 'unocss' then
|
||||
return -- skip highlight if unocss is attached (workaround)
|
||||
end
|
||||
end
|
||||
vim.lsp.buf.document_highlight()
|
||||
end
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd({ 'CursorMoved', 'CursorMovedI' }, {
|
||||
buffer = event.buf,
|
||||
callback = vim.lsp.buf.clear_references,
|
||||
})
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||
capabilities = vim.tbl_deep_extend('force', capabilities, require('cmp_nvim_lsp').default_capabilities())
|
||||
|
||||
local servers = {
|
||||
clangd = {},
|
||||
gopls = {},
|
||||
-- pyright = {},
|
||||
rust_analyzer = {},
|
||||
ts_ls = {},
|
||||
|
||||
lua_ls = {
|
||||
settings = {
|
||||
Lua = {
|
||||
runtime = { version = 'LuaJIT' },
|
||||
workspace = { checkThirdParty = false },
|
||||
telemetry = { enable = false },
|
||||
completion = {
|
||||
callSnippet = 'Replace',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
html = {},
|
||||
htmx = {},
|
||||
unocss = {},
|
||||
}
|
||||
|
||||
require 'lspconfig'.html.setup {
|
||||
filetypes = { "html", "templ" },
|
||||
}
|
||||
|
||||
require 'lspconfig'.htmx.setup {
|
||||
filetypes = { "html", "templ" },
|
||||
}
|
||||
|
||||
require 'lspconfig'.unocss.setup {
|
||||
filetypes = { "html", "templ" },
|
||||
}
|
||||
|
||||
-- Setup neovim lua configuration
|
||||
require('neodev').setup()
|
||||
|
||||
require('mason').setup()
|
||||
|
||||
local ensure_installed = vim.tbl_keys(servers or {})
|
||||
vim.list_extend(ensure_installed, {
|
||||
'stylua', -- Used to format lua code
|
||||
})
|
||||
require('mason-tool-installer').setup { ensure_installed = ensure_installed }
|
||||
|
||||
require('mason-lspconfig').setup {
|
||||
handlers = {
|
||||
function(server_name)
|
||||
local server = servers[server_name] or {}
|
||||
-- This handles overriding only values explicitly passed
|
||||
-- by the server configuration above. Useful when disabling
|
||||
-- certain features of an LSP (for example, turning off formatting for tsserver)
|
||||
server.capabilities = vim.tbl_deep_extend('force', {}, capabilities, server.capabilities or {})
|
||||
require('lspconfig')[server_name].setup(server)
|
||||
end,
|
||||
},
|
||||
}
|
||||
end,
|
||||
},
|
||||
|
||||
{
|
||||
'nvimdev/lspsaga.nvim',
|
||||
dependencies = {
|
||||
'nvim-treesitter/nvim-treesitter',
|
||||
'nvim-tree/nvim-web-devicons',
|
||||
},
|
||||
opts = {
|
||||
lightbulb = { enable = false }
|
||||
},
|
||||
config = function(_, opts)
|
||||
require('lspsaga').setup(opts)
|
||||
vim.keymap.set('n', '<leader>la', '<cmd>Lspsaga code_action<CR>', { desc = "[L]spsaga code [A]ction" })
|
||||
vim.keymap.set('n', '<leader>lb', '<cmd>Lspsaga show_buf_diagnostics<CR>',
|
||||
{ desc = "[L]spsaga [B]uffer diagnostics" })
|
||||
vim.keymap.set('n', '<leader>lc', '<cmd>Lspsaga show_cursor_diagnostics<CR>',
|
||||
{ desc = "[L]spsaga [C]ursor diagnostics" })
|
||||
vim.keymap.set('n', '<leader>ld', '<cmd>Lspsaga goto_definition<CR>', { desc = "[L]spsaga goto [D]efinition" })
|
||||
vim.keymap.set('n', '<leader>lD', '<cmd>Lspsaga goto_type_definition<CR>',
|
||||
{ desc = "[L]spsaga goto type [D]efinition" })
|
||||
vim.keymap.set('n', '<leader>lf', '<cmd>Lspsaga finder<CR>', { desc = "[L]spsaga [F]inder" })
|
||||
vim.keymap.set('n', '<leader>lI', '<cmd>Lspsaga finder imp<CR>', { desc = "[L]spsaga finder [I]mplementations" })
|
||||
vim.keymap.set('n', '<leader>li', '<cmd>Lspsaga incoming_calls<CR>', { desc = "[L]spsaga [I]ncomping calls" })
|
||||
vim.keymap.set('n', '<leader>ll', '<cmd>Lspsaga show_line_diagnostics<CR>',
|
||||
{ desc = "[L]spsaga [L]ine diagnostics" })
|
||||
vim.keymap.set('n', '<leader>lo', '<cmd>Lspsaga outgoing_calls<CR>', { desc = "[L]spsaga [O]utgoing calls" })
|
||||
vim.keymap.set('n', '<leader>lO', '<cmd>Lspsaga outline<CR>', { desc = "[L]spsaga [O]utline" })
|
||||
vim.keymap.set('n', '<leader>lp', '<cmd>Lspsaga peek_definition<CR>', { desc = "[L]spsaga [P]eek definition" })
|
||||
vim.keymap.set('n', '<leader>lP', '<cmd>Lspsaga peek_type_definition<CR>',
|
||||
{ desc = "[L]spsaga [P]eek type definition" })
|
||||
vim.keymap.set('n', '<leader>lw', '<cmd>Lspsaga show_workspace_diagnostics<CR>',
|
||||
{ desc = "[L]spsaga [W]orkspace diagnostics" })
|
||||
vim.keymap.set({ 'n', 't' }, '<C-_>', '<cmd>Lspsaga term_toggle<CR>', { desc = "[L]spsaga [T]erm toggle" })
|
||||
end,
|
||||
},
|
||||
|
||||
{
|
||||
"folke/trouble.nvim",
|
||||
dependencies = { "nvim-tree/nvim-web-devicons" },
|
||||
opts = {},
|
||||
cmd = 'Trouble'
|
||||
},
|
||||
|
||||
{
|
||||
"ray-x/lsp_signature.nvim",
|
||||
event = "InsertEnter",
|
||||
opts = {
|
||||
-- cfg options
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -1,71 +0,0 @@
|
||||
return {
|
||||
init = function(mc)
|
||||
local set = vim.keymap.set
|
||||
|
||||
-- Add or skip cursor above/below the main cursor.
|
||||
set({ "n", "x" }, "<c-k>", function()
|
||||
mc.lineAddCursor(-1)
|
||||
end)
|
||||
set({ "n", "x" }, "<c-j>", function()
|
||||
mc.lineAddCursor(1)
|
||||
end)
|
||||
set({ "n", "x" }, "<leader><c-k>", function()
|
||||
mc.lineSkipCursor(-1)
|
||||
end)
|
||||
set({ "n", "x" }, "<leader><c-j>", function()
|
||||
mc.lineSkipCursor(1)
|
||||
end)
|
||||
|
||||
-- Add or skip adding a new cursor by matching word/selection
|
||||
set({ "n", "x" }, "<c-n>", function()
|
||||
mc.matchAddCursor(1)
|
||||
end)
|
||||
set({ "n", "x" }, "<leader><c-n>", function()
|
||||
mc.matchSkipCursor(1)
|
||||
end)
|
||||
set({ "n", "x" }, "<c-p>", function()
|
||||
mc.matchAddCursor(-1)
|
||||
end)
|
||||
set({ "n", "x" }, "<leader><c-p>", function()
|
||||
mc.matchSkipCursor(-1)
|
||||
end)
|
||||
|
||||
-- Add and remove cursors with control + left click.
|
||||
set("n", "<c-leftmouse>", mc.handleMouse)
|
||||
set("n", "<c-leftdrag>", mc.handleMouseDrag)
|
||||
set("n", "<c-leftrelease>", mc.handleMouseRelease)
|
||||
|
||||
-- Disable and enable cursors.
|
||||
set({ "n", "x" }, "<leader><c-q>", mc.toggleCursor)
|
||||
|
||||
-- Mappings defined in a keymap layer only apply when there are
|
||||
-- multiple cursors. This lets you have overlapping mappings.
|
||||
mc.addKeymapLayer(function(layerSet)
|
||||
-- Select a different cursor as the main one.
|
||||
layerSet({ "n", "x" }, "<left>", mc.prevCursor)
|
||||
layerSet({ "n", "x" }, "<right>", mc.nextCursor)
|
||||
|
||||
-- Delete the main cursor.
|
||||
layerSet({ "n", "x" }, "<leader>x", mc.deleteCursor)
|
||||
|
||||
-- Enable and clear cursors using escape.
|
||||
layerSet("n", "<esc>", function()
|
||||
if not mc.cursorsEnabled() then
|
||||
mc.enableCursors()
|
||||
else
|
||||
mc.clearCursors()
|
||||
end
|
||||
end)
|
||||
end)
|
||||
|
||||
-- Customize how cursors look.
|
||||
local hl = vim.api.nvim_set_hl
|
||||
hl(0, "MultiCursorCursor", { reverse = true })
|
||||
hl(0, "MultiCursorVisual", { link = "Visual" })
|
||||
hl(0, "MultiCursorSign", { link = "SignColumn" })
|
||||
hl(0, "MultiCursorMatchPreview", { link = "Search" })
|
||||
hl(0, "MultiCursorDisabledCursor", { reverse = true })
|
||||
hl(0, "MultiCursorDisabledVisual", { link = "Visual" })
|
||||
hl(0, "MultiCursorDisabledSign", { link = "SignColumn" })
|
||||
end,
|
||||
}
|
||||
49
nvim/.config/nvim/lua/plugins/odin.lua
Normal file
49
nvim/.config/nvim/lua/plugins/odin.lua
Normal file
@@ -0,0 +1,49 @@
|
||||
require 'lspconfig'.ols.setup {}
|
||||
|
||||
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",
|
||||
})
|
||||
|
||||
return {
|
||||
{
|
||||
"stevearc/conform.nvim",
|
||||
opts = {
|
||||
-- notify_on_error = false,
|
||||
-- Odinfmt gets its configuration from odinfmt.json. It defaults
|
||||
-- writing to stdout but needs to be told to read from stdin.
|
||||
formatters = {
|
||||
odinfmt = {
|
||||
-- Change where to find the command if it isn't in your path.
|
||||
command = "odinfmt",
|
||||
args = { "-stdin" },
|
||||
stdin = true,
|
||||
},
|
||||
},
|
||||
-- and instruct conform to use odinfmt.
|
||||
formatters_by_ft = {
|
||||
odin = { "odinfmt" },
|
||||
},
|
||||
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,
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
return {
|
||||
init = function()
|
||||
vim.keymap.set("n", "<leader>-", "<cmd>Oil<cr>", { desc = "Oil file manager" })
|
||||
end,
|
||||
}
|
||||
14
nvim/.config/nvim/lua/plugins/persisted.lua
Normal file
14
nvim/.config/nvim/lua/plugins/persisted.lua
Normal file
@@ -0,0 +1,14 @@
|
||||
return {
|
||||
"olimorris/persisted.nvim",
|
||||
lazy = false, -- make sure the plugin is always loaded at startup
|
||||
opts = {
|
||||
autoload = true,
|
||||
ignored_dirs = {
|
||||
"~/.config",
|
||||
"~/tmp",
|
||||
"/tmp",
|
||||
{ "~", exact = true },
|
||||
{ "/", exact = true },
|
||||
},
|
||||
},
|
||||
}
|
||||
7
nvim/.config/nvim/lua/plugins/quicker.lua
Normal file
7
nvim/.config/nvim/lua/plugins/quicker.lua
Normal file
@@ -0,0 +1,7 @@
|
||||
return {
|
||||
'stevearc/quicker.nvim',
|
||||
event = "FileType qf",
|
||||
---@module "quicker"
|
||||
---@type quicker.SetupOptions
|
||||
opts = {},
|
||||
}
|
||||
@@ -1,142 +1,146 @@
|
||||
return {
|
||||
init = function()
|
||||
local set = vim.keymap.set
|
||||
|
||||
set("n", "<leader><space>", function()
|
||||
Snacks.picker.smart()
|
||||
end, { desc = "Smart Find Files" })
|
||||
|
||||
set("n", "<leader><space>", function()
|
||||
Snacks.picker.smart()
|
||||
end, { desc = "Smart Find Files" })
|
||||
|
||||
set("n", "<leader>a", function()
|
||||
Snacks.picker.buffers()
|
||||
end, { desc = "Buffers" })
|
||||
|
||||
set("n", "<leader>r", function()
|
||||
Snacks.picker.recent()
|
||||
end, { desc = "Recent files" })
|
||||
|
||||
set("n", "<leader>R", function()
|
||||
Snacks.picker.resume()
|
||||
end, { desc = "Resume" })
|
||||
|
||||
set("n", "<leader>b", function()
|
||||
Snacks.picker.lines()
|
||||
end, { desc = "Buffer lines" })
|
||||
|
||||
set("n", "<leader>B", function()
|
||||
Snacks.picker.grep_buffers()
|
||||
end, { desc = "Grep Open Buffers" })
|
||||
|
||||
set("n", "<leader>f", function()
|
||||
Snacks.picker.files()
|
||||
end, { desc = "Find Files" })
|
||||
|
||||
set("n", "<leader>s", function()
|
||||
Snacks.picker.grep()
|
||||
end, { desc = "Grep" })
|
||||
|
||||
set("n", "<leader>S", function()
|
||||
Snacks.picker.git_status()
|
||||
end, { desc = "Git Status" })
|
||||
|
||||
set("n", "<leader>g", function()
|
||||
Snacks.picker.git_files()
|
||||
end, { desc = "Find Git Files" })
|
||||
|
||||
set("n", "<leader>G", function()
|
||||
Snacks.picker.git_grep()
|
||||
end, { desc = "Git Grep" })
|
||||
|
||||
set("n", "<leader>l", function()
|
||||
Snacks.lazygit()
|
||||
end, { desc = "Lazygit" })
|
||||
|
||||
set("n", "<leader>L", function()
|
||||
Snacks.lazygit.log_file()
|
||||
end, { desc = "Lazygit log file" })
|
||||
|
||||
set("n", "<leader>n", function()
|
||||
Snacks.notifier.show_history()
|
||||
end, { desc = "Notification History" })
|
||||
|
||||
set("n", "<leader>N", function()
|
||||
Snacks.picker.notifications()
|
||||
end, { desc = "Notifications" })
|
||||
|
||||
set("n", "<leader>C", function()
|
||||
Snacks.picker.commands()
|
||||
end, { desc = "Commands" })
|
||||
|
||||
set("n", "<leader>h", function()
|
||||
Snacks.picker.keymaps()
|
||||
end, { desc = "Keymaps" })
|
||||
|
||||
set("n", "<leader>:", function()
|
||||
Snacks.picker.command_history()
|
||||
end, { desc = "Command History" })
|
||||
|
||||
set("n", '<leader>"', function()
|
||||
Snacks.picker.registers()
|
||||
end, { desc = "Registers" })
|
||||
|
||||
set("n", "<leader>$", function()
|
||||
Snacks.rename.rename_file()
|
||||
end, { desc = "Rename File" })
|
||||
|
||||
set("n", "<leader>z", function()
|
||||
Snacks.zen.zoom()
|
||||
end, { desc = "Toggle Zoom" })
|
||||
{
|
||||
"folke/snacks.nvim",
|
||||
priority = 1000,
|
||||
lazy = false,
|
||||
---@type snacks.Config
|
||||
opts = {
|
||||
bigfile = { enabled = true },
|
||||
dashboard = { enabled = false },
|
||||
explorer = { enabled = true },
|
||||
indent = { enabled = true },
|
||||
input = { enabled = true },
|
||||
notifier = {
|
||||
enabled = true,
|
||||
timeout = 3000,
|
||||
},
|
||||
picker = { enabled = true },
|
||||
quickfile = { enabled = true },
|
||||
scope = { enabled = true },
|
||||
scroll = { enabled = false },
|
||||
statuscolumn = { enabled = true },
|
||||
words = { enabled = true },
|
||||
styles = {
|
||||
notification = {
|
||||
-- wo = { wrap = true } -- Wrap notifications
|
||||
}
|
||||
},
|
||||
zen = {
|
||||
win = { width = 180, backdrop = { transparent = false } },
|
||||
on_open = function()
|
||||
vim.opt.laststatus = 1
|
||||
require('incline').disable()
|
||||
vim.system({ 'hyprctl', 'dispatch', 'fullscreen' })
|
||||
vim.system({ 'awesome-client', 'client.focus.fullscreen = true' })
|
||||
end,
|
||||
on_close = function()
|
||||
vim.opt.laststatus = 3
|
||||
require('incline').enable()
|
||||
vim.system({ 'hyprctl', 'dispatch', 'fullscreen' })
|
||||
vim.system({ 'awesome-client', 'client.focus.fullscreen = false' })
|
||||
end
|
||||
}
|
||||
},
|
||||
keys = {
|
||||
-- Top Pickr & Explorer
|
||||
{ "<leader><space>", function() Snacks.picker.smart() end, desc = "Smart Find Files" },
|
||||
{ "<leader>,", function() Snacks.picker.buffers() end, desc = "Buffers" },
|
||||
{ "<leader>/", function() Snacks.picker.grep() end, desc = "Grep" },
|
||||
{ "<leader>:", function() Snacks.picker.command_history() end, desc = "Command History" },
|
||||
{ "<leader>n", function() Snacks.picker.notifications() end, desc = "Notification History" },
|
||||
{ "<leader>e", function() Snacks.explorer() end, desc = "File Explorer" },
|
||||
-- find
|
||||
{ "<leader>fb", function() Snacks.picker.buffers() end, desc = "Buffers" },
|
||||
{ "<leader>fc", function() Snacks.picker.files({ cwd = vim.fn.stdpath("config") }) end, desc = "Find Config File" },
|
||||
{ "<leader>ff", function() Snacks.picker.files() end, desc = "Find Files" },
|
||||
{ "<leader>fg", function() Snacks.picker.git_files() end, desc = "Find Git Files" },
|
||||
{ "<leader>fp", function() Snacks.picker.projects() end, desc = "Projects" },
|
||||
{ "<leader>fr", function() Snacks.picker.recent() end, desc = "Recent" },
|
||||
-- git
|
||||
{ "<leader>gb", function() Snacks.picker.git_branches() end, desc = "Git Branches" },
|
||||
{ "<leader>gl", function() Snacks.picker.git_log() end, desc = "Git Log" },
|
||||
{ "<leader>gL", function() Snacks.picker.git_log_line() end, desc = "Git Log Line" },
|
||||
{ "<leader>gs", function() Snacks.picker.git_status() end, desc = "Git Status" },
|
||||
{ "<leader>gS", function() Snacks.picker.git_stash() end, desc = "Git Stash" },
|
||||
{ "<leader>gd", function() Snacks.picker.git_diff() end, desc = "Git Diff (Hunks)" },
|
||||
{ "<leader>gf", function() Snacks.picker.git_log_file() end, desc = "Git Log File" },
|
||||
{ "<leader>gg", function() Snacks.picker.git_grep() end, desc = "Git Grep" },
|
||||
-- Grep
|
||||
{ "<leader>sb", function() Snacks.picker.lines() end, desc = "Buffer Lines" },
|
||||
{ "<leader>sB", function() Snacks.picker.grep_buffers() end, desc = "Grep Open Buffers" },
|
||||
{ "<leader>sg", function() Snacks.picker.grep() end, desc = "Grep" },
|
||||
{ "<leader>sw", function() Snacks.picker.grep_word() end, desc = "Visual selection or word", mode = { "n", "x" } },
|
||||
{ "<leader>so", function() Snacks.picker.grep({ cwd = "/usr/lib/odin" }) end, desc = "Grep" },
|
||||
{ "<leader>sO", function() Snacks.picker.files({ cwd = "/usr/lib/odin" }) end, desc = "Grep" },
|
||||
{ "<leader>sX", function() Snacks.picker.grep({ cwd = "/usr/include/xcb" }) end, desc = "Grep" },
|
||||
-- search
|
||||
{ '<leader>s"', function() Snacks.picker.registers() end, desc = "Registers" },
|
||||
{ '<leader>s/', function() Snacks.picker.search_history() end, desc = "Search History" },
|
||||
{ "<leader>sa", function() Snacks.picker.autocmds() end, desc = "Autocmds" },
|
||||
{ "<leader>sb", function() Snacks.picker.lines() end, desc = "Buffer Lines" },
|
||||
{ "<leader>sc", function() Snacks.picker.command_history() end, desc = "Command History" },
|
||||
{ "<leader>sC", function() Snacks.picker.commands() end, desc = "Commands" },
|
||||
{ "<leader>sd", function() Snacks.picker.diagnostics() end, desc = "Diagnostics" },
|
||||
{ "<leader>sD", function() Snacks.picker.diagnostics_buffer() end, desc = "Buffer Diagnostics" },
|
||||
{ "<leader>sh", function() Snacks.picker.help() end, desc = "Help Pages" },
|
||||
{ "<leader>sH", function() Snacks.picker.highlights() end, desc = "Highlights" },
|
||||
{ "<leader>si", function() Snacks.picker.icons() end, desc = "Icons" },
|
||||
{ "<leader>sj", function() Snacks.picker.jumps() end, desc = "Jumps" },
|
||||
{ "<leader>sk", function() Snacks.picker.keymaps() end, desc = "Keymaps" },
|
||||
{ "<leader>sl", function() Snacks.picker.loclist() end, desc = "Location List" },
|
||||
{ "<leader>sm", function() Snacks.picker.marks() end, desc = "Marks" },
|
||||
{ "<leader>sM", function() Snacks.picker.man() end, desc = "Man Pages" },
|
||||
{ "<leader>sp", function() Snacks.picker.lazy() end, desc = "Search for Plugin Spec" },
|
||||
{ "<leader>sq", function() Snacks.picker.qflist() end, desc = "Quickfix List" },
|
||||
{ "<leader>sR", function() Snacks.picker.resume() end, desc = "Resume" },
|
||||
{ "<leader>su", function() Snacks.picker.undo() end, desc = "Undo History" },
|
||||
{ "<leader>uC", function() Snacks.picker.colorschemes() end, desc = "Colorschemes" },
|
||||
-- LSP
|
||||
|
||||
set("n", "gd", function()
|
||||
Snacks.picker.lsp_definitions()
|
||||
end, { desc = "Goto Definition" })
|
||||
|
||||
set("n", "gD", function()
|
||||
Snacks.picker.lsp_declarations()
|
||||
end, { desc = "Goto Declaration" })
|
||||
|
||||
set("n", "gr", function()
|
||||
Snacks.picker.lsp_references()
|
||||
end, { desc = "References" })
|
||||
|
||||
set("n", "gI", function()
|
||||
Snacks.picker.lsp_implementations()
|
||||
end, { desc = "Goto Implementation" })
|
||||
|
||||
set("n", "gy", function()
|
||||
Snacks.picker.lsp_type_definitions()
|
||||
end, { desc = "Goto T[y]pe Definition" })
|
||||
|
||||
set("n", "<leader>w", function()
|
||||
Snacks.picker.lsp_symbols()
|
||||
end, { desc = "LSP Symbols" })
|
||||
|
||||
set("n", "<leader>d", function()
|
||||
Snacks.picker.diagnostics_buffer()
|
||||
end, { desc = "Buffer Diagnostics" })
|
||||
|
||||
set("n", "<leader>D", function()
|
||||
Snacks.picker.diagnostics()
|
||||
end, { desc = "Diagnostics" })
|
||||
|
||||
set("n", "<leader>W", function()
|
||||
Snacks.picker.lsp_workspace_symbols()
|
||||
end, { desc = "LSP Workspace Symbols" })
|
||||
-- Terminal
|
||||
|
||||
set({ "n", "t" }, "<c-/>", function()
|
||||
Snacks.terminal()
|
||||
end, { desc = "Toggle Terminal" })
|
||||
|
||||
set({ "n", "t" }, "<c-_>", function()
|
||||
Snacks.terminal()
|
||||
end, { desc = "which_key_ignore" })
|
||||
|
||||
vim.api.nvim_create_autocmd("VimEnter", {
|
||||
{ "gd", function() Snacks.picker.lsp_definitions() end, desc = "Goto Definition" },
|
||||
{ "gD", function() Snacks.picker.lsp_declarations() end, desc = "Goto Declaration" },
|
||||
{ "gr", function() Snacks.picker.lsp_references() end, nowait = true, desc = "References" },
|
||||
{ "gI", function() Snacks.picker.lsp_implementations() end, desc = "Goto Implementation" },
|
||||
{ "gy", function() Snacks.picker.lsp_type_definitions() end, desc = "Goto T[y]pe Definition" },
|
||||
{ "<leader>ss", function() Snacks.picker.lsp_symbols() end, desc = "LSP Symbols" },
|
||||
{ "<leader>sS", function() Snacks.picker.lsp_workspace_symbols() end, desc = "LSP Workspace Symbols" },
|
||||
-- Other
|
||||
{ "<leader>z", function() Snacks.zen() end, desc = "Toggle Zen Mode" },
|
||||
{ "<leader>Z", function() Snacks.zen.zoom() end, desc = "Toggle Zoom" },
|
||||
{ "<leader>'", function() Snacks.scratch() end, desc = "Toggle Scratch Buffer" },
|
||||
{ "<leader>S", function() Snacks.scratch.select() end, desc = "Select Scratch Buffer" },
|
||||
{ "<leader>n", function() Snacks.notifier.show_history() end, desc = "Notification History" },
|
||||
{ "<leader>bd", function() Snacks.bufdelete() end, desc = "Delete Buffer" },
|
||||
{ "<leader>cR", function() Snacks.rename.rename_file() end, desc = "Rename File" },
|
||||
{ "<leader>gB", function() Snacks.gitbrowse() end, desc = "Git Browse", mode = { "n", "v" } },
|
||||
{ "<leader>gG", function() Snacks.lazygit() end, desc = "Lazygit" },
|
||||
{ "<leader>un", function() Snacks.notifier.hide() end, desc = "Dismiss All Notifications" },
|
||||
{ "<leader>bl", function() Snacks.git.blame_line() end, desc = "Git Blame Line" },
|
||||
{ "<c-/>", function() Snacks.terminal() end, desc = "Toggle Terminal" },
|
||||
{ "<c-_>", function() Snacks.terminal() end, desc = "which_key_ignore" },
|
||||
{ "]]", function() Snacks.words.jump(vim.v.count1) end, desc = "Next Reference", mode = { "n", "t" } },
|
||||
{ "[[", function() Snacks.words.jump(-vim.v.count1) end, desc = "Prev Reference", mode = { "n", "t" } },
|
||||
{
|
||||
"<leader>N",
|
||||
desc = "Neovim News",
|
||||
function()
|
||||
Snacks.win({
|
||||
file = vim.api.nvim_get_runtime_file("doc/news.txt", false)[1],
|
||||
width = 0.6,
|
||||
height = 0.6,
|
||||
wo = {
|
||||
spell = false,
|
||||
wrap = false,
|
||||
signcolumn = "yes",
|
||||
statuscolumn = " ",
|
||||
conceallevel = 3,
|
||||
},
|
||||
})
|
||||
end,
|
||||
}
|
||||
},
|
||||
init = function()
|
||||
vim.api.nvim_create_autocmd("User", {
|
||||
pattern = "VeryLazy",
|
||||
callback = function()
|
||||
-- Setup some globals for debugging (lazy-loaded)
|
||||
_G.dd = function(...)
|
||||
@@ -145,15 +149,7 @@ return {
|
||||
_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
|
||||
vim.print = _G.dd -- Override print to use snacks for `:=` command
|
||||
|
||||
-- Create some toggle mappings
|
||||
Snacks.toggle.option("spell", { name = "Spelling" }):map("<leader>us")
|
||||
@@ -161,13 +157,10 @@ return {
|
||||
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.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.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")
|
||||
@@ -175,3 +168,4 @@ return {
|
||||
})
|
||||
end,
|
||||
}
|
||||
}
|
||||
|
||||
17
nvim/.config/nvim/lua/plugins/sql.lua
Normal file
17
nvim/.config/nvim/lua/plugins/sql.lua
Normal file
@@ -0,0 +1,17 @@
|
||||
return {
|
||||
'kristijanhusak/vim-dadbod-ui',
|
||||
dependencies = {
|
||||
{ 'tpope/vim-dadbod', lazy = true },
|
||||
{ 'kristijanhusak/vim-dadbod-completion', ft = { 'sql', 'mysql', 'plsql' }, lazy = true },
|
||||
},
|
||||
cmd = {
|
||||
'DBUI',
|
||||
'DBUIToggle',
|
||||
'DBUIAddConnection',
|
||||
'DBUIFindBuffer',
|
||||
},
|
||||
init = function()
|
||||
-- Your DBUI configuration
|
||||
vim.g.db_ui_use_nerd_fonts = 1
|
||||
end,
|
||||
}
|
||||
5
nvim/.config/nvim/lua/plugins/tardis.lua
Normal file
5
nvim/.config/nvim/lua/plugins/tardis.lua
Normal file
@@ -0,0 +1,5 @@
|
||||
return {
|
||||
'fredeeb/tardis.nvim',
|
||||
dependencies = { 'nvim-lua/plenary.nvim' },
|
||||
config = true,
|
||||
}
|
||||
28
nvim/.config/nvim/lua/plugins/telescope-tabs.lua
Normal file
28
nvim/.config/nvim/lua/plugins/telescope-tabs.lua
Normal 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
|
||||
}
|
||||
71
nvim/.config/nvim/lua/plugins/telescope.lua
Normal file
71
nvim/.config/nvim/lua/plugins/telescope.lua
Normal file
@@ -0,0 +1,71 @@
|
||||
return {
|
||||
{ -- Fuzzy Finder (files, lsp, etc)
|
||||
'nvim-telescope/telescope.nvim',
|
||||
event = 'VimEnter',
|
||||
branch = '0.1.x',
|
||||
dependencies = {
|
||||
'nvim-lua/plenary.nvim',
|
||||
{ -- If encountering errors, see telescope-fzf-native README for install instructions
|
||||
'nvim-telescope/telescope-fzf-native.nvim',
|
||||
build = 'make',
|
||||
cond = function()
|
||||
return vim.fn.executable 'make' == 1
|
||||
end,
|
||||
},
|
||||
{ 'nvim-telescope/telescope-ui-select.nvim' },
|
||||
|
||||
|
||||
-- change directory with telescope from a list of directories
|
||||
{
|
||||
"SalOrak/whaler",
|
||||
opts = {
|
||||
directories = { "/home/lupan/src" },
|
||||
oneoff_directories = { "/home/lupan/dotfiles" },
|
||||
auto_file_explorer = false,
|
||||
auto_cwd = true,
|
||||
}
|
||||
},
|
||||
|
||||
-- Icons, requires Nerd font.
|
||||
{ 'nvim-tree/nvim-web-devicons' },
|
||||
|
||||
'davvid/telescope-git-grep.nvim',
|
||||
},
|
||||
config = function()
|
||||
local telescope = require 'telescope'
|
||||
-- To list available key bindings inside given telescope picker:
|
||||
-- - Insert mode: <c-/>
|
||||
-- - Normal mode: ?
|
||||
telescope.setup {
|
||||
extensions = {
|
||||
['ui-select'] = {
|
||||
require('telescope.themes').get_dropdown(),
|
||||
},
|
||||
whaler = {
|
||||
directories = { "/home/lupan/src" },
|
||||
oneoff_directories = { "/home/lupan/dotfiles" },
|
||||
auto_file_explorer = false,
|
||||
auto_cwd = true,
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
pcall(telescope.load_extension, 'fzf')
|
||||
pcall(telescope.load_extension, 'ui-select')
|
||||
pcall(telescope.load_extension, 'whaler')
|
||||
pcall(telescope.load_extension, 'git_grep')
|
||||
|
||||
-- See `:help telescope.builtin`
|
||||
local builtin = require 'telescope.builtin'
|
||||
vim.keymap.set('n', '<leader>sT', builtin.builtin, { desc = '[S]earch [S]elect Telescope' })
|
||||
vim.keymap.set('n', '<leader>sr', builtin.resume, { desc = '[S]earch [R]esume' })
|
||||
|
||||
vim.keymap.set('n', '<leader>s.', builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' })
|
||||
vim.keymap.set('n', '<leader>sL', function() telescope.extensions.whaler.whaler() end,
|
||||
{ desc = '[S]earch with wha[L]er' })
|
||||
vim.keymap.set('n', '<leader>gw', function() telescope.extensions.git_grep.grep() end,
|
||||
{ desc = '[G]it grep current [W]ord' })
|
||||
end,
|
||||
}
|
||||
|
||||
}
|
||||
25
nvim/.config/nvim/lua/plugins/tmux.lua
Normal file
25
nvim/.config/nvim/lua/plugins/tmux.lua
Normal file
@@ -0,0 +1,25 @@
|
||||
return {
|
||||
{
|
||||
'aserowy/tmux.nvim',
|
||||
opts = {
|
||||
navigation = {
|
||||
enable_default_keybindings = false,
|
||||
},
|
||||
resize = {
|
||||
enable_default_keybindings = false,
|
||||
},
|
||||
},
|
||||
keys = {
|
||||
{ '<M-h>', [[<cmd>lua require("tmux").move_left()<cr>]] },
|
||||
{ '<M-j>', [[<cmd>lua require("tmux").move_bottom()<cr>]] },
|
||||
{ '<M-k>', [[<cmd>lua require("tmux").move_top()<cr>]] },
|
||||
{ '<M-l>', [[<cmd>lua require("tmux").move_right()<cr>]] },
|
||||
{ '<M-n>', [[<cmd>lua require("tmux").next_window()<cr>]] },
|
||||
{ '<M-p>', [[<cmd>lua require("tmux").previous_window()<cr>]] },
|
||||
{ '<M-H>', [[<cmd>lua require("tmux").resize_left()<cr>]] },
|
||||
{ '<M-J>', [[<cmd>lua require("tmux").resize_bottom()<cr>]] },
|
||||
{ '<M-K>', [[<cmd>lua require("tmux").resize_top()<cr>]] },
|
||||
{ '<M-L>', [[<cmd>lua require("tmux").resize_right()<cr>]] },
|
||||
},
|
||||
},
|
||||
}
|
||||
9
nvim/.config/nvim/lua/plugins/toggleterm.lua
Normal file
9
nvim/.config/nvim/lua/plugins/toggleterm.lua
Normal file
@@ -0,0 +1,9 @@
|
||||
return {
|
||||
'akinsho/toggleterm.nvim',
|
||||
version = '*',
|
||||
config = true,
|
||||
keys = {
|
||||
{ '<F2>', '<cmd>ToggleTerm size=25<CR>', mode = { 'n', 'i', 't', }, },
|
||||
{ '<C-w>', [[<C-\><C-n><C-w>]], mode = 't' },
|
||||
}
|
||||
}
|
||||
@@ -1,62 +1,95 @@
|
||||
return {
|
||||
main = "nvim-treesitter.configs",
|
||||
opts = {
|
||||
|
||||
{ -- Highlight, edit, and navigate code
|
||||
'nvim-treesitter/nvim-treesitter',
|
||||
dependencies = {
|
||||
'nvim-treesitter/nvim-treesitter-textobjects',
|
||||
'nvim-orgmode/orgmode', -- as configured together
|
||||
'vrischmann/tree-sitter-templ',
|
||||
"nushell/tree-sitter-nu", -- additional parser
|
||||
},
|
||||
build = ':TSUpdate',
|
||||
config = function()
|
||||
-- See `:help nvim-treesitter`
|
||||
local org = require('orgmode')
|
||||
|
||||
---@diagnostic disable-next-line: missing-fields
|
||||
require('nvim-treesitter.configs').setup {
|
||||
ensure_installed = { 'c', 'commonlisp', 'cpp', 'go', 'haskell', 'lua', '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",
|
||||
["ad"] = "@conditional.outer",
|
||||
["id"] = "@conditional.inner",
|
||||
["ar"] = "@return.outer",
|
||||
["ir"] = "@return.inner",
|
||||
["as"] = "@statement.outer",
|
||||
["ag"] = "@assignment.outer",
|
||||
["ig"] = "@assignment.inner",
|
||||
['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",
|
||||
[']m'] = '@function.outer',
|
||||
[']]'] = '@class.outer',
|
||||
},
|
||||
goto_next_end = {
|
||||
["]M"] = "@function.outer",
|
||||
["]["] = "@class.outer",
|
||||
[']M'] = '@function.outer',
|
||||
[']['] = '@class.outer',
|
||||
},
|
||||
goto_previous_start = {
|
||||
["[m"] = "@function.outer",
|
||||
["[["] = "@class.outer",
|
||||
['[m'] = '@function.outer',
|
||||
['[['] = '@class.outer',
|
||||
},
|
||||
goto_previous_end = {
|
||||
["[M"] = "@function.outer",
|
||||
["[]"] = "@class.outer",
|
||||
['[M'] = '@function.outer',
|
||||
['[]'] = '@class.outer',
|
||||
},
|
||||
},
|
||||
swap = {
|
||||
enable = true,
|
||||
swap_next = {
|
||||
["<leader>p"] = "@parameter.inner",
|
||||
['<leader>a'] = '@parameter.inner',
|
||||
},
|
||||
swap_previous = {
|
||||
["<leader>P"] = "@parameter.inner",
|
||||
},
|
||||
['<leader>A'] = '@parameter.inner',
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
org.setup({
|
||||
org_agenda_files = { '~/org/*.org' },
|
||||
org_default_notes_file = '~/org/capture.org',
|
||||
})
|
||||
end,
|
||||
}
|
||||
}
|
||||
|
||||
12
nvim/.config/nvim/lua/plugins/yankbank.lua
Normal file
12
nvim/.config/nvim/lua/plugins/yankbank.lua
Normal file
@@ -0,0 +1,12 @@
|
||||
return {
|
||||
"ptdewey/yankbank-nvim",
|
||||
dependencies = "kkharji/sqlite.lua",
|
||||
config = function()
|
||||
require('yankbank').setup({
|
||||
persist_type = "sqlite",
|
||||
})
|
||||
end,
|
||||
keys = {
|
||||
{ "<leader>yb", "<cmd>YankBank<CR>", desc = "Yank[B]ank" },
|
||||
},
|
||||
}
|
||||
3
nvim/.config/nvim/snippets/go/snippets.lua
Normal file
3
nvim/.config/nvim/snippets/go/snippets.lua
Normal file
@@ -0,0 +1,3 @@
|
||||
return {
|
||||
s("tr", { t "i18n.T(ctx, \"", i(1), t "\")" })
|
||||
}
|
||||
3
nvim/.config/nvim/snippets/lua/snippets.lua
Normal file
3
nvim/.config/nvim/snippets/lua/snippets.lua
Normal file
@@ -0,0 +1,3 @@
|
||||
return {
|
||||
s("ct", t "-- TODO: ")
|
||||
}
|
||||
@@ -1,22 +1,13 @@
|
||||
alias v=nvim
|
||||
alias ll='ls -l'
|
||||
alias ta='tmux attach -t'
|
||||
alias tl='tmux list-sessions'
|
||||
alias tn='tmux new -s'
|
||||
alias fv='fzf --preview="bat --color=always --theme=Nord {}" --bind="enter:become(nvim {})"'
|
||||
alias rgh='rg -.'
|
||||
alias fdh='fd -H'
|
||||
alias lg=lazygit
|
||||
|
||||
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
|
||||
@@ -24,41 +15,10 @@ 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)
|
||||
if [ -z "$1" ]; then
|
||||
vis $(fzf)
|
||||
else
|
||||
vis $(fzf -q $1)
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
[ -e ~/.profile ] && . ~/.profile
|
||||
@@ -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)"
|
||||
@@ -8,8 +8,6 @@
|
||||
# for ssh logins, install and configure the libpam-umask package.
|
||||
#umask 022
|
||||
|
||||
export LANG=pl_PL.UTF-8
|
||||
|
||||
export EDITOR=vis
|
||||
export VISUAL=vis
|
||||
|
||||
@@ -30,14 +28,12 @@ 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
|
||||
if [[ -z "$DISPLAY" && -z "$WAYLAND_DISPLAY" && "$XDG_VTNR" -eq 1 ]]; then
|
||||
if which Hyprland > /dev/null && [ -d ~/.config/hypr ]; then
|
||||
exec Hyprland
|
||||
elif which river > /dev/null && [ -d ~/.config/river ]; then
|
||||
exec river
|
||||
elif which /usr/bin/sx > /dev/null; then
|
||||
exec /usr/bin/sx ~/.xsession
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -33,23 +33,55 @@ bind-key Left resize-pane -L 8
|
||||
bind-key Up resize-pane -U 4
|
||||
bind-key Down resize-pane -D 4
|
||||
|
||||
set -g default-terminal "xterm-256color"
|
||||
set -g default-terminal "screen-256color"
|
||||
set -as terminal-features ",*:RGB"
|
||||
|
||||
set -g base-index 1
|
||||
setw -g base-index 1
|
||||
|
||||
set -g set-titles on
|
||||
set -g set-titles-string "#H [#S] #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 " #[fg=green]#[bg=green]#[fg=black] #H #[bg=default]#[fg=green]#[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 "#[fg=green]#[bg=green]#[fg=black] %H:%M #[bg=default]#[fg=green] "
|
||||
set-window-option -g window-status-current-format '#[fg=green]#[bg=green]#[fg=black] #I:#W#F #[fg=green]#[bg=black]'
|
||||
|
||||
is_vim="ps -o state= -o comm= -t '#{pane_tty}' | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?\.?(view|n?vim?x?)(-wrapped)?(diff)?$'"
|
||||
|
||||
bind-key -n 'M-h' if-shell "$is_vim" 'send-keys M-h' 'select-pane -L'
|
||||
bind-key -n 'M-j' if-shell "$is_vim" 'send-keys M-j' 'select-pane -D'
|
||||
bind-key -n 'M-k' if-shell "$is_vim" 'send-keys M-k' 'select-pane -U'
|
||||
bind-key -n 'M-l' if-shell "$is_vim" 'send-keys M-l' 'select-pane -R'
|
||||
bind-key -n 'M-n' if-shell "$is_vim" 'send-keys M-n' 'select-window -n'
|
||||
bind-key -n 'M-p' if-shell "$is_vim" 'send-keys M-p' 'select-window -p'
|
||||
|
||||
bind-key -T copy-mode-vi 'M-h' select-pane -L
|
||||
bind-key -T copy-mode-vi 'M-j' select-pane -D
|
||||
bind-key -T copy-mode-vi 'M-k' select-pane -U
|
||||
bind-key -T copy-mode-vi 'M-l' select-pane -R
|
||||
bind-key -T copy-mode-vi 'M-n' select-window -n
|
||||
bind-key -T copy-mode-vi 'M-p' select-window -p
|
||||
|
||||
bind -n 'M-H' if-shell "$is_vim" 'send-keys M-H' 'resize-pane -L 1'
|
||||
bind -n 'M-J' if-shell "$is_vim" 'send-keys M-J' 'resize-pane -D 1'
|
||||
bind -n 'M-K' if-shell "$is_vim" 'send-keys M-K' 'resize-pane -U 1'
|
||||
bind -n 'M-L' if-shell "$is_vim" 'send-keys M-L' 'resize-pane -R 1'
|
||||
|
||||
bind-key -T copy-mode-vi M-H resize-pane -L 1
|
||||
bind-key -T copy-mode-vi M-J resize-pane -D 1
|
||||
bind-key -T copy-mode-vi M-K resize-pane -U 1
|
||||
bind-key -T copy-mode-vi M-L resize-pane -R 1
|
||||
|
||||
bind -n 'C-M-h' if-shell "$is_vim" 'send-keys C-M-h' 'swap-pane -s "{left-of}"'
|
||||
bind -n 'C-M-j' if-shell "$is_vim" 'send-keys C-M-j' 'swap-pane -s "{down-of}"'
|
||||
bind -n 'C-M-k' if-shell "$is_vim" 'send-keys C-M-k' 'swap-pane -s "{up-of}"'
|
||||
bind -n 'C-M-l' if-shell "$is_vim" 'send-keys C-M-l' 'swap-pane -s "{right-of}"'
|
||||
|
||||
bind-key -T copy-mode-vi C-M-h swap-pane -s "{left-of}"
|
||||
bind-key -T copy-mode-vi C-M-j swap-pane -s "{down-of}"
|
||||
bind-key -T copy-mode-vi C-M-k swap-pane -s "{up-of}"
|
||||
bind-key -T copy-mode-vi C-M-l swap-pane -s "{right-of}"
|
||||
|
||||
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
|
||||
|
||||
@@ -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)
|
||||
@@ -18,7 +18,6 @@ if [ "$1" = list ]; then
|
||||
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
|
||||
@@ -29,9 +28,6 @@ if [ "$1" = list ]; then
|
||||
files+hidden)
|
||||
exec fd --type f -H '' $dir
|
||||
;;
|
||||
find-files*)
|
||||
exec find $dir -type f
|
||||
;;
|
||||
search)
|
||||
exec $ripgrep "$FZF_QUERY" $dir
|
||||
;;
|
||||
@@ -120,9 +116,6 @@ if [ "$1" = key ]; then
|
||||
;;
|
||||
alt-f)
|
||||
case "$cmd" in
|
||||
files)
|
||||
prompt="find-files$hidden"
|
||||
;;
|
||||
*files|search)
|
||||
prompt="files$hidden"
|
||||
;;
|
||||
@@ -227,7 +220,7 @@ auto-search)
|
||||
action="$no_search"
|
||||
prompt="$cmd> "
|
||||
;;
|
||||
files|git-files|jj-files|find-files)
|
||||
files|git-files|jj-files)
|
||||
cmd="$1"
|
||||
action="$search"
|
||||
prompt="$1> "
|
||||
@@ -270,9 +263,7 @@ fi
|
||||
exec fzf --query "$3" \
|
||||
--prompt "$prompt" \
|
||||
--header-label "$label" \
|
||||
--multi \
|
||||
--ansi \
|
||||
--scheme path \
|
||||
--delimiter : \
|
||||
--ghost ' (Use alt-? for help)' \
|
||||
--bind "enter:transform($accept)" \
|
||||
@@ -287,5 +278,4 @@ exec fzf --query "$3" \
|
||||
--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"
|
||||
--bind "alt-?:change-preview(echo '$HELP')+show-preview"
|
||||
|
||||
2
vis/.config/vis/global-marks.txt
Normal file
2
vis/.config/vis/global-marks.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
/home/lupan/dotfiles/Makefile:23:22: (PREFIX): make -C dwm install PREFIX="${HOME}/.local"
|
||||
/home/lupan/dotfiles/Makefile:41:15: (clock): install-lupan-clock:
|
||||
@@ -1,31 +0,0 @@
|
||||
-- Copyright 2006-2025 Mitchell. See LICENSE.
|
||||
-- go with SQL LPeg lexer.
|
||||
|
||||
local lexer = lexer
|
||||
local starts_line = lexer.starts_line
|
||||
local B, P, S = lpeg.B, lpeg.P, lpeg.S
|
||||
|
||||
local lex = lexer.new(..., {inherit = lexer.load('go')})
|
||||
|
||||
local open_brace = lex:tag(lexer.OPERATOR, P('{'))
|
||||
local close_brace = lex:tag(lexer.OPERATOR, P('}'))
|
||||
local backtick = lex:tag(lexer.CODE, P('`'))
|
||||
local ws = lex:get_rule('whitespace')
|
||||
|
||||
local tpl = lexer.new("template")
|
||||
tpl:add_rule('keyword', lex:tag(lexer.KEYWORD, lexer.word_match('if else end with range break define continue template block')))
|
||||
tpl:add_rule('constant', lex:get_rule('constant'))
|
||||
tpl:add_rule('operator', lex:get_rule('operator') + lex:tag(lexer.OPERATOR, S('$')))
|
||||
local func = lexer.after_set(' \t\n{|', lexer.word)
|
||||
tpl:add_rule('function', lex:tag(lexer.FUNCTION, func))
|
||||
tpl:add_rule('identifier', lex:get_rule('identifier'))
|
||||
tpl:add_rule('string', lex:get_rule('string'))
|
||||
tpl:add_rule('number', lex:get_rule('number'))
|
||||
|
||||
local sql = lexer.load('sql')
|
||||
local sql_kwd = lexer.word_match('ALTER CREATE DELETE DROP GRANT INSERT SELECT UPDATE WITH')
|
||||
sql:embed(tpl, open_brace * open_brace, close_brace * close_brace)
|
||||
|
||||
lex:embed(sql, backtick * #(ws^0 * sql_kwd), backtick)
|
||||
|
||||
return lex
|
||||
@@ -1,87 +0,0 @@
|
||||
-- Copyright 2006-2024 Mitchell. See LICENSE.
|
||||
-- Odin LPeg lexer.
|
||||
|
||||
local lexer = lexer
|
||||
local P, S = lpeg.P, lpeg.S
|
||||
|
||||
local lex = lexer.new(...)
|
||||
|
||||
-- Keywords.
|
||||
lex:add_rule('keyword', lex:tag(lexer.KEYWORD, lex:word_match(lexer.KEYWORD)))
|
||||
|
||||
-- Constants.
|
||||
lex:add_rule('constant', lex:tag(lexer.CONSTANT_BUILTIN, lex:word_match(lexer.CONSTANT_BUILTIN)))
|
||||
|
||||
-- Types.
|
||||
lex:add_rule('type', lex:tag(lexer.TYPE, lex:word_match(lexer.TYPE)))
|
||||
|
||||
-- Functions.
|
||||
local builtin_proc = -lpeg.B('.') *
|
||||
lex:tag(lexer.FUNCTION_BUILTIN, lex:word_match(lexer.FUNCTION_BUILTIN))
|
||||
local proc = lex:tag(lexer.FUNCTION, lexer.word)
|
||||
lex:add_rule('function', (builtin_proc + proc) * #(lexer.space^0 * '(') +
|
||||
proc * #(lexer.space^0 * '::' * lexer.space^0 * "proc"))
|
||||
|
||||
-- Identifiers.
|
||||
lex:add_rule('identifier', lex:tag(lexer.IDENTIFIER, lexer.word))
|
||||
|
||||
-- Strings.
|
||||
local sq_str = lexer.range("'", true)
|
||||
local dq_str = lexer.range('"', true)
|
||||
local raw_str = lexer.range('`', false, false)
|
||||
lex:add_rule('string', lex:tag(lexer.STRING, sq_str + dq_str + raw_str))
|
||||
|
||||
-- Comments.
|
||||
local line_comment = lexer.to_eol('//')
|
||||
local block_comment = lexer.range('/*', '*/')
|
||||
lex:add_rule('comment', lex:tag(lexer.COMMENT, line_comment + block_comment))
|
||||
|
||||
-- Numbers.
|
||||
lex:add_rule('number', lex:tag(lexer.NUMBER, lexer.number * P('i')^-1))
|
||||
|
||||
-- Operators.
|
||||
lex:add_rule('operator', lex:tag(lexer.OPERATOR,
|
||||
P('%%=') + P('&~=') + P('<<=') + P('>>=') + P('&&=') + P('||=') + P('---') + P('..=') +
|
||||
P('..<') + P('%%') + P('&~') + P('<<') + P('>>') + P('&&') + P('||') + P('+=') + P('-=') +
|
||||
P('*=') + P('/=') + P('%=') + P('&=') + P('|=') + P('~=') + P('++') + P('--') + P('->') +
|
||||
P('==') + P('!=') + P('<=') + P('>=') + P('..') + S('=!#@$^?+-*/%&|~<>()[]{}:;.,')))
|
||||
|
||||
-- Fold points.
|
||||
lex:add_fold_point(lexer.OPERATOR, '{', '}')
|
||||
lex:add_fold_point(lexer.COMMENT, '/*', '*/')
|
||||
|
||||
-- Word lists.
|
||||
lex:set_word_list(lexer.KEYWORD, {
|
||||
'import', 'foreign', 'package', 'typeid', 'when', 'where', 'if', 'else', 'for', 'switch', 'in',
|
||||
'not_in', 'do', 'case', 'break', 'continue', 'fallthrough', 'defer', 'return', 'proc', 'struct',
|
||||
'union', 'enum', 'bit_set', 'bit_field', 'map', 'dynamic', 'auto_cast', 'cast', 'transmute',
|
||||
'distinct', 'using', 'context', 'or_else', 'or_return', 'or_break', 'or_continue', 'asm', 'matrix'
|
||||
})
|
||||
|
||||
lex:set_word_list(lexer.CONSTANT_BUILTIN, {
|
||||
'ODIN_ARCH', 'ODIN_BUILD_MODE', 'ODIN_COMPILE_TIMESTAMP', 'ODIN_DEBUG',
|
||||
'ODIN_DEFAULT_TO_NIL_ALLOCATOR', 'ODIN_DEFAULT_TO_PANIC_ALLOCATOR', 'ODIN_DISABLE_ASSERT',
|
||||
'ODIN_ENDIAN', 'ODIN_ERROR_POS_STYLE', 'ODIN_NO_CRT', 'ODIN_NO_ENTRY_POINT', 'ODIN_NO_RTTI',
|
||||
'ODIN_OS', 'ODIN_PLATFORM_SUBTARGET', 'ODIN_ROOT', 'ODIN_VENDOR', 'ODIN_VERSION',
|
||||
'ODIN_WINDOWS_SUBSYSTEM', 'false', 'nil', 'true'
|
||||
})
|
||||
|
||||
lex:set_word_list(lexer.TYPE, {
|
||||
'b16', 'b32', 'b64', 'b8', 'bool', 'byte', 'complex128', 'complex32', 'complex64', 'cstring',
|
||||
'cstring16', 'f16', 'f16be', 'f16le', 'f32', 'f32be', 'f32le', 'f64', 'f64be', 'f64le', 'i128',
|
||||
'i128be', 'i128le', 'i16', 'i16be', 'i16le', 'i32', 'i32be', 'i32le', 'i64', 'i64be', 'i64le',
|
||||
'i8', 'int', 'quaternion128', 'quaternion256', 'quaternion64', 'rawptr', 'rune', 'string',
|
||||
'string16', 'typeid', 'u128', 'u128be', 'u128le', 'u16', 'u16be', 'u16le', 'u32', 'u32be',
|
||||
'u32le', 'u64', 'u64be', 'u64le', 'u8', 'uint', 'uintptr', 'Maybe', 'Objc_Block'
|
||||
})
|
||||
|
||||
lex:set_word_list(lexer.FUNCTION_BUILTIN, {
|
||||
'abs', 'align_of', 'cap', 'clamp', 'complex', 'compress_values', 'conj', 'expand_values', 'imag',
|
||||
'jmag', 'kmag', 'len', 'max', 'min', 'offset_of', 'offset_of_by_string', 'offset_of_member',
|
||||
'offset_of_selector', 'quaternion', 'raw_data', 'real', 'size_of', 'soa_unzip', 'soa_zip',
|
||||
'swizzle', 'type_info_of', 'type_of', 'typeid_of'
|
||||
})
|
||||
|
||||
lexer.property['scintillua.comment'] = '//'
|
||||
|
||||
return lex
|
||||
@@ -1,65 +1,71 @@
|
||||
-- Copyright 2006-2025 Mitchell. See LICENSE.
|
||||
-- templ LPeg lexer.
|
||||
-- Go LPeg lexer.
|
||||
|
||||
local lexer = lexer
|
||||
local starts_line = lexer.starts_line
|
||||
local P, S = lpeg.P, lpeg.S
|
||||
|
||||
local lex = lexer.new(..., {inherit = lexer.load('go')})
|
||||
local lex = lexer.new(...)
|
||||
|
||||
local close_paren = lex:tag(lexer.OPERATOR, P(')'))
|
||||
local open_brace = lex:tag(lexer.OPERATOR, P('{'))
|
||||
local close_brace = lex:tag(lexer.OPERATOR, P('}'))
|
||||
local colon = lex:tag(lexer.OPERATOR, P(':'))
|
||||
local at = lex:tag(lexer.OPERATOR, P('@'))
|
||||
local ws = lex:get_rule('whitespace')
|
||||
local ident = lex:get_rule('identifier')
|
||||
-- Keywords.
|
||||
lex:add_rule('keyword', lex:tag(lexer.KEYWORD, lex:word_match(lexer.KEYWORD)))
|
||||
|
||||
local html = lexer.load('html')
|
||||
local go_expr = lexer.load('go', 'go.expr')
|
||||
local go_stmt1 = lexer.load('go', 'go.stmt1')
|
||||
local go_stmt2 = lexer.load('go', 'go.stmt2')
|
||||
local go_stmt3 = lexer.load('go', 'go.stmt3')
|
||||
local for_ = lex:tag(lexer.KEYWORD, lexer.word_match('for if switch'))
|
||||
local else_ = close_brace * ws^0 * lex:tag(lexer.KEYWORD, P('else'))
|
||||
local case_ = lex:tag(lexer.KEYWORD, lexer.word_match('case default'))
|
||||
html:embed(go_expr, open_brace, close_brace * close_brace^-1)
|
||||
html:embed(go_stmt1, starts_line(for_ + else_, true), open_brace * #lexer.newline)
|
||||
html:embed(go_stmt2, starts_line(case_, true), colon * #lexer.newline)
|
||||
html:embed(go_stmt3, starts_line(at, true), (ident + open_brace + close_paren) * #lexer.newline)
|
||||
-- Constants.
|
||||
lex:add_rule('constant', lex:tag(lexer.CONSTANT_BUILTIN, lex:word_match(lexer.CONSTANT_BUILTIN)))
|
||||
|
||||
local func_block_start = close_paren * ws^0 * open_brace
|
||||
-- Types.
|
||||
lex:add_rule('type', lex:tag(lexer.TYPE, lex:word_match(lexer.TYPE)))
|
||||
|
||||
lex:set_word_list(lexer.KEYWORD, 'templ css script', true)
|
||||
-- Functions.
|
||||
local builtin_func = -lpeg.B('.') *
|
||||
lex:tag(lexer.FUNCTION_BUILTIN, lex:word_match(lexer.FUNCTION_BUILTIN))
|
||||
local func = lex:tag(lexer.FUNCTION, lexer.word)
|
||||
local method = lpeg.B('.') * lex:tag(lexer.FUNCTION_METHOD, lexer.word)
|
||||
lex:add_rule('function', (builtin_func + method + func) * #(lexer.space^0 * '('))
|
||||
|
||||
local function starts_with(keyword)
|
||||
local prefix = '\n' .. keyword .. '%s'
|
||||
return function(input, index)
|
||||
local i = index - 1024
|
||||
if i < 1 then
|
||||
i = 1
|
||||
end
|
||||
local s = input:sub(i, index)
|
||||
local k = 0
|
||||
repeat
|
||||
i = s:find('\n%w', i)
|
||||
if i then
|
||||
k = i
|
||||
i = i + 2
|
||||
end
|
||||
until not i
|
||||
return k > 0 and s:find(prefix, k) and true
|
||||
end
|
||||
end
|
||||
-- Identifiers.
|
||||
lex:add_rule('identifier', lex:tag(lexer.IDENTIFIER, lexer.word))
|
||||
|
||||
lex:embed(html, func_block_start * P(starts_with("templ")), starts_line(close_brace))
|
||||
-- Strings.
|
||||
local sq_str = lexer.range("'", true)
|
||||
local dq_str = lexer.range('"', true)
|
||||
local raw_str = lexer.range('`', false, false)
|
||||
lex:add_rule('string', lex:tag(lexer.STRING, sq_str + dq_str + raw_str))
|
||||
|
||||
local css = lexer.load('css')
|
||||
local css_go_expr = lexer.load('go', 'go.expr2')
|
||||
css:embed(css_go_expr, open_brace, close_brace)
|
||||
lex:embed(css, func_block_start * P(starts_with("css")), starts_line(close_brace))
|
||||
-- Comments.
|
||||
local line_comment = lexer.to_eol('//')
|
||||
local block_comment = lexer.range('/*', '*/')
|
||||
lex:add_rule('comment', lex:tag(lexer.COMMENT, line_comment + block_comment))
|
||||
|
||||
local js = lexer.load('javascript')
|
||||
lex:embed(js, func_block_start * P(starts_with("script")), starts_line(close_brace))
|
||||
-- Numbers.
|
||||
lex:add_rule('number', lex:tag(lexer.NUMBER, lexer.number * P('i')^-1))
|
||||
|
||||
-- Operators.
|
||||
lex:add_rule('operator', lex:tag(lexer.OPERATOR, S('+-*/%&|^<>=!~:;.,()[]{}@')))
|
||||
|
||||
-- Fold points.
|
||||
lex:add_fold_point(lexer.OPERATOR, '{', '}')
|
||||
lex:add_fold_point(lexer.COMMENT, '/*', '*/')
|
||||
|
||||
-- Word lists.
|
||||
lex:set_word_list(lexer.KEYWORD, {
|
||||
'break', 'case', 'chan', 'const', 'continue', 'default', 'defer', 'else', 'fallthrough', 'for',
|
||||
'func', 'go', 'goto', 'if', 'import', 'interface', 'map', 'package', 'range', 'return', 'select',
|
||||
'struct', 'switch', 'type', 'var', 'templ'
|
||||
})
|
||||
|
||||
lex:set_word_list(lexer.CONSTANT_BUILTIN, 'true false iota nil')
|
||||
|
||||
lex:set_word_list(lexer.TYPE, {
|
||||
'any', 'bool', 'byte', 'comparable', 'complex64', 'complex128', 'error', 'float32', 'float64',
|
||||
'int', 'int8', 'int16', 'int32', 'int64', 'rune', 'string', 'uint', 'uint8', 'uint16', 'uint32',
|
||||
'uint64', 'uintptr'
|
||||
})
|
||||
|
||||
lex:set_word_list(lexer.FUNCTION_BUILTIN, {
|
||||
'append', 'cap', 'close', 'complex', 'copy', 'delete', 'imag', 'len', 'make', 'new', 'panic',
|
||||
'print', 'println', 'real', 'recover'
|
||||
})
|
||||
|
||||
lexer.property['scintillua.comment'] = '//'
|
||||
|
||||
return lex
|
||||
|
||||
@@ -1,64 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ $# -eq 0 ]; then
|
||||
echo 'error: argument required (action), one of: clone, fetch, merge' >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
ACTION="$1"
|
||||
PLUGINS_DIR=$(dirname $(realpath "$0"))/plugins
|
||||
|
||||
cd "$PLUGINS_DIR"
|
||||
|
||||
action() {
|
||||
case "$1" in
|
||||
*:*)
|
||||
P="$1"
|
||||
|
||||
;;
|
||||
*)
|
||||
P="https://github.com/$1"
|
||||
;;
|
||||
esac
|
||||
B=$(basename "$1")
|
||||
B="${B%.git}"
|
||||
case "$ACTION" in
|
||||
clone)
|
||||
if [ ! -e "$B" ]; then
|
||||
echo "$ACTION $B"
|
||||
git clone "$P"
|
||||
fi
|
||||
;;
|
||||
fetch)
|
||||
if [ -e "$B" ]; then
|
||||
echo "$ACTION $B"
|
||||
git -C "$B" fetch
|
||||
fi
|
||||
;;
|
||||
merge)
|
||||
if [ -e "$B" ]; then
|
||||
echo "$ACTION $B"
|
||||
git -C "$B" merge
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
echo "error: unsupported action: $ACTION" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
for plugin in \
|
||||
'https://gitlab.com/muhq/vis-lspc' \
|
||||
'lutobler/vis-commentary' \
|
||||
'https://repo.or.cz/vis-surround.git' \
|
||||
'peaceant/vis-fzf-mru' \
|
||||
'https://gitlab.com/muhq/vis-build' \
|
||||
'erf/vis-cursors' \
|
||||
'thimc/vis-colorizer' \
|
||||
'https://repo.or.cz/vis-quickfix.git' \
|
||||
'https://repo.or.cz/vis-pairs.git' \
|
||||
'https://gitea.lupan.pl/lupan/vis-pin-files.git'; \
|
||||
do
|
||||
action "$plugin"
|
||||
done
|
||||
@@ -31,8 +31,8 @@ lexers.STYLE_CURSOR_PRIMARY = lexers.STYLE_CURSOR..',fore:#e6fefe'
|
||||
lexers.STYLE_CURSOR_LINE = 'underlined'
|
||||
lexers.STYLE_COLOR_COLUMN = 'back:red'
|
||||
lexers.STYLE_SELECTION = 'back:#4d5580,bold'
|
||||
lexers.STYLE_STATUS = 'back:#1c3b4a,fore:#73848c'
|
||||
lexers.STYLE_STATUS_FOCUSED = 'back:#1c3b4a,fore:#abb5ba,bold'
|
||||
lexers.STYLE_STATUS = 'reverse'
|
||||
lexers.STYLE_STATUS_FOCUSED = 'reverse,bold'
|
||||
lexers.STYLE_SEPARATOR = lexers.STYLE_DEFAULT
|
||||
lexers.STYLE_INFO = 'bold'
|
||||
lexers.STYLE_EOF = ''
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
-- Eight-color scheme
|
||||
local lexers = vis.lexers
|
||||
lexers.STYLE_DEFAULT ='back:#f2f2f3,#e0e5eb,fore:#1f212e'
|
||||
lexers.STYLE_DEFAULT ='back:#dbdff0,fore:#1f212e'
|
||||
lexers.STYLE_NOTHING = ''
|
||||
lexers.STYLE_ATTRIBUTE = 'fore:#a1a3aa,bold'
|
||||
lexers.STYLE_CLASS = 'fore:yellow,bold'
|
||||
@@ -21,7 +21,7 @@ lexers.STYLE_TAG = 'fore:#705943,bold'
|
||||
lexers.STYLE_TYPE = 'fore:#7461d1,bold'
|
||||
lexers.STYLE_VARIABLE = 'fore:#8c5eba,bold'
|
||||
lexers.STYLE_WHITESPACE = ''
|
||||
lexers.STYLE_EMBEDDED = 'back:#e0e5eb,bold'
|
||||
lexers.STYLE_EMBEDDED = 'back:#2d3353,bold'
|
||||
lexers.STYLE_IDENTIFIER = ''
|
||||
|
||||
lexers.STYLE_LINENUMBER = ''
|
||||
@@ -30,7 +30,7 @@ lexers.STYLE_CURSOR = 'back:#bf8040,fore:#1f212e'
|
||||
lexers.STYLE_CURSOR_PRIMARY = lexers.STYLE_CURSOR..',fore:#e6fefe'
|
||||
lexers.STYLE_CURSOR_LINE = 'underlined'
|
||||
lexers.STYLE_COLOR_COLUMN = 'back:red'
|
||||
lexers.STYLE_SELECTION = 'back:#a6c7f2,bold'
|
||||
lexers.STYLE_SELECTION = 'back:#a1a3aa,bold'
|
||||
lexers.STYLE_STATUS = 'reverse'
|
||||
lexers.STYLE_STATUS_FOCUSED = 'reverse,bold'
|
||||
lexers.STYLE_SEPARATOR = lexers.STYLE_DEFAULT
|
||||
|
||||
@@ -1,45 +1,39 @@
|
||||
require('vis')
|
||||
require('fast-jump')
|
||||
|
||||
local lspc = require('plugins/vis-lspc')
|
||||
require('plugins/vis-commentary')
|
||||
require('plugins/vis-surround')
|
||||
local fzfmru = require('plugins/vis-fzf-mru/fzf-mru')
|
||||
require('plugins/vis-build')
|
||||
require('plugins/vis-cursors')
|
||||
require('plugins/vis-colorizer')
|
||||
local qf = require('plugins/vis-quickfix')
|
||||
local pairs = require('plugins/vis-pairs')
|
||||
local plug = (function()
|
||||
if not pcall(require, 'plugins/vis-plug') then
|
||||
os.execute('git clone --quiet https://github.com/erf/vis-plug ' ..
|
||||
(os.getenv('XDG_CONFIG_HOME') or os.getenv('HOME') .. '/.config')
|
||||
.. '/vis/plugins/vis-plug')
|
||||
end
|
||||
return require('plugins/vis-plug')
|
||||
end)()
|
||||
|
||||
require('plugins/vis-pin-files')
|
||||
plug = require('plugins/vis-plug')
|
||||
|
||||
pairs.autopairs = false
|
||||
local plugins = {
|
||||
{ 'https://gitlab.com/muhq/vis-lspc', alias = 'lspc' },
|
||||
{ 'lutobler/vis-commentary' },
|
||||
{ 'https://repo.or.cz/vis-surround.git' },
|
||||
{ 'peaceant/vis-fzf-mru', file = 'fzf-mru', alias = 'fzfmru' },
|
||||
{ 'https://gitlab.com/muhq/vis-build' },
|
||||
{ 'erf/vis-cursors' },
|
||||
}
|
||||
|
||||
vis.ftdetect.filetypes.go_ext = vis.ftdetect.filetypes.go
|
||||
vis.ftdetect.filetypes.go = nil
|
||||
lspc.ls_map.go_ext = lspc.ls_map.go
|
||||
plug.init(plugins, true)
|
||||
|
||||
vis.ftdetect.filetypes.templ = {
|
||||
ext = { "%.templ$" },
|
||||
}
|
||||
|
||||
vis.ftdetect.filetypes.odin = {
|
||||
ext = { "%.odin$" },
|
||||
}
|
||||
plug.plugins.lspc.message_level = 2
|
||||
|
||||
lspc.message_level = 2
|
||||
|
||||
lspc.ls_map.templ = {
|
||||
plug.plugins.lspc.ls_map.templ = {
|
||||
name = 'templ-lsp',
|
||||
cmd = 'templ lsp',
|
||||
}
|
||||
|
||||
lspc.ls_map.odin = {
|
||||
name = 'ols',
|
||||
cmd = 'ols',
|
||||
}
|
||||
|
||||
fzfmru.fzfmru_history = 60
|
||||
plug.plugins.fzfmru.fzfmru_history = 60
|
||||
|
||||
local function open_file(file, cmd)
|
||||
vis:command((cmd or 'o') .. ' ' .. file)
|
||||
@@ -50,16 +44,10 @@ local function nil_or_tonumber(s)
|
||||
end
|
||||
|
||||
local function open_file_pos(line, open_cmd)
|
||||
local iter = line:gmatch('[^:]+')
|
||||
local iter = string.gmatch(line, '[^:]+')
|
||||
local file = iter()
|
||||
local ln = iter()
|
||||
local line_num = nil_or_tonumber(iter())
|
||||
local col = nil_or_tonumber(iter()) or 1
|
||||
local i = ln and ln:find(' ')
|
||||
if i then
|
||||
ln = ln:sub(0, i)
|
||||
col = 1
|
||||
end
|
||||
local line_num = nil_or_tonumber(ln)
|
||||
if open_cmd ~= 'e' or vis.win.file ~= file then
|
||||
open_file(file, open_cmd)
|
||||
end
|
||||
@@ -68,17 +56,14 @@ local function open_file_pos(line, open_cmd)
|
||||
end
|
||||
end
|
||||
|
||||
local function open_file_current_line(open_cmd, keys)
|
||||
local function open_file_current_line(open_cmd)
|
||||
local line = vis.win.file.lines[vis.win.selection.line]
|
||||
vis:info(line)
|
||||
if keys then
|
||||
vis:feedkeys(keys)
|
||||
end
|
||||
open_file_pos(line, open_cmd)
|
||||
open_file_pos(line)
|
||||
end
|
||||
|
||||
local function escape_and_quoted(s)
|
||||
return "'" .. s:gsub("'", [['"'"']]) .. "'"
|
||||
return "'" .. s:gsub("'", "\\'") .. "'"
|
||||
end
|
||||
|
||||
local function cmd_action(cmd, action)
|
||||
@@ -92,38 +77,25 @@ local function cmd_action(cmd, action)
|
||||
end
|
||||
end
|
||||
|
||||
local function fzf_sh(arg, query)
|
||||
local function fzf_sh(arg)
|
||||
action = function(out)
|
||||
if (out:find('\n') or #out) == #out then
|
||||
open_file_pos(out, vis.win.file.modified and 'o' or 'e')
|
||||
else
|
||||
vis:message(out)
|
||||
end
|
||||
end
|
||||
local home = os.getenv('HOME')
|
||||
local path = vis.win.file.path or ''
|
||||
local dir = path:match('^.*/') or ''
|
||||
if not query and vis.register ~= '"' then
|
||||
query = string.gsub(vis.registers[vis.register][1], '%z', '')
|
||||
local reg = ''
|
||||
if reg ~= '"' then
|
||||
reg = string.gsub(vis.registers[vis.register][1], '%z', '')
|
||||
end
|
||||
local cmd = home ..
|
||||
'/.config/vis/fzf.sh ' ..
|
||||
escape_and_quoted(arg) .. ' ' .. escape_and_quoted(dir) .. ' ' .. escape_and_quoted(query or '')
|
||||
local cmd = home .. '/.config/vis/fzf.sh ' .. escape_and_quoted(arg) .. ' ' .. escape_and_quoted(dir) .. ' ' .. escape_and_quoted(reg)
|
||||
cmd_action(cmd, action)
|
||||
end
|
||||
|
||||
vis:command_register('fzf-files', function(argv, force, win, selection, range)
|
||||
fzf_sh(argv[1] or 'auto-files', argv[2])
|
||||
end)
|
||||
|
||||
local function search(cmd, action)
|
||||
if action == nil then
|
||||
action = function(out)
|
||||
if (out:find('\n') or #out) == #out then
|
||||
open_file_pos(out, 'e')
|
||||
else
|
||||
vis:message(out)
|
||||
end
|
||||
end
|
||||
end
|
||||
if cmd:match('^fzf ') and vis.register ~= '"' then
|
||||
@@ -135,6 +107,30 @@ local function search(cmd, action)
|
||||
cmd_action(cmd, action)
|
||||
end
|
||||
|
||||
local file_slots = {}
|
||||
|
||||
local function set_file_slot(num)
|
||||
local file = vis.win.file.path
|
||||
if file ~= nil then
|
||||
file_slots[num] = file
|
||||
vis:info('File slot [' .. num .. '] updated')
|
||||
else
|
||||
vis:info('Window has no file')
|
||||
end
|
||||
end
|
||||
|
||||
local function open_file_slot(num, open_cmd)
|
||||
local file = file_slots[num]
|
||||
if file == nil then
|
||||
vis:info('File slot [' .. num .. '] empty')
|
||||
elseif file == vis.win.file.path then
|
||||
vis:info('File slot [' .. num .. '] is the same file, no file change')
|
||||
else
|
||||
vis:info('File slot [' .. num .. '] open')
|
||||
open_file(file, open_cmd)
|
||||
end
|
||||
end
|
||||
|
||||
local function fzf_reload(cmd)
|
||||
local prompt = escape_and_quoted('1. ' .. cmd:match('^%w*') .. '> ')
|
||||
if not cmd:match('{q}') then
|
||||
@@ -169,73 +165,21 @@ local function add_global_mark()
|
||||
end
|
||||
end
|
||||
|
||||
local function set_current_theme()
|
||||
local path = os.getenv('HOME') .. '/.lightmode'
|
||||
local theme = 'lupan-dark'
|
||||
local f = io.open(path)
|
||||
function set_current_theme()
|
||||
local f = io.open(os.getenv('HOME') .. '/.config/xsettingsd/xsettingsd.conf')
|
||||
if f then
|
||||
local s = f:read('*all')
|
||||
f:close()
|
||||
theme = 'lupan-light'
|
||||
if s:match('light') then
|
||||
vis:command('set theme lupan-light')
|
||||
else
|
||||
vis:command('set theme lupan-dark')
|
||||
end
|
||||
end
|
||||
vis:command('set theme ' .. theme)
|
||||
end
|
||||
|
||||
local ripgrep = 'rg --column --line-number --color=always --smart-case'
|
||||
|
||||
local function close_prev_win()
|
||||
vis:feedkeys('<vis-window-prev>')
|
||||
if vis.win == win then
|
||||
vis:info('Last window')
|
||||
elseif not vis.win:close() then
|
||||
if vis.win.file.modified then
|
||||
vis:info('No write since last change')
|
||||
else
|
||||
vis:command('q')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function close_next_win()
|
||||
vis:feedkeys('<vis-window-next>')
|
||||
if vis.win == win then
|
||||
vis:info('Last window')
|
||||
elseif not vis.win:close() then
|
||||
if vis.win.file.modified then
|
||||
vis:info('No write since last change')
|
||||
else
|
||||
vis:command('q')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function ensure_last_line_empty()
|
||||
local size = vis.win.file.size
|
||||
if size > 0 then
|
||||
if vis.win.file:content(size - 1, size) ~= '\n' then
|
||||
vis.win.file:insert(size, '\n')
|
||||
end
|
||||
local lines = vis.win.file.lines
|
||||
if string.find(lines[#lines], '%S') then
|
||||
lines[#lines + 1] = ''
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function add_note()
|
||||
local path = vis.win.file.path
|
||||
local line = path and path .. ':' .. vis.win.selection.line .. ':' .. vis.win.selection.col .. ': ' .. vis.win.file.lines[vis.win.selection.line]
|
||||
vis:command('o ~/notes/notes.md')
|
||||
ensure_last_line_empty()
|
||||
local lines = vis.win.file.lines
|
||||
lines[#lines + 1] = '## '
|
||||
local pos = vis.win.file.size - 1
|
||||
lines[#lines + 1] = '* time: ' .. os.date('%Y-%m-%d %X')
|
||||
if line then
|
||||
lines[#lines + 1] = '* line: ' .. line
|
||||
end
|
||||
vis.win.selection.pos = pos
|
||||
end
|
||||
|
||||
vis.events.subscribe(vis.events.INIT, function()
|
||||
vis:command('set autoindent')
|
||||
|
||||
@@ -245,31 +189,39 @@ vis.events.subscribe(vis.events.INIT, function()
|
||||
|
||||
vis:map(vis.modes.NORMAL, '<M-k>', '<vis-window-prev>')
|
||||
vis:map(vis.modes.NORMAL, '<M-j>', '<vis-window-next>')
|
||||
vis:map(vis.modes.NORMAL, '<M-n>', '<vis-prompt-show>open<Enter>')
|
||||
vis:map(vis.modes.NORMAL, ' K', close_prev_win)
|
||||
vis:map(vis.modes.NORMAL, ' J', close_next_win)
|
||||
vis:map(vis.modes.NORMAL, ' k', qf.action.cp)
|
||||
vis:map(vis.modes.NORMAL, ' j', qf.action.cn)
|
||||
vis:map(vis.modes.NORMAL, ' K', '<vis-window-prev>:q<Enter>', 'close previous window')
|
||||
vis:map(vis.modes.NORMAL, ' J', '<vis-window-next>:q<Enter><vis-window-prev>', 'close next window')
|
||||
|
||||
vis:map(vis.modes.NORMAL, ' [', '<vis-prompt-show>lspc-prev-diagnostic<Enter>')
|
||||
vis:map(vis.modes.NORMAL, ' ]', '<vis-prompt-show>lspc-next-diagnostic<Enter>')
|
||||
vis:map(vis.modes.NORMAL, ' =', '<vis-prompt-show>lspc-format<Enter>')
|
||||
vis:map(vis.modes.NORMAL, ' l[', ':lspc-prev-diagnostic<Enter>')
|
||||
vis:map(vis.modes.NORMAL, ' l]', ':lspc-next-diagnostic<Enter>')
|
||||
vis:map(vis.modes.NORMAL, ' l=', ':lspc-format<Enter>')
|
||||
|
||||
vis:map(vis.modes.NORMAL, ' s', '<vis-prompt-show>fzf-files auto-search<Enter>', 'fzf: search')
|
||||
vis:map(vis.modes.NORMAL, ' f', '<vis-prompt-show>fzf-files auto-files<Enter>', 'fzf: files')
|
||||
vis:map(vis.modes.NORMAL, ' S', '<vis-prompt-show>fzf-files search<Enter>', 'fzf: search with rg')
|
||||
vis:map(vis.modes.NORMAL, ' F', '<vis-prompt-show>fzf-files files<Enter>', 'fzf: files with fd')
|
||||
for num = 1, 9 do
|
||||
vis:map(vis.modes.NORMAL, ' r' .. num, function() set_file_slot(num) end, 'set file slot ' .. num)
|
||||
vis:map(vis.modes.NORMAL, ' ' .. num, function() open_file_slot(num, 'e') end, 'open file slot ' .. num)
|
||||
vis:map(vis.modes.NORMAL, ' h' .. num, function() open_file_slot(num, 'o') end, 'open file slot ' .. num)
|
||||
vis:map(vis.modes.NORMAL, ' v' .. num, function() open_file_slot(num, 'vsplit') end,
|
||||
'open file slot ' .. num)
|
||||
end
|
||||
|
||||
vis:map(vis.modes.NORMAL, ' s', function()
|
||||
fzf_sh('auto-search')
|
||||
end, 'fzf: search')
|
||||
|
||||
vis:map(vis.modes.NORMAL, ' f', function()
|
||||
fzf_sh('auto-files')
|
||||
end, 'fzf: files')
|
||||
|
||||
vis:map(vis.modes.NORMAL, ' /', function()
|
||||
search(fzf_reload(ripgrep .. ' --with-filename {q} ' .. escape_and_quoted(vis.win.file.path)))
|
||||
end, 'fzf: rg current file')
|
||||
|
||||
vis:map(vis.modes.NORMAL, ' d', function()
|
||||
vis:map(vis.modes.NORMAL, ' .', function()
|
||||
local shell = os.getenv('SHELL')
|
||||
vis:command('!' .. shell)
|
||||
end, 'run shell')
|
||||
|
||||
vis:map(vis.modes.NORMAL, ' D', function()
|
||||
vis:map(vis.modes.NORMAL, ' ds', function()
|
||||
local shell = os.getenv('SHELL')
|
||||
local path = vis.win.file.path
|
||||
if path then
|
||||
@@ -285,7 +237,7 @@ vis.events.subscribe(vis.events.INIT, function()
|
||||
vis:command('!lazygit')
|
||||
end, 'lazygit')
|
||||
|
||||
vis:map(vis.modes.NORMAL, ' gj', function()
|
||||
vis:map(vis.modes.NORMAL, ' jl', function()
|
||||
vis:command('!lazyjj')
|
||||
end, 'lazyjj')
|
||||
|
||||
@@ -293,54 +245,41 @@ vis.events.subscribe(vis.events.INIT, function()
|
||||
vis:command('fzfmru')
|
||||
end, 'fzf recent')
|
||||
|
||||
vis:map(vis.modes.NORMAL, ' w', function()
|
||||
open_file_current_line('e')
|
||||
end, 'open file from current line in current window (with optional line and col)')
|
||||
|
||||
vis:map(vis.modes.NORMAL, ' o', function()
|
||||
vis:map(vis.modes.NORMAL, 'gf', function()
|
||||
open_file_current_line('o')
|
||||
end, 'open file from current line in new window (with optional line and col)')
|
||||
end, 'open file from current line (with line and col')
|
||||
|
||||
vis:map(vis.modes.NORMAL, ' zk', function()
|
||||
open_file_current_line('e', '<vis-window-prev>')
|
||||
end, 'open file from current line in above window (with optional line and col)')
|
||||
|
||||
vis:map(vis.modes.NORMAL, ' zj', function()
|
||||
open_file_current_line('e', '<vis-window-next>')
|
||||
end, 'open file from current line in below window (with optional line and col)')
|
||||
|
||||
vis:map(vis.modes.NORMAL, ' c', function()
|
||||
search('( fd -t d "" ~/src ~/dotfiles -H -E "\\.git" -E node_modules ; zoxide query -l ) | fzf --scheme path', function(path)
|
||||
vis:map(vis.modes.NORMAL, ' cd', function()
|
||||
search('zoxide query -l | fzf', function(path)
|
||||
vis:command('cd ' .. path)
|
||||
end)
|
||||
end, 'fzf change directory')
|
||||
|
||||
vis:map(vis.modes.NORMAL, ' l', '<vis-prompt-show>!lf<Enter>', 'lf file manager')
|
||||
vis:map(vis.modes.NORMAL, ' yy', function()
|
||||
vis:command('!yazi')
|
||||
end, 'yazi')
|
||||
|
||||
vis:map(vis.modes.NORMAL, ' L', function()
|
||||
vis:map(vis.modes.NORMAL, ' y.', function()
|
||||
local path = vis.win.file.path
|
||||
if path then
|
||||
vis:command('!lf ' .. escape_and_quoted(path:match('^.*/')))
|
||||
local dir = path:match('^.*/')
|
||||
local arg = escape_and_quoted(dir)
|
||||
vis:command('!cd ' .. arg .. ' && yazi')
|
||||
else
|
||||
vis:command('!lf')
|
||||
vis:command('!yazi')
|
||||
end
|
||||
end, 'lf file manager in current file directory')
|
||||
end, 'yazi in file directory')
|
||||
|
||||
vis:map(vis.modes.NORMAL, ' m', add_global_mark, 'global marks: add')
|
||||
vis:map(vis.modes.NORMAL, ' ma', add_global_mark, 'global marks: add')
|
||||
|
||||
vis:map(vis.modes.NORMAL, ' M', function()
|
||||
vis:map(vis.modes.NORMAL, ' mj', function()
|
||||
search('cat ~/.config/vis/global-marks.txt | fzf --tac')
|
||||
end, 'global marks: jump')
|
||||
|
||||
vis:map(vis.modes.NORMAL, ' zm', function()
|
||||
vis:map(vis.modes.NORMAL, ' me', function()
|
||||
vis:command('o ~/.config/vis/global-marks.txt')
|
||||
end, 'global marks: edit')
|
||||
|
||||
vis:map(vis.modes.NORMAL, ' n', add_note)
|
||||
|
||||
vis:map(vis.modes.NORMAL, ' N', function()
|
||||
search(fzf_reload(ripgrep .. ' --with-filename {q} ~/notes'))
|
||||
end, 'search notes')
|
||||
|
||||
vis:map(vis.modes.NORMAL, ' td', function()
|
||||
vis:command('set theme lupan-dark')
|
||||
@@ -348,11 +287,7 @@ vis.events.subscribe(vis.events.INIT, function()
|
||||
vis:map(vis.modes.NORMAL, ' tl', function()
|
||||
vis:command('set theme lupan-light')
|
||||
end, 'change to light theme')
|
||||
|
||||
vis:map(vis.modes.NORMAL, '<C-l>', function()
|
||||
vis:feedkeys('<vis-selections-remove-column-except>')
|
||||
set_current_theme()
|
||||
end, 'Remove all but the count selection column and update theme if needed')
|
||||
vis:map(vis.modes.NORMAL, ' tt', set_current_theme)
|
||||
|
||||
set_current_theme()
|
||||
end)
|
||||
@@ -360,11 +295,3 @@ end)
|
||||
vis.events.subscribe(vis.events.WIN_OPEN, function(win)
|
||||
vis:command('set relativenumber')
|
||||
end)
|
||||
|
||||
vis.events.subscribe(vis.events.FILE_SAVE_PRE, function(file, path)
|
||||
if path:find('[.]go$') then
|
||||
-- formatting is async, so when reformated you should write file again
|
||||
vis:command('lspc-format')
|
||||
end
|
||||
return true
|
||||
end)
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
#define THEME_DARK
|
||||
|
||||
#if HEIGHT >= 2160
|
||||
Xft.dpi: 160
|
||||
Xcursor.size: 48
|
||||
@@ -55,51 +53,3 @@ XTerm.vt100.color14: #8FBCBB
|
||||
! white
|
||||
XTerm.vt100.color7: #E5E9F0
|
||||
XTerm.vt100.color15: #ECEFF4
|
||||
|
||||
st.font: FiraCode Nerd Font:size=10
|
||||
|
||||
#ifdef THEME_DARK
|
||||
st.lightmode: 0
|
||||
st.background: #1f212e
|
||||
st.foreground: #9da0af
|
||||
st.cursorColor: #bf8040
|
||||
st.reverse-cursor: #1f212e
|
||||
st.color0: #1f212e
|
||||
st.color1: #862d2d
|
||||
st.color2: #3a783a
|
||||
st.color3: #707010
|
||||
st.color4: #345eb2
|
||||
st.color5: #cc66cc
|
||||
st.color6: #3a7878
|
||||
st.color7: #a1a3aa
|
||||
st.color8: #4d4d4d
|
||||
st.color9: #c27070
|
||||
st.color10: #40bf40
|
||||
st.color11: #acac53
|
||||
st.color12: #6b8ac7
|
||||
st.color13: #8f248f
|
||||
st.color14: #509595
|
||||
st.color15: #dbdff0
|
||||
#else
|
||||
st.lightmode: 1
|
||||
st.background: #f2f2f3
|
||||
st.foreground: #1f212e
|
||||
st.cursorColor: #bf8040
|
||||
st.reverse-cursor: #1f212e
|
||||
st.color0: #1f212e
|
||||
st.color1: #862d2d
|
||||
st.color2: #3a783a
|
||||
st.color3: #707010
|
||||
st.color4: #345eb2
|
||||
st.color5: #cc66cc
|
||||
st.color6: #3a7878
|
||||
st.color7: #a1a3aa
|
||||
st.color8: #73778c
|
||||
st.color9: #c27070
|
||||
st.color10: #40bf40
|
||||
st.color11: #acac53
|
||||
st.color12: #6b8ac7
|
||||
st.color13: #8f248f
|
||||
st.color14: #509595
|
||||
st.color15: #dae4f1
|
||||
#endif
|
||||
|
||||
@@ -30,6 +30,14 @@ xsetroot -cursor_name left_ptr
|
||||
|
||||
picom -b -I 1 -O 1 -i 1 -e 1 --no-fading-openclose || compton -b --no-fading-openclose
|
||||
|
||||
if which dk > /dev/null; then
|
||||
for m in $(polybar --list-monitors | cut -d: -f1); do
|
||||
MONITOR=$m polybar --reload bar &
|
||||
done
|
||||
fi
|
||||
exec dk
|
||||
fi
|
||||
|
||||
if which dwm > /dev/null; then
|
||||
lupan-clock &
|
||||
exec dwm
|
||||
@@ -39,14 +47,6 @@ if which awesome > /dev/null; then
|
||||
exec awesome
|
||||
fi
|
||||
|
||||
if which dk > /dev/null; then
|
||||
for m in $(polybar --list-monitors | cut -d: -f1); do
|
||||
MONITOR=$m polybar --reload bar &
|
||||
done
|
||||
fi
|
||||
exec dk
|
||||
fi
|
||||
|
||||
if which xmonad > /dev/null && test -f ~/.config/xmonad/xmonad.hs; then
|
||||
exec xmonad
|
||||
fi
|
||||
|
||||
@@ -3,48 +3,30 @@
|
||||
THEME="$1"
|
||||
|
||||
if [ "$THEME" = "toggle" ]; then
|
||||
if [ -e ~/.lightmode ]; then
|
||||
THEME=dark
|
||||
else
|
||||
if grep Materia-dark ~/.config/xsettingsd/xsettingsd.conf > /dev/null; then
|
||||
THEME=light
|
||||
else
|
||||
THEME=dark
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$THEME" = dark ]; then
|
||||
GTK_THEME=Materia-dark
|
||||
rm -f ~/.lightmode
|
||||
elif [ "$THEME" = light ]; then
|
||||
GTK_THEME=Materia-light
|
||||
touch ~/.lightmode
|
||||
else
|
||||
echo "error: unknown theme: should be either dark, light or toggle" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
pkill -USR1 '^dwm$'
|
||||
|
||||
XRES=$(readlink -e ~/.Xresources)
|
||||
if [ -n "$XRES" ]; then
|
||||
if [ "$THEME" = dark ]; then
|
||||
sed -i 's/^#undef THEME_DARK/#define THEME_DARK/' "$XRES"
|
||||
elif [ "$THEME" = light ]; then
|
||||
sed -i 's/^#define THEME_DARK/#undef THEME_DARK/' "$XRES"
|
||||
fi
|
||||
xrdb -merge "$XRES"
|
||||
pkill -USR1 '^st$'
|
||||
fi
|
||||
|
||||
# Alacritty
|
||||
AYML=$(readlink -e ~/.config/alacritty/alacritty.yml)
|
||||
if [ -n "$AYML" ]; then
|
||||
sed -i "s/^colors: [*].*/colors: *$THEME/" "$AYML"
|
||||
if [ -f ~/.config/alacritty/alacritty.yml ]; then
|
||||
sed -i "s/^colors: [*].*/colors: *$THEME/" ~/.config/alacritty/alacritty.yml
|
||||
fi
|
||||
ATOML=$(readlink -e ~/.config/alacritty/alacritty.toml)
|
||||
if [ -f "$ATOML" ]; then
|
||||
sed -i "s#^import =.*#import = [\"~/.config/alacritty/$THEME.toml\"]#" "$ATOML"
|
||||
if [ -f ~/.config/alacritty/alacritty.toml ]; then
|
||||
sed -i "s#^import =.*#import = [\"~/.config/alacritty/$THEME.toml\"]#" ~/.config/alacritty/alacritty.toml
|
||||
fi
|
||||
|
||||
XSET=$(readlink -e ~/.config/xsettingsd/xsettingsd.conf)
|
||||
if [ "$THEME" = dark ]; then
|
||||
kitten themes --reload-in=all Afterglow
|
||||
elif [ "$THEME" = light ]; then
|
||||
@@ -52,14 +34,13 @@ elif [ "$THEME" = light ]; then
|
||||
fi
|
||||
|
||||
# GTK
|
||||
if [ -n "$XSET" ]; then
|
||||
sed -i -E "s#(Net/ThemeName) .*#\\1 \"${GTK_THEME}\"#" "$XSET"
|
||||
if [ -f ~/.config/xsettingsd/xsettingsd.conf ]; then
|
||||
sed -i -E "s#(Net/ThemeName) .*#\\1 \"${GTK_THEME}\"#" ~/.config/xsettingsd/xsettingsd.conf
|
||||
pkill -HUP -x xsettingsd
|
||||
gsettings set org.gnome.desktop.interface gtk-theme "${GTK_THEME}"
|
||||
fi
|
||||
|
||||
# waybar
|
||||
WCSS=$(readlink -e ~/.config/waybar/style.css)
|
||||
if [ -f "$WCSS" ]; then
|
||||
sed -i -E "s#file:///.*/(light|dark)[.]css#file://$HOME/.config/waybar/$THEME.css#" "$WCSS"
|
||||
if [ -f ~/.config/waybar/style.css ]; then
|
||||
sed -i -E "s#file:///.*/(light|dark)[.]css#file://$HOME/.config/waybar/$THEME.css#" ~/.config/waybar/style.css
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user