diff options
author | mhsn <mail@mhsn.net> | 2025-01-22 00:44:19 +0000 |
---|---|---|
committer | mhsn <mail@mhsn.net> | 2025-01-22 00:44:19 +0000 |
commit | dc17ab2fb051efceafddc3b97ebe9f67c775e9b7 (patch) | |
tree | b9c65af3f8d64f1bd5f48488afd69f2596ab4dec /lua | |
parent | c0ee49298161bccb75b9e23ed64fe80aacec2fd4 (diff) | |
download | nvim-dc17ab2fb051efceafddc3b97ebe9f67c775e9b7.tar.gz nvim-dc17ab2fb051efceafddc3b97ebe9f67c775e9b7.zip |
split plugins into separate files and other changes
Diffstat (limited to 'lua')
-rw-r--r-- | lua/config/lazy.lua | 19 | ||||
-rw-r--r-- | lua/config/opt.lua | 1 | ||||
-rw-r--r-- | lua/plugins/conform.lua | 13 | ||||
-rw-r--r-- | lua/plugins/general.lua | 42 | ||||
-rw-r--r-- | lua/plugins/gitsigns.lua | 6 | ||||
-rw-r--r-- | lua/plugins/mason.lua (renamed from lua/plugins/lsp.lua) | 8 | ||||
-rw-r--r-- | lua/plugins/nvim-autopairs.lua | 6 | ||||
-rw-r--r-- | lua/plugins/nvim-cmp.lua | 48 | ||||
-rw-r--r-- | lua/plugins/nvim-tree.lua | 13 | ||||
-rw-r--r-- | lua/plugins/nvim-treesitter.lua | 14 | ||||
-rw-r--r-- | lua/plugins/telescope.lua | 9 | ||||
-rw-r--r-- | lua/plugins/tiny-inline-diagnostic.lua | 18 | ||||
-rw-r--r-- | lua/plugins/vim-ledger.lua | 9 |
13 files changed, 141 insertions, 65 deletions
diff --git a/lua/config/lazy.lua b/lua/config/lazy.lua index 7e90925..07420fd 100644 --- a/lua/config/lazy.lua +++ b/lua/config/lazy.lua @@ -1,17 +1,14 @@ -- 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 + local out = vim.fn.system({ + "git", + "clone", + "https://github.com/folke/lazy.nvim.git", + "--filter=blob:none", + "--branch=stable", + lazypath, + }) end vim.opt.rtp:prepend(lazypath) diff --git a/lua/config/opt.lua b/lua/config/opt.lua index 60b1d5b..37b785c 100644 --- a/lua/config/opt.lua +++ b/lua/config/opt.lua @@ -7,6 +7,7 @@ vim.opt.tabstop = 4 vim.opt.softtabstop = 0 vim.opt.shiftwidth = 4 vim.opt.smarttab = true +vim.opt.expandtab = true -- Smart indenting vim.opt.autoindent = true diff --git a/lua/plugins/conform.lua b/lua/plugins/conform.lua index 2751524..7b7cd46 100644 --- a/lua/plugins/conform.lua +++ b/lua/plugins/conform.lua @@ -1,11 +1,12 @@ return { { "stevearc/conform.nvim", - config = function() - require("conform").setup({ - formatters_by_ft = { lua = { "stylua" } }, - format_on_save = { timeout_ms = 500, lsp_format = "fallback" }, - }) - end, + opts = { + formatters_by_ft = { + lua = { "stylua" }, + python = { "ruff_fix", "ruff_format", "ruff_organize_imports" }, + }, + format_on_save = { timeout_ms = 500, lsp_format = "fallback" }, + }, }, } diff --git a/lua/plugins/general.lua b/lua/plugins/general.lua deleted file mode 100644 index ee08d88..0000000 --- a/lua/plugins/general.lua +++ /dev/null @@ -1,42 +0,0 @@ -return { - { - "nvim-tree/nvim-tree.lua", - version = "*", - lazy = false, - dependencies = { - "nvim-tree/nvim-web-devicons", - }, - keys = { - { "<leader>e", "<cmd>NvimTreeFocus<cr>", desc = "NvimTree focus" }, - }, - config = function() - require("nvim-tree").setup({}) - end, - }, - { - "nvim-telescope/telescope.nvim", - tag = "0.1.8", - keys = { - { "<C-p>", "<cmd>Telescope find_files<cr>", desc = "Telescope find files" }, - }, - }, - { - "nvim-treesitter/nvim-treesitter", - build = ":TSUpdate", - config = function() - require("nvim-treesitter.configs").setup({ - ensure_installed = { "lua" }, - sync_install = false, - highlight = { enable = true }, - indent = { enable = true }, - }) - end, - }, - { - "ledger/vim-ledger", - version = "*", - config = function() - vim.g.ledger_fuzzy_account_completion = 1 - end, - }, -} diff --git a/lua/plugins/gitsigns.lua b/lua/plugins/gitsigns.lua new file mode 100644 index 0000000..b9399e9 --- /dev/null +++ b/lua/plugins/gitsigns.lua @@ -0,0 +1,6 @@ +return { + { + "lewis6991/gitsigns.nvim", + opts = {}, + }, +} diff --git a/lua/plugins/lsp.lua b/lua/plugins/mason.lua index 66a7e76..01132d7 100644 --- a/lua/plugins/lsp.lua +++ b/lua/plugins/mason.lua @@ -1,12 +1,8 @@ return { - { - "neovim/nvim-lspconfig", - }, + { "neovim/nvim-lspconfig" }, { "williamboman/mason.nvim", - config = function() - require("mason").setup() - end, + opts = {}, }, { "williamboman/mason-lspconfig.nvim", diff --git a/lua/plugins/nvim-autopairs.lua b/lua/plugins/nvim-autopairs.lua new file mode 100644 index 0000000..a35707a --- /dev/null +++ b/lua/plugins/nvim-autopairs.lua @@ -0,0 +1,6 @@ +return { + { + "windwp/nvim-autopairs", + opts = {}, + }, +} diff --git a/lua/plugins/nvim-cmp.lua b/lua/plugins/nvim-cmp.lua new file mode 100644 index 0000000..c4dd59d --- /dev/null +++ b/lua/plugins/nvim-cmp.lua @@ -0,0 +1,48 @@ +return { + { + "L3MON4D3/LuaSnip", + version = "v2.*", + }, + { + "hrsh7th/nvim-cmp", + dependencies = { + "hrsh7th/cmp-buffer", + "hrsh7th/cmp-nvim-lsp", + "hrsh7th/cmp-path", + "L3MON4D3/LuaSnip", + }, + opts = function() + local cmp = require("cmp") + return { + snippet = { + expand = function(args) + require("luasnip").lsp_expand(args.body) + end, + }, + mapping = cmp.mapping.preset.insert({ + ["<C-h>"] = cmp.mapping.scroll_docs(-4), + ["<C-l>"] = cmp.mapping.scroll_docs(4), + ["<C-j>"] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert }), + ["<C-k>"] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Insert }), + ["<C-Space>"] = cmp.mapping(function(fallback) + -- Confirm with C-Space. If none selected, confirm first. + if cmp.visible() then + local entry = cmp.get_selected_entry() + if not entry then + cmp.select_next_item({ behaviour = cmp.SelectBehavior.Select }) + end + cmp.confirm() + else + fallback() + end + end, { "i", "s", "c" }), + }), + sources = cmp.config.sources({ + { name = "nvim_lsp" }, + { name = "path" }, + { name = "buffer" }, + }), + } + end, + }, +} diff --git a/lua/plugins/nvim-tree.lua b/lua/plugins/nvim-tree.lua new file mode 100644 index 0000000..39fe2cf --- /dev/null +++ b/lua/plugins/nvim-tree.lua @@ -0,0 +1,13 @@ +return { + { + "nvim-tree/nvim-tree.lua", + lazy = false, + dependencies = { + "nvim-tree/nvim-web-devicons", + }, + keys = { + { "<leader>e", "<cmd>NvimTreeFocus<cr>", desc = "NvimTree focus" }, + }, + opts = {}, + }, +} diff --git a/lua/plugins/nvim-treesitter.lua b/lua/plugins/nvim-treesitter.lua new file mode 100644 index 0000000..5fc91d5 --- /dev/null +++ b/lua/plugins/nvim-treesitter.lua @@ -0,0 +1,14 @@ +return { + { + "nvim-treesitter/nvim-treesitter", + build = ":TSUpdate", + config = function() + require("nvim-treesitter.configs").setup({ + ensure_installed = { "lua", "python", "rust" }, + sync_install = false, + highlight = { enable = true }, + indent = { enable = true }, + }) + end, + }, +} diff --git a/lua/plugins/telescope.lua b/lua/plugins/telescope.lua new file mode 100644 index 0000000..59efa89 --- /dev/null +++ b/lua/plugins/telescope.lua @@ -0,0 +1,9 @@ +return { + { + "nvim-telescope/telescope.nvim", + keys = { + { "<C-p>", "<cmd>Telescope find_files<cr>", desc = "Telescope find files" }, + { "<C-b>", "<cmd>Telescope keymaps<cr>", desc = "Telescope search keymaps" }, + }, + }, +} diff --git a/lua/plugins/tiny-inline-diagnostic.lua b/lua/plugins/tiny-inline-diagnostic.lua new file mode 100644 index 0000000..4bcfc6c --- /dev/null +++ b/lua/plugins/tiny-inline-diagnostic.lua @@ -0,0 +1,18 @@ +return { + { + "rachartier/tiny-inline-diagnostic.nvim", + priority = 1000, + opts = { + preset = "minimal", + options = { + show_source = true, + multiple_diag_under_cursor = true, + multiline = true, + enable_on_insert = true, + }, + }, + init = function() + vim.diagnostic.config({ virtual_text = false }) + end, + }, +} diff --git a/lua/plugins/vim-ledger.lua b/lua/plugins/vim-ledger.lua new file mode 100644 index 0000000..b90d293 --- /dev/null +++ b/lua/plugins/vim-ledger.lua @@ -0,0 +1,9 @@ +return { + { + "ledger/vim-ledger", + ft = "ledger", + init = function() + vim.g.ledger_fuzzy_account_completion = 1 + end, + }, +} |