diff --git a/lua/plugins/cmp.lua b/lua/plugins/cmp.lua new file mode 100644 index 0000000..062f96f --- /dev/null +++ b/lua/plugins/cmp.lua @@ -0,0 +1,91 @@ +return { + "hrsh7th/nvim-cmp", + version = false, -- last release is way too old + event = "InsertEnter", + dependencies = { + "hrsh7th/cmp-nvim-lsp", + "hrsh7th/cmp-buffer", + "hrsh7th/cmp-path", + "saadparwaiz1/cmp_luasnip", + "hrsh7th/cmp-nvim-lua", + -- { + -- "hrsh7th/cmp-cmdline", + -- --event = "BufWinEnter", + -- event = "VeryLazy", + -- config = function() + -- require("user.cmdline") + -- end, + -- }, + }, + opts = function() + local cmp = require("cmp") + local luasnip = require("luasnip") + + local check_backspace = function() + local col = vim.fn.col(".") - 1 + return col == 0 or vim.fn.getline("."):sub(col, col):match("%s") + end + + return { + completion = { + completeopt = "menu,menuone,noinsert", + }, + snippet = { + expand = function(args) + require("luasnip").lsp_expand(args.body) + end, + }, + mapping = cmp.mapping.preset.insert({ + [""] = cmp.mapping.scroll_docs(-4), + [""] = cmp.mapping.scroll_docs(4), + [""] = cmp.mapping.complete(), + [""] = cmp.mapping.abort(), + [""] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item() + elseif luasnip.expandable() then + luasnip.expand() + elseif luasnip.expand_or_jumpable() then + luasnip.expand_or_jump() + elseif check_backspace() then + fallback() + else + fallback() + end + end, { + "i", + "s", + }), + }), + sources = cmp.config.sources({ + { name = "nvim_lsp" }, + { name = "luasnip" }, + { name = "buffer" }, + { name = "path" }, + { name = "nvim_lua" }, + }), + formatting = { + fields = { "kind", "abbr", "menu" }, + format = function(entry, vim_item) + vim_item.kind = string.format("%s", require("user.icons")["kind"][vim_item.kind]) + vim_item.menu = ({ + nvim_lsp = "(LSP)", + luasnip = "(Snippet)", + buffer = "(Buffer)", + path = "(Path)", + })[entry.source.name] + return vim_item + end, + }, + window = { + completion = cmp.config.window.bordered(), + documentation = cmp.config.window.bordered(), + }, + experimental = { + ghost_text = false, + native_menu = false, + }, + } + end, +} diff --git a/lua/plugins/cmp_cndline.lua b/lua/plugins/cmp_cndline.lua new file mode 100644 index 0000000..742106b --- /dev/null +++ b/lua/plugins/cmp_cndline.lua @@ -0,0 +1,49 @@ +return { + -- { + -- "hrsh7th/cmp-cmdline", + -- event = "BufWinEnter", + -- config = function() + -- local cmp = require("cmp") + -- -- for cmd line + -- cmp.setup.cmdline("/", { + -- mapping = cmp.mapping.preset.cmdline(), + -- sources = { + -- { name = "buffer" }, + -- }, + -- }) + -- + -- -- -- `:` cmdline setup. + -- cmp.setup.cmdline(":", { + -- mapping = cmp.mapping.preset.cmdline(), + -- sources = cmp.config.sources({ + -- { name = "path" }, + -- }, { + -- { + -- name = "cmdline", + -- option = { + -- ignore_cmds = { "man", "!" }, + -- }, + -- }, + -- }), + -- }) + -- end, + -- }, + + -- for auto complate commond mode + { + "gelguy/wilder.nvim", + event = "BufWinEnter", + config = function() + local wilder = require("wilder") + wilder.setup({ modes = { ":", "/", "?" } }) + wilder.set_option( + "renderer", + wilder.popupmenu_renderer({ + highlighter = wilder.basic_highlighter(), + left = { " ", wilder.popupmenu_devicons() }, + right = { " ", wilder.popupmenu_scrollbar() }, + }) + ) + end, + }, +} diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index 3d0e34c..639944f 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -515,205 +515,4 @@ return { ) end, }, - -- for UI - -- color scheme - -- { - -- "folke/tokyonight.nvim", - -- -- commit = "66bfc2e8f754869c7b651f3f47a2ee56ae557764", - -- 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 - -- config = function() - -- local is_transparant = false - -- if is_transparant then - -- require("user.tokyonight_transparant") - -- else - -- require("user.tokyonight") - -- end - -- -- require("core") - -- require("user.colorscheme") - -- end, - -- }, - -- { - -- "navarasu/onedark.nvim", - -- init = function() - -- require("user.onedark") - -- require("onedark").load() - -- end, - -- }, - -- { "lunarvim/lunar.nvim" }, - -- -- { "arcticicestudio/nord-vim" }, - -- { - -- "catppuccin/nvim", - -- name = "catppuccin", - -- init = function() - -- require("user.catppuccin") - -- end, - -- }, - { "luisiacc/gruvbox-baby", lazy = true }, - -- { - -- "ellisonleao/gruvbox.nvim", - -- init = function() - -- require("gruvbox").setup({ - -- undercurl = true, - -- underline = true, - -- bold = true, - -- italic = true, - -- strikethrough = true, - -- invert_selection = false, - -- invert_signs = false, - -- invert_tabline = false, - -- invert_intend_guides = false, - -- inverse = true, -- invert background for search, diffs, statuslines and errors - -- contrast = "", -- can be "hard", "soft" or empty string - -- palette_overrides = {}, - -- overrides = {}, - -- dim_inactive = false, - -- transparent_mode = false, - -- }) - -- vim.o.background = "dark" -- or "light" for light mode - -- end, - -- }, - -- { "sainnhe/sonokai" }, - -- -- { "EdenEast/nightfox.nvim" }, - -- { - -- "marko-cerovac/material.nvim", - -- init = function() - -- vim.g.material_style = "darker" - -- end, - -- }, - - -- include treesitter - -- require("plugins.treesitter"), - -- { - -- "nvim-treesitter/nvim-treesitter", - -- commit = "8e763332b7bf7b3a426fd8707b7f5aa85823a5ac", - -- run = ":TSUpdate", - -- event = "BufWinEnter", - -- opts = function() - -- require("user.treesitter") - -- end, - -- }, - -- dashboard - { - "goolord/alpha-nvim", - -- event = "BufWinEnter", - event = "VimEnter", - config = function() - require("user.alpha") - end, - }, - -- line info bootom - { - "nvim-lualine/lualine.nvim", - -- dependencies = { "kyazdani42/nvim-web-devicons", opt = true }, - event = "BufWinEnter", - config = function() - local model = 0 - if model == 1 then - require("user.lualine1") - elseif model == 2 then - require("user.lualine2") - else - require("user.lualine") - end - end, - }, - -- for show icon - { - "kyazdani42/nvim-web-devicons", - event = "BufRead", - config = function() - require("user.webdevicons") - end, - }, - -- for tree exploler - { - "kyazdani42/nvim-tree.lua", - -- event = "BufWinEnter", - cmd = { "NvimTree", "NvimTreeToggle", "NvimTreeFocus", "NvimTreeClose" }, - -- dependencies = "kyazdani42/nvim-web-devicons", - config = function() - require("user.nvim-tree") - end, - }, - -- for file tab - { - "famiu/bufdelete.nvim", - event = "BufRead", - }, - { - "akinsho/bufferline.nvim", - event = "BufWinEnter", - config = function() - require("user.bufferline") - end, - }, - -- for delete buffers (close files) without closing your windows or messing up your layout. - { "moll/vim-bbye", event = "BufRead" }, - -- for view terminal - { - "akinsho/toggleterm.nvim", - cmd = "Toggleterm", - event = "BufWinEnter", - init = function() - require("user.toggleterm") - end, - }, - -- key mapping - { - "folke/which-key.nvim", - event = "VeryLazy", - init = function() - require("user.whichkey") - end, - }, - -- for search - { - "nvim-telescope/telescope.nvim", - -- event = "BufRead", - -- dependencies = { { "nvim-lua/plenary.nvim" } }, - cmd = "Telescope", - version = false, -- telescope did only one release, so use HEAD for now - config = function() - require("user.telescope") - end, - }, - -- -- ui components - -- { "MunifTanjim/nui.nvim", lazy = true }, - -- -- noicer ui - -- { - -- "folke/noice.nvim", - -- event = "VeryLazy", - -- opts = { - -- lsp = { - -- override = { - -- ["vim.lsp.util.convert_input_to_markdown_lines"] = true, - -- ["vim.lsp.util.stylize_markdown"] = true, - -- }, - -- }, - -- presets = { - -- bottom_search = true, - -- command_palette = true, - -- long_message_to_split = true, - -- }, - -- }, - -- -- stylua: ignore - -- keys = { - -- { "", function() require("noice").redirect(vim.fn.getcmdline()) end, mode = "c", desc = "Redirect Cmdline" }, - -- { "snl", function() require("noice").cmd("last") end, desc = "Noice Last Message" }, - -- { "snh", function() require("noice").cmd("history") end, desc = "Noice History" }, - -- { "sna", function() require("noice").cmd("all") end, desc = "Noice All" }, - -- { "", function() if not require("noice.lsp").scroll(4) then return "" end end, silent = true, expr = true, desc = "Scroll forward", mode = {"i", "n", "s"} }, - -- { "", function() if not require("noice.lsp").scroll(-4) then return "" end end, silent = true, expr = true, desc = "Scroll backward", mode = {"i", "n", "s"}}, - -- }, - -- }, - - -- simbol outline - { - "simrat39/symbols-outline.nvim", - event = "BufRead", - config = function() - require("symbols-outline").setup() - end, - }, } diff --git a/lua/plugins/ui.lua b/lua/plugins/ui.lua new file mode 100644 index 0000000..f4c2c95 --- /dev/null +++ b/lua/plugins/ui.lua @@ -0,0 +1,202 @@ +return { + -- color scheme + -- { + -- "folke/tokyonight.nvim", + -- -- commit = "66bfc2e8f754869c7b651f3f47a2ee56ae557764", + -- 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 + -- config = function() + -- local is_transparant = false + -- if is_transparant then + -- require("user.tokyonight_transparant") + -- else + -- require("user.tokyonight") + -- end + -- -- require("core") + -- require("user.colorscheme") + -- end, + -- }, + -- { + -- "navarasu/onedark.nvim", + -- init = function() + -- require("user.onedark") + -- require("onedark").load() + -- end, + -- }, + -- { "lunarvim/lunar.nvim" }, + -- -- { "arcticicestudio/nord-vim" }, + -- { + -- "catppuccin/nvim", + -- name = "catppuccin", + -- init = function() + -- require("user.catppuccin") + -- end, + -- }, + { "luisiacc/gruvbox-baby", lazy = true }, + -- { + -- "ellisonleao/gruvbox.nvim", + -- init = function() + -- require("gruvbox").setup({ + -- undercurl = true, + -- underline = true, + -- bold = true, + -- italic = true, + -- strikethrough = true, + -- invert_selection = false, + -- invert_signs = false, + -- invert_tabline = false, + -- invert_intend_guides = false, + -- inverse = true, -- invert background for search, diffs, statuslines and errors + -- contrast = "", -- can be "hard", "soft" or empty string + -- palette_overrides = {}, + -- overrides = {}, + -- dim_inactive = false, + -- transparent_mode = false, + -- }) + -- vim.o.background = "dark" -- or "light" for light mode + -- end, + -- }, + -- { "sainnhe/sonokai" }, + -- -- { "EdenEast/nightfox.nvim" }, + -- { + -- "marko-cerovac/material.nvim", + -- init = function() + -- vim.g.material_style = "darker" + -- end, + -- }, + + -- include treesitter + -- require("plugins.treesitter"), + -- { + -- "nvim-treesitter/nvim-treesitter", + -- commit = "8e763332b7bf7b3a426fd8707b7f5aa85823a5ac", + -- run = ":TSUpdate", + -- event = "BufWinEnter", + -- opts = function() + -- require("user.treesitter") + -- end, + -- }, + -- dashboard + { + "goolord/alpha-nvim", + -- event = "BufWinEnter", + event = "VimEnter", + config = function() + require("user.alpha") + end, + }, + -- line info bootom + { + "nvim-lualine/lualine.nvim", + -- dependencies = { "kyazdani42/nvim-web-devicons", opt = true }, + event = "BufWinEnter", + config = function() + local model = 0 + if model == 1 then + require("user.lualine1") + elseif model == 2 then + require("user.lualine2") + else + require("user.lualine") + end + end, + }, + -- for show icon + { + "kyazdani42/nvim-web-devicons", + event = "BufRead", + config = function() + require("user.webdevicons") + end, + }, + -- for tree exploler + { + "kyazdani42/nvim-tree.lua", + -- event = "BufWinEnter", + cmd = { "NvimTree", "NvimTreeToggle", "NvimTreeFocus", "NvimTreeClose" }, + -- dependencies = "kyazdani42/nvim-web-devicons", + config = function() + require("user.nvim-tree") + end, + }, + -- for file tab + { + "famiu/bufdelete.nvim", + event = "BufRead", + }, + { + "akinsho/bufferline.nvim", + event = "BufWinEnter", + config = function() + require("user.bufferline") + end, + }, + -- for delete buffers (close files) without closing your windows or messing up your layout. + { "moll/vim-bbye", event = "BufRead" }, + -- for view terminal + { + "akinsho/toggleterm.nvim", + cmd = "Toggleterm", + event = "BufWinEnter", + init = function() + require("user.toggleterm") + end, + }, + -- key mapping + { + "folke/which-key.nvim", + event = "VeryLazy", + init = function() + require("user.whichkey") + end, + }, + -- for search + { + "nvim-telescope/telescope.nvim", + -- event = "BufRead", + -- dependencies = { { "nvim-lua/plenary.nvim" } }, + cmd = "Telescope", + version = false, -- telescope did only one release, so use HEAD for now + config = function() + require("user.telescope") + end, + }, + -- -- ui components + -- { "MunifTanjim/nui.nvim", lazy = true }, + -- -- noicer ui + -- { + -- "folke/noice.nvim", + -- event = "VeryLazy", + -- opts = { + -- lsp = { + -- override = { + -- ["vim.lsp.util.convert_input_to_markdown_lines"] = true, + -- ["vim.lsp.util.stylize_markdown"] = true, + -- }, + -- }, + -- presets = { + -- bottom_search = true, + -- command_palette = true, + -- long_message_to_split = true, + -- }, + -- }, + -- -- stylua: ignore + -- keys = { + -- { "", function() require("noice").redirect(vim.fn.getcmdline()) end, mode = "c", desc = "Redirect Cmdline" }, + -- { "snl", function() require("noice").cmd("last") end, desc = "Noice Last Message" }, + -- { "snh", function() require("noice").cmd("history") end, desc = "Noice History" }, + -- { "sna", function() require("noice").cmd("all") end, desc = "Noice All" }, + -- { "", function() if not require("noice.lsp").scroll(4) then return "" end end, silent = true, expr = true, desc = "Scroll forward", mode = {"i", "n", "s"} }, + -- { "", function() if not require("noice.lsp").scroll(-4) then return "" end end, silent = true, expr = true, desc = "Scroll backward", mode = {"i", "n", "s"}}, + -- }, + -- }, + + -- simbol outline + { + "simrat39/symbols-outline.nvim", + event = "BufRead", + config = function() + require("symbols-outline").setup() + end, + }, +}