diff --git a/init.lua b/init.lua index a29ff1d..5a146a5 100644 --- a/init.lua +++ b/init.lua @@ -9,8 +9,6 @@ vim.o.tabstop = 4 vim.o.shiftwidth = 0 vim.o.expandtab = true -vim.wo[0][0].foldexpr = "v:lua.vim.treesitter.foldexpr()" -vim.wo[0][0].foldmethod = "expr" vim.o.foldcolumn = "1" vim.o.foldlevel = 99 vim.o.foldlevelstart = 99 @@ -33,309 +31,17 @@ end vim.opt.rtp:prepend(lazypath) require("lazy").setup({ - { - "folke/tokyonight.nvim", - lazy = false, - priority = 1000, - opts = {}, - }, - { - "nvim-treesitter/nvim-treesitter", - build = ":TSUpdate", - config = function() - local ensureInstalled = { - "lua", - "python", - "javascript", - "typescript", - "java", - "go", - "rust", - "html", - "css", - "json", - "yaml", - "markdown", - "sql", - "org", - } - local alreadyInstalled = require("nvim-treesitter.config").get_installed() - local parsersToInstall = vim.iter(ensureInstalled) - :filter(function(parser) - return not vim.tbl_contains(alreadyInstalled, parser) - end) - :totable() - require("nvim-treesitter").install(parsersToInstall) - end, - }, - { - "nvim-treesitter/nvim-treesitter-textobjects", - branch = "main", - }, - { - "junegunn/fzf.vim", - dependencies = { - "https://github.com/junegunn/fzf", - }, - keys = { - { "", "Files", desc = "Find files" }, - { ",", "Buffers", desc = "Find buffers" }, - { "/", "Rg", desc = "Search project" }, - }, - }, - { - "stevearc/oil.nvim", - config = function() - require("oil").setup() - end, - keys = { - { "-", "Oil", desc = "Browse files from here" }, - }, - }, - { "nvim-tree/nvim-web-devicons", opts = {} }, - { - "NeogitOrg/neogit", - lazy = true, - dependencies = { - "nvim-lua/plenary.nvim", -- required - "sindrets/diffview.nvim", -- optional - Diff integration - }, - cmd = "Neogit", - keys = { - { "gg", "Neogit", desc = "Show Neogit UI" }, - }, - }, - { - "farmergreg/vim-lastplace", - event = "BufReadPost", - }, - { - "windwp/nvim-autopairs", - event = "InsertEnter", - config = function() - require("nvim-autopairs").setup() - end, - }, - { - "numToStr/Comment.nvim", - event = "VeryLazy", - config = function() - require("Comment").setup() - end, - }, - { - "folke/flash.nvim", - event = "VeryLazy", - config = function() - require("flash").setup({ - modes = { - search = { - enabled = true, - }, - char = { - enabled = false, - }, - }, - }) - end, - }, - { - "folke/snacks.nvim", - priority = 1000, - lazy = false, - ---@type snacks.Config - opts = { - bigfile = { enabled = true }, - dashboard = { enabled = true }, - explorer = { enabled = true }, - indent = { enabled = true }, - input = { enabled = true }, - picker = { enabled = true }, - notifier = { enabled = true }, - quickfile = { enabled = true }, - scope = { enabled = true }, - scroll = { - enabled = true, - animate = { - duration = { step = 10, total = 100 }, - easing = "linear", - }, - }, - statuscolumn = { enabled = true }, - words = { enabled = true }, - }, - config = function(_, opts) - function floating_terminal() - require("snacks").terminal("fish", { - win = { - position = "float", - width = 0.8, - height = 0.8, - border = "rounded", - }, - }) - end - vim.keymap.set("n", "tf", floating_terminal, { desc = "Open floating terminal" }) - vim.keymap.set("n", "\\", floating_terminal, { desc = "Open floating terminal" }) - require("snacks").setup(opts) - end, - }, - { - "lukas-reineke/indent-blankline.nvim", - event = { "VeryLazy" }, - config = function() - require("ibl").setup() - end, - }, - { - "https://github.com/nvim-lualine/lualine.nvim", - event = "VeryLazy", - config = function() - require("lualine").setup() - end, - }, - { - "stevearc/conform.nvim", - opts = {}, - config = function() - local conform = require("conform") - conform.setup({ - formatters_by_ft = { - lua = { "stylua" }, - python = { - "ruff_fix", - "ruff_format", - }, - }, - }) - - -- Command to format buffer or range - vim.api.nvim_create_user_command("Format", function(args) - local range = nil - if args.count ~= -1 then - local end_line = vim.api.nvim_buf_get_lines(0, args.line2 - 1, args.line2, true)[1] - range = { - start = { args.line1, 0 }, - ["end"] = { args.line2, end_line:len() }, - } - end - require("conform").format({ - async = true, - lsp_fallback = true, - range = range, - }) - end, { range = true, desc = "Format buffer or range with conform.nvim" }) - - -- Keymap for format - vim.keymap.set("n", "lf", "Format", { desc = "Format buffer with conform.nvim" }) - end, - }, - { - "serhez/bento.nvim", - config = function() - require("bento").setup({ - main_keymap = ",", - }) - end, - }, - { - "zbirenbaum/copilot.lua", - dependencies = { - "copilotlsp-nvim/copilot-lsp", - }, - cmd = "Copilot", - build = ":Copilot auth", - event = "BufReadPost", - config = function() - require("copilot").setup({ - suggestion = { - enabled = true, - auto_trigger = true, - keymap = { - accept = "", - accept_line = "", - accept_word = "", - next = "", - prev = "", - dismiss = "", - }, - }, - nes = { - enabled = false, - keymap = { - accept_and_goto = "p", - accept = false, - dismiss = "", - }, - }, - panel = { enabled = false }, - filetypes = { - lua = true, - markdown = true, - help = true, - }, - }) - vim.api.nvim_create_autocmd("User", { - pattern = "BlinkCmpMenuOpen", - callback = function() - vim.b.copilot_suggestion_hidden = true - end, - }) - - vim.api.nvim_create_autocmd("User", { - pattern = "BlinkCmpMenuClose", - callback = function() - vim.b.copilot_suggestion_hidden = false - end, - }) - end, - }, - { - "CopilotC-Nvim/CopilotChat.nvim", - dependencies = { - { "nvim-lua/plenary.nvim", branch = "master" }, - }, - build = "make tiktoken", - opts = { - -- See Configuration section for options - }, - }, - { - "nvim-orgmode/orgmode", - tag = "0.7.0", - event = "VeryLazy", - ft = { "org" }, - config = function() - require("orgmode").setup({ - org_agenda_files = "~/org/**/*", - org_default_notes_file = "~/org/refile.org", - }) - end, - }, - { - "chipsenkbeil/org-roam.nvim", - tag = "0.2.0", - config = function() - require("org-roam").setup({ - directory = "~/org", - }) - end, - }, - { - "brianhuster/live-preview.nvim", - dependencies = { - "ibhagwan/fzf-lua", - }, - }, + require("plugins.appearance"), + require("plugins.editor"), + require("plugins.git"), + require("plugins.ai"), + require("plugins.orgmode"), require("plugins.lsp"), }) -- LSP vim.diagnostic.config({ virtual_text = true }) vim.lsp.inlay_hint.enable(true) -vim.lsp.enable({ - "luals", -}) vim.cmd([[colorscheme tokyonight-night]]) diff --git a/lazy-lock.json b/lazy-lock.json index 68c7311..dc53906 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -33,5 +33,6 @@ "snacks.nvim": { "branch": "main", "commit": "fe7cfe9800a182274d0f868a74b7263b8c0c020b" }, "swenv.nvim": { "branch": "main", "commit": "4157de2619ec2e5c61c103fb6517845a0e04e558" }, "tokyonight.nvim": { "branch": "main", "commit": "5da1b76e64daf4c5d410f06bcb6b9cb640da7dfd" }, - "vim-lastplace": { "branch": "master", "commit": "e58cb0df716d3c88605ae49db5c4741db8b48aa9" } + "vim-lastplace": { "branch": "master", "commit": "e58cb0df716d3c88605ae49db5c4741db8b48aa9" }, + "which-key.nvim": { "branch": "main", "commit": "3aab2147e74890957785941f0c1ad87d0a44c15a" } } diff --git a/lsp/luals.lua b/lsp/luals.lua index e0e6126..4d7118e 100644 --- a/lsp/luals.lua +++ b/lsp/luals.lua @@ -9,6 +9,9 @@ return { }, settings = { Lua = { + diagnostics = { + globals = { "vim" }, + }, runtime = { version = "LuaJIT", }, diff --git a/lua/plugins/ai.lua b/lua/plugins/ai.lua new file mode 100644 index 0000000..c36e684 --- /dev/null +++ b/lua/plugins/ai.lua @@ -0,0 +1,64 @@ +local M = { + { + "zbirenbaum/copilot.lua", + dependencies = { + "copilotlsp-nvim/copilot-lsp", + }, + cmd = "Copilot", + build = ":Copilot auth", + event = "BufReadPost", + config = function() + require("copilot").setup({ + suggestion = { + enabled = true, + auto_trigger = true, + keymap = { + accept = "", + accept_line = "", + accept_word = "", + next = "", + prev = "", + dismiss = "", + }, + }, + nes = { + enabled = false, + keymap = { + accept_and_goto = "p", + accept = false, + dismiss = "", + }, + }, + panel = { enabled = false }, + filetypes = { + lua = true, + markdown = true, + help = true, + }, + }) + vim.api.nvim_create_autocmd("User", { + pattern = "BlinkCmpMenuOpen", + callback = function() + vim.b.copilot_suggestion_hidden = true + end, + }) + + vim.api.nvim_create_autocmd("User", { + pattern = "BlinkCmpMenuClose", + callback = function() + vim.b.copilot_suggestion_hidden = false + end, + }) + end, + }, + { + "CopilotC-Nvim/CopilotChat.nvim", + dependencies = { + { "nvim-lua/plenary.nvim", branch = "master" }, + }, + build = "make tiktoken", + opts = {}, + }, +} + +return M \ No newline at end of file diff --git a/lua/plugins/appearance.lua b/lua/plugins/appearance.lua new file mode 100644 index 0000000..35236e7 --- /dev/null +++ b/lua/plugins/appearance.lua @@ -0,0 +1,18 @@ +local M = { + { + "folke/tokyonight.nvim", + lazy = false, + priority = 1000, + opts = {}, + }, + { "nvim-tree/nvim-web-devicons", opts = {} }, + { + "https://github.com/nvim-lualine/lualine.nvim", + event = "VeryLazy", + config = function() + require("lualine").setup() + end, + }, +} + +return M \ No newline at end of file diff --git a/lua/plugins/editor.lua b/lua/plugins/editor.lua new file mode 100644 index 0000000..cd49fe8 --- /dev/null +++ b/lua/plugins/editor.lua @@ -0,0 +1,248 @@ +local M = { + { + "folke/which-key.nvim", + event = "VeryLazy", + opts = { + -- your configuration comes here + -- or leave it empty to use the default settings + -- refer to the configuration section below + }, + keys = { + { + "?", + function() + require("which-key").show({ global = false }) + end, + desc = "Buffer Local Keymaps (which-key)", + }, + }, + }, + { + "nvim-treesitter/nvim-treesitter", + build = ":TSUpdate", + config = function() + local ensureInstalled = { + "lua", + "python", + "javascript", + "typescript", + "java", + "go", + "rust", + "html", + "css", + "json", + "yaml", + "markdown", + "sql", + "org", + } + local alreadyInstalled = require("nvim-treesitter.config").get_installed() + local parsersToInstall = vim.iter(ensureInstalled) + :filter(function(parser) + return not vim.tbl_contains(alreadyInstalled, parser) + end) + :totable() + require("nvim-treesitter").install(parsersToInstall) + end, + }, + { + "nvim-treesitter/nvim-treesitter-textobjects", + branch = "main", + }, + { + "junegunn/fzf.vim", + dependencies = { + "https://github.com/junegunn/fzf", + }, + keys = { + { "", "Files", desc = "Find files" }, + { ",", "Buffers", desc = "Find buffers" }, + { "/", "Rg", desc = "Search project" }, + }, + }, + { + "stevearc/oil.nvim", + config = function() + require("oil").setup() + end, + keys = { + { "-", "Oil", desc = "Browse files from here" }, + }, + }, + { + "farmergreg/vim-lastplace", + event = "BufReadPost", + }, + { + "windwp/nvim-autopairs", + event = "InsertEnter", + config = function() + require("nvim-autopairs").setup() + end, + }, + { + "numToStr/Comment.nvim", + event = "VeryLazy", + config = function() + require("Comment").setup() + end, + }, + { + "folke/flash.nvim", + event = "VeryLazy", + 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", + }, + { + "r", + mode = "o", + function() + require("flash").remote() + end, + desc = "Remote Flash", + }, + { + "R", + mode = { "o", "x" }, + function() + require("flash").treesitter_search() + end, + desc = "Treesitter Search", + }, + { + "", + mode = { "c" }, + function() + require("flash").toggle() + end, + desc = "Toggle Flash Search", + }, + }, + config = function() + require("flash").setup({ + modes = { + search = { + enabled = true, + }, + char = { + enabled = true, + jump_labels = true, + }, + } + }) + end, + }, + { + "folke/snacks.nvim", + priority = 1000, + lazy = false, + ---@type snacks.Config + opts = { + bigfile = { enabled = true }, + dashboard = { enabled = true }, + explorer = { enabled = true }, + indent = { enabled = true }, + input = { enabled = true }, + picker = { enabled = true }, + notifier = { enabled = true }, + quickfile = { enabled = true }, + scope = { enabled = true }, + scroll = { + enabled = true, + animate = { + duration = { step = 10, total = 100 }, + easing = "linear", + }, + }, + statuscolumn = { enabled = true }, + words = { enabled = true }, + }, + config = function(_, opts) + function floating_terminal() + require("snacks").terminal("fish", { + win = { + position = "float", + width = 0.8, + height = 0.8, + border = "rounded", + }, + }) + end + vim.keymap.set("n", "tf", floating_terminal, { desc = "Open floating terminal" }) + vim.keymap.set("n", "\\", floating_terminal, { desc = "Open floating terminal" }) + require("snacks").setup(opts) + end, + }, + { + "lukas-reineke/indent-blankline.nvim", + event = { "VeryLazy" }, + config = function() + require("ibl").setup() + end, + }, + { + "stevearc/conform.nvim", + opts = {}, + config = function() + local conform = require("conform") + conform.setup({ + formatters_by_ft = { + lua = { "stylua" }, + python = { + "ruff_fix", + "ruff_format", + }, + }, + }) + + vim.api.nvim_create_user_command("Format", function(args) + local range = nil + if args.count ~= -1 then + local end_line = vim.api.nvim_buf_get_lines(0, args.line2 - 1, args.line2, true)[1] + range = { + start = { args.line1, 0 }, + ["end"] = { args.line2, end_line:len() }, + } + end + require("conform").format({ + async = true, + lsp_fallback = true, + range = range, + }) + end, { range = true, desc = "Format buffer or range with conform.nvim" }) + + vim.keymap.set("n", "lf", "Format", { desc = "Format buffer with conform.nvim" }) + end, + }, + { + "serhez/bento.nvim", + config = function() + require("bento").setup({ + main_keymap = ",", + }) + end, + }, + { + "brianhuster/live-preview.nvim", + dependencies = { + "ibhagwan/fzf-lua", + }, + }, +} + +return M diff --git a/lua/plugins/git.lua b/lua/plugins/git.lua new file mode 100644 index 0000000..32c8ccc --- /dev/null +++ b/lua/plugins/git.lua @@ -0,0 +1,16 @@ +local M = { + { + "NeogitOrg/neogit", + lazy = true, + dependencies = { + "nvim-lua/plenary.nvim", + "sindrets/diffview.nvim", + }, + cmd = "Neogit", + keys = { + { "gg", "Neogit", desc = "Show Neogit UI" }, + }, + }, +} + +return M \ No newline at end of file diff --git a/lua/plugins/lsp.lua b/lua/plugins/lsp.lua index 23eda2a..fe5acad 100644 --- a/lua/plugins/lsp.lua +++ b/lua/plugins/lsp.lua @@ -11,7 +11,6 @@ local M = { }, { "saghen/blink.cmp", - -- optional: provides snippets for the snippet source dependencies = { "rafamadriz/friendly-snippets" }, -- use a release tag to download pre-built binaries @@ -106,10 +105,7 @@ local M = { end require("ufo").setup() end, - }, - { - "AckslD/swenv.nvim", - }, + } } return M diff --git a/lua/plugins/orgmode.lua b/lua/plugins/orgmode.lua new file mode 100644 index 0000000..06a901f --- /dev/null +++ b/lua/plugins/orgmode.lua @@ -0,0 +1,31 @@ +local M = { + { + "nvim-orgmode/orgmode", + tag = "0.7.0", + event = "VeryLazy", + ft = { "org" }, + config = function() + require("orgmode").setup({ + org_agenda_files = "~/org/**/*", + org_default_notes_file = "~/org/refile.org", + }) + + -- Create TANGLE command + vim.api.nvim_create_user_command("TANGLE", function() + require("orgmode").action("org_mappings.org_babel_tangle") + end, {}) + end, + }, + { + "chipsenkbeil/org-roam.nvim", + tag = "0.2.0", + config = function() + require("org-roam").setup({ + directory = "~/org", + }) + end, + }, +} + +return M +