diff --git a/nvim/after/plugin/lualine.lua b/nvim/after/plugin/lualine.lua deleted file mode 100644 index c32fa23..0000000 --- a/nvim/after/plugin/lualine.lua +++ /dev/null @@ -1,60 +0,0 @@ -local ok, lualine = pcall(require, "lualine") -if not ok then - return -end - -local function diff_source() - local gitsigns = vim.b.gitsigns_status_dict - if gitsigns then - return { - added = gitsigns.added, - modified = gitsigns.changed, - removed = gitsigns.removed, - } - end -end - -lualine.setup { - options = { - theme = "auto", - globalstatus = true, - section_separators = "", - }, - sections = { - lualine_b = { - { "branch" }, - { - "diff", - source = diff_source, - }, - }, - lualine_c = { - { - "filetype", - colored = true, - icon_only = true, - separator = "", - }, - { "filename" }, - { - function() - return vim.fn.search([[\s\+$]], "nw") ~= 0 and "trailing" or "" - end, - color = "WarningMsg", - }, - }, - lualine_x = { - { "encoding" }, - { "fileformat" }, - { - function() - if vim.bo.expandtab then - return "Space " .. vim.bo.shiftwidth - else - return "Tab " .. vim.bo.shiftwidth - end - end, - }, - }, - }, -} diff --git a/nvim/after/plugin/nvim-cmp.lua b/nvim/after/plugin/nvim-cmp.lua deleted file mode 100644 index 20ab0ff..0000000 --- a/nvim/after/plugin/nvim-cmp.lua +++ /dev/null @@ -1,44 +0,0 @@ -local ok, cmp = pcall(require, "cmp") -if not ok then - return -end - -local luasnip_ok, luasnip = pcall(require, "luasnip") -if not luasnip_ok then - vim.notify("Luasnip is required for nvim-cmp to work", vim.log.levels.WARN) -end - -local lspkind = require "lspkind" - -cmp.setup { - snippet = { - expand = function(args) - luasnip.lsp_expand(args.body) - end, - }, - mapping = cmp.mapping.preset.insert { - [""] = cmp.mapping(cmp.mapping.scroll_docs(4, { "i", "c" })), - [""] = cmp.mapping(cmp.mapping.scroll_docs(-4, { "i", "c" })), - [""] = cmp.mapping(cmp.mapping.complete {}, { "i", "c" }), - [""] = cmp.mapping.close(), - [""] = cmp.mapping.confirm { select = true }, - }, - sources = cmp.config.sources({ - { name = "nvim_lsp" }, - }, { - { name = "buffer" }, - { name = "path" }, - }), - formatting = { - format = lspkind.cmp_format(), - }, -} - -cmp.setup.cmdline(":", { - mapping = cmp.mapping.preset.cmdline(), - sources = cmp.config.sources({ - { name = "path" }, - }, { - { name = "cmdline" }, - }), -}) diff --git a/nvim/init.lua b/nvim/init.lua index 83ee673..e7ea8b5 100644 --- a/nvim/init.lua +++ b/nvim/init.lua @@ -57,6 +57,7 @@ vim.opt.signcolumn = "yes" vim.opt.smartcase = true vim.opt.splitright = true vim.opt.swapfile = false +vim.opt.laststatus = 3 vim.opt.termguicolors = true vim.opt.title = true vim.opt.undodir = vim.fn.stdpath "cache" .. "/undo" diff --git a/nvim/after/plugin/lspconfig.lua b/nvim/lua/my/lsp.lua similarity index 94% rename from nvim/after/plugin/lspconfig.lua rename to nvim/lua/my/lsp.lua index e3c7b55..138ebf7 100644 --- a/nvim/after/plugin/lspconfig.lua +++ b/nvim/lua/my/lsp.lua @@ -1,8 +1,5 @@ -local ok, lspconfig = pcall(require, "lspconfig") - -if not ok then - return -end +local lspconfig = require "lspconfig" +require "neodev".setup() local root_dir for dir in vim.fs.parents(vim.api.nvim_buf_get_name(0)) do @@ -30,11 +27,11 @@ local on_attach = function(client, bufnr) require("my.keymaps").lsp_keymaps(client, bufnr) if client.server_capabilities.completionProvider then - vim.api.nvim_buf_set_option(bufnr, "omnifunc", "v:lua.vim.lsp.omnifunc") + vim.api.nvim_set_option_value("omnifunc", "v:lua.vim.lsp.omnifunc", { buf = bufnr }) end if client.server_capabilities.definitionProvider then - vim.api.nvim_buf_set_option(bufnr, "tagfunc", "v:lua.vim.lsp.tagfunc") + vim.api.nvim_set_option_value("tagfunc", "v:lua.vim.lsp.tagfunc", { buf = bufnr }) end -- Highlight on cursor hold diff --git a/nvim/after/plugin/telescope.lua b/nvim/lua/my/telescope.lua similarity index 87% rename from nvim/after/plugin/telescope.lua rename to nvim/lua/my/telescope.lua index d54c86c..28b113f 100644 --- a/nvim/after/plugin/telescope.lua +++ b/nvim/lua/my/telescope.lua @@ -1,8 +1,5 @@ -local _, telescope = pcall(require, "telescope") -local ok, builtin = pcall(require, "telescope.builtin") -if not ok then - return -end +local telescope = require "telescope" +local builtin = require "telescope.builtin" telescope.setup { extensions = { diff --git a/nvim/lua/plugins.lua b/nvim/lua/plugins.lua deleted file mode 100644 index b55f8ab..0000000 --- a/nvim/lua/plugins.lua +++ /dev/null @@ -1,138 +0,0 @@ -return { - { - "catppuccin/nvim", - lazy = false, -- make sure we load this during startup if it is your main colorscheme - priority = 1000, -- make sure to load this before all the other start plugins - name = "catppuccin", - opts = { - flavour = "mocha", -- latte, frappe, macchiato, mocha - transparent_background = false, - dim_inactive = { - enabled = true, - shade = "dark", - percentage = 0.15, - }, - integrations = { - cmp = true, - fidget = true, - gitsigns = true, - indent_blankline = { - enabled = true, - colored_indent_levels = false, - }, - native_lsp = { - enabled = true, - virtual_text = { - errors = { "italic" }, - hints = { "italic" }, - warnings = { "italic" }, - information = { "italic" }, - }, - underlines = { - errors = { "underline" }, - hints = { "underline" }, - warnings = { "underline" }, - information = { "underline" }, - }, - }, - telescope = true, - treesitter = true, - }, - }, - config = function(_LazyPlugin, opts) - require("catppuccin").setup(opts) - vim.cmd.colorscheme "catppuccin" - end - }, - { - "nvim-telescope/telescope.nvim", - branch = "0.1.x", - dependencies = { - { "nvim-telescope/telescope-fzf-native.nvim", build = "make" }, - { "nvim-telescope/telescope-ui-select.nvim" }, - "nvim-lua/plenary.nvim", - } - }, - { - "hrsh7th/nvim-cmp", - dependencies = { - "hrsh7th/cmp-buffer", - "hrsh7th/cmp-nvim-lsp", - "hrsh7th/cmp-path", - } - }, - { - "nvim-treesitter/nvim-treesitter", - dependencies = { - "nvim-treesitter/nvim-treesitter-textobjects", - }, - }, - { - "j-hui/fidget.nvim", - tag = "legacy", - event = "LspAttach", - opts = { - window = { - blend = 0, - }, - }, - }, - { - "windwp/nvim-autopairs", - event = "InsertEnter", - opts = {} - }, - { - "lukas-reineke/indent-blankline.nvim", - branch = "v3", - config = function() - require("ibl").setup { - scope = { enabled = false } - } - end - }, - { - "stevearc/oil.nvim", - tag = "v2.1.0", - opts = { - keymaps = { - ["g?"] = "actions.show_help", - [""] = "actions.select", - [""] = "actions.select_vsplit", - [""] = "actions.select_split", - [""] = "actions.select_tab", - [""] = "actions.preview", - [""] = "actions.close", - ["r"] = "actions.refresh", - ["-"] = "actions.parent", - ["_"] = "actions.open_cwd", - ["`"] = "actions.cd", - ["~"] = "actions.tcd", - ["g."] = "actions.toggle_hidden", - }, - use_default_keymaps = false, - } - }, - { - "lewis6991/gitsigns.nvim", - opts = { - current_line_blame = true, - current_line_blame_opts = { - delay = 300, - }, - on_attach = require "my.keymaps".gitsigns_keymaps, - } - }, - { "lukas-reineke/lsp-format.nvim", tag = "v2.5.1" }, - { "nvim-tree/nvim-web-devicons", lazy = true }, - { - "L3MON4D3/LuaSnip", - version = "v2.*", - -- install jsregexp (optional!). - build = "make install_jsregexp" - }, - "hrsh7th/cmp-cmdline", - "neovim/nvim-lspconfig", - "nvim-lualine/lualine.nvim", - "onsails/lspkind.nvim", -} diff --git a/nvim/lua/plugins/cmp.lua b/nvim/lua/plugins/cmp.lua new file mode 100644 index 0000000..b887b2a --- /dev/null +++ b/nvim/lua/plugins/cmp.lua @@ -0,0 +1,61 @@ +return { + { + "hrsh7th/nvim-cmp", + event = "InsertEnter", + dependencies = { + "hrsh7th/cmp-buffer", + "hrsh7th/cmp-nvim-lsp", + "hrsh7th/cmp-path", + "hrsh7th/cmp-cmdline", + "onsails/lspkind.nvim", + }, + config = function() + local cmp = require "cmp" + local lspkind = require "lspkind" + local luasnip = require "luasnip" + + cmp.setup { + snippet = { + expand = function(args) + luasnip.lsp_expand(args.body) + end, + }, + mapping = cmp.mapping.preset.insert { + [""] = cmp.mapping(cmp.mapping.scroll_docs(4, { "i", "c" })), + [""] = cmp.mapping(cmp.mapping.scroll_docs(-4, { "i", "c" })), + [""] = cmp.mapping(cmp.mapping.complete {}, { "i", "c" }), + [""] = cmp.mapping.close(), + [""] = cmp.mapping.confirm { select = true }, + [""] = cmp.mapping(function() + if luasnip.expand_or_locally_jumpable() then + luasnip.expand_or_jump() + end + end, { "i", "s" }), + [""] = cmp.mapping(function() + if luasnip.locally_jumpable(-1) then + luasnip.jump(-1) + end + end, { "i", "s" }) + }, + sources = cmp.config.sources({ + { name = "nvim_lsp" }, + }, { + { name = "buffer" }, + { name = "path" }, + }), + formatting = { + format = lspkind.cmp_format(), + }, + } + + cmp.setup.cmdline(":", { + mapping = cmp.mapping.preset.cmdline(), + sources = cmp.config.sources({ + { name = "path" }, + }, { + { name = "cmdline" }, + }), + }) + end + }, +} diff --git a/nvim/lua/plugins/init.lua b/nvim/lua/plugins/init.lua new file mode 100644 index 0000000..88ba298 --- /dev/null +++ b/nvim/lua/plugins/init.lua @@ -0,0 +1,74 @@ +return { + { + "nvim-telescope/telescope.nvim", + event = "VeryLazy", + branch = "0.1.x", + dependencies = { + { "nvim-telescope/telescope-fzf-native.nvim", build = "make" }, + { "nvim-telescope/telescope-ui-select.nvim" }, + "nvim-lua/plenary.nvim", + }, + config = function() + require "my.telescope" + end + }, + { + "nvim-treesitter/nvim-treesitter", + dependencies = { + "nvim-treesitter/nvim-treesitter-textobjects", + }, + }, + { + "windwp/nvim-autopairs", + event = "InsertEnter", + opts = {} + }, + { + "stevearc/oil.nvim", + tag = "v2.1.0", + opts = { + keymaps = { + ["g?"] = "actions.show_help", + [""] = "actions.select", + [""] = "actions.select_vsplit", + [""] = "actions.select_split", + [""] = "actions.select_tab", + [""] = "actions.preview", + [""] = "actions.close", + ["r"] = "actions.refresh", + ["-"] = "actions.parent", + ["_"] = "actions.open_cwd", + ["`"] = "actions.cd", + ["~"] = "actions.tcd", + ["g."] = "actions.toggle_hidden", + }, + use_default_keymaps = false, + } + }, + { + "lewis6991/gitsigns.nvim", + event = "VeryLazy", + opts = { + current_line_blame = true, + current_line_blame_opts = { + delay = 300, + }, + on_attach = require "my.keymaps".gitsigns_keymaps, + } + }, + { "lukas-reineke/lsp-format.nvim", tag = "v2.5.1" }, + { "nvim-tree/nvim-web-devicons", lazy = true }, + { + "L3MON4D3/LuaSnip", + version = "v2.*", + -- install jsregexp (optional!). + build = "make install_jsregexp" + }, + { + 'echasnovski/mini.nvim', + version = '*', + config = function() + require "mini.statusline".setup() + end + }, +} diff --git a/nvim/lua/plugins/lspconfig.lua b/nvim/lua/plugins/lspconfig.lua new file mode 100644 index 0000000..1623e22 --- /dev/null +++ b/nvim/lua/plugins/lspconfig.lua @@ -0,0 +1,17 @@ +return { + { + "neovim/nvim-lspconfig", + dependencies = { + "folke/neodev.nvim", + }, + config = function() + require "my.lsp" + end, + }, + { + "j-hui/fidget.nvim", + tag = "v1.4.0", + opts = {}, + event = "LspAttach" + }, +} diff --git a/nvim/lua/plugins/theme.lua b/nvim/lua/plugins/theme.lua new file mode 100644 index 0000000..b7c17ef --- /dev/null +++ b/nvim/lua/plugins/theme.lua @@ -0,0 +1,47 @@ +return { + { + "catppuccin/nvim", + lazy = false, -- make sure we load this during startup if it is your main colorscheme + priority = 1000, -- make sure to load this before all the other start plugins + name = "catppuccin", + opts = { + flavour = "latte", -- latte, frappe, macchiato, mocha + transparent_background = false, + dim_inactive = { + enabled = true, + shade = "dark", + percentage = 0.15, + }, + integrations = { + cmp = true, + fidget = true, + gitsigns = true, + native_lsp = { + enabled = true, + virtual_text = { + errors = { "italic" }, + hints = { "italic" }, + warnings = { "italic" }, + information = { "italic" }, + }, + underlines = { + errors = { "underline" }, + hints = { "underline" }, + warnings = { "underline" }, + information = { "underline" }, + }, + }, + telescope = true, + treesitter = true, + mini = { + enabled = true, + indentscope_color = "", + }, + }, + }, + config = function(_, opts) + require("catppuccin").setup(opts) + vim.cmd.colorscheme "catppuccin" + end + }, +}