commit d3de5b76fbaa4e81b5c16577f98508366e75f3e2 Author: Daniel Heras Quesada Date: Fri May 30 08:19:56 2025 +0200 feat: new config with everything manually installed diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..397b4a7 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*.log diff --git a/README.md b/README.md new file mode 100644 index 0000000..3773968 --- /dev/null +++ b/README.md @@ -0,0 +1,16 @@ +# README + +## Deps + +- [Emmet language server](https://github.com/olrtg/emmet-language-server) + +### Language servers + +This list is arbitrary and will depend on the current state of the lsp folder: + +- `# pacman -S lua-language-server bash-language-server typescript-language-server vscode-html-language-server vscode-css-language-server pyright-langserver gopls astro-ls jdtls rust-analyzer solargraph vue-language-server vscode-json-languageserver` +- `# npm i -g emmet-language-server emmet-ls` + +## Relevant docs + +- [LSP config](https://lsp-zero.netlify.app/blog/lsp-config-overview.html): the new nvim integration with LSP makes it unnecessary to rely on third party tools like `lsp-config` or `lsp-zero`. diff --git a/init.lua b/init.lua new file mode 100644 index 0000000..fa913ce --- /dev/null +++ b/init.lua @@ -0,0 +1,66 @@ +-- ╭──────╮ +-- │ Init │ +-- ╰──────╯ +vim.g.loaded_netrwPlugin = 0 +vim.g.loaded_netrw = 0 +vim.cmd("set termguicolors") +require("config") + +-- ╭─────────╮ +-- │ Generic │ +-- ╰─────────╯ +vim.cmd("set rnu") +vim.cmd("set textwidth=0") +vim.cmd("set wrapmargin=0") +vim.cmd("set linebreak") +-- vim.cmd("set colorcolumn=85") +vim.cmd("set conceallevel=0") -- DONT hide characters in MD +vim.cmd("set tabstop=4") +vim.cmd("set shiftwidth=4") +vim.cmd("set expandtab") +vim.cmd("set wrap") +vim.lsp.inlay_hint.enable(false) + +-- ╭─────────────╮ +-- │ Colorscheme │ +-- ╰─────────────╯ +vim.cmd("colorscheme rose-pine") + +-- ╭───────────────────╮ +-- │ Default clipboard │ +-- ╰───────────────────╯ +vim.cmd("set clipboard=unnamedplus") + +-- ╭───────╮ +-- │ Chars │ +-- ╰───────╯ +vim.opt.fillchars = { + horiz = "━", + vert = "▏", + stl = " ", + eob = " ", +} +vim.opt.listchars = { + tab = "> ", + trail = " ", + nbsp = "+", +} + +-- ╭─────╮ +-- │ LSP │ +-- ╰─────╯ +vim.lsp.enable('astro') +vim.lsp.enable('bashls') +vim.lsp.enable('clangd') +vim.lsp.enable('cssls') +vim.lsp.enable('emmet') +vim.lsp.enable('gopls') +vim.lsp.enable('html') +vim.lsp.enable('jdtls') +vim.lsp.enable('luals') +vim.lsp.enable('pyright') +vim.lsp.enable('rust_analyzer') +vim.lsp.enable('solargraph') +vim.lsp.enable('tsserver') +vim.lsp.enable('volar') +vim.lsp.enable('json') diff --git a/lazy-lock.json b/lazy-lock.json new file mode 100644 index 0000000..8e7b19b --- /dev/null +++ b/lazy-lock.json @@ -0,0 +1,44 @@ +{ + "Comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" }, + "LuaSnip": { "branch": "master", "commit": "faf3c94a44508cec1b961406d36cc65113ff3b98" }, + "aerial.nvim": { "branch": "master", "commit": "2e00d1d4248f08dddfceacb8d2996e51e13e00f6" }, + "auto-session": { "branch": "main", "commit": "00334ee24b9a05001ad50221c8daffbeedaa0842" }, + "autoclose.nvim": { "branch": "main", "commit": "b2077aa2c83df7ebc19b2a20a3a0654b24ae9c8f" }, + "blueprints": { "branch": "main", "commit": "e5825c30464f98e77e8b5ffb88d59fd98df6c802" }, + "bufferline.nvim": { "branch": "main", "commit": "655133c3b4c3e5e05ec549b9f8cc2894ac6f51b3" }, + "cmp-buffer": { "branch": "main", "commit": "b74fab3656eea9de20a9b8116afa3cfc4ec09657" }, + "cmp-cmdline": { "branch": "main", "commit": "d126061b624e0af6c3a556428712dd4d4194ec6d" }, + "cmp-emoji": { "branch": "main", "commit": "e8398e2adf512a03bb4e1728ca017ffeac670a9f" }, + "cmp-nvim-lsp": { "branch": "main", "commit": "a8912b88ce488f411177fc8aed358b04dc246d7b" }, + "cmp-path": { "branch": "main", "commit": "c6635aae33a50d6010bf1aa756ac2398a2d54c32" }, + "cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" }, + "conform.nvim": { "branch": "master", "commit": "6feb2f28f9a9385e401857b21eeac3c1b66dd628" }, + "diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" }, + "flash.nvim": { "branch": "main", "commit": "3c942666f115e2811e959eabbdd361a025db8b63" }, + "friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" }, + "gitsigns.nvim": { "branch": "main", "commit": "8bdaccdb897945a3c99c1ad8df94db0ddf5c8790" }, + "indent-blankline.nvim": { "branch": "master", "commit": "005b56001b2cb30bfa61b7986bc50657816ba4ba" }, + "lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" }, + "lualine.nvim": { "branch": "master", "commit": "0c6cca9f2c63dadeb9225c45bc92bb95a151d4af" }, + "neo-tree.nvim": { "branch": "main", "commit": "3f1dd2de5045659e00bfbe27c8aca3b52c1fdbde" }, + "no-neck-pain.nvim": { "branch": "main", "commit": "c824c54d837160ac32d0f877574ccfa2ecce9947" }, + "noice.nvim": { "branch": "main", "commit": "0427460c2d7f673ad60eb02b35f5e9926cf67c59" }, + "nui.nvim": { "branch": "main", "commit": "7cd18e73cfbd70e1546931b7268b3eebaeff9391" }, + "nvim-cmp": { "branch": "main", "commit": "b5311ab3ed9c846b585c0c15b7559be131ec4be9" }, + "nvim-colorizer.lua": { "branch": "master", "commit": "a065833f35a3a7cc3ef137ac88b5381da2ba302e" }, + "nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" }, + "nvim-treesitter-context": { "branch": "master", "commit": "ed1cf48d5af252248c55f50b9427e8ce883a2c6b" }, + "nvim-ts-autotag": { "branch": "main", "commit": "a1d526af391f6aebb25a8795cbc05351ed3620b5" }, + "nvim-web-devicons": { "branch": "master", "commit": "1fb58cca9aebbc4fd32b086cb413548ce132c127" }, + "nvim-window-picker": { "branch": "main", "commit": "6382540b2ae5de6c793d4aa2e3fe6dbb518505ec" }, + "plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" }, + "scope.nvim": { "branch": "main", "commit": "6b4208f017da9b122d69ddc5841e040dffe7313c" }, + "smear-cursor.nvim": { "branch": "main", "commit": "162703638203060b1d3412e73429d232bbd2627e" }, + "snacks.nvim": { "branch": "main", "commit": "bc0630e43be5699bb94dadc302c0d21615421d93" }, + "telescope-fzf-native.nvim": { "branch": "main", "commit": "1f08ed60cafc8f6168b72b80be2b2ea149813e55" }, + "telescope-git-file-history.nvim": { "branch": "master", "commit": "e7d495319f2a04df96402057a6992ea970f8914d" }, + "telescope.nvim": { "branch": "master", "commit": "b4da76be54691e854d3e0e02c36b0245f945c2c7" }, + "trouble.nvim": { "branch": "main", "commit": "85bedb7eb7fa331a2ccbecb9202d8abba64d37b3" }, + "vim-fugitive": { "branch": "master", "commit": "4a745ea72fa93bb15dd077109afbb3d1809383f2" }, + "which-key.nvim": { "branch": "main", "commit": "370ec46f710e058c9c1646273e6b225acf47cbed" } +} diff --git a/lsp/astro.lua b/lsp/astro.lua new file mode 100644 index 0000000..4778ab7 --- /dev/null +++ b/lsp/astro.lua @@ -0,0 +1,5 @@ +return { + cmd = { 'astro-ls', '--stdio' }, + filetypes = { 'astro' }, + root_markers = { '.git', 'astro.config.mjs', 'astro.config.js', 'astro.config.ts' }, +} diff --git a/lsp/bashls.lua b/lsp/bashls.lua new file mode 100644 index 0000000..59874ea --- /dev/null +++ b/lsp/bashls.lua @@ -0,0 +1,5 @@ +return { + cmd = { 'bash-language-server', 'start' }, + filetypes = { 'sh', 'bash' }, + root_markers = { '.bashrc', '.bash_profile', '.profile' }, +} diff --git a/lsp/clangd.lua b/lsp/clangd.lua new file mode 100644 index 0000000..e0b599f --- /dev/null +++ b/lsp/clangd.lua @@ -0,0 +1,5 @@ +return { + cmd = { 'clangd' }, + filetypes = { 'c', 'cpp', 'objc', 'objcpp' }, + root_markers = { 'compile_commands.json', '.git', 'compile_flags.txt' }, +} diff --git a/lsp/cssls.lua b/lsp/cssls.lua new file mode 100644 index 0000000..a493543 --- /dev/null +++ b/lsp/cssls.lua @@ -0,0 +1,5 @@ +return { + cmd = { 'vscode-css-language-server', '--stdio' }, + filetypes = { 'css', 'scss', 'sass' }, + root_markers = { '.git' }, +} diff --git a/lsp/emmet.lua b/lsp/emmet.lua new file mode 100644 index 0000000..4143a09 --- /dev/null +++ b/lsp/emmet.lua @@ -0,0 +1,5 @@ +return { + cmd = { 'emmet-ls', '--stdio' }, + filetypes = { 'html', 'css', 'scss', 'less' }, + root_markers = { '.git' }, +} diff --git a/lsp/gopls.lua b/lsp/gopls.lua new file mode 100644 index 0000000..ffc9bd6 --- /dev/null +++ b/lsp/gopls.lua @@ -0,0 +1,5 @@ +return { + cmd = { 'gopls' }, + filetypes = { 'go', 'gomod', 'gowork', 'gotmpl' }, + root_markers = { 'go.mod', '.git' }, +} diff --git a/lsp/html.lua b/lsp/html.lua new file mode 100644 index 0000000..0f49451 --- /dev/null +++ b/lsp/html.lua @@ -0,0 +1,5 @@ +return { + cmd = { 'vscode-html-language-server', '--stdio' }, + filetypes = { 'html', 'htm', 'xhtml' }, + root_markers = { '.git', 'index.html' }, +} diff --git a/lsp/jdtls.lua b/lsp/jdtls.lua new file mode 100644 index 0000000..02de944 --- /dev/null +++ b/lsp/jdtls.lua @@ -0,0 +1,5 @@ +return { + cmd = { 'jdtls' }, + filetypes = { 'java' }, + root_markers = { 'pom.xml', 'build.gradle', '.git', 'mvnw', 'gradlew' }, +} diff --git a/lsp/jsonls.lua b/lsp/jsonls.lua new file mode 100644 index 0000000..63d7df1 --- /dev/null +++ b/lsp/jsonls.lua @@ -0,0 +1,4 @@ +return { + cmd = { 'vscode-json-language-server', '--stdio' }, + filetypes = { 'json', 'jsonc' }, +} diff --git a/lsp/luals.lua b/lsp/luals.lua new file mode 100644 index 0000000..c76d70e --- /dev/null +++ b/lsp/luals.lua @@ -0,0 +1,5 @@ +return { + cmd = { 'lua-language-server' }, + filetypes = { 'lua' }, + root_markers = { '.luarc.json', '.luarc.jsonc', 'init.lua' }, +} diff --git a/lsp/pyright.lua b/lsp/pyright.lua new file mode 100644 index 0000000..5c82a59 --- /dev/null +++ b/lsp/pyright.lua @@ -0,0 +1,5 @@ +return { + cmd = { 'pyright-langserver', '--stdio' }, + filetypes = { 'python' }, + root_markers = { 'setup.py', 'setup.cfg', 'requirements.txt', '.git' }, +} diff --git a/lsp/rust_analyzer.lua b/lsp/rust_analyzer.lua new file mode 100644 index 0000000..c0dacf5 --- /dev/null +++ b/lsp/rust_analyzer.lua @@ -0,0 +1,5 @@ +return { + cmd = { 'rust-analyzer' }, + filetypes = { 'rust' }, + root_markers = { 'Cargo.toml', 'rust-project.json', '.git' }, +} diff --git a/lsp/solargraph.lua b/lsp/solargraph.lua new file mode 100644 index 0000000..f03877c --- /dev/null +++ b/lsp/solargraph.lua @@ -0,0 +1,5 @@ +return { + cmd = { 'solargraph', 'stdio' }, + filetypes = { 'ruby' }, + root_markers = { 'Gemfile', '.git' }, +} diff --git a/lsp/tsserver.lua b/lsp/tsserver.lua new file mode 100644 index 0000000..4a3e6ce --- /dev/null +++ b/lsp/tsserver.lua @@ -0,0 +1,5 @@ +return { + cmd = { 'typescript-language-server', '--stdio' }, + filetypes = { 'typescript', 'typescriptreact', 'typescript.tsx', 'javascript', 'javascriptreact', 'javascript.jsx', 'js', 'jsx', 'ts','tsx' }, + root_markers = { 'package.json', 'tsconfig.json', 'jsconfig.json', '.git' }, +} diff --git a/lsp/volar.lua b/lsp/volar.lua new file mode 100644 index 0000000..4484f9d --- /dev/null +++ b/lsp/volar.lua @@ -0,0 +1,5 @@ +return { + cmd = { 'vue-language-server', '--stdio' }, + filetypes = { 'vue' }, + root_markers = { 'package.json', 'vue.config.js', 'vue.config.ts', '.git' }, +} diff --git a/lua/config/autocmds.lua b/lua/config/autocmds.lua new file mode 100644 index 0000000..848024d --- /dev/null +++ b/lua/config/autocmds.lua @@ -0,0 +1,11 @@ +vim.api.nvim_create_autocmd("ModeChanged", { + callback = function(opts) + require("lualine").refresh() + end, +}) +vim.api.nvim_create_autocmd("CursorMoved", { + callback = function(opts) + require("lualine").refresh() + end, +}) + diff --git a/lua/config/init.lua b/lua/config/init.lua new file mode 100644 index 0000000..04bc99c --- /dev/null +++ b/lua/config/init.lua @@ -0,0 +1,3 @@ +require("config.autocmds") +require("config.remap") +require("config.lazy") diff --git a/lua/config/lazy.lua b/lua/config/lazy.lua new file mode 100644 index 0000000..341ac20 --- /dev/null +++ b/lua/config/lazy.lua @@ -0,0 +1,35 @@ +-- Bootstrap lazy.nvim +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) + +-- Make sure to setup `mapleader` and `maplocalleader` before +-- loading lazy.nvim so that mappings are correct. +-- This is also a good place to setup other settings (vim.opt) +vim.g.mapleader = " " +vim.g.maplocalleader = "\\" + +-- Setup lazy.nvim +require("lazy").setup({ + spec = { + -- import your plugins + { import = "plugins" }, + }, + -- Configure any other settings here. See the documentation for more details. + -- colorscheme that will be used when installing plugins. + install = { colorscheme = { "habamax" } }, + -- automatically check for plugin updates + checker = { enabled = true }, +}) diff --git a/lua/config/remap.lua b/lua/config/remap.lua new file mode 100644 index 0000000..44518f1 --- /dev/null +++ b/lua/config/remap.lua @@ -0,0 +1,374 @@ +vim.g.mapleader = " " +local map = vim.keymap.set + +---- Bufferline ---- + +map("n", "bg", "BufferLinePick") +map("n", "bpx", "BufferLinePickClose") +map("n", "box", "BufferLineCloseOthers") +map("n", "", "BufferLineCycleNext") +map("n", "", "BufferLineCyclePrev") +map("n", "bsd", "BufferLineSortByDirectory") +map("n", "bse", "BufferLineSortByExtension") +map("n", "bsr", "BufferLineSortByRelativeDirectory") +map("n", "bst", "BufferLineSortByTabs") +-- buffers +map("n", "", "BufferLineMovePrev", { desc = "Move buffer to left" }) +map("n", "", "BufferLineMoveNext", { desc = "Move buffer to right" }) +map("n", "[b", "bprevious", { desc = "Prev Buffer" }) +map("n", "]b", "bnext", { desc = "Next Buffer" }) +map("n", "bd", function() + Snacks.bufdelete() +end, { desc = "Delete Buffer" }) +map("n", "x", function() + Snacks.bufdelete() +end, { desc = "Delete Buffer" }) +-- cant have C-w to delete buffer since in being used to navigate windows +-- map("n", "", function() +-- Snacks.bufdelete() +-- end, { desc = "Go to Left Window", remap = true }) +map("n", "", function() + Snacks.bufdelete() +end, { desc = "Delete Buffer" }) +map("n", "bD", ":bd", { desc = "Delete Buffer and Window" }) +-- tabpages +map("n", "]", ":+tabnext", { desc = "Goes to the next tabpage" }) +map("n", "[", ":-tabnext", { desc = "Goes to the previous tabpage" }) +map("n", "nt", ":tabnew", { desc = "Create new tabpage" }) + +--------------------------------------------------------------------------- + +-- Treesitter context +map("n", "tc", "TSContextToggle", { desc = "Toggle treesitter context" }) + +-- Regex search and replace +map("n", "fs", "GrugFar", { desc = "Search all with replace option" }) + +-- Blueprints +map("n", "ct", "lua require('blueprints').createFromTemplateTelescope()", { desc = "Nvim blueprints" }) + +---- Git ---- +map("n", "gb", "Gitsigns blame") +map("n", "gd", "DiffviewOpen") +map("n", "gx", "DiffviewClose") +map("n", "K", "Gitsigns blame_line") +map("n", "gtb", "Gitsigns toggle_current_line_blame") +map("n", "gtd", "Gitsigns toggle_deleted") +map("n", "gc", "Telescope git_commits ", { desc = "Git commits" }) +map("n", "gs", "Telescope git_status ", { desc = "Git status" }) + +-- lazygit +map("n", "gg", function() + Snacks.lazygit({ cwd = LazyVim.root.git() }) +end, { desc = "Lazygit (Root Dir)" }) +map("n", "gG", function() + Snacks.lazygit() +end, { desc = "Lazygit (cwd)" }) +map("n", "gb", function() + Snacks.lazygit.blame_line() +end, { desc = "Git Blame Line" }) +map("n", "gB", function() + Snacks.lazygit.browse() +end, { desc = "Git Browse" }) + +map("n", "gf", function() + local git_path = vim.api.nvim_buf_get_name(0) + Snacks.lazygit({ args = { "-f", vim.trim(git_path) } }) +end, { desc = "Lazygit Current File History" }) + +map("n", "gl", function() + Snacks.lazygit({ args = { "log" }, cwd = LazyVim.root.git() }) +end, { desc = "Lazygit Log" }) +map("n", "gL", function() + Snacks.lazygit({ args = { "log" } }) +end, { desc = "Lazygit Log (cwd)" }) + +--------------------------------------------------------------------------- + +-- Neotree +map("n", "", "Neotree toggle", { desc = "Toggle Neotree open" }) +map("n", "e", "Neotree focus", { desc = "Focus neotree" }) + +-- LSP +map("n", "gD", function() + vim.lsp.buf.declaration() +end, { desc = "LSP declaration" }) +map("n", "gd", function() + vim.lsp.buf.definition() +end, { desc = "LSP definition" }) +map("n", "gr", function() + vim.lsp.buf.references() +end, { desc = "LSP references" }) +map("n", "K", function() + vim.lsp.buf.hover() +end, { desc = "LSP hover" }) +map("n", "gi", function() + vim.lsp.buf.implementation() +end, { desc = "LSP implementation" }) +map("n", "ls", function() + vim.lsp.buf.signature_help() +end, { desc = "LSP signature help" }) +map("n", "lf", function() + vim.diagnostic.open_float({ border = "rounded" }) +end, { desc = "Floating diagnostics" }) +map("n", "D", function() + vim.lsp.buf.type_definition() +end, { desc = "LSP type definition" }) +map("n", "ca", function() + vim.lsp.buf.code_action() +end, { desc = "LSP code actions" }) +map("n", "[d", function() + vim.diagnostic.goto_prev({ float = { border = "rounded" } }) +end, { desc = "Goto prev diagnostic" }) +map("n", "]d", function() + vim.diagnostic.goto_next({ float = { border = "rounded" } }) +end, { desc = "Goto next diagnostic" }) +map("v", "ca", function() + vim.lsp.buf.code_action() +end, { desc = "LSP code action" }) +map("n", "r", function() + -- when rename opens the prompt, this autocommand will trigger + -- it will "press" CTRL-F to enter the command-line window `:h cmdwin` + -- in this window I can use normal mode keybindings + local cmdId + cmdId = vim.api.nvim_create_autocmd({ "CmdlineEnter" }, { + callback = function() + local key = vim.api.nvim_replace_termcodes("", true, false, true) + vim.api.nvim_feedkeys(key, "c", false) + vim.api.nvim_feedkeys("0", "n", false) + -- autocmd was triggered and so we can remove the ID and return true to delete the autocmd + cmdId = nil + return true + end, + }) + vim.lsp.buf.rename() + -- if LPS couldn't trigger rename on the symbol, clear the autocmd + vim.defer_fn(function() + -- the cmdId is not nil only if the LSP failed to rename + if cmdId then + vim.api.nvim_del_autocmd(cmdId) + end + end, 500) +end, { desc = "Rename symbol" }) + +map("n", "wa", function() + vim.lsp.buf.add_workspace_folder() +end, { desc = "Add workspace folder" }) +map("n", "wr", function() + vim.lsp.buf.remove_workspace_folder() +end, { desc = "Remove workspace folder" }) +map("n", "wl", function() + print(vim.inspect(vim.lsp.buf.list_workspace_folders())) +end, { desc = "List workspace folders" }) + +---- Debugging with dap ---- +map("n", "cdt", ":DapToggleBreakpoint") +map("n", "cdx", ":DapTerminate") +map("n", "cdo", ":DapStepOver") + +---- Completion ---- +-- map({ "i", "s" }, "", function() +-- if require("cmp").visible() then +-- require("nvim-cmp").select_next_item() +-- elseif require("luasnip").expand_or_jumpable() then +-- vim.fn.feedkeys(vim.api.nvim_replace_termcodes("luasnip-expand-or-jump", true, true, true), "") +-- end +-- end, { desc = "Next completion item" }) + +---- Telescope find ---- + +map("n", "ff", " Telescope find_files ", { desc = "Find files" }) +map("n", "fa", " Telescope find_files follow=true no_ignore=true hidden=true ", { desc = "Find all" }) +map("n", "fw", " Telescope live_grep ", { desc = "Live grep" }) +map("n", "fb", " Telescope buffers ", { desc = "Find buffers" }) +map("n", "", " Telescope buffers ", { desc = "Find buffers" }) +map("n", "fh", " Telescope help_tags ", { desc = "Help page" }) +map("n", "fo", " Telescope oldfiles ", { desc = "Fild old files" }) +map("n", "fz", " Telescope current_buffer_fuzzy_find ", { desc = "Find in current buffer" }) + +----------------------------------------------------------- + +-- better up/down +-- map({ "n", "x" }, "j", "v:count == 0 ? 'gj' : 'j'", { desc = "Down", expr = true, silent = true }) +-- map({ "n", "x" }, "", "v:count == 0 ? 'gj' : 'j'", { desc = "Down", expr = true, silent = true }) +-- map({ "n", "x" }, "k", "v:count == 0 ? 'gk' : 'k'", { desc = "Up", expr = true, silent = true }) +-- map({ "n", "x" }, "", "v:count == 0 ? 'gk' : 'k'", { desc = "Up", expr = true, silent = true }) + +---- Movement ---- + +-- Move Lines +map("n", "", "m .+1==", { desc = "Move Down" }) +map("n", "", "m .-2==", { desc = "Move Up" }) +map("i", "", "m .+1==gi", { desc = "Move Down" }) +map("i", "", "m .-2==gi", { desc = "Move Up" }) +map("v", "", ":m '>+1gv=gv", { desc = "Move Down" }) +map("v", "", ":m '<-2gv=gv", { desc = "Move Up" }) + +-- Clear search with +map({ "i", "n" }, "", "noh", { desc = "Escape and Clear hlsearch" }) + +-- Clear search, diff update and redraw +-- taken from runtime/lua/_editor.lua +map( + "n", + "ur", + "nohlsearchdiffupdatenormal! ", + { desc = "Redraw / Clear hlsearch / Diff Update" } +) + +-- https://github.com/mhinz/vim-galore#saner-behavior-of-n-and-n +map("n", "n", "'Nn'[v:searchforward].'zv'", { expr = true, desc = "Next Search Result" }) +map("x", "n", "'Nn'[v:searchforward]", { expr = true, desc = "Next Search Result" }) +map("o", "n", "'Nn'[v:searchforward]", { expr = true, desc = "Next Search Result" }) +map("n", "N", "'nN'[v:searchforward].'zv'", { expr = true, desc = "Prev Search Result" }) +map("x", "N", "'nN'[v:searchforward]", { expr = true, desc = "Prev Search Result" }) +map("o", "N", "'nN'[v:searchforward]", { expr = true, desc = "Prev Search Result" }) + +----------------------------------------------------------- + +-- save file +map({ "i", "x", "n", "s" }, "", "w", { desc = "Save File" }) + +-- better indenting +map("v", "<", "", ">gv") + +-- new file +map("n", "nf", "enew", { desc = "New File" }) +map("n", "", "enew", { desc = "New File" }) + +map("n", "[q", vim.cmd.cprev, { desc = "Previous Quickfix" }) +map("n", "]q", vim.cmd.cnext, { desc = "Next Quickfix" }) + +---- Code ---- + +-- formatting +map({ "n", "v" }, "cf", function() + require("conform").format() +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 +map("n", "cd", vim.diagnostic.open_float, { desc = "Line Diagnostics" }) +map("n", "]d", diagnostic_goto(true), { desc = "Next Diagnostic" }) +map("n", "[d", diagnostic_goto(false), { desc = "Prev Diagnostic" }) +map("n", "]e", diagnostic_goto(true, "ERROR"), { desc = "Next Error" }) +map("n", "[e", diagnostic_goto(false, "ERROR"), { desc = "Prev Error" }) +map("n", "]w", diagnostic_goto(true, "WARN"), { desc = "Next Warning" }) +map("n", "[w", diagnostic_goto(false, "WARN"), { desc = "Prev Warning" }) + +---- Toggle options ---- + +map("n", "uf", function() + LazyVim.format.toggle() +end, { desc = "Toggle Auto Format (Global)" }) +map("n", "uF", function() + LazyVim.format.toggle(true) +end, { desc = "Toggle Auto Format (Buffer)" }) +map("n", "us", function() + LazyVim.toggle("spell") +end, { desc = "Toggle Spelling" }) +map("n", "uw", function() + LazyVim.toggle("wrap") +end, { desc = "Toggle Word Wrap" }) +map("n", "uL", function() + LazyVim.toggle("relativenumber") +end, { desc = "Toggle Relative Line Numbers" }) +map("n", "ul", function() + LazyVim.toggle.number() +end, { desc = "Toggle Line Numbers" }) +map("n", "ud", function() + LazyVim.toggle.diagnostics() +end, { desc = "Toggle Diagnostics" }) +local conceallevel = vim.o.conceallevel > 0 and vim.o.conceallevel or 3 +map("n", "uc", function() + LazyVim.toggle("conceallevel", false, { 0, conceallevel }) +end, { desc = "Toggle Conceal" }) +if vim.lsp.buf.inlay_hint or vim.lsp.inlay_hint then + map("n", "uh", function() + LazyVim.toggle.inlay_hints() + end, { desc = "Toggle Inlay Hints" }) +end +map("n", "uT", function() + if vim.b.ts_highlight then + vim.treesitter.stop() + else + vim.treesitter.start() + end +end, { desc = "Toggle Treesitter Highlight" }) +map("n", "ub", function() + LazyVim.toggle("background", false, { "light", "dark" }) +end, { desc = "Toggle Background" }) +-- aerial +map("n", "ua", "AerialToggle", { desc = "Toggle aerial view" }) + +--------------------------------------------------------------------------- + +-- highlights under cursor +map("n", "ui", vim.show_pos, { desc = "Inspect Pos" }) +map("n", "uI", "InspectTree", { desc = "Inspect Tree" }) + +---- Terminal ---- + +map("n", "nz", "terminal", { desc = "Open new terminal" }) + +-- Terminal Mappings +map("t", "", "", { desc = "Enter Normal Mode" }) +map("t", "", "wincmd h", { desc = "Go to Left Window" }) +map("t", "", "wincmd j", { desc = "Go to Lower Window" }) +map("t", "", "wincmd k", { desc = "Go to Upper Window" }) +map("t", "", "wincmd l", { desc = "Go to Right Window" }) +map("t", "", "close", { desc = "Hide Terminal" }) +map("t", "", "close", { desc = "which_key_ignore" }) + +--------------------------------------------------------------------------- + +---- Windows ---- + +map("n", "ww", "p", { desc = "Other Window", remap = true }) +map("n", "wd", "c", { desc = "Delete Window", remap = true }) +map("n", "w-", "s", { desc = "Split Window Below", remap = true }) +map("n", "w|", "v", { desc = "Split Window Right", remap = true }) +map("n", "-", "s", { desc = "Split Window Below", remap = true }) +map("n", "|", "v", { desc = "Split Window Right", remap = true }) +map("n", "wm", function() + LazyVim.toggle.maximize() +end, { desc = "Maximize Toggle" }) + +-- Move to window using the hjkl keys +map("n", "", "h", { desc = "Go to Left Window", remap = true }) +map("n", "", "j", { desc = "Go to Lower Window", remap = true }) +map("n", "", "k", { desc = "Go to Upper Window", remap = true }) +map("n", "", "l", { desc = "Go to Right Window", remap = true }) + +map("n", "", "resize +2", { desc = "Increase Window Height" }) +map("n", "", "resize -2", { desc = "Decrease Window Height" }) +map("n", "", "vertical resize -2", { desc = "Decrease Window Width" }) +map("n", "", "vertical resize +2", { desc = "Increase Window Width" }) + +-- Resize window using arrow keys +map("n", "", "resize +2", { desc = "Increase Window Height" }) +map("n", "", "resize -2", { desc = "Decrease Window Height" }) +map("n", "", "vertical resize -2", { desc = "Decrease Window Width" }) +map("n", "", "vertical resize +2", { desc = "Increase Window Width" }) + +-- quit +map("n", "qq", "qa", { desc = "Quit All" }) + +--------------------------------------------------------------------------- + +---- Utils ---- + +-- undotree +map("n", "ut", "UndotreeToggle", { desc = "Toggle undotree" }) + +-- aerial +map("n", "a", "AerialToggle", { desc = "Toggle aerial view" }) +map("n", "]a", "AerialNext", { desc = "Next aerial view" }) +map("n", "[a", "AerialPrev", { desc = "Prev aerial view" }) diff --git a/lua/plugins/blueprints.lua b/lua/plugins/blueprints.lua new file mode 100644 index 0000000..6d00fe4 --- /dev/null +++ b/lua/plugins/blueprints.lua @@ -0,0 +1,12 @@ +-- ╭────────────╮ +-- │ Blueprints │ +-- ╰────────────╯ +return { + { + "dqnid/nvim-blueprints", + name = "blueprints", + init = function() + require("blueprints").setup({ blueprintsDir = "/home/danih/.config/nvim/blueprints" }) + end, + }, +} diff --git a/lua/plugins/code-utils.lua b/lua/plugins/code-utils.lua new file mode 100644 index 0000000..ca16a37 --- /dev/null +++ b/lua/plugins/code-utils.lua @@ -0,0 +1,97 @@ +-- ╭────────────╮ +-- │ Code utils │ +-- ╰────────────╯ +return { + -- │ Code parse │ + { + "nvim-treesitter/nvim-treesitter", + opts = function() + return require("plugins.opts.treesitter") + end, + config = function(_, opts) + require("nvim-treesitter.configs").setup(opts) + end, + }, + -- To test if TreeSitter is working + -- "nvim-treesitter/playground", + { + "nvim-treesitter/nvim-treesitter-context", + opts = function() + return require("plugins.opts.treesitterContext") + end, + }, + + -- │ Completion │ + { + "hrsh7th/nvim-cmp", + enabled = true, + dependencies = { + "hrsh7th/cmp-emoji", + "hrsh7th/cmp-buffer", + "hrsh7th/cmp-emoji", + "hrsh7th/cmp-nvim-lsp", + "hrsh7th/cmp-cmdline", + "hrsh7th/cmp-path", + }, + opts = function() + return require("plugins.opts.cmp") + end, + }, + + { + "L3MON4D3/LuaSnip", + build = "make install_jsregexp", + dependencies = { "rafamadriz/friendly-snippets" }, + }, + { + "saadparwaiz1/cmp_luasnip", + dependencies = { + "hrsh7th/nvim-cmp", + }, + }, + + -- │ Auto close │ + { + "m4xshen/autoclose.nvim", + }, + + { + "windwp/nvim-ts-autotag", + config = function(_, opts) + require('nvim-ts-autotag').setup({ + opts = { + enable_close = true, -- Auto close tags + enable_rename = true, -- Auto rename pairs of tags + enable_close_on_slash = false -- Auto close on trailing ?", + function() + require("which-key").show({ global = false }) + end, + desc = "Buffer Local Keymaps (which-key)", + }, + }, + } +} diff --git a/lua/plugins/navigation.lua b/lua/plugins/navigation.lua new file mode 100644 index 0000000..ac2950f --- /dev/null +++ b/lua/plugins/navigation.lua @@ -0,0 +1,28 @@ +return { + -- ╭────────────╮ + -- │ Navigation │ + -- ╰────────────╯ + { + "folke/flash.nvim", + event = "VeryLazy", + opts = {}, + keys = { + { + "s", + mode = { "n", "x", "o" }, + function() + require("flash").jump() + end, + desc = "Flash", + }, + { + "S", + mode = { "n", "x", "o" }, + function() + require("flash").treesitter() + end, + desc = "Flash Treesitter", + }, + }, + }, +} diff --git a/lua/plugins/opts/aerialview.lua b/lua/plugins/opts/aerialview.lua new file mode 100644 index 0000000..d0fff89 --- /dev/null +++ b/lua/plugins/opts/aerialview.lua @@ -0,0 +1,323 @@ +local config = { + backends = { "treesitter", "lsp", "markdown", "asciidoc", "man" }, + + layout = { + -- These control the width of the aerial window. + -- They can be integers or a float between 0 and 1 (e.g. 0.4 for 40%) + -- min_width and max_width can be a list of mixed types. + -- max_width = {40, 0.2} means "the lesser of 40 columns or 20% of total" + max_width = { 40, 0.2 }, + width = nil, + min_width = 10, + + -- key-value pairs of window-local options for aerial window (e.g. winhl) + win_opts = {}, + + -- Determines the default direction to open the aerial window. The 'prefer' + -- options will open the window in the other direction *if* there is a + -- different buffer in the way of the preferred direction + -- Enum: prefer_right, prefer_left, right, left, float + default_direction = "prefer_right", + + -- Determines where the aerial window will be opened + -- edge - open aerial at the far right/left of the editor + -- window - open aerial to the right/left of the current window + placement = "window", + + -- When the symbols change, resize the aerial window (within min/max constraints) to fit + resize_to_content = true, + + -- Preserve window size equality with (:help CTRL-W_=) + preserve_equality = false, + }, + + -- Determines how the aerial window decides which buffer to display symbols for + -- window - aerial window will display symbols for the buffer in the window from which it was opened + -- global - aerial window will display symbols for the current window + attach_mode = "window", + + -- List of enum values that configure when to auto-close the aerial window + -- unfocus - close aerial when you leave the original source window + -- switch_buffer - close aerial when you change buffers in the source window + -- unsupported - close aerial when attaching to a buffer that has no symbol source + close_automatic_events = {}, + + -- Keymaps in aerial window. Can be any value that `vim.keymap.set` accepts OR a table of keymap + -- options with a `callback` (e.g. { callback = function() ... end, desc = "", nowait = true }) + -- Additionally, if it is a string that matches "actions.", + -- it will use the mapping at require("aerial.actions"). + -- Set to `false` to remove a keymap + keymaps = { + ["?"] = "actions.show_help", + ["g?"] = "actions.show_help", + [""] = "actions.jump", + ["<2-LeftMouse>"] = "actions.jump", + [""] = "actions.jump_vsplit", + [""] = "actions.jump_split", + ["p"] = "actions.scroll", + [""] = "actions.down_and_scroll", + [""] = "actions.up_and_scroll", + ["{"] = "actions.prev", + ["}"] = "actions.next", + ["[["] = "actions.prev_up", + ["]]"] = "actions.next_up", + ["q"] = "actions.close", + ["o"] = "actions.tree_toggle", + ["za"] = "actions.tree_toggle", + ["O"] = "actions.tree_toggle_recursive", + ["zA"] = "actions.tree_toggle_recursive", + ["l"] = "actions.tree_open", + ["zo"] = "actions.tree_open", + ["L"] = "actions.tree_open_recursive", + ["zO"] = "actions.tree_open_recursive", + ["h"] = "actions.tree_close", + ["zc"] = "actions.tree_close", + ["H"] = "actions.tree_close_recursive", + ["zC"] = "actions.tree_close_recursive", + ["zr"] = "actions.tree_increase_fold_level", + ["zR"] = "actions.tree_open_all", + ["zm"] = "actions.tree_decrease_fold_level", + ["zM"] = "actions.tree_close_all", + ["zx"] = "actions.tree_sync_folds", + ["zX"] = "actions.tree_sync_folds", + }, + + -- When true, don't load aerial until a command or function is called + -- Defaults to true, unless `on_attach` is provided, then it defaults to false + lazy_load = true, + + -- Disable aerial on files with this many lines + disable_max_lines = 10000, + + -- Disable aerial on files this size or larger (in bytes) + disable_max_size = 2000000, -- Default 2MB + + -- A list of all symbols to display. Set to false to display all symbols. + -- This can be a filetype map (see :help aerial-filetype-map) + -- To see all available values, see :help SymbolKind + filter_kind = { + "Class", + "Constructor", + "Enum", + "Function", + "Interface", + "Module", + "Method", + "Struct", + }, + + -- Determines line highlighting mode when multiple splits are visible. + -- split_width Each open window will have its cursor location marked in the + -- aerial buffer. Each line will only be partially highlighted + -- to indicate which window is at that location. + -- full_width Each open window will have its cursor location marked as a + -- full-width highlight in the aerial buffer. + -- last Only the most-recently focused window will have its location + -- marked in the aerial buffer. + -- none Do not show the cursor locations in the aerial window. + highlight_mode = "split_width", + + -- Highlight the closest symbol if the cursor is not exactly on one. + highlight_closest = true, + + -- Highlight the symbol in the source buffer when cursor is in the aerial win + highlight_on_hover = false, + + -- When jumping to a symbol, highlight the line for this many ms. + -- Set to false to disable + highlight_on_jump = 300, + + -- Jump to symbol in source window when the cursor moves + autojump = false, + + -- Define symbol icons. You can also specify "Collapsed" to change the + -- icon when the tree is collapsed at that symbol, or "Collapsed" to specify a + -- default collapsed icon. The default icon set is determined by the + -- "nerd_font" option below. + -- If you have lspkind-nvim installed, it will be the default icon set. + -- This can be a filetype map (see :help aerial-filetype-map) + icons = {}, + + -- Control which windows and buffers aerial should ignore. + -- Aerial will not open when these are focused, and existing aerial windows will not be updated + ignore = { + -- Ignore unlisted buffers. See :help buflisted + unlisted_buffers = false, + + -- Ignore diff windows (setting to false will allow aerial in diff windows) + diff_windows = true, + + -- List of filetypes to ignore. + filetypes = {}, + + -- Ignored buftypes. + -- Can be one of the following: + -- false or nil - No buftypes are ignored. + -- "special" - All buffers other than normal, help and man page buffers are ignored. + -- table - A list of buftypes to ignore. See :help buftype for the + -- possible values. + -- function - A function that returns true if the buffer should be + -- ignored or false if it should not be ignored. + -- Takes two arguments, `bufnr` and `buftype`. + buftypes = "special", + + -- Ignored wintypes. + -- Can be one of the following: + -- false or nil - No wintypes are ignored. + -- "special" - All windows other than normal windows are ignored. + -- table - A list of wintypes to ignore. See :help win_gettype() for the + -- possible values. + -- function - A function that returns true if the window should be + -- ignored or false if it should not be ignored. + -- Takes two arguments, `winid` and `wintype`. + wintypes = "special", + }, + + -- Use symbol tree for folding. Set to true or false to enable/disable + -- Set to "auto" to manage folds if your previous foldmethod was 'manual' + -- This can be a filetype map (see :help aerial-filetype-map) + manage_folds = false, + + -- When you fold code with za, zo, or zc, update the aerial tree as well. + -- Only works when manage_folds = true + link_folds_to_tree = false, + + -- Fold code when you open/collapse symbols in the tree. + -- Only works when manage_folds = true + link_tree_to_folds = true, + + -- Set default symbol icons to use patched font icons (see https://www.nerdfonts.com/) + -- "auto" will set it to true if nvim-web-devicons or lspkind-nvim is installed. + nerd_font = "auto", + + -- Call this function when aerial attaches to a buffer. + on_attach = function(bufnr) end, + + -- Call this function when aerial first sets symbols on a buffer. + on_first_symbols = function(bufnr) end, + + -- Automatically open aerial when entering supported buffers. + -- This can be a function (see :help aerial-open-automatic) + open_automatic = false, + + -- Run this command after jumping to a symbol (false will disable) + post_jump_cmd = "normal! zz", + + -- Invoked after each symbol is parsed, can be used to modify the parsed item, + -- or to filter it by returning false. + -- + -- bufnr: a neovim buffer number + -- item: of type aerial.Symbol + -- ctx: a record containing the following fields: + -- * backend_name: treesitter, lsp, man... + -- * lang: info about the language + -- * symbols?: specific to the lsp backend + -- * symbol?: specific to the lsp backend + -- * syntax_tree?: specific to the treesitter backend + -- * match?: specific to the treesitter backend, TS query match + post_parse_symbol = function(bufnr, item, ctx) + return true + end, + + -- Invoked after all symbols have been parsed and post-processed, + -- allows to modify the symbol structure before final display + -- + -- bufnr: a neovim buffer number + -- items: a collection of aerial.Symbol items, organized in a tree, + -- with 'parent' and 'children' fields + -- ctx: a record containing the following fields: + -- * backend_name: treesitter, lsp, man... + -- * lang: info about the language + -- * symbols?: specific to the lsp backend + -- * syntax_tree?: specific to the treesitter backend + post_add_all_symbols = function(bufnr, items, ctx) + return items + end, + + -- When true, aerial will automatically close after jumping to a symbol + close_on_select = false, + + -- The autocmds that trigger symbols update (not used for LSP backend) + update_events = "TextChanged,InsertLeave", + + -- Show box drawing characters for the tree hierarchy + show_guides = false, + + -- Customize the characters used when show_guides = true + guides = { + -- When the child item has a sibling below it + mid_item = "├─", + -- When the child item is the last in the list + last_item = "└─", + -- When there are nested child guides to the right + nested_top = "│ ", + -- Raw indentation + whitespace = " ", + }, + + -- Set this function to override the highlight groups for certain symbols + get_highlight = function(symbol, is_icon, is_collapsed) + -- return "MyHighlight" .. symbol.kind + end, + + -- Options for opening aerial in a floating win + float = { + -- Controls border appearance. Passed to nvim_open_win + border = "rounded", + + -- Determines location of floating window + -- cursor - Opens float on top of the cursor + -- editor - Opens float centered in the editor + -- win - Opens float centered in the window + relative = "cursor", + + -- These control the height of the floating window. + -- They can be integers or a float between 0 and 1 (e.g. 0.4 for 40%) + -- min_height and max_height can be a list of mixed types. + -- min_height = {8, 0.1} means "the greater of 8 rows or 10% of total" + max_height = 0.9, + height = nil, + min_height = { 8, 0.1 }, + + override = function(conf, source_winid) + -- This is the config that will be passed to nvim_open_win. + -- Change values here to customize the layout + return conf + end, + }, + + -- Options for the floating nav windows + nav = { + border = "rounded", + max_height = 0.9, + min_height = { 10, 0.1 }, + max_width = 0.5, + min_width = { 0.2, 20 }, + win_opts = { + cursorline = true, + winblend = 10, + }, + -- Jump to symbol in source window when the cursor moves + autojump = false, + -- Show a preview of the code in the right column, when there are no child symbols + preview = false, + -- Keymaps in the nav window + keymaps = { + [""] = "actions.jump", + ["<2-LeftMouse>"] = "actions.jump", + [""] = "actions.jump_vsplit", + [""] = "actions.jump_split", + ["h"] = "actions.left", + ["l"] = "actions.right", + [""] = "actions.close", + }, + }, + + lsp = { + diagnostics_trigger_update = false, + update_when_errors = true, + update_delay = 300, + }, +} + +return config diff --git a/lua/plugins/opts/autosession.lua b/lua/plugins/opts/autosession.lua new file mode 100644 index 0000000..2e43810 --- /dev/null +++ b/lua/plugins/opts/autosession.lua @@ -0,0 +1,21 @@ +local options = { + auto_session_enabled = true, + auto_save_enabled = false, + auto_restore_enabled = false, + auto_session_use_git_branch = true, + log_level = "error", + auto_session_suppress_dirs = { "~/", "~/Projects", "~/Downloads", "/" }, + session_lens = { + -- If load_on_setup is false, make sure you use `:SessionSearch` to open the picker as it will initialize everything first + load_on_setup = false, + theme_conf = { border = true }, + previewer = false, + mappings = { + -- Mode can be a string or a table, e.g. {"i", "n"} for both insert and normal mode + delete_session = { "i", "" }, + alternate_session = { "i", "" }, + }, + }, +} + +return options diff --git a/lua/plugins/opts/bufferline.lua b/lua/plugins/opts/bufferline.lua new file mode 100644 index 0000000..eb2b978 --- /dev/null +++ b/lua/plugins/opts/bufferline.lua @@ -0,0 +1,108 @@ +local config = { + highlights = { + buffer_selected = { bold = true }, + diagnostic_selected = { bold = true }, + info_selected = { bold = true }, + info_diagnostic_selected = { bold = true }, + warning_selected = { bold = true }, + warning_diagnostic_selected = { bold = true }, + error_selected = { bold = true }, + error_diagnostic_selected = { bold = true }, + }, + options = { + themeable = true, + numbers = "none", + diagnostics = "nvim_lsp", -- or "coc" + max_prefix_length = 8, + close_command = "b# | bd#", + right_mouse_command = "b# | bd#", + left_mouse_command = "buffer %d", + buffer_close_icon = "󰅖", + modified_icon = "●", + close_icon = "", + left_trunc_marker = "", + right_trunc_marker = "", + max_name_length = 18, + truncate_names = true, + tab_size = 18, + color_icons = true, + show_buffer_icons = true, + show_buffer_close_icons = true, + show_tab_indicators = true, + duplicates_across_groups = true, -- whether to consider duplicate paths in different groups as duplicates + persist_buffer_sort = true, -- whether or not custom sorted buffers should persist + separator_style = { "▏", "" }, -- "slant" | "slope" | "thick" | "thin" | { 'any', 'any' }, + -- always_show_bufferline = false, + auto_toggle_bufferline = true, + show_close_icon = true, + hover = { + enabled = true, + delay = 200, + reveal = { "close" }, + }, + offsets = { + { + filetype = "neo-tree", + text = "", + highlight = "Directory", + separator = "", -- use a "true" to enable the default, or set your own character + }, + }, + groups = { + options = { + toggle_hidden_on_enter = true, -- when you re-enter a hidden group this options re-opens that group so the buffer is visible + }, + items = { + { + name = "Tests", + highlight = { underline = true, sp = "blue" }, + priority = 2, + -- icon = " ", + matcher = function(buf) + return buf.path:match("%_test") or buf.path:match("%_spec") + end, + }, + { + name = "Docs", + -- icon = "󰈙 ", + highlight = { undercurl = false, sp = "green" }, + auto_close = false, + matcher = function(buf) + return buf.path:match("%.md") or buf.path:match("%.txt") + end, + separator = { + style = require("bufferline.groups").separator.tab, + }, + }, + { + name = "Shells", + icon = " ", + highlight = { undercurl = false, sp = "grey" }, + auto_close = false, + matcher = function(buf) + return buf.path:match("zsh") + end, + separator = { + style = require("bufferline.groups").separator.tab, + }, + }, + { + name = "Docker", + highlight = { undercurl = false, sp = "blue" }, + auto_close = false, + matcher = function(buf) + return buf.path:match("dockerfile") + or buf.path:match("DOCKERFILE") + or buf.path:match("Dockerfile") + or buf.path:match("docker%-compose%.yml") + end, + separator = { + style = require("bufferline.groups").separator.tab, + }, + }, + }, + }, + }, +} + +return config diff --git a/lua/plugins/opts/cmp.lua b/lua/plugins/opts/cmp.lua new file mode 100644 index 0000000..d367093 --- /dev/null +++ b/lua/plugins/opts/cmp.lua @@ -0,0 +1,83 @@ +local cmp = require("cmp") + +local function border(hl_name) + return { + { "╭", hl_name }, + { "─", hl_name }, + { "╮", hl_name }, + { "│", hl_name }, + { "╯", hl_name }, + { "─", hl_name }, + { "╰", hl_name }, + { "│", hl_name }, + } +end + +local options = { + completion = { + completeopt = "menu,menuone", + }, + + window = { + completion = { + side_padding = 1, + scrollbar = false, + }, + documentation = { + border = border("CmpDocBorder"), + winhighlight = "Normal:CmpDoc", + }, + }, + snippet = { + expand = function(args) + require("luasnip").lsp_expand(args.body) + end, + }, + preselect = cmp.PreselectMode.None, + mapping = { + [""] = cmp.mapping.select_prev_item(), + [""] = cmp.mapping.select_next_item(), + [""] = cmp.mapping.scroll_docs(-4), + [""] = cmp.mapping.scroll_docs(4), + [""] = cmp.mapping.complete(), + [""] = cmp.mapping.close(), + [""] = cmp.mapping.confirm({ + behavior = cmp.ConfirmBehavior.Insert, + select = true, + }), + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item() + elseif require("luasnip").expand_or_jumpable() then + vim.fn.feedkeys(vim.api.nvim_replace_termcodes("luasnip-expand-or-jump", true, true, true), "") + else + fallback() + end + end, { + "i", + "s", + }), + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_prev_item() + elseif require("luasnip").jumpable(-1) then + vim.fn.feedkeys(vim.api.nvim_replace_termcodes("luasnip-jump-prev", true, true, true), "") + else + fallback() + end + end, { + "i", + "s", + }), + }, + sources = { + { name = "nvim_lsp" }, + { name = "luasnip" }, + { name = "buffer" }, + { name = "nvim_lua" }, + { name = "path" }, + { name = "emoji" }, + }, +} + +return options diff --git a/lua/plugins/opts/conformFormat.lua b/lua/plugins/opts/conformFormat.lua new file mode 100644 index 0000000..e07d940 --- /dev/null +++ b/lua/plugins/opts/conformFormat.lua @@ -0,0 +1,36 @@ +local config = { + -- Define your formatters + formatters_by_ft = { + rust = { "rustfmt" }, + lua = { "stylua" }, + go = { "goimports", "gofmt" }, + javascript = { "prettierd", "prettier", "biome", stop_after_first = true }, + javascriptreact = { "prettierd", "prettier", "biome", stop_after_first = true }, + typescript = { "prettierd", "prettier", "biome", stop_after_first = true }, + typescriptreact = { "prettierd", "prettier", "biome", stop_after_first = true }, + css = { "prettierd", "prettier", "biome", stop_after_first = true }, + scss = { "prettierd", "prettier", "biome", stop_after_first = true }, + -- python = function(bufnr) + -- if require("conform").get_formatter_info("ruff_format", bufnr).available then + -- return { "ruff_format" } + -- else + -- return { "isort", "black" } + -- end + -- end, + ["_"] = { "trim_whitespace" }, -- run only on filetypes without formater + -- ["*"] = { "trim_whitespace" }, -- run in all filetypes + }, + -- Managed by lazyvim + -- format_on_save = { + -- timeout_ms = 500, + -- lsp_format = "fallback", + -- }, + -- Customize formatters + formatters = { + shfmt = { + prepend_args = { "-i", "2" }, + }, + }, +} + +return config diff --git a/lua/plugins/opts/gitsigns.lua b/lua/plugins/opts/gitsigns.lua new file mode 100644 index 0000000..0b24284 --- /dev/null +++ b/lua/plugins/opts/gitsigns.lua @@ -0,0 +1,42 @@ +local config = { + signs = { + add = { text = "┃" }, + change = { text = "┃" }, + delete = { text = "_" }, + topdelete = { text = "‾" }, + changedelete = { text = "~" }, + untracked = { text = "┆" }, + }, + signcolumn = true, -- Toggle with `:Gitsigns toggle_signs` + numhl = false, -- Toggle with `:Gitsigns toggle_numhl` + linehl = false, -- Toggle with `:Gitsigns toggle_linehl` + word_diff = false, -- Toggle with `:Gitsigns toggle_word_diff` + watch_gitdir = { + follow_files = true, + }, + auto_attach = true, + attach_to_untracked = false, + current_line_blame = true, -- Toggle with `:Gitsigns toggle_current_line_blame` + current_line_blame_opts = { + virt_text = true, + virt_text_pos = "eol", -- 'eol' | 'overlay' | 'right_align' + delay = 500, + ignore_whitespace = false, + virt_text_priority = 100, + }, + current_line_blame_formatter = ", - ", + sign_priority = 6, + update_debounce = 100, + status_formatter = nil, -- Use default + max_file_length = 40000, -- Disable if file is longer than this (in lines) + preview_config = { + -- Options passed to nvim_open_win + border = "single", + style = "minimal", + relative = "cursor", + row = 0, + col = 1, + }, +} + +return config diff --git a/lua/plugins/opts/lualine.lua b/lua/plugins/opts/lualine.lua new file mode 100644 index 0000000..8b34118 --- /dev/null +++ b/lua/plugins/opts/lualine.lua @@ -0,0 +1,42 @@ +local options = { + options = { + icons_enabled = true, + theme = "auto", + component_separators = { left = "", right = "" }, + section_separators = { left = "", right = "" }, + disabled_filetypes = { + statusline = {}, + winbar = {}, + }, + ignore_focus = {}, + always_divide_middle = true, + globalstatus = true, + refresh = { + statusline = 1000, + tabline = 1000, + winbar = 1000, + }, + }, + sections = { + lualine_a = { "mode" }, + lualine_b = { "branch", "diff" }, + lualine_c = { "filename" }, + lualine_x = { "diagnostics", "filetype", "encoding", "fileformat" }, + lualine_y = { "progress" }, + lualine_z = { "location" }, + }, + inactive_sections = { + lualine_a = {}, + lualine_b = {}, + lualine_c = { "filename" }, + lualine_x = { "location" }, + lualine_y = {}, + lualine_z = {}, + }, + tabline = {}, + winbar = {}, + inactive_winbar = {}, + extensions = {}, +} + +return options diff --git a/lua/plugins/opts/neotree.lua b/lua/plugins/opts/neotree.lua new file mode 100644 index 0000000..3a8ab0f --- /dev/null +++ b/lua/plugins/opts/neotree.lua @@ -0,0 +1,268 @@ +local config = { + close_if_last_window = false, + popup_border_style = "rounded", + enable_git_status = true, + enable_diagnostics = true, + open_files_do_not_replace_types = { "terminal", "trouble", "qf" }, -- when opening files, do not use windows containing these filetypes or buftypes + sort_case_insensitive = false, -- used when sorting files and directories in the tree + sort_function = nil, + follow_current_file = { enabled = true }, + source_selector = { + winbar = true, + statusline = false, + }, + default_component_configs = { + container = { + enable_character_fade = true, + }, + indent = { + indent_size = 2, + padding = 1, -- extra padding on left hand side + -- indent guides + with_markers = true, + indent_marker = "│", + last_indent_marker = "└", + highlight = "NeoTreeIndentMarker", + -- expander config, needed for nesting files + with_expanders = nil, -- if nil and file nesting is enabled, will enable expanders + expander_collapsed = "", + expander_expanded = "", + expander_highlight = "NeoTreeExpander", + }, + icon = { + folder_closed = "", + folder_open = "", + folder_empty = "󰜌", + -- The next two settings are only a fallback, if you use nvim-web-devicons and configure default icons there + -- then these will never be used. + default = "*", + highlight = "NeoTreeFileIcon", + }, + modified = { + symbol = "[+]", + highlight = "NeoTreeModified", + }, + name = { + trailing_slash = false, + use_git_status_colors = true, + highlight = "NeoTreeFileName", + }, + git_status = { + symbols = { + -- Change type + added = "", -- or "✚", but this is redundant info if you use git_status_colors on the name + modified = "", -- or "", but this is redundant info if you use git_status_colors on the name + deleted = "✖", -- this can only be used in the git_status source + renamed = "󰁕", -- this can only be used in the git_status source + -- Status type + untracked = "", + ignored = "", + unstaged = "󰄱", + staged = "", + conflict = "", + }, + }, + -- If you don't want to use these columns, you can set `enabled = false` for each of them individually + file_size = { + enabled = true, + required_width = 64, -- min width of window required to show this column + }, + type = { + enabled = true, + required_width = 122, -- min width of window required to show this column + }, + last_modified = { + enabled = true, + required_width = 88, -- min width of window required to show this column + }, + created = { + enabled = true, + required_width = 110, -- min width of window required to show this column + }, + symlink_target = { + enabled = false, + }, + }, + -- A list of functions, each representing a global custom command + -- that will be available in all sources (if not overridden in `opts[source_name].commands`) + -- see `:h neo-tree-custom-commands-global` + commands = {}, + window = { + position = "left", + width = 40, + mapping_options = { + noremap = true, + nowait = true, + }, + mappings = { + [""] = { + "toggle_node", + nowait = false, -- disable `nowait` if you have existing combos starting with this char that you want to use + }, + ["<2-LeftMouse>"] = "open", + [""] = "open", + [""] = "cancel", -- close preview or floating neo-tree window + ["P"] = { "toggle_preview", config = { use_float = true, use_image_nvim = true } }, + -- Read `# Preview Mode` for more information + ["l"] = "focus_preview", + ["S"] = "open_split", + ["s"] = "open_vsplit", + -- ["S"] = "split_with_window_picker", + -- ["s"] = "vsplit_with_window_picker", + ["t"] = "open_tabnew", + -- [""] = "open_drop", + -- ["t"] = "open_tab_drop", + ["w"] = "open_with_window_picker", + --["P"] = "toggle_preview", -- enter preview mode, which shows the current node without focusing + ["C"] = "close_node", + -- ['C'] = 'close_all_subnodes', + ["z"] = "close_all_nodes", + --["Z"] = "expand_all_nodes", + ["a"] = { + "add", + -- this command supports BASH style brace expansion ("x{a,b,c}" -> xa,xb,xc). see `:h neo-tree-file-actions` for details + -- some commands may take optional config options, see `:h neo-tree-mappings` for details + config = { + show_path = "none", -- "none", "relative", "absolute" + }, + }, + ["A"] = "add_directory", -- also accepts the optional config.show_path option like "add". this also supports BASH style brace expansion. + ["d"] = "delete", + ["r"] = "rename", + ["y"] = "copy_to_clipboard", + ["x"] = "cut_to_clipboard", + ["p"] = "paste_from_clipboard", + ["c"] = "copy", -- takes text input for destination, also accepts the optional config.show_path option like "add": + -- ["c"] = { + -- "copy", + -- config = { + -- show_path = "none" -- "none", "relative", "absolute" + -- } + --} + ["m"] = "move", -- takes text input for destination, also accepts the optional config.show_path option like "add". + ["q"] = "close_window", + ["R"] = "refresh", + ["?"] = "show_help", + ["<"] = "prev_source", + [">"] = "next_source", + ["i"] = "show_file_details", + }, + }, + nesting_rules = {}, + filesystem = { + filtered_items = { + visible = false, -- when true, they will just be displayed differently than normal items + hide_dotfiles = true, + hide_gitignored = true, + hide_hidden = true, -- only works on Windows for hidden files/directories + hide_by_name = { + --"node_modules" + }, + hide_by_pattern = { -- uses glob style patterns + --"*.meta", + --"*/src/*/tsconfig.json", + }, + always_show = { -- remains visible even if other settings would normally hide it + --".gitignored", + }, + always_show_by_pattern = { -- uses glob style patterns + --".env*", + }, + never_show = { -- remains hidden even if visible is toggled to true, this overrides always_show + --".DS_Store", + --"thumbs.db" + }, + never_show_by_pattern = { -- uses glob style patterns + --".null-ls_*", + }, + }, + group_empty_dirs = false, -- when true, empty folders will be grouped together + hijack_netrw_behavior = "open_default", -- netrw disabled, opening a directory opens neo-tree + -- in whatever position is specified in window.position + -- "open_current", -- netrw disabled, opening a directory opens within the + -- window like netrw would, regardless of window.position + -- "disabled", -- netrw left alone, neo-tree does not handle opening dirs + use_libuv_file_watcher = false, -- This will use the OS level file watchers to detect changes + follow_current_file = { enabled = true }, + -- instead of relying on nvim autocmd events. + window = { + mappings = { + [""] = "navigate_up", + ["."] = "set_root", + ["H"] = "toggle_hidden", + ["/"] = "fuzzy_finder", + ["D"] = "fuzzy_finder_directory", + ["#"] = "fuzzy_sorter", -- fuzzy sorting using the fzy algorithm + -- ["D"] = "fuzzy_sorter_directory", + ["f"] = "filter_on_submit", + [""] = "clear_filter", + ["[g"] = "prev_git_modified", + ["]g"] = "next_git_modified", + ["o"] = { "show_help", nowait = false, config = { title = "Order by", prefix_key = "o" } }, + ["oc"] = { "order_by_created", nowait = false }, + ["od"] = { "order_by_diagnostics", nowait = false }, + ["og"] = { "order_by_git_status", nowait = false }, + ["om"] = { "order_by_modified", nowait = false }, + ["on"] = { "order_by_name", nowait = false }, + ["os"] = { "order_by_size", nowait = false }, + ["ot"] = { "order_by_type", nowait = false }, + -- [''] = function(state) ... end, + }, + fuzzy_finder_mappings = { -- define keymaps for filter popup window in fuzzy_finder_mode + [""] = "move_cursor_down", + [""] = "move_cursor_down", + [""] = "move_cursor_up", + [""] = "move_cursor_up", + -- [''] = function(state, scroll_padding) ... end, + }, + }, + + commands = {}, -- Add a custom command or override a global one using the same function name + }, + buffers = { + follow_current_file = { + enabled = true, -- This will find and focus the file in the active buffer every time + -- -- the current file is changed while the tree is open. + leave_dirs_open = false, -- `false` closes auto expanded dirs, such as with `:Neotree reveal` + }, + group_empty_dirs = true, -- when true, empty folders will be grouped together + show_unloaded = true, + window = { + mappings = { + ["bd"] = "buffer_delete", + [""] = "navigate_up", + ["."] = "set_root", + ["o"] = { "show_help", nowait = false, config = { title = "Order by", prefix_key = "o" } }, + ["oc"] = { "order_by_created", nowait = false }, + ["od"] = { "order_by_diagnostics", nowait = false }, + ["om"] = { "order_by_modified", nowait = false }, + ["on"] = { "order_by_name", nowait = false }, + ["os"] = { "order_by_size", nowait = false }, + ["ot"] = { "order_by_type", nowait = false }, + }, + }, + }, + git_status = { + window = { + position = "float", + mappings = { + ["A"] = "git_add_all", + ["gu"] = "git_unstage_file", + ["ga"] = "git_add_file", + ["gr"] = "git_revert_file", + ["gc"] = "git_commit", + ["gp"] = "git_push", + ["gg"] = "git_commit_and_push", + ["o"] = { "show_help", nowait = false, config = { title = "Order by", prefix_key = "o" } }, + ["oc"] = { "order_by_created", nowait = false }, + ["od"] = { "order_by_diagnostics", nowait = false }, + ["om"] = { "order_by_modified", nowait = false }, + ["on"] = { "order_by_name", nowait = false }, + ["os"] = { "order_by_size", nowait = false }, + ["ot"] = { "order_by_type", nowait = false }, + }, + }, + }, +} + +return config diff --git a/lua/plugins/opts/noice.lua b/lua/plugins/opts/noice.lua new file mode 100644 index 0000000..1c139db --- /dev/null +++ b/lua/plugins/opts/noice.lua @@ -0,0 +1,81 @@ +local config = { + views = { + cmdline_popup = { + position = { + row = 3, + col = "50%", + }, + size = { + width = 60, + height = "auto", + }, + }, + cmdline_popupmenu = { + position = { + row = 6, + col = "50%", + }, + size = { + width = 60, + height = "auto", + }, + }, + }, + cmdline = { + enabled = true, + view = "cmdline_popup", + opts = {}, + ---@type table + format = { + cmdline = { pattern = "^:", icon = "λ", lang = "vim", title = "" }, + search_down = { kind = "search", pattern = "^/", icon = " ", lang = "regex" }, + search_up = { kind = "search", pattern = "^%?", icon = " ", lang = "regex" }, + filter = { pattern = "^:%s*!", icon = "$", lang = "bash" }, + lua = { + pattern = { "^:%s*lua%s+", "^:%s*lua%s*=%s*", "^:%s*=%s*" }, + icon = "", + lang = "lua", + }, + help = { pattern = "^:%s*he?l?p?%s+", icon = "" }, + input = {}, -- Used by input() + -- lua = false, -- to disable a format, set to `false` + }, + }, + notify = { + -- Noice can be used as `vim.notify` so you can route any notification like other messages + -- Notification messages have their level and other properties set. + -- event is always "notify" and kind can be any log level as a string + -- The default routes will forward notifications to nvim-notify + -- Benefit of using Noice for this is the routing and consistent history view + enabled = false, + view = "notify", + }, + lsp = { + -- override markdown rendering so that **cmp** and other plugins use **Treesitter** + override = { + ["vim.lsp.util.convert_input_to_markdown_lines"] = true, + ["vim.lsp.util.stylize_markdown"] = true, + ["cmp.entry.get_documentation"] = true, -- requires hrsh7th/nvim-cmp + }, + }, + presets = { + bottom_search = true, -- use a classic bottom cmdline for search + command_palette = true, -- position the cmdline and popupmenu together + long_message_to_split = true, -- long messages will be sent to a split + inc_rename = false, -- enables an input dialog for inc-rename.nvim + lsp_doc_border = false, -- add a border to hover docs and signature help + }, + routes = { + { view = "cmdline", filter = { event = "msg_showmode" } }, + { + filter = { + event = "msg_show", + kind = "", + find = "written", + }, + opts = { skip = true }, + }, + }, +} + +return config diff --git a/lua/plugins/opts/telescope.lua b/lua/plugins/opts/telescope.lua new file mode 100644 index 0000000..ed90e68 --- /dev/null +++ b/lua/plugins/opts/telescope.lua @@ -0,0 +1,63 @@ +local options = { + defaults = { + vimgrep_arguments = { + "rg", + "-L", + "--color=never", + "--no-heading", + "--with-filename", + "--line-number", + "--column", + "--smart-case", + }, + prompt_prefix = "  ", + selection_caret = " ", + entry_prefix = " ", + initial_mode = "insert", + selection_strategy = "reset", + sorting_strategy = "ascending", + layout_strategy = "horizontal", + layout_config = { + horizontal = { + prompt_position = "top", + preview_width = 0.55, + results_width = 0.8, + }, + vertical = { + mirror = false, + }, + width = 0.87, + height = 0.80, + preview_cutoff = 120, + }, + file_sorter = require("telescope.sorters").get_fuzzy_file, + file_ignore_patterns = { "node_modules" }, + generic_sorter = require("telescope.sorters").get_generic_fuzzy_sorter, + path_display = { "truncate" }, + winblend = 0, + border = {}, + borderchars = { "─", "│", "─", "│", "╭", "╮", "╯", "╰" }, + color_devicons = true, + set_env = { ["COLORTERM"] = "truecolor" }, -- default = nil, + file_previewer = require("telescope.previewers").vim_buffer_cat.new, + grep_previewer = require("telescope.previewers").vim_buffer_vimgrep.new, + qflist_previewer = require("telescope.previewers").vim_buffer_qflist.new, + -- Developer configurations: Not meant for general override + buffer_previewer_maker = require("telescope.previewers").buffer_previewer_maker, + mappings = { + n = { ["q"] = require("telescope.actions").close }, + }, + }, + + extensions_list = { "fzf" }, + extensions = { + fzf = { + fuzzy = true, + override_generic_sorter = true, + override_file_sorter = true, + case_mode = "smart_case", + }, + }, +} + +return options diff --git a/lua/plugins/opts/treesitter.lua b/lua/plugins/opts/treesitter.lua new file mode 100644 index 0000000..1c5b9ae --- /dev/null +++ b/lua/plugins/opts/treesitter.lua @@ -0,0 +1,35 @@ +local options = { + auto_install = true, + ensure_installed = { + "lua", + "css", + "scss", + "html", + "json", + "tsx", + "bash", + "javascript", + "json", + "markdown", + "markdown_inline", + "python", + "query", + "regex", + "typescript", + "styled", + "vim", + "yaml", + "rust", + "ruby", + "c", + }, + + highlight = { + enable = true, + use_languagetree = true, + }, + + indent = { enable = true }, +} + +return options diff --git a/lua/plugins/opts/treesitterContext.lua b/lua/plugins/opts/treesitterContext.lua new file mode 100644 index 0000000..b9f8972 --- /dev/null +++ b/lua/plugins/opts/treesitterContext.lua @@ -0,0 +1,16 @@ +local options = { + enable = true, -- Enable this plugin (Can be enabled/disabled later via commands) + max_lines = 1, -- How many lines the window should span. Values <= 0 mean no limit. + min_window_height = 0, -- Minimum editor window height to enable context. Values <= 0 mean no limit. + line_numbers = true, + multiline_threshold = 20, -- Maximum number of lines to show for a single context + trim_scope = "outer", -- Which context lines to discard if `max_lines` is exceeded. Choices: 'inner', 'outer' + mode = "cursor", -- Line used to calculate context. Choices: 'cursor', 'topline' + -- Separator between context and content. Should be a single character string, like '-'. + -- When separator is set, the context will only show up when there are at least 2 lines above cursorline. + separator = nil, + zindex = 20, -- The Z-index of the context window + on_attach = nil, -- (fun(buf: integer): boolean) return false to disable attaching +} + +return options diff --git a/lua/plugins/opts/which-key.lua b/lua/plugins/opts/which-key.lua new file mode 100644 index 0000000..564deeb --- /dev/null +++ b/lua/plugins/opts/which-key.lua @@ -0,0 +1,35 @@ +local options = { + plugins = { + marks = true, -- shows a list of your marks on ' and ` + registers = true, -- shows your registers on " in NORMAL or in INSERT mode + spelling = { + enabled = true, -- enabling this will show WhichKey when pressing z= to select spelling suggestions + suggestions = 20, -- how many suggestions should be shown in the list? + }, + }, + replace = { + -- override the label used to display some keys. It doesn't affect WK in any other way + [""] = "SPC", + [""] = "RET", + [""] = "TAB", + }, + icons = { + breadcrumb = "»", -- symbol used in the command line area that shows your active key combo + separator = "➜", -- symbol used between a key and it's label + group = "+", -- symbol prepended to a group + }, + win = { + border = "single", -- none, single, double, shadow + position = "top", -- bottom, top + margin = { 1, 0, 1, 0 }, -- extra window margin [top, right, bottom, left] + padding = { 2, 2, 2, 2 }, -- extra window padding [top, right, bottom, left] + }, + layout = { + height = { min = 4, max = 25 }, -- min and max height of the columns + width = { min = 20, max = 50 }, -- min and max width of the columns + spacing = 3, -- spacing between columns + align = "left", -- align columns left, center or right + }, +} + +return options diff --git a/lua/plugins/search.lua b/lua/plugins/search.lua new file mode 100644 index 0000000..2b6b98c --- /dev/null +++ b/lua/plugins/search.lua @@ -0,0 +1,32 @@ +-- ╭───────────╮ +-- │ Telescope │ +-- ╰───────────╯ +return { + { + "nvim-telescope/telescope.nvim", + dependencies = { + "nvim-treesitter/nvim-treesitter", + { "nvim-telescope/telescope-fzf-native.nvim", build = "make" }, + { + "isak102/telescope-git-file-history.nvim", + dependencies = { + "nvim-lua/plenary.nvim", + "tpope/vim-fugitive", + }, + }, + }, + cmd = "Telescope", + opts = function() + return require("plugins.opts.telescope") + end, + config = function(_, opts) + local telescope = require("telescope") + telescope.setup(opts) + + -- load extensions + for _, ext in ipairs(opts.extensions_list) do + telescope.load_extension(ext) + end + end, + }, +} diff --git a/lua/plugins/sessions.lua b/lua/plugins/sessions.lua new file mode 100644 index 0000000..1945e94 --- /dev/null +++ b/lua/plugins/sessions.lua @@ -0,0 +1,16 @@ +-- ╭──────────╮ +-- │ Sessions │ +-- ╰──────────╯ +return { + { + + "rmagatti/auto-session", + dependencies = { + "nvim-telescope/telescope.nvim", + }, + opts = function() + return require("plugins.opts.autosession") + end, + lazy = false, + }, +} diff --git a/lua/plugins/style.lua b/lua/plugins/style.lua new file mode 100644 index 0000000..ef20362 --- /dev/null +++ b/lua/plugins/style.lua @@ -0,0 +1,54 @@ +-- ╭─────────╮ +-- │ Styling │ +-- ╰─────────╯ +return { + { + -- "dqnid/plain-colors.nvim", + -- dir = "~/Documents/Proyectos/neovim-theme", + dir = "~/Documents/Code/plain-colors.nvim", + name = "rose-pine", + opts = { + variant = "darker", -- dark, light, darker + }, + }, + { + "folke/noice.nvim", + event = "VeryLazy", + dependencies = { + "MunifTanjim/nui.nvim", + -- OPTIONAL: (if not mini is the backup) + -- "rcarriga/nvim-notify", + }, + opts = function() + return require("plugins.opts.noice") + end, + }, + + { + "norcalli/nvim-colorizer.lua", + config = function() + require("colorizer").setup({}) + end, + }, + + { "shortcuts/no-neck-pain.nvim", version = "*" }, + + { + "sphamba/smear-cursor.nvim", + opts = { + smear_between_buffers = false, + smear_between_neighbor_lines = true, + scroll_buffer_space = true, + -- Set to `true` if your font supports legacy computing symbols (block unicode symbols). + legacy_computing_symbols_support = false, + smear_insert_mode = true, + + -- fast smear + stiffness = 0.8, -- 0.6 [0, 1] + trailing_stiffness = 0.5, -- 0.4 [0, 1] + stiffness_insert_mode = 0.6, -- 0.4 [0, 1] + trailing_stiffness_insert_mode = 0.6, -- 0.4 [0, 1] + distance_stop_animating = 0.5, -- 0.1 > 0 + }, + }, +}