Updated config
This commit is contained in:
parent
7085c0afa9
commit
7547ef0ff1
11 changed files with 127 additions and 6 deletions
|
@ -52,7 +52,7 @@ end
|
||||||
|
|
||||||
# MPV
|
# MPV
|
||||||
if command -q mpv
|
if command -q mpv
|
||||||
alias music "mpv music --shuffle --no-video"
|
alias m "mpv music --shuffle --no-video"
|
||||||
end
|
end
|
||||||
|
|
||||||
# Neovim
|
# Neovim
|
||||||
|
|
24
.config/fish/scripts/jpgtoavif
Executable file
24
.config/fish/scripts/jpgtoavif
Executable file
|
@ -0,0 +1,24 @@
|
||||||
|
#!/usr/bin/fish
|
||||||
|
|
||||||
|
if not set -q argv[1]
|
||||||
|
echo "Usage: $argv[0] /path/to/search"
|
||||||
|
exit 1
|
||||||
|
end
|
||||||
|
|
||||||
|
for jpg in (find $argv[1] -type f -name '*.jpg')
|
||||||
|
set avif (string replace -r '\.jpg$' '.avif' $jpg)
|
||||||
|
|
||||||
|
if test -f $avif
|
||||||
|
echo Skip $avif
|
||||||
|
continue
|
||||||
|
end
|
||||||
|
|
||||||
|
echo Converting $jpg to $avif
|
||||||
|
avifenc $jpg $avif
|
||||||
|
|
||||||
|
set json "$jpg.JSON"
|
||||||
|
if test -f $json
|
||||||
|
echo Renaming JSON $json to "$avif.JSON"
|
||||||
|
mv $json "$avif.JSON"
|
||||||
|
end
|
||||||
|
end
|
|
@ -1,5 +1,5 @@
|
||||||
# Autostart
|
# Autostart
|
||||||
exec-once = swaybg -i ~/pictures/wallpapers/01.png
|
exec-once = swaybg -i ~/pictures/wallpapers/current
|
||||||
exec-once = wl-paste --watch cliphist store
|
exec-once = wl-paste --watch cliphist store
|
||||||
exec-once = $statusbar
|
exec-once = $statusbar
|
||||||
exec-once = ssh-agent -D -a $SSH_AUTH_SOCK
|
exec-once = ssh-agent -D -a $SSH_AUTH_SOCK
|
||||||
|
|
|
@ -21,7 +21,7 @@ bind =, Print, exec, $screenshot
|
||||||
bind = $main, C, killactive,
|
bind = $main, C, killactive,
|
||||||
bind = $main, J, togglesplit,
|
bind = $main, J, togglesplit,
|
||||||
bind = $main, V, togglefloating,
|
bind = $main, V, togglefloating,
|
||||||
bind = $main, Super_R, fullscreen,
|
bind = $main, X, fullscreen,
|
||||||
|
|
||||||
# Session management
|
# Session management
|
||||||
bind = $main, Backspace, exit,
|
bind = $main, Backspace, exit,
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
return {
|
return {
|
||||||
cmd = { "clangd", "--background-index" },
|
cmd = { "clangd", "--background-index" },
|
||||||
root_markers = { "meson_options.txt", "CMakePresets.json", "compile_commands.json" },
|
root_markers = { "meson_options.txt", "CMakePresets.json", "compile_commands.json", ".git" },
|
||||||
filetypes = { "c", "cpp" },
|
filetypes = { "c", "cpp" },
|
||||||
}
|
}
|
|
@ -1,5 +1,5 @@
|
||||||
return {
|
return {
|
||||||
cmd = { "gopls" },
|
cmd = { "gopls" },
|
||||||
root_markers = { "go.mod", "go.work" },
|
root_markers = { "go.mod", "go.work", ".git" },
|
||||||
filetypes = { "go", "gomod", "gowork", "gotmpl" },
|
filetypes = { "go", "gomod", "gowork", "gotmpl" },
|
||||||
}
|
}
|
15
.config/nvim/lsp/lua-language-server.lua
Normal file
15
.config/nvim/lsp/lua-language-server.lua
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
return {
|
||||||
|
cmd = { "lua-language-server" },
|
||||||
|
filetypes = { "lua" },
|
||||||
|
root_markers = { "stylua.toml", "init.lua", ".git" },
|
||||||
|
settings = {
|
||||||
|
Lua = {
|
||||||
|
runtime = { version = "LuaJIT" },
|
||||||
|
workspace = {
|
||||||
|
checkThirdParty = false,
|
||||||
|
library = vim.api.nvim_get_runtime_file("", true),
|
||||||
|
},
|
||||||
|
telemetry = { enable = false }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,5 +1,5 @@
|
||||||
return {
|
return {
|
||||||
cmd = { "rust-analyzer" },
|
cmd = { "rust-analyzer" },
|
||||||
root_markers = { "Cargo.toml" },
|
root_markers = { "Cargo.toml", ".git" },
|
||||||
filetypes = { "rust" },
|
filetypes = { "rust" },
|
||||||
}
|
}
|
|
@ -1,3 +1,73 @@
|
||||||
|
-- ToggleComment
|
||||||
|
vim.api.nvim_create_user_command("ToggleComment", function()
|
||||||
|
local comments = {
|
||||||
|
bash = "#",
|
||||||
|
c = "//",
|
||||||
|
cpp = "//",
|
||||||
|
editorconfig = "#",
|
||||||
|
fish = "#",
|
||||||
|
gdscript = "#",
|
||||||
|
gdshader = "//",
|
||||||
|
gitignore = "#",
|
||||||
|
glsl = "//",
|
||||||
|
go = "//",
|
||||||
|
hyprlang = "#",
|
||||||
|
javascript = "//",
|
||||||
|
jsonc = "//",
|
||||||
|
lua = "--",
|
||||||
|
rust = "//",
|
||||||
|
sh = "#",
|
||||||
|
tmux = "#",
|
||||||
|
toml = "#",
|
||||||
|
typescript = "//",
|
||||||
|
yaml = "#",
|
||||||
|
zig = "//",
|
||||||
|
}
|
||||||
|
|
||||||
|
local comment = comments[vim.bo.filetype]
|
||||||
|
|
||||||
|
if comment == nil then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local is_visual = vim.fn.mode():match("[vV]")
|
||||||
|
local start_line
|
||||||
|
local end_line
|
||||||
|
|
||||||
|
if is_visual then
|
||||||
|
start_line = vim.fn.line("v")
|
||||||
|
end_line = vim.fn.line(".")
|
||||||
|
else
|
||||||
|
start_line = vim.fn.line(".")
|
||||||
|
end_line = start_line
|
||||||
|
end
|
||||||
|
|
||||||
|
if start_line == 0 or end_line == 0 then
|
||||||
|
vim.notify("No visual selection found. Please make a selection first.", vim.log.levels.WARN)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
if start_line > end_line then
|
||||||
|
start_line, end_line = end_line, start_line
|
||||||
|
end
|
||||||
|
|
||||||
|
local lines = vim.api.nvim_buf_get_lines(0, start_line - 1, end_line, false)
|
||||||
|
|
||||||
|
for i, line in ipairs(lines) do
|
||||||
|
local indent, rest = line:match("^(%s*)(.*)")
|
||||||
|
|
||||||
|
if vim.startswith(rest, comment) then
|
||||||
|
rest = rest:sub(#comment + 1):gsub("^%s*", "")
|
||||||
|
else
|
||||||
|
rest = comment .. " " .. rest
|
||||||
|
end
|
||||||
|
|
||||||
|
lines[i] = indent .. rest
|
||||||
|
end
|
||||||
|
|
||||||
|
vim.api.nvim_buf_set_lines(0, start_line - 1, end_line, false, lines)
|
||||||
|
end, {})
|
||||||
|
|
||||||
-- ToggleWord
|
-- ToggleWord
|
||||||
vim.api.nvim_create_user_command("ToggleWord", function()
|
vim.api.nvim_create_user_command("ToggleWord", function()
|
||||||
local inverse = {
|
local inverse = {
|
||||||
|
|
|
@ -17,9 +17,15 @@ map({"n", "v"}, "Q", "<cmd>qa!<cr>", "Force quit")
|
||||||
-- Clear search with Esc
|
-- Clear search with Esc
|
||||||
map({"n", "i"}, "<esc>", "<cmd>noh<cr><esc>", "Clear search")
|
map({"n", "i"}, "<esc>", "<cmd>noh<cr><esc>", "Clear search")
|
||||||
|
|
||||||
|
-- Change with c changes the entire word
|
||||||
|
map("n", "c", "ciw", "Change word")
|
||||||
|
|
||||||
-- Ctrl S to save the file from any mode
|
-- Ctrl S to save the file from any mode
|
||||||
map({"n", "i", "s", "v"}, "<C-s>", "<cmd>w<cr><esc>", "Save file")
|
map({"n", "i", "s", "v"}, "<C-s>", "<cmd>w<cr><esc>", "Save file")
|
||||||
|
|
||||||
|
-- Ctrl Space for auto complete
|
||||||
|
map("i", "<C-Space>", "<C-x><C-o>", "Auto complete")
|
||||||
|
|
||||||
-- Grab the line and move it up/down
|
-- Grab the line and move it up/down
|
||||||
map("n", "<C-j>", "<cmd>set paste<cr>m`O<esc>``<cmd>set nopaste<cr>", "Add empty line above")
|
map("n", "<C-j>", "<cmd>set paste<cr>m`O<esc>``<cmd>set nopaste<cr>", "Add empty line above")
|
||||||
map("n", "<C-k>", "m`<cmd>-g/\\m^\\s*$/d<cr>``<cmd>noh<cr>", "Delete empty line above")
|
map("n", "<C-k>", "m`<cmd>-g/\\m^\\s*$/d<cr>``<cmd>noh<cr>", "Delete empty line above")
|
||||||
|
@ -29,6 +35,8 @@ map("n", "<A-j>", "<cmd>set paste<cr>m`o<esc>``<cmd>set nopaste<cr>", "Add empty
|
||||||
map("n", "<A-k>", "m`<cmd>+g/\\m^\\s*$/d<cr>``<cmd>noh<cr>", "Delete empty line below")
|
map("n", "<A-k>", "m`<cmd>+g/\\m^\\s*$/d<cr>``<cmd>noh<cr>", "Delete empty line below")
|
||||||
|
|
||||||
-- Horizontal movement
|
-- Horizontal movement
|
||||||
|
map({"n", "v"}, "<C-h>", "b", "Back one word")
|
||||||
|
map({"n", "v"}, "<C-l>", "w", "Forward one word")
|
||||||
map({"n", "v"}, "H", "^", "Beginning of line")
|
map({"n", "v"}, "H", "^", "Beginning of line")
|
||||||
map({"n", "v"}, "L", "<end>", "End of line")
|
map({"n", "v"}, "L", "<end>", "End of line")
|
||||||
|
|
||||||
|
@ -42,6 +50,9 @@ map("n", "<S-Tab>", "V<gv<esc>")
|
||||||
map("v", "<Tab>", ">gv")
|
map("v", "<Tab>", ">gv")
|
||||||
map("v", "<S-Tab>", "<gv")
|
map("v", "<S-Tab>", "<gv")
|
||||||
|
|
||||||
|
-- Toggle comment
|
||||||
|
map({"n", "v"}, "<C-/>", "<cmd>ToggleComment<cr>", "Toggle comment")
|
||||||
|
|
||||||
-- Toggle word
|
-- Toggle word
|
||||||
map("n", "<Bslash>", "<cmd>ToggleWord<cr>", "Toggle word")
|
map("n", "<Bslash>", "<cmd>ToggleWord<cr>", "Toggle word")
|
||||||
|
|
||||||
|
|
|
@ -7,5 +7,6 @@ vim.diagnostic.config({
|
||||||
vim.lsp.enable({
|
vim.lsp.enable({
|
||||||
"clangd",
|
"clangd",
|
||||||
"gopls",
|
"gopls",
|
||||||
|
"lua-language-server",
|
||||||
"rust-analyzer",
|
"rust-analyzer",
|
||||||
})
|
})
|
Loading…
Add table
Add a link
Reference in a new issue