diff options
| author | TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> | 2025-01-24 20:35:27 +0900 |
|---|---|---|
| committer | TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> | 2025-01-24 20:35:27 +0900 |
| commit | c80a54e42b52ce297f0f2f71af23c562832025c7 (patch) | |
| tree | dcce8bb977a770f473325d48f6f70b21d9818a40 /ar/.config/LazyVim/lua/config | |
init
Diffstat (limited to 'ar/.config/LazyVim/lua/config')
| -rw-r--r-- | ar/.config/LazyVim/lua/config/autocmds.lua | 157 | ||||
| -rw-r--r-- | ar/.config/LazyVim/lua/config/keymaps.lua | 275 | ||||
| -rw-r--r-- | ar/.config/LazyVim/lua/config/lazy.lua | 105 | ||||
| -rw-r--r-- | ar/.config/LazyVim/lua/config/options.lua | 105 |
4 files changed, 642 insertions, 0 deletions
diff --git a/ar/.config/LazyVim/lua/config/autocmds.lua b/ar/.config/LazyVim/lua/config/autocmds.lua new file mode 100644 index 0000000..6550daf --- /dev/null +++ b/ar/.config/LazyVim/lua/config/autocmds.lua @@ -0,0 +1,157 @@ +-------------------------------------------------------------- +-- ######################################################## -- +-- ################## Custom #################### -- +-- ######################################################## -- +-------------------------------------------------------------- + +-- Save file as sudo on files that require root permission +vim.api.nvim_create_user_command("SudoWrite", function() + vim.cmd("write !sudo tee % >/dev/null") + vim.cmd("edit!") +end, {}) + +-- Enable Goyo by default for mutt writing +local goyo_group = vim.api.nvim_create_augroup("GoyoForMutt", { clear = true }) +vim.api.nvim_create_autocmd({ "BufRead", "BufNewFile" }, { + pattern = "/tmp/neomutt*", + group = goyo_group, + callback = function() + vim.g.goyo_width = 80 + vim.cmd("Goyo") + vim.cmd("set bg=light") + vim.cmd("set linebreak") + vim.cmd("set wrap") + vim.cmd("set textwidth=0") + vim.cmd("set wrapmargin=0") + vim.cmd("colorscheme seoul256") + vim.api.nvim_buf_set_keymap( + 0, + "n", + "<leader>gx", + ":Goyo|x!<CR>", + { noremap = true, silent = true, desc = "Goyo Quit" } + ) + vim.api.nvim_buf_set_keymap( + 0, + "n", + "<leader>gq", + ":Goyo|q!<CR>", + { noremap = true, silent = true, desc = "Goyo Abort" } + ) + end, +}) + +-- Vimwiki +-- Ensure files are read with the desired filetype +vim.g.vimwiki_ext2syntax = { + [".Rmd"] = "markdown", + [".rmd"] = "markdown", + [".md"] = "markdown", + [".markdown"] = "markdown", + [".mdown"] = "markdown", +} +-- Set up Vimwiki list +vim.g.vimwiki_list = { { + path = vim.fn.expand("~/.local/share/vimwiki"), + syntax = "markdown", + ext = ".md", +} } +-- Markdown for specific files and directories +vim.api.nvim_create_autocmd({ "BufRead", "BufNewFile" }, { + pattern = { "/tmp/calcurse*", "~/.calcurse/notes/*" }, + command = "set filetype=markdown", +}) + +-- Groff for specific file extensions +vim.api.nvim_create_autocmd({ "BufRead", "BufNewFile" }, { + pattern = { "*.ms", "*.me", "*.mom", "*.man" }, + command = "set filetype=groff", +}) + +-- TeX for .tex files +vim.api.nvim_create_autocmd({ "BufRead", "BufNewFile" }, { + pattern = { "*.tex" }, + command = "set filetype=tex", +}) + +-- When shortcut files are updated, renew bash and lf configs with new material: +local config_group = vim.api.nvim_create_augroup("ConfigUpdate", { clear = true }) +vim.api.nvim_create_autocmd("BufWritePost", { + pattern = { "bm-files", "bm-dirs" }, + group = config_group, + callback = function() + -- Execute the 'shortcuts' shell command + vim.fn.system("shortcuts") + + -- Check if the 'shortcuts' command was successful + if vim.v.shell_error == 0 then + -- Display a message in Neovim + vim.api.nvim_echo({ { "shortcuts updated", "None" } }, true, {}) + else + -- Optional: Display an error message if the 'shortcuts' command fails + vim.api.nvim_echo({ { "failed to update shortcuts", "ErrorMsg" } }, true, {}) + end + end, +}) + +-- Run xrdb whenever Xdefaults or Xresources are updated. +vim.api.nvim_create_autocmd({ "BufRead", "BufNewFile" }, { + pattern = { "Xresources", "Xdefaults", "xresources", "xdefaults" }, + group = config_group, + callback = function() + vim.bo.filetype = "xdefaults" + end, +}) +vim.api.nvim_create_autocmd("BufWritePost", { + pattern = { "Xresources", "Xdefaults", "xresources", "xdefaults" }, + group = config_group, + callback = function() + vim.cmd("!xrdb %") + end, +}) + +-- Recompile dwmblocks on config edit. +local home = os.getenv("HOME") -- Gets the home directory +local dwmblocks_path = home .. "/.local/src/suckless/dwmblocks/config.h" +vim.api.nvim_create_autocmd("BufWritePost", { + pattern = dwmblocks_path, + group = vim.api.nvim_create_augroup("DwmblocksConfigGroup", { clear = true }), + callback = function() + vim.cmd( + "!cd " + .. home + .. "/.local/src/suckless/dwmblocks/ && sudo make install && { killall -q dwmblocks; setsid -f dwmblocks; }" + ) + end, +}) + +-- Autocommand group for DWM +vim.api.nvim_create_augroup("DwmConfigGroup", { clear = true }) +vim.api.nvim_create_autocmd("BufWritePost", { + pattern = home .. "/.local/src/suckless/dwm/config.h", + group = "DwmConfigGroup", + callback = function() + vim.cmd("!extractkeys") + end, +}) + +-- Autocommand group for ST +vim.api.nvim_create_augroup("StConfigGroup", { clear = true }) +vim.api.nvim_create_autocmd("BufWritePost", { + pattern = home .. "/.local/src/suckless/st/config.h", + group = "StConfigGroup", + callback = function() + vim.cmd("!extractkeys") + end, +}) + +vim.api.nvim_create_autocmd({ "BufRead", "BufEnter" }, { + pattern = { "*.c", "*.cpp", "*.h", "*.hpp" }, + callback = function() + local suckless_path = vim.fn.expand("~/.local/src"):gsub("/+$", "") + local file_path = vim.fn.expand("%:p"):gsub("/+$", "") + if file_path == suckless_path or file_path:find("^" .. suckless_path .. "/") then + vim.b.autoformat = false + end + end, +}) diff --git a/ar/.config/LazyVim/lua/config/keymaps.lua b/ar/.config/LazyVim/lua/config/keymaps.lua new file mode 100644 index 0000000..e985c9d --- /dev/null +++ b/ar/.config/LazyVim/lua/config/keymaps.lua @@ -0,0 +1,275 @@ +local function word_definition(input) + if input == "" then + input = vim.fn.getreg(vim.fn.visualmode(), 1, 1) + end + + local escaped_input = vim.fn.shellescape(input) + local output = vim.fn.system("dict " .. escaped_input) + + vim.api.nvim_out_write(output) +end + +-- source shortcuts from bm-files and bm-folders +local shortcuts_file = vim.fn.expand("~/.config/nvim/shortcuts.lua") +local file = io.open(shortcuts_file, "r") +if file then + file:close() -- It's important to close the file after opening it. + vim.cmd("silent! source " .. shortcuts_file) +end + +-- word definition +vim.api.nvim_set_keymap( + "n", + "<leader>fd", + ":lua word_definition(vim.fn.expand('<cword>'))<CR>", + { noremap = true, silent = true, desc = "Word Definition" } +) +vim.api.nvim_set_keymap( + "x", + "<leader>fd", + ":lua word_definition(vim.fn.getreg('v', 1, 1))<CR>", + { noremap = true, silent = true, desc = "Word Definition in Visual Mode" } +) + +-------------------------------------- +-- Disable +vim.keymap.del("n", "<C-F>") +vim.keymap.del("n", "<leader><tab>]") +vim.keymap.del("n", "<leader><tab>d") +vim.keymap.del("n", "<leader><tab>[") +vim.keymap.del("n", "<leader>wd") +vim.keymap.del("n", "<leader>ww") + +-- vim.keymap.set( "n", "J", "<Nop>", { noremap = true, silent = true }) +vim.keymap.set("n", "Q", "<nop>") + +-- ESC +vim.keymap.set("i", "jk", "<ESC>", { desc = "<ESC>" }) + +-- : +vim.keymap.set("n", "<C-c>", ":", { desc = "Enter Command Mode", nowait = true }) + +-- Check Health +vim.keymap.set("n", "<leader>ch", ":checkhealth<cr>", { desc = "Check Health" }) + +-- Copy & Cut & Paste +vim.keymap.set("n", "x", '"_x') +-- vim.keymap.set("n", "d", '"_d') +-- vim.keymap.set("n", "D", '"_D') +-- vim.keymap.set("v", "d", '"_d') +-- vim.keymap.set("n", "<leader>d", '""d') +-- vim.keymap.set("n", "<leader>D", '""D') +-- vim.keymap.set("v", "<leader>d", '""d') +vim.keymap.set("n", "<leader>a", "ggVG", { desc = "Select Whole File" }) +vim.keymap.set("n", "<leader>cpa", "<cmd>%y+<cr>", { desc = "Copy Whole File" }) +vim.keymap.set("x", "p", 'p:let @+=@0<CR>:let @"=@0<CR>', { silent = true }) + +-- Lines +vim.keymap.set("i", "<C-cr>", "<Esc>$o", { nowait = true, silent = true }) +vim.keymap.set("i", "<C-f>", "<ESC>o", { noremap = true, nowait = true, silent = true, desc = "Next Line" }) +vim.keymap.set("i", "<C-b>", "<ESC>O", { noremap = true, nowait = true, silent = true, desc = "Previous Line" }) +-- vim.keymap.set( +-- "v", +-- "<C-j>", +-- ":m '>+1<CR>gv=gv", +-- { noremap = true, nowait = true, silent = true, desc = "Move A Line To Bottom" } +-- ) +-- vim.keymap.set( +-- "v", +-- "<C-k>", +-- ":m '<-2<CR>gv=gv", +-- { noremap = true, nowait = true, silent = true, desc = "Move A Line To Up" } +-- ) + +-- Navigation +vim.keymap.set("i", "<C-i>", "<ESC>I", { desc = "Beginning of Line" }) +vim.keymap.set("i", "<C-a>", "<End>", { desc = "End of Line" }) +vim.keymap.set("i", "<C-h>", "<Left>", { desc = "Move Left" }) +vim.keymap.set("i", "<C-l>", "<Right>", { desc = "Move Right" }) +vim.keymap.set("i", "<C-j>", "<Down>", { desc = "Move Down" }) +vim.keymap.set("i", "<C-k>", "<Up>", { desc = "Move Up" }) + +-- better up/down +vim.keymap.set({ "n", "x" }, "j", "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true, desc = "Better Down" }) +vim.keymap.set( + { "n", "x" }, + "<Down>", + "v:count == 0 ? 'gj' : 'j'", + { expr = true, silent = true, desc = "Better Down" } +) +vim.keymap.set({ "n", "x" }, "k", "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true, desc = "Better Up" }) +vim.keymap.set({ "n", "x" }, "<Up>", "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true, desc = "Better Up" }) + +-- -- Move to window using the <ctrl> hjkl keys +-- vim.keymap.set("n", "<C-h>", "<C-w>h", { desc = "Go to left window", remap = true }) +-- vim.keymap.set("n", "<C-j>", "<C-w>j", { desc = "Go to lower window", remap = true }) +-- vim.keymap.set("n", "<C-k>", "<C-w>k", { desc = "Go to upper window", remap = true }) +-- vim.keymap.set("n", "<C-l>", "<C-w>l", { desc = "Go to right window", remap = true }) +-- +-- -- Resize window using <ctrl> arrow keys +-- vim.keymap.set("n", "<C-Up>", "<cmd>resize +2<cr>", { desc = "Increase window height" }) +-- vim.keymap.set("n", "<C-Down>", "<cmd>resize -2<cr>", { desc = "Decrease window height" }) +-- vim.keymap.set("n", "<C-Left>", "<cmd>vertical resize -2<cr>", { desc = "Decrease window width" }) +-- vim.keymap.set("n", "<C-Right>", "<cmd>vertical resize +2<cr>", { desc = "Increase window width" }) +-- +-- -- Move Lines +-- vim.keymap.set("n", "<A-J>", "<cmd>m .+1<cr>==", { desc = "Move down" }) +-- vim.keymap.set("n", "<A-K>", "<cmd>m .-2<cr>==", { desc = "Move up" }) +-- vim.keymap.set("i", "<A-J>", "<esc><cmd>m .+1<cr>==gi", { desc = "Move down" }) +-- vim.keymap.set("i", "<A-K>", "<esc><cmd>m .-2<cr>==gi", { desc = "Move up" }) +-- vim.keymap.set("v", "<A-J>", ":m '>+1<cr>gv=gv", { desc = "Move down" }) +-- vim.keymap.set("v", "<A-K>", ":m '<-2<cr>gv=gv", { desc = "Move up" }) +-- vim.keymap.set("n", "<C-A-n>", "<cmd>m .+1<cr>==", { desc = "Move down" }) +-- vim.keymap.set("n", "<C-A-p>", "<cmd>m .-2<cr>==", { desc = "Move up" }) +-- vim.keymap.set("i", "<C-A-n>", "<esc><cmd>m .+1<cr>==gi", { desc = "Move down" }) +-- vim.keymap.set("i", "<C-A-p>", "<esc><cmd>m .-2<cr>==gi", { desc = "Move up" }) +-- vim.keymap.set("v", "<C-A-n>", ":m '>+1<cr>gv=gv", { desc = "Move down" }) +-- vim.keymap.set("v", "<C-A-p>", ":m '<-2<cr>gv=gv", { desc = "Move up" }) +vim.keymap.set("n", "<A-,>", "<cmd>m .+1<cr>==", { desc = "Move down" }) +vim.keymap.set("n", "<A-.>", "<cmd>m .-2<cr>==", { desc = "Move up" }) +vim.keymap.set("i", "<A-,>", "<esc><cmd>m .+1<cr>==gi", { desc = "Move down" }) +vim.keymap.set("i", "<A-.>", "<esc><cmd>m .-2<cr>==gi", { desc = "Move up" }) +vim.keymap.set("v", "<A-,>", ":m '>+1<cr>gv=gv", { desc = "Move down" }) +vim.keymap.set("v", "<A-.>", ":m '<-2<cr>gv=gv", { desc = "Move up" }) +vim.keymap.set("n", "<C-b>", "<C-b>zz") +vim.keymap.set("n", "<C-f>", "<C-f>zz") +-- +-- -- buffers +-- vim.keymap.set("n", "<S-h>", "<cmd>bprevious<cr>", { desc = "Prev buffer" }) +-- vim.keymap.set("n", "<S-l>", "<cmd>bnext<cr>", { desc = "Next buffer" }) +-- vim.keymap.set("n", "[b", "<cmd>bprevious<cr>", { desc = "Prev buffer" }) +-- vim.keymap.set("n", "]b", "<cmd>bnext<cr>", { desc = "Next buffer" }) +-- vim.keymap.set("n", "<leader>bb", "<cmd>e #<cr>", { desc = "Switch to Other Buffer" }) +-- vim.keymap.set("n", "<leader>`", "<cmd>e #<cr>", { desc = "Switch to Other Buffer" }) +-- +-- -- Clear search with <esc> +-- vim.keymap.set({ "i", "n" }, "<esc>", "<cmd>noh<cr><esc>", { desc = "Escape and clear hlsearch" }) +-- +-- -- Clear search, diff update and redraw +-- -- taken from runtime/lua/_editor.lua +-- vim.keymap.set( +-- "n", +-- "<leader>ur", +-- "<Cmd>nohlsearch<Bar>diffupdate<Bar>normal! <C-L><CR>", +-- { desc = "Redraw / clear hlsearch / diff update" } +-- ) +-- +-- -- https://github.com/mhinz/vim-galore#saner-behavior-of-n-and-n +-- vim.keymap.set("n", "n", "'Nn'[v:searchforward].'zv'", { expr = true, desc = "Next search result" }) +-- vim.keymap.set("x", "n", "'Nn'[v:searchforward]", { expr = true, desc = "Next search result" }) +-- vim.keymap.set("o", "n", "'Nn'[v:searchforward]", { expr = true, desc = "Next search result" }) +-- vim.keymap.set("n", "N", "'nN'[v:searchforward].'zv'", { expr = true, desc = "Prev search result" }) +-- vim.keymap.set("x", "N", "'nN'[v:searchforward]", { expr = true, desc = "Prev search result" }) +-- vim.keymap.set("o", "N", "'nN'[v:searchforward]", { expr = true, desc = "Prev search result" }) +-- +-- -- Add undo break-points +-- vim.keymap.set("i", ",", ",<c-g>u") +-- vim.keymap.set("i", ".", ".<c-g>u") +-- vim.keymap.set("i", ";", ";<c-g>u") +-- +-- -- save file +-- vim.keymap.set({ "i", "x", "n", "s" }, "<C-s>", "<cmd>w<cr><esc>", { desc = "Save file" }) +vim.keymap.set({ "n" }, "<leader>W", "<cmd>SudoWrite<cr><esc>", { desc = "Save readonly file" }) +-- +-- --keywordprg +-- vim.keymap.set("n", "<leader>K", "<cmd>norm! K<cr>", { desc = "Keywordprg" }) +-- +-- -- better indenting +-- vim.keymap.set("v", "<", "<gv") +-- vim.keymap.set("v", ">", ">gv") +-- +-- -- lazy +-- vim.keymap.set("n", "<leader>l", "<cmd>Lazy<cr>", { desc = "Lazy" }) +-- +-- -- new file +-- vim.keymap.set("n", "<leader>fn", "<cmd>enew<cr>", { desc = "New File" }) +-- +-- vim.keymap.set("n", "<leader>xl", "<cmd>lopen<cr>", { desc = "Location List" }) +-- vim.keymap.set("n", "<leader>xq", "<cmd>copen<cr>", { desc = "Quickfix List" }) +-- +-- vim.keymap.set("n", "[q", vim.cmd.cprev, { desc = "Previous quickfix" }) +-- vim.keymap.set("n", "]q", vim.cmd.cnext, { desc = "Next quickfix" }) +-- +-- -- formatting +-- vim.keymap.set({ "n", "v" }, "<leader>cf", function() +-- Util.format({ force = true }) +-- end, { desc = "Format" }) +-- +-- -- diagnostic +-- local diagnostic_goto = function(next, severity) +-- local go = next and vim.diagnostic.goto_next or vim.diagnostic.goto_prev +-- severity = severity and vim.diagnostic.severity[severity] or nil +-- return function() +-- go({ severity = severity }) +-- end +-- end +-- vim.keymap.set("n", "<leader>cd", vim.diagnostic.open_float, { desc = "Line Diagnostics" }) +-- vim.keymap.set("n", "]d", diagnostic_goto(true), { desc = "Next Diagnostic" }) +-- vim.keymap.set("n", "[d", diagnostic_goto(false), { desc = "Prev Diagnostic" }) +-- vim.keymap.set("n", "]e", diagnostic_goto(true, "ERROR"), { desc = "Next Error" }) +-- vim.keymap.set("n", "[e", diagnostic_goto(false, "ERROR"), { desc = "Prev Error" }) +-- vim.keymap.set("n", "]w", diagnostic_goto(true, "WARN"), { desc = "Next Warning" }) +-- vim.keymap.set("n", "[w", diagnostic_goto(false, "WARN"), { desc = "Prev Warning" }) +-- +-- -- stylua: ignore start +-- +-- -- toggle options +-- vim.keymap.set("n", "<leader>uf", function() Util.format.toggle() end, { desc = "Toggle auto format (global)" }) +-- vim.keymap.set("n", "<leader>uF", function() Util.format.toggle(true) end, { desc = "Toggle auto format (buffer)" }) +-- vim.keymap.set("n", "<leader>us", function() Util.toggle("spell") end, { desc = "Toggle Spelling" }) +-- vim.keymap.set("n", "<leader>uw", function() Util.toggle("wrap") end, { desc = "Toggle Word Wrap" }) +-- vim.keymap.set("n", "<leader>uL", function() Util.toggle("relativenumber") end, { desc = "Toggle Relative Line Numbers" }) +-- vim.keymap.set("n", "<leader>ul", function() Util.toggle.number() end, { desc = "Toggle Line Numbers" }) +-- vim.keymap.set("n", "<leader>ud", function() Util.toggle.diagnostics() end, { desc = "Toggle Diagnostics" }) +-- local conceallevel = vim.o.conceallevel > 0 and vim.o.conceallevel or 3 +-- vim.keymap.set("n", "<leader>uc", function() Util.toggle("conceallevel", false, {0, conceallevel}) end, { desc = "Toggle Conceal" }) +-- if vim.lsp.buf.inlay_hint or vim.lsp.inlay_hint then +-- map( "n", "<leader>uh", function() Util.toggle.inlay_hints() end, { desc = "Toggle Inlay Hints" }) +-- end +-- vim.keymap.set("n", "<leader>uT", function() if vim.b.ts_highlight then vim.treesitter.stop() else vim.treesitter.start() end end, { desc = "Toggle Treesitter Highlight" }) +-- +-- -- lazygit +-- vim.keymap.set("n", "<leader>gg", function() Util.terminal({ "lazygit" }, { cwd = Util.root(), esc_esc = false, ctrl_hjkl = false }) end, { desc = "Lazygit (root dir)" }) +-- vim.keymap.set("n", "<leader>gG", function() Util.terminal({ "lazygit" }, {esc_esc = false, ctrl_hjkl = false}) end, { desc = "Lazygit (cwd)" }) +-- +-- -- quit +-- vim.keymap.set("n", "<leader>qq", "<cmd>qa<cr>", { desc = "Quit all" }) +-- +-- -- highlights under cursor +-- vim.keymap.set("n", "<leader>ui", vim.show_pos, { desc = "Inspect Pos" }) +-- +-- -- LazyVim Changelog +-- vim.keymap.set("n", "<leader>L", function() Util.news.changelog() end, { desc = "LazyVim Changelog" }) +-- +-- -- floating terminal +-- local lazyterm = function() Util.terminal(nil, { cwd = Util.root() }) end +-- vim.keymap.set("n", "<leader>ft", lazyterm, { desc = "Terminal (root dir)" }) +-- vim.keymap.set("n", "<leader>fT", function() Util.terminal() end, { desc = "Terminal (cwd)" }) +-- vim.keymap.set("n", "<c-/>", lazyterm, { desc = "Terminal (root dir)" }) +-- vim.keymap.set("n", "<c-_>", lazyterm, { desc = "which_key_ignore" }) +-- +-- -- Terminal Mappings +-- vim.keymap.set("t", "<esc><esc>", "<c-\\><c-n>", { desc = "Enter Normal Mode" }) +-- vim.keymap.set("t", "<C-h>", "<cmd>wincmd h<cr>", { desc = "Go to left window" }) +-- vim.keymap.set("t", "<C-j>", "<cmd>wincmd j<cr>", { desc = "Go to lower window" }) +-- vim.keymap.set("t", "<C-k>", "<cmd>wincmd k<cr>", { desc = "Go to upper window" }) +-- vim.keymap.set("t", "<C-l>", "<cmd>wincmd l<cr>", { desc = "Go to right window" }) +-- vim.keymap.set("t", "<C-/>", "<cmd>close<cr>", { desc = "Hide Terminal" }) +-- vim.keymap.set("t", "<c-_>", "<cmd>close<cr>", { desc = "which_key_ignore" }) +-- +-- -- windows +vim.keymap.set("n", "<leader>w=", "<C-W>=", { desc = "Equal window", remap = true }) +vim.keymap.set("n", "<leader>wo", "<C-W>p", { desc = "Other window", remap = true }) +vim.keymap.set("n", "<leader>wx", "<C-W>c", { desc = "Close window", remap = true }) +-- vim.keymap.set("n", "<leader>w-", "<C-W>s", { desc = "Split window below", remap = true }) +-- vim.keymap.set("n", "<leader>w|", "<C-W>v", { desc = "Split window right", remap = true }) +-- vim.keymap.set("n", "<leader>-", "<C-W>s", { desc = "Split window below", remap = true }) +-- vim.keymap.set("n", "<leader>|", "<C-W>v", { desc = "Split window right", remap = true }) +-- +-- -- tabs +-- vim.keymap.set("n", "<leader><tab>l", "<cmd>tablast<cr>", { desc = "Last Tab" }) +-- vim.keymap.set("n", "<leader><tab>f", "<cmd>tabfirst<cr>", { desc = "First Tab" }) +-- vim.keymap.set("n", "<leader><tab><tab>", "<cmd>tabnew<cr>", { desc = "New Tab" }) +vim.keymap.set("n", "<leader><tab>n", "<cmd>tabnext<cr>", { desc = "Next Tab" }) +vim.keymap.set("n", "<leader><tab>x", "<cmd>tabclose<cr>", { desc = "Close Tab" }) +vim.keymap.set("n", "<leader><tab>p", "<cmd>tabprevious<cr>", { desc = "Previous Tab" }) diff --git a/ar/.config/LazyVim/lua/config/lazy.lua b/ar/.config/LazyVim/lua/config/lazy.lua new file mode 100644 index 0000000..b52de86 --- /dev/null +++ b/ar/.config/LazyVim/lua/config/lazy.lua @@ -0,0 +1,105 @@ +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +if not vim.loop.fs_stat(lazypath) then + -- bootstrap lazy.nvim + -- stylua: ignore + vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", "--branch=stable", lazypath }) +end +vim.opt.rtp:prepend(vim.env.LAZY or lazypath) + +require("lazy").setup({ + spec = { + -- add LazyVim and import its plugins + { "LazyVim/LazyVim", import = "lazyvim.plugins" }, + -- import any extras modules here + -- coding + -- { import = "lazyvim.plugins.extras.coding.codeium" }, + -- { import = "lazyvim.plugins.extras.coding.copilot" }, + -- { import = "lazyvim.plugins.extras.coding.native_snippets" }, + -- { import = "lazyvim.plugins.extras.coding.tabnine" }, + -- { import = "lazyvim.plugins.extras.coding.yanky" }, + -- dap + { import = "lazyvim.plugins.extras.dap.core" }, + { import = "lazyvim.plugins.extras.dap.nlua" }, + -- editor + -- { import = "lazyvim.plugins.extras.editor.aerial" }, + { import = "lazyvim.plugins.extras.editor.harpoon2" }, + { import = "lazyvim.plugins.extras.editor.leap" }, + { import = "lazyvim.plugins.extras.editor.mini-files" }, + -- { import = "lazyvim.plugins.extras.editor.navic" }, + -- { import = "lazyvim.plugins.extras.editor.outline" }, + -- formatting + { import = "lazyvim.plugins.extras.formatting.black" }, + { import = "lazyvim.plugins.extras.formatting.prettier" }, + -- lang + { import = "lazyvim.plugins.extras.lang.ansible" }, + { import = "lazyvim.plugins.extras.lang.clangd" }, + -- { import = "lazyvim.plugins.extras.lang.cmake" }, + { import = "lazyvim.plugins.extras.lang.docker" }, + -- { import = "lazyvim.plugins.extras.lang.elixir" }, + -- { import = "lazyvim.plugins.extras.lang.go" }, + -- { import = "lazyvim.plugins.extras.lang.haskell" }, + -- { import = "lazyvim.plugins.extras.lang.helm" }, + { import = "lazyvim.plugins.extras.lang.java" }, + { import = "lazyvim.plugins.extras.lang.json" }, + { import = "lazyvim.plugins.extras.lang.markdown" }, + -- { import = "lazyvim.plugins.extras.lang.omnisharp" }, + -- { import = "lazyvim.plugins.extras.lang.python-semshi" }, + { import = "lazyvim.plugins.extras.lang.python" }, + -- { import = "lazyvim.plugins.extras.lang.ruby" }, + -- { import = "lazyvim.plugins.extras.lang.rust" }, + -- { import = "lazyvim.plugins.extras.lang.scala" }, + -- { import = "lazyvim.plugins.extras.lang.tailwind" }, + -- { import = "lazyvim.plugins.extras.lang.terraform" }, + -- { import = "lazyvim.plugins.extras.lang.tex" }, + -- { import = "lazyvim.plugins.extras.lang.typescript" }, + { import = "lazyvim.plugins.extras.lang.yaml" }, + -- linting + { import = "lazyvim.plugins.extras.linting.eslint" }, + -- lsp + { import = "lazyvim.plugins.extras.lsp.none-ls" }, + -- test + { import = "lazyvim.plugins.extras.test.core" }, + -- ui + -- { import = "lazyvim.plugins.extras.ui.alpha" }, + { import = "lazyvim.plugins.extras.ui.edgy" }, + -- { import = "lazyvim.plugins.extras.ui.mini-animate" }, + -- { import = "lazyvim.plugins.extras.ui.mini-starter" }, + -- util + -- { import = "lazyvim.plugins.extras.util.dot" }, + -- { import = "lazyvim.plugins.extras.util.gitui" }, + { import = "lazyvim.plugins.extras.util.mini-hipatterns" }, + { import = "lazyvim.plugins.extras.util.project" }, + -- extras + { import = "lazyvim.plugins.extras.lazyrc" }, + { import = "lazyvim.plugins.extras.vscode" }, + + -- import/override with your plugins + { import = "plugins" }, + }, + defaults = { + -- By default, only LazyVim plugins will be lazy-loaded. Your custom plugins will load during startup. + -- If you know what you're doing, you can set this to `true` to have all your custom plugins lazy-loaded by default. + lazy = false, + -- It's recommended to leave version=false for now, since a lot the plugin that support versioning, + -- have outdated releases, which may break your Neovim install. + version = false, -- always use the latest git commit + -- version = "*", -- try installing the latest stable version for plugins that support semver + }, + install = { colorscheme = { "tokyonight", "habamax" } }, + checker = { enabled = true }, -- automatically check for plugin updates + performance = { + rtp = { + -- disable some rtp plugins + disabled_plugins = { + "gzip", + -- "matchit", + -- "matchparen", + -- "netrwPlugin", + "tarPlugin", + "tohtml", + "tutor", + "zipPlugin", + }, + }, + }, +}) diff --git a/ar/.config/LazyVim/lua/config/options.lua b/ar/.config/LazyVim/lua/config/options.lua new file mode 100644 index 0000000..1172763 --- /dev/null +++ b/ar/.config/LazyVim/lua/config/options.lua @@ -0,0 +1,105 @@ +-- Options are automatically loaded before lazy.nvim startup +-- Default options that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/options.lua +-- Add any additional options here + +-- vim.g.mapleader = " " +vim.g.maplocalleader = "\\" +-- vim.g.autoformat = true +-- vim.g.root_spec = { "lsp", { ".git", "lua" }, "cwd" } +-- vim.g.netrw_banner = 0 +-- vim.g.netrw_mouse = 2 + +-- vim.opt.autowrite = true -- Enable auto write +vim.opt.backup = false -- creates a backup file +-- vim.opt.clipboard = "" -- "unnamedplus" -- Sync with system clipboard +vim.opt.cmdheight = 1 +vim.opt.colorcolumn = "85" +-- vim.opt.completeopt = "menu,menuone,noselect" +vim.opt.conceallevel = 1 -- default = 3, Hide * markup for bold and italic +-- vim.opt.confirm = true -- Confirm to save changes before exiting modified buffer +-- vim.opt.cursorline = true -- Enable highlighting of the current line +-- vim.opt.expandtab = true -- Use spaces instead of tabs +-- vim.opt.fileencoding = "utf-8" +vim.opt.hlsearch = true +-- vim.opt.formatoptions = "jcroqlnt" -- tcqj +-- vim.opt.grepformat = "%f:%l:%c:%m" +-- vim.opt.grepprg = "rg --vimgrep" +-- vim.opt.guifont = "monospace:h17" +-- vim.opt.ignorecase = true -- Ignore case +-- vim.opt.inccommand = "nosplit" -- preview incremental substitute +-- vim.opt.laststatus = 3 -- global statusline +-- vim.opt.list = true -- Show some invisible characters (tabs... +-- vim.opt.mouse = "a" -- Enable mouse mode +-- vim.opt.number = true -- Print line number +-- vim.opt.numberwidth = 4 +-- vim.opt.pumblend = 10 -- Popup blend +-- vim.opt.pumheight = 10 -- Maximum number of entries in a popup +-- vim.opt.relativenumber = true -- Relative line numbers +vim.opt.ruler = false +vim.opt.scrolloff = 8 -- Lines of context +-- vim.opt.sessionoptions = { "buffers", "curdir", "tabpages", "winsize", "help", "globals", "skiprtp", "folds" } +-- vim.opt.shiftround = true -- Round indent +-- vim.opt.shiftwidth = 2 -- Size of an indent +-- vim.opt.shortmess:append({ W = true, I = true, c = true, C = true }) +vim.opt.showcmd = false +-- vim.opt.showmode = false -- Dont show mode since we have a statusline +vim.opt.showtabline = 1 +-- vim.opt.sidescrolloff = 8 -- Columns of context +-- vim.opt.signcolumn = "yes" -- Always show the signcolumn, otherwise it would shift the text each time +-- vim.opt.smartcase = true -- Don't ignore case with capitals +-- vim.opt.smartindent = true -- Insert indents automatically +-- vim.opt.spelllang = { "en" } +-- vim.opt.splitbelow = true -- Put new windows below current +-- vim.opt.splitkeep = "screen" +-- vim.opt.splitright = true -- Put new windows right of current +vim.opt.swapfile = false +vim.opt.tabstop = 4 -- Number of spaces tabs count for +-- vim.opt.termguicolors = true -- True color support +-- vim.opt.timeoutlen = 300 +vim.opt.title = false +-- vim.opt.undofile = true +-- vim.opt.undolevels = 10000 +-- vim.opt.updatetime = 200 -- Save swap file and trigger CursorHold +-- vim.opt.virtualedit = "block" -- Allow cursor to move where there is no text in visual block mode +-- vim.opt.wildmode = "longest:full,full" -- Command-line completion mode +-- vim.opt.winminwidth = 5 -- Minimum window width +-- vim.opt.wrap = false -- Disable line wrap +vim.opt.writebackup = false + +vim.cmd("set whichwrap+=<,>,[,],h,l") +vim.cmd([[set iskeyword+=-]]) + +-- vim.opt.fillchars = { +-- foldopen = "", +-- foldclose = "", +-- -- fold = "⸱", +-- fold = " ", +-- foldsep = " ", +-- diff = "╱", +-- eob = " ", +-- } +-- +-- if vim.fn.has("nvim-0.10") == 1 then +-- vim.opt.smoothscroll = true +-- end +-- +-- -- Folding +-- vim.opt.foldlevel = 99 +-- vim.opt.foldtext = "v:lua.require'lazyvim.util'.ui.foldtext()" +-- +-- if vim.fn.has("nvim-0.9.0") == 1 then +-- vim.opt.statuscolumn = [[%!v:lua.require'lazyvim.util'.ui.statuscolumn()]] +-- end +-- +-- -- HACK: causes freezes on <= 0.9, so only enable on >= 0.10 for now +-- if vim.fn.has("nvim-0.10") == 1 then +-- vim.opt.foldmethod = "expr" +-- vim.opt.foldexpr = "v:lua.require'lazyvim.util'.ui.foldexpr()" +-- else +-- vim.opt.foldmethod = "indent" +-- end +-- +-- vim.o.formatexpr = "v:lua.require'lazyvim.util'.format.formatexpr()" +-- +-- -- Fix markdown indentation settings +-- vim.g.markdown_recommended_style = 0 |
