diff --git a/.gitignore b/.gitignore index 204e063..ad90b66 100755 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,7 @@ .netrwhist .vimlog -plugin/ +lua/plugin/ plugged/ autoload/ lua/custom/ -lazy-lock.json diff --git a/README.md b/README.md index 1fc094f..8c93c1a 100755 --- a/README.md +++ b/README.md @@ -139,3 +139,12 @@ you can find the list of contributors on the [contributors page](https://github. +| ![pakrohk](https://github.com/Pakrohk.png?size=71) | ![ARS101](https://github.com/ARS101.png?size=71) | ![lorem10](https://github.com/lorem10.png?size=71) | ![nooob-developer](https://github.com/nooob-developer.png?size=71) | +| :------------------------------------------------: | :----------------------------------------------: | ------------------------------------- | -------------- | +| [Pakrohk](https://github.com/Pakrohk) | [ARS101](https://github.com/ARS101) | [lorem10](https://github.com/lorem10) | [nooob-developer](https://github.com/nooob-developer) | + +| [H-cyber](https://github.com/H-cyber.png?size=74) | ![mandarvaze](https://github.com/mandarvaze.png?size=74) | ![RealMrHex](https://github.com/RealMrHex.png?size=74) | ![0xj0hn](https://github.com/0xj0hn.png?size=74) | +| --------------------------------------- | ------------------------------------------------------ | --------------------- | ----------------------- | +| [H-cyber](https://github.com/H-cyber) | [mandarvaze](https://github.com/mandarvaze) | [RealMrHex](https://github.com/RealMrHex) | [0xj0hn](https://github.com/0xj0hn) | + + diff --git a/init.lua b/init.lua index 640b0a1..6471a2c 100755 --- a/init.lua +++ b/init.lua @@ -1,3 +1,2 @@ -require("core") -- load basic config -require("plugins") -- plugins -require("theme") -- load user configs +require("core") -- load basic configs +require("plugins.ui.theme") -- load theme/color configs diff --git a/lua/core/init.lua b/lua/core/init.lua index 7ca24bb..a82ce59 100755 --- a/lua/core/init.lua +++ b/lua/core/init.lua @@ -1,3 +1,5 @@ -- Basic configs require("core.basic") require("core.bindings.bindings") +-- Setup Rocks Package Manager +require("core.rocks") diff --git a/lua/core/rocks.lua b/lua/core/rocks.lua new file mode 100644 index 0000000..9d43954 --- /dev/null +++ b/lua/core/rocks.lua @@ -0,0 +1,51 @@ +do + -- Specifies where to install/use rocks.nvim + local install_location = vim.fs.joinpath(vim.fn.stdpath("data"), "rocks") + + -- Set up configuration options related to rocks.nvim (recommended to leave as default) + local rocks_config = { + rocks_path = vim.fs.normalize(install_location), + } + + vim.g.rocks_nvim = rocks_config + + -- Configure the package path (so that plugin code can be found) + local luarocks_path = { + vim.fs.joinpath(rocks_config.rocks_path, "share", "lua", "5.1", "?.lua"), + vim.fs.joinpath(rocks_config.rocks_path, "share", "lua", "5.1", "?", "init.lua"), + } + package.path = package.path .. ";" .. table.concat(luarocks_path, ";") + + -- Configure the C path (so that e.g. tree-sitter parsers can be found) + local luarocks_cpath = { + vim.fs.joinpath(rocks_config.rocks_path, "lib", "lua", "5.1", "?.so"), + vim.fs.joinpath(rocks_config.rocks_path, "lib64", "lua", "5.1", "?.so"), + } + package.cpath = package.cpath .. ";" .. table.concat(luarocks_cpath, ";") + + -- Load all installed plugins, including rocks.nvim itself + vim.opt.runtimepath:append(vim.fs.joinpath(rocks_config.rocks_path, "lib", "luarocks", "rocks-5.1", "rocks.nvim", "*")) +end + +-- If rocks.nvim is not installed then install it! +if not pcall(require, "rocks") then + local rocks_location = vim.fs.joinpath(vim.fn.stdpath("cache"), "rocks.nvim") + + if not vim.uv.fs_stat(rocks_location) then + -- Pull down rocks.nvim + vim.fn.system({ + "git", + "clone", + "--filter=blob:none", + "https://github.com/nvim-neorocks/rocks.nvim", + rocks_location, + }) + end + + -- If the clone was successful then source the bootstrapping script + assert(vim.v.shell_error == 0, "rocks.nvim installation failed. Try exiting and re-entering Neovim!") + + vim.cmd.source(vim.fs.joinpath(rocks_location, "bootstrap.lua")) + + vim.fn.delete(rocks_location, "rf") +end diff --git a/lua/packages/autocomplete/cmp/autopairs/cmp_autopairs.lua b/lua/packages/autocomplete/cmp/autopairs/cmp_autopairs.lua deleted file mode 100644 index 3d059d9..0000000 --- a/lua/packages/autocomplete/cmp/autopairs/cmp_autopairs.lua +++ /dev/null @@ -1,41 +0,0 @@ --- local handlers = require("nvim-autopairs.completion.handlers") - -local function cmp_autopairs_setup(cmp, cmp_autopairs) - cmp.event:on( - "confirm_done", - cmp_autopairs.on_confirm_done({ - -- filetypes = { - -- -- "*" is a alias to all filetypes - -- ["*"] = { - -- ["("] = { - -- kind = { - -- cmp.lsp.CompletionItemKind.Function, - -- cmp.lsp.CompletionItemKind.Method, - -- }, - -- handler = handlers["*"], - -- }, - -- }, - -- lua = { - -- ["("] = { - -- kind = { - -- cmp.lsp.CompletionItemKind.Function, - -- cmp.lsp.CompletionItemKind.Method, - -- }, - -- ---@param char string - -- ---@param item table item completion - -- ---@param bufnr number buffer number - -- ---@param rules table - -- ---@param commit_character table - -- handler = function(char, item, bufnr, rules, commit_character) - -- -- Your handler function. Inpect with print(vim.inspect{char, item, bufnr, rules, commit_character}) - -- end, - -- }, - -- }, - -- -- Disable for tex - -- tex = false, - -- }, - }) - ) -end - -return { cmp_autopairs_setup = cmp_autopairs_setup } diff --git a/lua/packages/autocomplete/cmp/autopairs/init.lua b/lua/packages/autocomplete/cmp/autopairs/init.lua deleted file mode 100644 index e54f496..0000000 --- a/lua/packages/autocomplete/cmp/autopairs/init.lua +++ /dev/null @@ -1,7 +0,0 @@ -return { - "windwp/nvim-autopairs", - event = "InsertEnter", - config = function() - require("packages.autocomplete.cmp.autopairs.main") - end, -} diff --git a/lua/packages/autocomplete/cmp/autopairs/main.lua b/lua/packages/autocomplete/cmp/autopairs/main.lua deleted file mode 100644 index bcccb6a..0000000 --- a/lua/packages/autocomplete/cmp/autopairs/main.lua +++ /dev/null @@ -1,19 +0,0 @@ -local npairs = require("nvim-autopairs") -local Rule = require("nvim-autopairs.rule") - -npairs.setup({ - check_ts = true, - ts_config = { - lua = { "string" }, -- it will not add a pair on that treesitter node - javascript = { "template_string" }, - java = false, -- don't check treesitter on java - }, -}) - -local ts_conds = require("nvim-autopairs.ts-conds") - --- press % => %% only while inside a comment or string -npairs.add_rules({ - Rule("%", "%", "lua"):with_pair(ts_conds.is_ts_node({ "string", "comment" })), - Rule("$", "$", "lua"):with_pair(ts_conds.is_not_ts_node({ "function" })), -}) diff --git a/lua/packages/autocomplete/cmp/formatting.lua b/lua/packages/autocomplete/cmp/formatting.lua deleted file mode 100644 index 48c718c..0000000 --- a/lua/packages/autocomplete/cmp/formatting.lua +++ /dev/null @@ -1,23 +0,0 @@ -local function setup_formatting(cmp, lspkind, source_mapping) - cmp.setup({ - formatting = { - fields = { - cmp.ItemField.Abbr, - cmp.ItemField.Kind, - cmp.ItemField.Menu, - }, - format = lspkind.cmp_format({ - mode = "symbol_text", - maxwidth = 40, - before = function(entry, vim_item) - vim_item.kind = lspkind.presets.default[vim_item.kind] - local menu = source_mapping[entry.source.name] - vim_item.menu = menu - return vim_item - end, - }), - }, - }) -end - -return { setup_formatting = setup_formatting } diff --git a/lua/packages/autocomplete/cmp/init.lua b/lua/packages/autocomplete/cmp/init.lua deleted file mode 100644 index b91a0ea..0000000 --- a/lua/packages/autocomplete/cmp/init.lua +++ /dev/null @@ -1,21 +0,0 @@ -return { - "hrsh7th/nvim-cmp", - event = { "InsertEnter", "CmdlineEnter" }, - dependencies = { - "hrsh7th/cmp-nvim-lsp", - "hrsh7th/cmp-nvim-lua", - "onsails/lspkind.nvim", - "hrsh7th/cmp-buffer", - "f3fora/cmp-spell", - "hrsh7th/cmp-path", - "hrsh7th/cmp-cmdline", - "hrsh7th/cmp-nvim-lsp-document-symbol", - "hrsh7th/cmp-nvim-lsp-signature-help", - { - require("packages.autocomplete.cmp.snippets"), - }, - }, - config = function() - require("packages.autocomplete.cmp.main") - end, -} diff --git a/lua/packages/autocomplete/cmp/main.lua b/lua/packages/autocomplete/cmp/main.lua deleted file mode 100755 index db5e88b..0000000 --- a/lua/packages/autocomplete/cmp/main.lua +++ /dev/null @@ -1,35 +0,0 @@ -local cmp = require("cmp") -local lspkind = require("lspkind") -local luasnip = require("luasnip") -local compare = require("cmp.config.compare") -local cmp_autopairs = require("nvim-autopairs.completion.cmp") -local source_mapping = { - spell = "[SPL]", - dictionary = "[DCT]", - nvim_lsp = "[LSP]", - path = "[FIL]", - luasnip = "[SNP]", - buffer = "[BUF]", -} - -local sorting = require("packages.autocomplete.cmp.sorting").setup_sorting -local snippet = require("packages.autocomplete.cmp.snippets.cmp_snippet").setup_snippet -local window = require("packages.autocomplete.cmp.window").setup_window -local sources = require("packages.autocomplete.cmp.sources").setup_sources -local bindings = require("packages.autocomplete.cmp.bindings").setup_mapping -local formatting = require("packages.autocomplete.cmp.formatting").setup_formatting -local cmdline = require("packages.autocomplete.cmp.cmdline").setup_cmdline -local autopairs = require("packages.autocomplete.cmp.autopairs.cmp_autopairs").cmp_autopairs_setup - -local function setup() - sorting(cmp, compare) - snippet(cmp, luasnip) - window(cmp) - sources(cmp) - bindings(cmp) - formatting(cmp, lspkind, source_mapping) - cmdline(cmp) - autopairs(cmp, cmp_autopairs) -end - -setup() diff --git a/lua/packages/autocomplete/cmp/snippets/init.lua b/lua/packages/autocomplete/cmp/snippets/init.lua deleted file mode 100644 index 9bb4f62..0000000 --- a/lua/packages/autocomplete/cmp/snippets/init.lua +++ /dev/null @@ -1,8 +0,0 @@ -return { - "L3MON4D3/LuaSnip", - dependencies = { "saadparwaiz1/cmp_luasnip", "rafamadriz/friendly-snippets" }, - build = "make install_jsregexp", - config = function() - require("packages.autocomplete.cmp.snippets.main") - end, -} diff --git a/lua/packages/autocomplete/cmp/sources.lua b/lua/packages/autocomplete/cmp/sources.lua deleted file mode 100644 index 7cf675b..0000000 --- a/lua/packages/autocomplete/cmp/sources.lua +++ /dev/null @@ -1,50 +0,0 @@ -local function setup_sources(cmp) - cmp.setup({ - sources = { - { - name = "nvim_lsp", - keyword_length = 1, - max_item_count = 11, - }, - { - name = "luasnip", - keyword_length = 2, - max_item_count = 2, - }, - { - name = "buffer", - keyword_length = 3, - option = { - get_bufnrs = function() - local bufs = {} - for _, win in ipairs(vim.api.nvim_list_wins()) do - bufs[vim.api.nvim_win_get_buf(win)] = true - end - return vim.tbl_keys(bufs) - end, - }, - max_item_count = 10, - }, - { - name = "path", - keyword_length = 3, - max_item_count = 5, - }, - { - name = "spell", - keyword_length = 3, - option = { - keep_all_entries = false, - enable_in_context = function() - return true - end, - }, - }, - { - name = "nvim_lsp_signature_help", - }, - }, - }) -end - -return { setup_sources = setup_sources } diff --git a/lua/packages/autocomplete/lspconfig/init.lua b/lua/packages/autocomplete/lspconfig/init.lua deleted file mode 100755 index 8fdc404..0000000 --- a/lua/packages/autocomplete/lspconfig/init.lua +++ /dev/null @@ -1,17 +0,0 @@ -return { - "neovim/nvim-lspconfig", - event = { "BufReadPre", "BufNew" }, - dependencies = { - "williamboman/mason.nvim", - "williamboman/mason-lspconfig.nvim", - { - "folke/neodev.nvim", - config = function() - require("packages.autocomplete.lspconfig.external_servers.neodev") - end, - }, - }, - config = function() - require("packages.autocomplete.lspconfig.main") - end, -} diff --git a/lua/packages/autocomplete/trouble/init.lua b/lua/packages/autocomplete/trouble/init.lua deleted file mode 100755 index 8fbf9a6..0000000 --- a/lua/packages/autocomplete/trouble/init.lua +++ /dev/null @@ -1,8 +0,0 @@ -return { - "folke/trouble.nvim", - event = { "BufRead" }, - dependencies = "nvim-tree/nvim-web-devicons", - config = function() - require("packages.autocomplete.trouble.main") - end, - } diff --git a/lua/packages/colors/base46.lua b/lua/packages/colors/base46.lua deleted file mode 100755 index 58116d1..0000000 --- a/lua/packages/colors/base46.lua +++ /dev/null @@ -1,16 +0,0 @@ --- exit if it can't be found -local present, base46 = pcall(require, "base46") -if not present then - return -end - -local theme = "gruvchad" -local color_base = "base46" - -local theme_opts = { - base = color_base, - theme = theme, - transparency = false, -} - -base46.load_theme(theme_opts) diff --git a/lua/packages/colors/init.lua b/lua/packages/colors/init.lua deleted file mode 100755 index 0c23844..0000000 --- a/lua/packages/colors/init.lua +++ /dev/null @@ -1,10 +0,0 @@ -return { - "Mofiqul/dracula.nvim", - { "catppuccin/nvim", name = "catppuccin" }, - "cocopon/iceberg.vim", - "navarasu/onedark.nvim", - "shaunsingh/nord.nvim", - "jayden-chan/base46.nvim", - "tanvirtin/monokai.nvim", - { "rose-pine/neovim", name = "rose-pine" }, -} diff --git a/lua/packages/colors/onedark.lua b/lua/packages/colors/onedark.lua deleted file mode 100755 index c93f9c0..0000000 --- a/lua/packages/colors/onedark.lua +++ /dev/null @@ -1,32 +0,0 @@ -require("onedark").setup({ - -- Main options -- - style = "cool", -- Default theme style. Choose between 'dark', 'darker', 'cool', 'deep', 'warm', 'warmer' and 'light' - transparent = true, -- Show/hide background - term_colors = true, -- Change terminal color as per the selected theme style - ending_tildes = false, -- Show the end-of-buffer tildes. By default they are hidden - cmp_itemkind_reverse = false, -- reverse item kind highlights in cmp menu - -- toggle theme style --- - toggle_style_key = nil, -- keybind to toggle theme style. Leave it nil to disable it, or set it to a string, for example "ts" - toggle_style_list = { "dark", "darker", "cool", "deep", "warm", "warmer", "light" }, -- List of styles to toggle between - -- Change code style --- - -- Options are italic, bold, underline, none - -- You can configure multiple style with comma seperated, For e.g., keywords = 'italic,bold' - code_style = { - comments = "italic", - keywords = "none", - functions = "none", - strings = "none", - variables = "none", - }, - -- Custom Highlights -- - colors = {}, -- Override default colors - highlights = {}, -- Override highlight groups - -- Plugins Config - - diagnostics = { - darker = true, -- darker colors for diagnostic - undercurl = true, -- use undercurl instead of underline for diagnostics - background = true, -- use background color for virtual text - }, -}) - -require("onedark").load() diff --git a/lua/packages/telescope/init.lua b/lua/packages/telescope/init.lua deleted file mode 100755 index 0aca851..0000000 --- a/lua/packages/telescope/init.lua +++ /dev/null @@ -1,13 +0,0 @@ -return { - "nvim-telescope/telescope.nvim", - branch = "0.1.x", - event = { "VimEnter" }, - dependencies = { - "nvim-lua/plenary.nvim", - { "nvim-telescope/telescope-fzf-native.nvim", build = "make" }, - "nvim-telescope/telescope-ui-select.nvim", - }, - config = function() - require("packages.telescope.main") - end, -} diff --git a/lua/packages/telescope/main.lua b/lua/packages/telescope/main.lua deleted file mode 100755 index fcf2774..0000000 --- a/lua/packages/telescope/main.lua +++ /dev/null @@ -1,26 +0,0 @@ --- import telescope plugin safely -local telescope = require("telescope") -local theme = require("telescope.themes") --- Bindings -local hotkeys = require("packages.telescope.bind") - --- configure telescope -local mappings = hotkeys.mappings -telescope.setup({ - -- configure custom mappings - defaults = { - mappings, - }, - extensions = { - ["ui-select"] = theme.get_dropdown({ - -- even more opts - }), - }, -}) - -telescope.load_extension("fzf") --- To get ui-select loaded and working with telescope, you need to call --- load_extension, somewhere after setup function: -telescope.load_extension("ui-select") --- telescope notify plugin -telescope.load_extension("notify") diff --git a/lua/packages/ui/barbar/bind.lua b/lua/packages/ui/barbar/bind.lua deleted file mode 100755 index 22d6efd..0000000 --- a/lua/packages/ui/barbar/bind.lua +++ /dev/null @@ -1,43 +0,0 @@ -local bind = vim.keymap.set -local opts = { noremap = true, silent = true } - --- Move to previous/next -bind('n', '', 'BufferPrevious', opts) -bind('n', '', 'BufferNext', opts) --- Re-order to previous/next -bind('n', '', 'BufferMovePrevious', opts) -bind('n', '>', 'BufferMoveNext', opts) --- Goto buffer in position... -bind('n', '', 'BufferGoto 1', opts) -bind('n', '', 'BufferGoto 2', opts) -bind('n', '', 'BufferGoto 3', opts) -bind('n', '', 'BufferGoto 4', opts) -bind('n', '', 'BufferGoto 5', opts) -bind('n', '', 'BufferGoto 6', opts) -bind('n', '', 'BufferGoto 7', opts) -bind('n', '', 'BufferGoto 8', opts) -bind('n', '', 'BufferGoto 9', opts) -bind('n', '', 'BufferLast', opts) --- Pin/unpin buffer -bind('n', '', 'BufferPin', opts) --- Close buffer -bind('n', '', 'BufferClose', opts) --- Wipeout buffer --- :BufferWipeout --- Close commands --- :BufferCloseAllButCurrent --- :BufferCloseAllButPinned --- :BufferCloseAllButCurrentOrPinned --- :BufferCloseBuffersLeft --- :BufferCloseBuffersRight --- Magic buffer-picking mode -bind('n', '', 'BufferPick', opts) --- Sort automatically by... -bind('n', 'bb', 'BufferOrderByBufferNumber', opts) -bind('n', 'bd', 'BufferOrderByDirectory', opts) -bind('n', 'bl', 'BufferOrderByLanguage', opts) -bind('n', 'bw', 'BufferOrderByWindowNumber', opts) - --- Other: --- :BarbarEnable - enables barbar (enabled by default) --- :BarbarDisable - very bad command, should never be used diff --git a/lua/packages/ui/barbar/init.lua b/lua/packages/ui/barbar/init.lua deleted file mode 100755 index 9fcd40c..0000000 --- a/lua/packages/ui/barbar/init.lua +++ /dev/null @@ -1,7 +0,0 @@ -return { - "romgrk/barbar.nvim", - dependencies = "nvim-tree/nvim-web-devicons", - config = function() - require("packages.ui.barbar.main") - end, -} diff --git a/lua/packages/ui/barbar/main.lua b/lua/packages/ui/barbar/main.lua deleted file mode 100755 index e8e5707..0000000 --- a/lua/packages/ui/barbar/main.lua +++ /dev/null @@ -1,13 +0,0 @@ --- Set kaybinds -require("packages.ui.barbar.bind") --- Set barbar's options -local barbar = require("bufferline") - --- set config variables -local config = { - auto_hide = false, - tabpages = true, -} - --- enable barbar -barbar.setup(config) diff --git a/lua/packages/ui/dashboard/init.lua b/lua/packages/ui/dashboard/init.lua deleted file mode 100644 index 5d864d6..0000000 --- a/lua/packages/ui/dashboard/init.lua +++ /dev/null @@ -1,8 +0,0 @@ -return { - "glepnir/dashboard-nvim", - event = "VimEnter", - config = function() - require("packages.ui.dashboard.main") - end, - dependencies = "nvim-tree/nvim-web-devicons", -} diff --git a/lua/packages/ui/lualine/file_status.lua b/lua/packages/ui/lualine/file_status.lua deleted file mode 100755 index 8ff038e..0000000 --- a/lua/packages/ui/lualine/file_status.lua +++ /dev/null @@ -1,17 +0,0 @@ -local conditions = {} - -function conditions.buffer_not_empty() - return vim.fn.empty(vim.fn.expand("%:t")) ~= 1 -end - -function conditions.hide_in_width() - return vim.fn.winwidth(0) > 80 -end - -function conditions.check_git_workspace() - local filepath = vim.fn.expand("%:p:h") - local gitdir = vim.fn.finddir(".git", filepath .. ";") - return gitdir and #gitdir > 0 and #gitdir < #filepath -end - -return conditions diff --git a/lua/packages/ui/lualine/init.lua b/lua/packages/ui/lualine/init.lua deleted file mode 100755 index c9785fd..0000000 --- a/lua/packages/ui/lualine/init.lua +++ /dev/null @@ -1,13 +0,0 @@ -return { - "nvim-lualine/lualine.nvim", - event = { "VimEnter" }, - config = function() - require("packages.ui.lualine.main") - end, - dependencies = { - "nvim-tree/nvim-web-devicons", - "linrongbin16/lsp-progress.nvim", - }, - } - - diff --git a/lua/packages/ui/lualine/lsp_progress.lua b/lua/packages/ui/lualine/lsp_progress.lua deleted file mode 100755 index d0f3aef..0000000 --- a/lua/packages/ui/lualine/lsp_progress.lua +++ /dev/null @@ -1,95 +0,0 @@ -local lsp_progress = require("lsp-progress") - -lsp_progress.setup({ - -- Spinning icons. - spinner = { "⣾", "⣽", "⣻", "⢿", "⡿", "⣟", "⣯", "⣷" }, - -- Spinning update time in milliseconds. - spin_update_time = 200, - -- Last message cached decay time in milliseconds. - -- - -- Message could be really fast(appear and disappear in an - -- instant) that user cannot even see it, thus we cache the last message - -- for a while for user view. - decay = 1000, - -- User event name. - event = "LspProgressStatusUpdated", - -- Event update time limit in milliseconds. - -- - -- Sometimes progress handler could emit many events in an instant, while - -- refreshing statusline cause too heavy synchronized IO, so we limit the - -- event rate to reduce this cost. - event_update_time_limit = 100, - --- Max progress string length, by default -1 is unlimit. - max_size = -1, - -- Format series message. - -- - -- By default it looks like: `formatting isort (100%) - done`. - -- - -- @param title Message title. - -- @param message Message body. - -- @param percentage Progress in percentage numbers: [0%-100%]. - -- @param done Indicate if this message is the last one in progress. - -- @return A nil|string|table value. The returned value will be - -- passed to function `client_format` as one of the - -- `series_messages` array, or ignored if return nil. - series_format = function(title, message, percentage, done) - local builder = {} - local has_title = false - local has_message = false - if title and title ~= "" then - table.insert(builder, title) - has_title = true - end - if message and message ~= "" then - table.insert(builder, message) - has_message = true - end - if percentage and (has_title or has_message) then - table.insert(builder, string.format("(%.0f%%%%)", percentage)) - end - if done and (has_title or has_message) then - table.insert(builder, "- done") - end - return table.concat(builder, " ") - end, - -- Format client message. - -- - -- By default it looks like: - -- `[null-ls] ⣷ formatting isort (100%) - done, formatting black (50%)`. - -- - -- @param client_name Client name. - -- @param spinner Spinner icon. - -- @param series_messages Series messages array. - -- @return A nil|string|table value. The returned value will - -- be passed to function `format` as one of the - -- `client_messages` array, or ignored if return nil. - client_format = function(client_name, spinner, series_messages) - return #series_messages > 0 - and ("[" .. client_name .. "] " .. spinner .. " " .. table.concat(series_messages, ", ")) - or nil - end, - -- Format (final) message. - -- - -- By default it looks like: - -- ` LSP [null-ls] ⣷ formatting isort (100%) - done, formatting black (50%)` - -- - -- @param client_messages Client messages array. - -- @return A nil|string|table value. The returned value will be - -- returned from `progress` API. - format = function(client_messages) - local sign = "" -- nf-fa-gear \uf013 - return #client_messages > 0 and (sign .. " " .. table.concat(client_messages, " ")) or sign - end, - --- Enable debug. - debug = false, - --- Print log to console(command line). - console_log = true, - --- Print log to file. - file_log = false, - -- Log file to write, work with `file_log=true`. - -- For Windows: `$env:USERPROFILE\AppData\Local\nvim-data\lsp-progress.log`. - -- For *NIX: `~/.local/share/nvim/lsp-progress.log`. - file_log_name = "lsp-progress.log", -}) - -return lsp_progress.progress diff --git a/lua/packages/ui/lualine/lsp_status.lua b/lua/packages/ui/lualine/lsp_status.lua deleted file mode 100755 index 56c837e..0000000 --- a/lua/packages/ui/lualine/lsp_status.lua +++ /dev/null @@ -1,74 +0,0 @@ -local lsp_status = {} - --- Define function to get the LSP clients -function lsp_status.get_clients() - return vim.lsp.get_active_clients() -end - -function lsp_status.get_attached_null_ls_sources() - local null_ls_sources = require("null-ls").get_sources() - local ret = {} - for _, source in pairs(null_ls_sources) do - if source.filetypes[vim.bo.ft] then - if not vim.tbl_contains(ret, source.name) then - table.insert(ret, source.name) - end - end - end - return ret -end - --- Define function to update the LSP client list --- Define function to update the LSP client list -function lsp_status.update_lsp_list(lsp_clients) - local lsp_names = {} - local lsp_ids = {} - local unique_lsp_names = {} - for _, client in ipairs(lsp_clients) do - local lsp_name = client.name - if lsp_name == "null-ls" then - for _, source in pairs(lsp_status.get_attached_null_ls_sources()) do - local null_ls_lsp_name = source .. "[Null-ls]" - if not unique_lsp_names[null_ls_lsp_name] then - lsp_names[#lsp_names + 1] = null_ls_lsp_name - unique_lsp_names[null_ls_lsp_name] = true - end - end - else - if not unique_lsp_names[lsp_name] then - lsp_names[#lsp_names + 1] = lsp_name - unique_lsp_names[lsp_name] = true - end - end - lsp_ids[#lsp_ids + 1] = client.id - end - return lsp_names, lsp_ids -end - --- Define function to remove disconnected LSP clients from the list -function lsp_status.remove_disconnected_clients(lsp_names, lsp_ids) - for i = #lsp_names, 1, -1 do - local client = vim.lsp.get_client_by_id(lsp_ids[i]) - if client == nil then - table.remove(lsp_names, i) - table.remove(lsp_ids, i) - end - end - return lsp_names -end - --- Define function to get the LSP status -function lsp_status.get() - local lsp_clients = lsp_status.get_clients() - local lsp_names, lsp_ids = lsp_status.update_lsp_list(lsp_clients) - lsp_status.remove_disconnected_clients(lsp_names, lsp_ids) - local lsp_sarver_status = " " - if #lsp_names > 0 then - lsp_sarver_status = " LSP: " .. table.concat(lsp_names, ", ") - else - lsp_sarver_status = "No Active LSP" - end - return lsp_sarver_status -end - -return lsp_status diff --git a/lua/packages/ui/lualine/main.lua b/lua/packages/ui/lualine/main.lua deleted file mode 100755 index e6795c2..0000000 --- a/lua/packages/ui/lualine/main.lua +++ /dev/null @@ -1,146 +0,0 @@ -local lualine = require("lualine") -local lsp_status = require("packages.ui.lualine.lsp_status") -local lsp_progress = require("packages.ui.lualine.lsp_progress") -local file_status = require("packages.ui.lualine.file_status") - -local colors = { - -- Use vim.fn.synIDattr to get colors from the current Neovim color scheme - yellow = vim.fn.synIDattr(vim.fn.hlID("WarningMsg"), "fg"), - cyan = vim.fn.synIDattr(vim.fn.hlID("Function"), "fg"), - darkblue = vim.fn.synIDattr(vim.fn.hlID("StatusLineNC"), "fg"), - green = vim.fn.synIDattr(vim.fn.hlID("Keyword"), "fg"), - orange = vim.fn.synIDattr(vim.fn.hlID("Conditional"), "fg"), - violet = vim.fn.synIDattr(vim.fn.hlID("Statement"), "fg"), - magenta = vim.fn.synIDattr(vim.fn.hlID("String"), "fg"), - blue = vim.fn.synIDattr(vim.fn.hlID("Type"), "fg"), - red = vim.fn.synIDattr(vim.fn.hlID("Error"), "fg"), -} - -local mode_color = { - n = colors.red, - i = colors.green, - v = colors.blue, - [""] = colors.blue, - V = colors.blue, - c = colors.magenta, - no = colors.red, - s = colors.orange, - S = colors.orange, - [""] = colors.orange, - ic = colors.yellow, - R = colors.violet, - Rv = colors.violet, - cv = colors.red, - ce = colors.red, - r = colors.cyan, - rm = colors.cyan, - ["r?"] = colors.cyan, - ["!"] = colors.red, - t = colors.red, -} - -local mode_icons = { - ["n"] = "  ", - ["no"] = "  ", - ["niI"] = "  ", - ["niR"] = "  ", - ["no"] = "  ", - ["niV"] = "  ", - ["nov"] = "  ", - ["noV"] = "  ", - ["i"] = "  ", - ["ic"] = "  ", - ["ix"] = "  ", - ["s"] = "  ", - ["S"] = "  ", - ["v"] = "  ", - ["V"] = "  ", - [""] = "  ", - ["r"] = " ﯒ ", - ["r?"] = "  ", - ["c"] = "  ", - ["t"] = "  ", - ["!"] = "  ", - ["R"] = "  ", -} - --- Config -local config = { - options = { - -- Disable sections and component separators - component_separators = "", - section_separators = "", - theme = "auto", - }, - sections = { - -- these are to remove the defaults - lualine_a = {}, - lualine_b = {}, - lualine_y = {}, - lualine_z = {}, - -- These will be filled later - lualine_c = {}, - lualine_x = {}, - }, - inactive_sections = { - -- these are to remove the defaults - lualine_a = {}, - lualine_b = {}, - lualine_y = {}, - lualine_z = {}, - lualine_c = {}, - lualine_x = {}, - }, -} - --- Inserts a component in lualine_c at left section -local function ins_left(component) - table.insert(config.sections.lualine_c, component) -end - --- Inserts a component in lualine_x ot right section -local function ins_right(component) - table.insert(config.sections.lualine_x, component) -end - -ins_left({ - -- mode component - function() - return mode_icons[vim.fn.mode()] - end, - color = function() - -- auto change color according to neovims mode - return { - fg = mode_color[vim.fn.mode()], - } - end, - padding = { right = 1 }, -}) - --- Insert the filename component into the left section -ins_left({ "filename", file_status.buffer_not_empty }) - --- Place the distance generation component in the left part. -ins_left({ "%=" }) - --- Insert the LSP status component into the left section -ins_left({ - lsp_status.get, - color = function() - return { fg = colors.blue } - end, -}) -ins_left({ - lsp_progress, - color = function() - return { fg = colors.yellow } - end, -}) - --- Insert the encoding, file format, and file type components into the right section -ins_right("encoding") -ins_right("fileformat") -ins_right("filetype") - --- Define the lualine configuration -lualine.setup(config) diff --git a/lua/packages/ui/nvim-notify/init.lua b/lua/packages/ui/nvim-notify/init.lua deleted file mode 100755 index 596d803..0000000 --- a/lua/packages/ui/nvim-notify/init.lua +++ /dev/null @@ -1,6 +0,0 @@ -return { - "rcarriga/nvim-notify", - config = function() - require("packages.ui.nvim-notify.main") - end, -} diff --git a/lua/packages/ui/nvim-tree/init.lua b/lua/packages/ui/nvim-tree/init.lua deleted file mode 100755 index dbdb363..0000000 --- a/lua/packages/ui/nvim-tree/init.lua +++ /dev/null @@ -1,8 +0,0 @@ -return { - "kyazdani42/nvim-tree.lua", - event = { "VimEnter", "BufEnter" }, - dependencies = "nvim-tree/nvim-web-devicons", - config = function() - require("packages.ui.nvim-tree.main") - end, -} diff --git a/lua/plugins.lua b/lua/plugins.bak.lua similarity index 97% rename from lua/plugins.lua rename to lua/plugins.bak.lua index ee85ece..bb45159 100755 --- a/lua/plugins.lua +++ b/lua/plugins.bak.lua @@ -16,9 +16,9 @@ local plugins = { require("packages.ui.nvim-notify"), -- autocompeletion plugins -- The goal of nvim-treesitter is both to provide a simple and easy way to use the interface for tree-sitter in Neovim and to provide some basic functionality such as highlighting based on it - require("packages.nvim-treesitter"), + require("packages.autocomplete.nvim-treesitter"), -- This plugin adds indentation guides to all lines (including empty lines). - require("packages.nvim-treesitter.indent"), + require("packages.autocomplete.nvim-treesitter.indent"), -- lsp plugins require("packages.autocomplete.lspconfig"), -- complate menu plugins @@ -30,7 +30,7 @@ local plugins = { -- vim diagnostics system require("packages.autocomplete.trouble"), -- Fuzzy Finder - require("packages.telescope"), + require("packages.ui.telescope"), -- Icons require("packages.ui.devicons"), -- Tree File Explorer diff --git a/lua/plugins/autocomplete/autopair/config.lua b/lua/plugins/autocomplete/autopair/config.lua new file mode 100644 index 0000000..af171a1 --- /dev/null +++ b/lua/plugins/autocomplete/autopair/config.lua @@ -0,0 +1,169 @@ +local autopair = require('ultimate-autopair') + +autopair.setup({ + conf = { + profile = 'default', + --what profile to use + map = true, + --whether to allow any insert map + cmap = true, --cmap stands for cmd-line map + --whether to allow any cmd-line map + pair_map = true, + --whether to allow pair insert map + pair_cmap = true, + --whether to allow pair cmd-line map + multiline = true, + --enable/disable multiline + bs = { -- *ultimate-autopair-map-backspace-config* + enable = true, + map = '', --string or table + cmap = '', --string or table + overjumps = true, + --(|foo) > bs > |foo + space = true, --false, true or 'balance' + --( |foo ) > bs > (|foo) + --balance: + -- Will prioritize balanced spaces + -- ( |foo ) > bs > ( |foo ) + indent_ignore = false, + --(\n\t|\n) > bs > (|) + single_delete = false, + -- > bs > ', --string or table + autoclose = false, + --(| > cr > (\n|\n) + conf = { cond = function(fn) return not fn.in_lisp() end }, + --contains extension config + multi = false, + --use multiple configs (|ultimate-autopair-map-multi-config|) + }, + space = { -- *ultimate-autopair-map-space-config* + enable = true, + map = ' ', --string or table + cmap = ' ', --string or table + check_box_ft = { 'markdown', 'vimwiki', 'org' }, + _check_box_ft2 = { 'norg' }, --may be removed + --+ [|] > space > + [ ] + conf = {}, + --contains extension config + multi = false, + --use multiple configs (|ultimate-autopair-map-multi-config|) + }, + space2 = { -- *ultimate-autopair-map-space2-config* + enable = false, + match = [[\k]], + --what character activate + conf = {}, + --contains extension config + multi = false, + --use multiple configs (|ultimate-autopair-map-multi-config|) + }, + fastwarp = { -- *ultimate-autopair-map-fastwarp-config* + enable = true, + enable_normal = true, + enable_reverse = true, + hopout = false, + --{(|)} > fastwarp > {(}|) + map = '', --string or table + rmap = '', --string or table + cmap = '', --string or table + rcmap = '', --string or table + multiline = true, + --(|) > fastwarp > (\n|) + nocursormove = true, + --makes the cursor not move (|)foo > fastwarp > (|foo) + --disables multiline feature + --only activates if prev char is start pair, otherwise fallback to normal + do_nothing_if_fail = true, + --add a module so that if fastwarp fails + --then an `e` will not be inserted + no_filter_nodes = { 'string', 'raw_string', 'string_literals', 'character_literal' }, + --which nodes to skip for tsnode filtering + faster = false, + --only enables jump over pair, goto end/next line + --useful for the situation of: + --{|}M.foo('bar') > {M.foo('bar')|} + conf = {}, + --contains extension config + multi = false, + --use multiple configs (|ultimate-autopair-map-multi-config|) + }, + close = { -- *ultimate-autopair-map-close-config* + enable = true, + map = '', --string or table + cmap = '', --string or table + conf = {}, + --contains extension config + multi = false, + --use multiple configs (|ultimate-autopair-map-multi-config|) + do_nothing_if_fail = true, + --add a module so that if close fails + --then a `)` will not be inserted + }, + tabout = { -- *ultimate-autopair-map-tabout-config* + enable = false, + map = '', --string or table + cmap = '', --string or table + conf = {}, + --contains extension config + multi = false, + --use multiple configs (|ultimate-autopair-map-multi-config|) + hopout = false, + -- (|) > tabout > ()| + do_nothing_if_fail = true, + --add a module so that if close fails + --then a `\t` will not be inserted + }, + extensions = { -- *ultimate-autopair-extensions-default-config* + cmdtype = { skip = { '/', '?', '@', '-' }, p = 100 }, + filetype = { p = 90, nft = { 'TelescopePrompt' }, tree = true }, + escape = { filter = true, p = 80 }, + utf8 = { p = 70 }, + tsnode = { + p = 60, + separate = { 'comment', 'string', 'char', 'character', + 'raw_string', --fish/bash/sh + 'char_literal', 'string_literal', --c/cpp + 'string_value', --css + 'str_lit', 'char_lit', --clojure/commonlisp + 'interpreted_string_literal', 'raw_string_literal', 'rune_literal', --go + 'quoted_attribute_value', --html + 'template_string', --javascript + 'LINESTRING', 'STRINGLITERALSINGLE', 'CHAR_LITERAL', --zig + 'string_literals', 'character_literal', 'line_comment', 'block_comment', + 'nesting_block_comment' --d #62 + } + }, + cond = { p = 40, filter = true }, + alpha = { p = 30, filter = false, all = false }, + suround = { p = 20 }, + fly = { other_char = { ' ' }, nofilter = false, p = 10, undomapconf = {}, undomap = nil, undocmap = nil, only_jump_end_pair = false }, + }, + internal_pairs = { -- *ultimate-autopair-pairs-default-pairs* + { '[', ']', fly = true, dosuround = true, newline = true, space = true }, + { '(', ')', fly = true, dosuround = true, newline = true, space = true }, + { '{', '}', fly = true, dosuround = true, newline = true, space = true }, + { '"', '"', suround = true, multiline = false }, + { "'", "'", suround = true, cond = function(fn) return not + fn.in_lisp() or fn.in_string() end, alpha = true, nft = { 'tex' }, multiline = false }, + { '`', '`', cond = function(fn) return not fn.in_lisp() or fn.in_string() end, nft = { 'tex' }, multiline = false }, + { '``', "''", ft = { 'tex' } }, + { '```', '```', newline = true, ft = { 'markdown' } }, + { '', ft = { 'markdown', 'html' }, space = true }, + { '"""', '"""', newline = true, ft = { 'python' } }, + { "'''", "'''", newline = true, ft = { 'python' } }, + }, + config_internal_pairs = { -- *ultimate-autopair-pairs-configure-default-pairs* + --configure internal pairs + --example: + --{'{','}',suround=true}, + }, + } +}) diff --git a/lua/packages/autocomplete/cmp/bindings.lua b/lua/plugins/autocomplete/cmp/bindings.lua similarity index 100% rename from lua/packages/autocomplete/cmp/bindings.lua rename to lua/plugins/autocomplete/cmp/bindings.lua diff --git a/lua/packages/autocomplete/cmp/cmdline.lua b/lua/plugins/autocomplete/cmp/cmdline.lua similarity index 100% rename from lua/packages/autocomplete/cmp/cmdline.lua rename to lua/plugins/autocomplete/cmp/cmdline.lua diff --git a/lua/plugins/autocomplete/cmp/formatting.lua b/lua/plugins/autocomplete/cmp/formatting.lua new file mode 100644 index 0000000..85bd73e --- /dev/null +++ b/lua/plugins/autocomplete/cmp/formatting.lua @@ -0,0 +1,34 @@ +local function setup_formatting(cmp, lspkind) + cmp.setup({ + formatting = { + fields = { + cmp.ItemField.Abbr, + cmp.ItemField.Kind, + cmp.ItemField.Menu, + }, + format = lspkind.cmp_format({ + mode = "symbol_text", + maxwidth = 40, + before = function(entry, vim_item) + local source_mapping = { + nvim_lsp = "[LSP]", + spell = "[SPL]", + dictionary = "[DCT]", + path = "[FIL]", + luasnip = "[SNP]", + buffer = "[BUF]", + } + + -- Use `kind` to set the appropriate icon + vim_item.kind = lspkind.presets.default[vim_item.kind] or vim_item.kind + -- Set the menu text based on the source + vim_item.menu = source_mapping[entry.source.name] or "" + + return vim_item + end, + }), + }, + }) +end + +return { setup_formatting = setup_formatting } diff --git a/lua/plugins/autocomplete/cmp/init.lua b/lua/plugins/autocomplete/cmp/init.lua new file mode 100644 index 0000000..3abe7af --- /dev/null +++ b/lua/plugins/autocomplete/cmp/init.lua @@ -0,0 +1,3 @@ +require("plugins.autocomplete.cmp.main") +require("plugins.autocomplete.cmp.snippets") + diff --git a/lua/plugins/autocomplete/cmp/main.lua b/lua/plugins/autocomplete/cmp/main.lua new file mode 100755 index 0000000..222618c --- /dev/null +++ b/lua/plugins/autocomplete/cmp/main.lua @@ -0,0 +1,30 @@ +-- Required modules +local cmp = require("cmp") +local lspkind = require("lspkind") +local luasnip = require("luasnip") +local compare = require("cmp.config.compare") + + +-- Import setup functions from separate modules +local sorting = require("plugins.autocomplete.cmp.sorting").setup_sorting +local snippet = require("plugins.autocomplete.cmp.snippets.cmp_snippet").setup_snippet +local window = require("plugins.autocomplete.cmp.window").setup_window +local sources = require("plugins.autocomplete.cmp.sources").setup_sources +local bindings = require("plugins.autocomplete.cmp.bindings").setup_mapping +local formatting = require("plugins.autocomplete.cmp.formatting").setup_formatting +local cmdline = require("plugins.autocomplete.cmp.cmdline").setup_cmdline + +-- Main setup function +local function setup() + sorting(cmp, compare) + snippet(cmp, luasnip) + window(cmp) + sources(cmp) + bindings(cmp) + formatting(cmp, lspkind) + cmdline(cmp) +end + + +-- Run setup +setup() diff --git a/lua/packages/autocomplete/cmp/snippets/cmp_snippet.lua b/lua/plugins/autocomplete/cmp/snippets/cmp_snippet.lua similarity index 100% rename from lua/packages/autocomplete/cmp/snippets/cmp_snippet.lua rename to lua/plugins/autocomplete/cmp/snippets/cmp_snippet.lua diff --git a/lua/plugins/autocomplete/cmp/snippets/init.lua b/lua/plugins/autocomplete/cmp/snippets/init.lua new file mode 100644 index 0000000..3ab7630 --- /dev/null +++ b/lua/plugins/autocomplete/cmp/snippets/init.lua @@ -0,0 +1 @@ +require("plugins.autocomplete.cmp.snippets.main") diff --git a/lua/packages/autocomplete/cmp/snippets/main.lua b/lua/plugins/autocomplete/cmp/snippets/main.lua similarity index 100% rename from lua/packages/autocomplete/cmp/snippets/main.lua rename to lua/plugins/autocomplete/cmp/snippets/main.lua diff --git a/lua/packages/autocomplete/cmp/sorting.lua b/lua/plugins/autocomplete/cmp/sorting.lua similarity index 100% rename from lua/packages/autocomplete/cmp/sorting.lua rename to lua/plugins/autocomplete/cmp/sorting.lua diff --git a/lua/plugins/autocomplete/cmp/sources.lua b/lua/plugins/autocomplete/cmp/sources.lua new file mode 100644 index 0000000..d819b57 --- /dev/null +++ b/lua/plugins/autocomplete/cmp/sources.lua @@ -0,0 +1,50 @@ +local function setup_sources(cmp) + cmp.setup({ + sources = { + { + name = "nvim_lsp", + keyword_length = 1, + max_item_count = 11, + }, + { + name = "luasnip", + keyword_length = 2, + max_item_count = 2, + }, + { + name = "buffer", + keyword_length = 3, + option = { + get_bufnrs = function() + local bufs = {} + for _, win in ipairs(vim.api.nvim_list_wins()) do + bufs[vim.api.nvim_win_get_buf(win)] = true + end + return vim.tbl_keys(bufs) + end, + }, + max_item_count = 10, + }, + { + name = "path", + keyword_length = 3, + max_item_count = 5, + }, + { + name = "spell", + keyword_length = 3, + option = { + keep_all_entries = false, + enable_in_context = function() + return true + end, + }, + }, + { + name = "nvim_lsp_signature_help", + }, + }, + }) +end + +return { setup_sources = setup_sources } diff --git a/lua/packages/autocomplete/cmp/window.lua b/lua/plugins/autocomplete/cmp/window.lua similarity index 100% rename from lua/packages/autocomplete/cmp/window.lua rename to lua/plugins/autocomplete/cmp/window.lua diff --git a/lua/packages/autocomplete/dap/init.lua b/lua/plugins/autocomplete/dap/init.lua similarity index 100% rename from lua/packages/autocomplete/dap/init.lua rename to lua/plugins/autocomplete/dap/init.lua diff --git a/lua/packages/autocomplete/dap/main.lua b/lua/plugins/autocomplete/dap/main.lua similarity index 100% rename from lua/packages/autocomplete/dap/main.lua rename to lua/plugins/autocomplete/dap/main.lua diff --git a/lua/packages/autocomplete/lspconfig/external_servers/neodev.lua b/lua/plugins/autocomplete/lspconfig/external_servers/neodev.lua similarity index 100% rename from lua/packages/autocomplete/lspconfig/external_servers/neodev.lua rename to lua/plugins/autocomplete/lspconfig/external_servers/neodev.lua diff --git a/lua/plugins/autocomplete/lspconfig/init.lua b/lua/plugins/autocomplete/lspconfig/init.lua new file mode 100755 index 0000000..e288ba8 --- /dev/null +++ b/lua/plugins/autocomplete/lspconfig/init.lua @@ -0,0 +1,2 @@ +require("plugins.autocomplete.lspconfig.external_servers.neodev") +require("plugins.autocomplete.lspconfig.main") diff --git a/lua/packages/autocomplete/lspconfig/main.lua b/lua/plugins/autocomplete/lspconfig/main.lua similarity index 83% rename from lua/packages/autocomplete/lspconfig/main.lua rename to lua/plugins/autocomplete/lspconfig/main.lua index aa89a4b..5644ee5 100755 --- a/lua/packages/autocomplete/lspconfig/main.lua +++ b/lua/plugins/autocomplete/lspconfig/main.lua @@ -3,24 +3,21 @@ local mason_lspconfig = require("mason-lspconfig") local nvim_lsp = require("lspconfig") local on_attach = function(client, bufnr) - -- Enable hover preview + -- Enable hover preview + vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc') - vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc') - - -- Display error and warning indicators - - if client.resolved_capabilities.document_highlight then - vim.api.nvim_create_augroup("lsp_document_highlight", { clear = true }) - vim.api.nvim_clear_autocmds({ buffer = bufnr, group = "lsp_document_highlight" }) - vim.api.nvim_create_autocmd({ "CursorHold", "CursorHoldI" }, { - group = "lsp_document_highlight", - buffer = bufnr, - callback = function() - require('vim.lsp.buf').document_highlight() - vim.api.nvim_command([[call ClearHighlightGroups()]]) - end, - }) - end + -- Display error and warning indicators + if client.server_capabilities.documentHighlightProvider then + vim.api.nvim_create_augroup("LspDocumentHighlight", { clear = true }) + vim.api.nvim_clear_autocmds({ buffer = bufnr, group = "LspDocumentHighlight" }) + vim.api.nvim_create_autocmd({ "CursorHold", "CursorHoldI" }, { + buffer = bufnr, + group = "LspDocumentHighlight", + callback = function() + vim.lsp.buf.document_highlight() + end, + }) + end end -- Define capabilities with snippet and resolve support diff --git a/lua/packages/nvim-treesitter/indent/init.lua b/lua/plugins/autocomplete/nvim-treesitter/indent/init.lua similarity index 68% rename from lua/packages/nvim-treesitter/indent/init.lua rename to lua/plugins/autocomplete/nvim-treesitter/indent/init.lua index 6dbcd9d..95c4b2e 100644 --- a/lua/packages/nvim-treesitter/indent/init.lua +++ b/lua/plugins/autocomplete/nvim-treesitter/indent/init.lua @@ -4,6 +4,6 @@ return { opts = {}, event = { "BufRead" }, config = function() - require("packages.nvim-treesitter.indent.main") + require("packages.autocomplete.nvim-treesitter.indent.main") end, } diff --git a/lua/packages/nvim-treesitter/indent/main.lua b/lua/plugins/autocomplete/nvim-treesitter/indent/main.lua similarity index 100% rename from lua/packages/nvim-treesitter/indent/main.lua rename to lua/plugins/autocomplete/nvim-treesitter/indent/main.lua diff --git a/lua/packages/nvim-treesitter/init.lua b/lua/plugins/autocomplete/nvim-treesitter/init.lua similarity index 68% rename from lua/packages/nvim-treesitter/init.lua rename to lua/plugins/autocomplete/nvim-treesitter/init.lua index 97fcc4b..4f02200 100755 --- a/lua/packages/nvim-treesitter/init.lua +++ b/lua/plugins/autocomplete/nvim-treesitter/init.lua @@ -3,6 +3,6 @@ return { event = "BufReadPre", build = ":TSUpdate", config = function() - require("packages.nvim-treesitter.main") + require("packages.autocomplete.nvim-treesitter.main") end, } diff --git a/lua/packages/nvim-treesitter/main.lua b/lua/plugins/autocomplete/nvim-treesitter/main.lua similarity index 100% rename from lua/packages/nvim-treesitter/main.lua rename to lua/plugins/autocomplete/nvim-treesitter/main.lua diff --git a/lua/packages/autocomplete/trouble/bind.lua b/lua/plugins/autocomplete/trouble/bind.lua similarity index 100% rename from lua/packages/autocomplete/trouble/bind.lua rename to lua/plugins/autocomplete/trouble/bind.lua diff --git a/lua/packages/autocomplete/trouble/main.lua b/lua/plugins/autocomplete/trouble/config.lua similarity index 95% rename from lua/packages/autocomplete/trouble/main.lua rename to lua/plugins/autocomplete/trouble/config.lua index 8aa3664..7771bd0 100755 --- a/lua/packages/autocomplete/trouble/main.lua +++ b/lua/plugins/autocomplete/trouble/config.lua @@ -1,5 +1,5 @@ local trouble = require("trouble") -local hotkeys = require("packages.autocomplete.trouble.bind") +local hotkeys = require("plugins.autocomplete.trouble.bind") trouble.setup({ position = "bottom", -- position of the list can be: bottom, top, left, right diff --git a/lua/packages/ui/HexColor/init.lua b/lua/plugins/ui/HexColor/init.lua similarity index 100% rename from lua/packages/ui/HexColor/init.lua rename to lua/plugins/ui/HexColor/init.lua diff --git a/lua/packages/ui/HexColor/main.lua b/lua/plugins/ui/HexColor/main.lua similarity index 100% rename from lua/packages/ui/HexColor/main.lua rename to lua/plugins/ui/HexColor/main.lua diff --git a/lua/packages/colors/catppuccin.lua b/lua/plugins/ui/colors/catppuccin.lua similarity index 100% rename from lua/packages/colors/catppuccin.lua rename to lua/plugins/ui/colors/catppuccin.lua diff --git a/lua/packages/colors/dracula.lua b/lua/plugins/ui/colors/dracula.lua similarity index 100% rename from lua/packages/colors/dracula.lua rename to lua/plugins/ui/colors/dracula.lua diff --git a/lua/packages/colors/monokia.lua b/lua/plugins/ui/colors/monokia.lua similarity index 100% rename from lua/packages/colors/monokia.lua rename to lua/plugins/ui/colors/monokia.lua diff --git a/lua/packages/colors/nord.lua b/lua/plugins/ui/colors/nord.lua similarity index 100% rename from lua/packages/colors/nord.lua rename to lua/plugins/ui/colors/nord.lua diff --git a/lua/plugins/ui/colors/onedarkpro.lua b/lua/plugins/ui/colors/onedarkpro.lua new file mode 100755 index 0000000..c80913d --- /dev/null +++ b/lua/plugins/ui/colors/onedarkpro.lua @@ -0,0 +1,14 @@ +require("onedarkpro").setup({ + filetypes = { + all = true, + }, + plugins = { + -- all = false, + -- nvim_lsp = true, + -- polygot = false, + -- treesitter = true + } +}) + +-- somewhere in your config: +vim.cmd("colorscheme onedark_vivid") -- onedark onelight onedark_vivid onedark_dark diff --git a/lua/packages/colors/rose-pine.lua b/lua/plugins/ui/colors/rose-pine.lua similarity index 100% rename from lua/packages/colors/rose-pine.lua rename to lua/plugins/ui/colors/rose-pine.lua diff --git a/lua/packages/ui/dashboard/main.lua b/lua/plugins/ui/dashboard/config.lua similarity index 94% rename from lua/packages/ui/dashboard/main.lua rename to lua/plugins/ui/dashboard/config.lua index fb7a256..4793e17 100755 --- a/lua/packages/ui/dashboard/main.lua +++ b/lua/plugins/ui/dashboard/config.lua @@ -12,7 +12,7 @@ require("dashboard").setup({ }, -- shortcuts in the top page shortcut = { - { desc = " Update", action = "Lazy sync", key = "u" }, + { desc = " Update", action = "Rocks sync", key = "u" }, { desc = " Files", action = "Telescope find_files", diff --git a/lua/packages/ui/devicons/init.lua b/lua/plugins/ui/devicons/init.lua similarity index 100% rename from lua/packages/ui/devicons/init.lua rename to lua/plugins/ui/devicons/init.lua diff --git a/lua/packages/ui/devicons/main.lua b/lua/plugins/ui/devicons/main.lua similarity index 100% rename from lua/packages/ui/devicons/main.lua rename to lua/plugins/ui/devicons/main.lua diff --git a/lua/packages/ui/nvim-notify/main.lua b/lua/plugins/ui/nvim-notify/config.lua similarity index 100% rename from lua/packages/ui/nvim-notify/main.lua rename to lua/plugins/ui/nvim-notify/config.lua diff --git a/lua/packages/ui/nvim-terminal/bind.lua b/lua/plugins/ui/nvim-terminal/bind.lua similarity index 100% rename from lua/packages/ui/nvim-terminal/bind.lua rename to lua/plugins/ui/nvim-terminal/bind.lua diff --git a/lua/packages/ui/nvim-terminal/init.lua b/lua/plugins/ui/nvim-terminal/init.lua similarity index 100% rename from lua/packages/ui/nvim-terminal/init.lua rename to lua/plugins/ui/nvim-terminal/init.lua diff --git a/lua/packages/ui/nvim-terminal/main.lua b/lua/plugins/ui/nvim-terminal/main.lua similarity index 100% rename from lua/packages/ui/nvim-terminal/main.lua rename to lua/plugins/ui/nvim-terminal/main.lua diff --git a/lua/packages/ui/nvim-tree/bind.lua b/lua/plugins/ui/nvim-tree/bind.lua similarity index 100% rename from lua/packages/ui/nvim-tree/bind.lua rename to lua/plugins/ui/nvim-tree/bind.lua diff --git a/lua/packages/ui/nvim-tree/main.lua b/lua/plugins/ui/nvim-tree/config.lua similarity index 95% rename from lua/packages/ui/nvim-tree/main.lua rename to lua/plugins/ui/nvim-tree/config.lua index 971cb40..944c12c 100755 --- a/lua/packages/ui/nvim-tree/main.lua +++ b/lua/plugins/ui/nvim-tree/config.lua @@ -1,6 +1,6 @@ local set = vim.g local nvim_tree = require("nvim-tree") -local tree_binds = require("packages.ui.nvim-tree.bind") +local tree_binds = require("plugins.ui.nvim-tree.bind") local function set_icons() set.nvim_tree_icons = { diff --git a/lua/plugins/ui/staline/config.lua b/lua/plugins/ui/staline/config.lua new file mode 100644 index 0000000..06cf821 --- /dev/null +++ b/lua/plugins/ui/staline/config.lua @@ -0,0 +1,39 @@ + +require "staline".setup { + sections = { + left = { ' ', 'mode', ' ', 'branch', ' ', 'lsp' }, + mid = {}, + right = {'file_name', 'line_column' } + }, + mode_colors = { + i = "#d4be98", + n = "#84a598", + c = "#8fbf7f", + v = "#fc802d", + }, + defaults = { + true_colors = true, + line_column = " [%l/%L] :%c ", + branch_symbol = " " + } +} + +require('stabline').setup { + style = "bar", -- others: arrow, slant, bubble + stab_left = "┃", + stab_right = " ", + + -- fg = Default is fg of "Normal". + -- bg = Default is bg of "Normal". + inactive_bg = "#1e2127", + inactive_fg = "#aaaaaa", + -- stab_bg = Default is darker version of bg., + + font_active = "bold", + exclude_fts = { 'NvimTree', 'dashboard', 'lir' }, + stab_start = "", -- The starting of stabline + stab_end = "", + numbers = function(bufn, n) + return '*'..n..' ' + end +} diff --git a/lua/packages/telescope/bind.lua b/lua/plugins/ui/telescope/bind.lua similarity index 89% rename from lua/packages/telescope/bind.lua rename to lua/plugins/ui/telescope/bind.lua index bf6bd0e..88ec83f 100755 --- a/lua/packages/telescope/bind.lua +++ b/lua/plugins/ui/telescope/bind.lua @@ -1,8 +1,7 @@ local bind = vim.keymap.set -- import trouble actions for telescope -local trouble = require("trouble.providers.telescope") --- import telescope actions safely +local open_with_trouble = require("trouble.sources.telescope").open -- import telescope actions safely local actions = require("telescope.actions") -- telescopes @@ -20,12 +19,12 @@ bind("n", "gs", "Telescope git_status") -- list current changes local binds = { mappings = { i = { - [""] = trouble.open_with_trouble, + [""] = open_with_trouble, [""] = actions.move_selection_previous, -- move to prev result [""] = actions.move_selection_next, -- move to next result [""] = actions.send_selected_to_qflist + actions.open_qflist, -- send selected to quickfixlist }, - n = { [""] = trouble.open_with_trouble }, + n = { [""] = open_with_trouble }, }, } return binds diff --git a/lua/plugins/ui/telescope/config.lua b/lua/plugins/ui/telescope/config.lua new file mode 100755 index 0000000..bbf3fd7 --- /dev/null +++ b/lua/plugins/ui/telescope/config.lua @@ -0,0 +1,33 @@ +-- import telescope plugin safely +local telescope = require("telescope") +local theme = require("telescope.themes") +-- Bindings +local hotkeys = require("plugins.ui.telescope.bind") + +-- configure telescope +local mappings = hotkeys.mappings +telescope.setup({ + -- configure custom mappings + defaults = { + mappings, + }, + extensions = { + ["ui-select"] = theme.get_dropdown({ + -- even more opts + }), + -- fzf = { + -- fuzzy = true, -- false will only do exact matching + -- override_generic_sorter = true, -- override the generic sorter + -- override_file_sorter = true, -- override the file sorter + -- case_mode = "smart_case", -- or "ignore_case" or "respect_case" + -- -- the default case_mode is "smart_case" + -- }, + }, +}) + +-- telescope.load_extension('fzf') +-- To get ui-select loaded and working with telescope, you need to call +-- load_extension, somewhere after setup function: +telescope.load_extension("ui-select") +-- telescope notify plugin +telescope.load_extension("notify") diff --git a/lua/plugins/ui/theme.lua b/lua/plugins/ui/theme.lua new file mode 100755 index 0000000..2280218 --- /dev/null +++ b/lua/plugins/ui/theme.lua @@ -0,0 +1,16 @@ +local set = vim.o +local vimscript = vim.cmd + +-- chack found themes +local themes_status = pcall(require, "onedarkpro") + +-- auto load theme +if themes_status then + require("plugins.ui.colors.onedarkpro") +end + +set.syntax = "Enable" + +-- vimscript([[ +-- highlight NvimTreeFolderIcon guibg=NONE +-- ]]) diff --git a/lua/theme.lua b/lua/theme.lua deleted file mode 100755 index 55cb786..0000000 --- a/lua/theme.lua +++ /dev/null @@ -1,16 +0,0 @@ -local set = vim.o -local vimscript = vim.cmd - --- chack found themes -local themes_status = pcall(require, "rose-pine") - --- auto load theme -if themes_status then - require("packages.colors.rose-pine") -end - -set.syntax = "Enable" - -vimscript([[ -highlight NvimTreeFolderIcon guibg=NONE -]]) diff --git a/rocks.toml b/rocks.toml new file mode 100644 index 0000000..dced13f --- /dev/null +++ b/rocks.toml @@ -0,0 +1,130 @@ +# This is your rocks.nvim plugins declaration file. +# Here is a small yet pretty detailed example on how to use it: + +# This includes things like `toml` or other lua packages. +[rocks] + +# List of Neovim plugins to install alongside their versions. +# If the plugin name contains a dot then you must add quotes to the key name! +[plugins] +"rocks.nvim" = "2.37.0" +"rocks-edit.nvim" = "scm" +"rocks-treesitter.nvim" = "1.0.3" +"rocks-git.nvim" = "2.0.1" +"rocks-config.nvim" = "2.2.0" +nvim-notify = "3.13.5" +tree-sitter-toml = "0.0.2" +"mason-lspconfig.nvim" = "scm" +"neodev.nvim" = "3.0.0" +neorg = "9.1.1" +nvim-cmp = "scm" +cmp-nvim-lsp = "scm" +"lspkind.nvim" = "scm" +cmp-buffer = "scm" +cmp-path = "scm" +cmp-cmdline = "scm" +cmp_luasnip = "scm" +luasnip = "2.3.0" +friendly-snippets = "scm" +"ultimate-autopair.nvim" = "scm" +"nvim-tree.lua" = "1.6.0" +nvim-web-devicons = "0.100" +"staline.nvim" = "scm" +dashboard-nvim = "scm" +tree-sitter-python = "0.0.2" +"dracula.nvim" = "scm" +catppuccin = "0.1.0" +"onedarkpro.nvim" = "0.8.0" +"monokai.nvim" = "scm" +"trouble.nvim" = "3.6.0" +"telescope-ui-select.nvim" = "scm" +"telescope.nvim" = "scm" + +[plugin.cmp-nvim-lua] +git = "hrsh7th/cmp-nvim-lua" +[plugin.cmp-spell] +git = "f3fora/cmp-spell" +[plugin.cmp-nvim-lsp-document-symbol] +git = "hrsh7th/cmp-nvim-lsp-document-symbol" +[plugin.cmp-nvim-lsp-signature-help] +git = "hrsh7th/cmp-nvim-lsp-signature-help" +[plugin.iceberg] # Theme/ColorSchrome +git = "cocopon/iceberg.vim" +[plugin.nord] # Theme/ColorSchrome +git = "shaunsingh/nord.nvim" +[plugin.rose-pine] # Theme/ColorSchrome +git = "rose-pine/neovim" +name = "rose-pine" + + +[treesitter] +# auto_highlight = "all" +# NOTE: These are parsers, not filetypes. +auto_highlight = [ + "haskell", + "dhall", + "rust", + "toml", + "python", + "lua" +] + +auto_install = "prompt" # true | false + +[treesitter.parser_map] +# You can add custom filetype to parser mappings. +# Determine the filetype with ':lua =vim.bo[0].filetype'. +# NOTE: You don't actually have to add these examples. +# They are added by default. +PKGBUILD = "bash" +cls = "latex" +sty = "latex" + +[config] +plugins_dir = "plugins/" +auto_setup = false + +# User Interface Plugins Settings +[plugin.nvim-notify] +config = "plugins.ui.nvim-notify.config" +[plugins.nvim-tree] +config = "plugins.ui.nvim-tree.config" +[plugins.staline] +config = "plugins.ui.staline.config" +[plugins.dashboard] +config = "plugins.ui.dashboard.config" + +[bundles.telescope] +items = [ + "telescope.nvim", + "telescope-ui-select.nvim" +] +config = "plugins.ui.telescope.config" + +[plugins.ultimate-autopair] +config = "plugins.autocomplete.autopair.config" + + +# LSP & autocomplete System Plugins Settings +[plugins.mason-lspconfig] +config = "plugins.autocomplete.lspconfig" + + +[bundles.cmp] # Create a bundle called `cmp` +items = [ + "lspkind.nvim", + "nvim-cmp", + "cmp-nvim-lsp", + "cmp-buffer", + "cmp-path", + "cmp-cmdline", + "luasnip", + "cmp_luasnip", + "friendly-snippets", + "neodev.nvim", + ] + config = "plugins.autocomplete.cmp" + +[plugins.trouble] +config = "plugins.autocomplete.trouble.config" +