summaryrefslogtreecommitdiff
path: root/.config/nvim
diff options
context:
space:
mode:
Diffstat (limited to '.config/nvim')
-rw-r--r--.config/nvim/.gitignore15
-rw-r--r--.config/nvim/.stylua.toml6
-rw-r--r--.config/nvim/README.md2
-rw-r--r--.config/nvim/colors/dark.vim1
-rw-r--r--.config/nvim/config.lua166
-rw-r--r--.config/nvim/ftdetect/nix.lua1
-rw-r--r--.config/nvim/ftdetect/zig.lua4
-rw-r--r--.config/nvim/ftplugin/json.lua2
-rw-r--r--.config/nvim/ftplugin/lua.lua2
-rw-r--r--.config/nvim/ftplugin/python.lua4
-rw-r--r--.config/nvim/ftplugin/sh.lua4
-rw-r--r--.config/nvim/init.lua17
-rw-r--r--.config/nvim/lsp-settings/jsonls.json0
-rw-r--r--.config/nvim/lsp-settings/pyright.json3
-rw-r--r--.config/nvim/lsp-settings/rust_analyzer.json4
-rw-r--r--.config/nvim/lsp-settings/terraformls.json5
-rw-r--r--.config/nvim/lua/bootstrap.lua77
-rw-r--r--.config/nvim/lua/config/defaults.lua39
-rw-r--r--.config/nvim/lua/config/init.lua127
-rw-r--r--.config/nvim/lua/config/settings.lua78
-rw-r--r--.config/nvim/lua/config/supported_languages.lua94
-rw-r--r--.config/nvim/lua/core/autocmds.lua145
-rw-r--r--.config/nvim/lua/core/autopairs.lua79
-rw-r--r--.config/nvim/lua/core/bufferline.lua21
-rw-r--r--.config/nvim/lua/core/builtins/init.lua26
-rw-r--r--.config/nvim/lua/core/cmp.lua309
-rw-r--r--.config/nvim/lua/core/commands.lua28
-rw-r--r--.config/nvim/lua/core/comment.lua71
-rw-r--r--.config/nvim/lua/core/dashboard.lua112
-rw-r--r--.config/nvim/lua/core/gitsigns.lua61
-rw-r--r--.config/nvim/lua/core/info.lua206
-rw-r--r--.config/nvim/lua/core/log.lua127
-rw-r--r--.config/nvim/lua/core/lualine/colors.lua19
-rw-r--r--.config/nvim/lua/core/lualine/components.lua179
-rw-r--r--.config/nvim/lua/core/lualine/conditions.lua17
-rw-r--r--.config/nvim/lua/core/lualine/init.lua47
-rw-r--r--.config/nvim/lua/core/lualine/styles.lua185
-rw-r--r--.config/nvim/lua/core/lualine/utils.lua27
-rw-r--r--.config/nvim/lua/core/nvimtree.lua175
-rw-r--r--.config/nvim/lua/core/project.lua51
-rw-r--r--.config/nvim/lua/core/telescope.lua159
-rw-r--r--.config/nvim/lua/core/terminal.lua118
-rw-r--r--.config/nvim/lua/core/treesitter.lua94
-rw-r--r--.config/nvim/lua/core/which-key.lua283
-rw-r--r--.config/nvim/lua/dark/Git.lua10
-rw-r--r--.config/nvim/lua/dark/LSP.lua92
-rw-r--r--.config/nvim/lua/dark/Treesitter.lua56
-rw-r--r--.config/nvim/lua/dark/Whichkey.lua9
-rw-r--r--.config/nvim/lua/dark/config.lua23
-rw-r--r--.config/nvim/lua/dark/highlights.lua99
-rw-r--r--.config/nvim/lua/dark/init.lua30
-rw-r--r--.config/nvim/lua/dark/markdown.lua27
-rw-r--r--.config/nvim/lua/dark/palette.lua33
-rw-r--r--.config/nvim/lua/dark/util.lua25
-rw-r--r--.config/nvim/lua/extra/colorizer.lua22
-rw-r--r--.config/nvim/lua/extra/hop.lua15
-rw-r--r--.config/nvim/lua/extra/lir.lua96
-rw-r--r--.config/nvim/lua/extra/lsp_signature.lua14
-rw-r--r--.config/nvim/lua/extra/neoscroll.lua25
-rw-r--r--.config/nvim/lua/extra/numb.lua17
-rw-r--r--.config/nvim/lua/extra/octo.lua139
-rw-r--r--.config/nvim/lua/extra/quickscope.lua3
-rw-r--r--.config/nvim/lua/extra/spectre.lua144
-rw-r--r--.config/nvim/lua/extra/zen.lua48
-rw-r--r--.config/nvim/lua/impatient.lua359
-rw-r--r--.config/nvim/lua/impatient/profile.lua156
-rw-r--r--.config/nvim/lua/interface/popup.lua62
-rw-r--r--.config/nvim/lua/interface/text.lua98
-rw-r--r--.config/nvim/lua/keymappings.lua203
-rw-r--r--.config/nvim/lua/lsp/config.lua67
-rw-r--r--.config/nvim/lua/lsp/handlers.lua187
-rw-r--r--.config/nvim/lua/lsp/init.lua198
-rw-r--r--.config/nvim/lua/lsp/manager.lua95
-rw-r--r--.config/nvim/lua/lsp/null-ls/code_actions.lua81
-rw-r--r--.config/nvim/lua/lsp/null-ls/formatters.lua82
-rw-r--r--.config/nvim/lua/lsp/null-ls/init.lua22
-rw-r--r--.config/nvim/lua/lsp/null-ls/linters.lua82
-rw-r--r--.config/nvim/lua/lsp/null-ls/services.lua61
-rw-r--r--.config/nvim/lua/lsp/peek.lua166
-rw-r--r--.config/nvim/lua/lsp/providers/jsonls.lua198
-rw-r--r--.config/nvim/lua/lsp/providers/sumneko_lua.lua19
-rw-r--r--.config/nvim/lua/lsp/providers/vuels.lua28
-rw-r--r--.config/nvim/lua/lsp/providers/yamlls.lua30
-rw-r--r--.config/nvim/lua/lsp/templates.lua74
-rw-r--r--.config/nvim/lua/lsp/utils.lua67
-rw-r--r--.config/nvim/lua/plugin-loader.lua110
-rw-r--r--.config/nvim/lua/plugins.lua241
-rw-r--r--.config/nvim/lua/utils/hooks.lua33
-rw-r--r--.config/nvim/lua/utils/init.lua179
-rw-r--r--.config/nvim/lua/utils/table.lua24
-rw-r--r--.config/nvim/spell/en.utf-8.add6
-rw-r--r--.config/nvim/spell/en.utf-8.add.splbin62 -> 0 bytes
92 files changed, 0 insertions, 7045 deletions
diff --git a/.config/nvim/.gitignore b/.config/nvim/.gitignore
deleted file mode 100644
index 36647be..0000000
--- a/.config/nvim/.gitignore
+++ /dev/null
@@ -1,15 +0,0 @@
-plugin/
-tags*
-.netrwhist
-pythonpath.vim
-nodepath.vim
-autoload/plugged/*
-vimspector-config/gadgets/*
-session
-wiki/
-pack/
-lua-language-server/
-site/
-package.json
-package-lock.json
-node_modules/
diff --git a/.config/nvim/.stylua.toml b/.config/nvim/.stylua.toml
deleted file mode 100644
index 4c56db7..0000000
--- a/.config/nvim/.stylua.toml
+++ /dev/null
@@ -1,6 +0,0 @@
-column_width = 88
-line_endings = "Unix"
-indent_type = "Spaces"
-indent_width = 2
-quote_style = "AutoPreferDouble"
-no_call_parentheses = true
diff --git a/.config/nvim/README.md b/.config/nvim/README.md
deleted file mode 100644
index 7f39a9b..0000000
--- a/.config/nvim/README.md
+++ /dev/null
@@ -1,2 +0,0 @@
-# Neovim
-
diff --git a/.config/nvim/colors/dark.vim b/.config/nvim/colors/dark.vim
deleted file mode 100644
index 89c03d1..0000000
--- a/.config/nvim/colors/dark.vim
+++ /dev/null
@@ -1 +0,0 @@
-lua require("dark")
diff --git a/.config/nvim/config.lua b/.config/nvim/config.lua
deleted file mode 100644
index d622353..0000000
--- a/.config/nvim/config.lua
+++ /dev/null
@@ -1,166 +0,0 @@
--- general
-options.format_on_save = true
-options.colorscheme = "dark"
-vim.opt.wrap = false
-
--- Keymappings
-options.leader = "space"
-
-options.keys.normal_mode["<esc><esc>"] = "<cmd>nohlsearch<cr>"
-
--- LSP
-options.lsp.diagnostics.virtual_text = false
--- require("extra.json_schemas").setup()
-
--- After changing plugin config it is recommended to run :PackerCompile
-options.builtin.autopairs.active = true
-options.builtin.dashboard.active = true
-options.builtin.terminal.active = true
-options.builtin.telescope.active = true
-options.builtin.bufferline.active = true
-options.builtin.lualine.active = true
-options.builtin.lualine.style = "dark"
-options.builtin.project.patterns = { ".git" }
-
--- Whichkey
-options.builtin.which_key.mappings.l.d = { "<cmd>TroubleToggle<cr>", "Diagnostics" }
-options.builtin.which_key.mappings.l.R = {
- "<cmd>TroubleToggle lsp_references<cr>",
- "References",
-}
-options.builtin.which_key.mappings.l.o = { "<cmd>SymbolsOutline<cr>", "Outline" }
-options.builtin.which_key.mappings.T.h = {
- "<cmd>TSHighlightCapturesUnderCursor<cr>",
- "Highlight",
-}
-options.builtin.which_key.mappings.T.p = { "<cmd>TSPlaygroundToggle<cr>", "Playground" }
-options.builtin.which_key.mappings["z"] = { "<cmd>ZenMode<cr>", "Zen" }
-options.builtin.which_key.mappings["r"] = {
- name = "Replace",
- r = { "<cmd>lua require('spectre').open()<cr>", "Replace" },
- w = {
- "<cmd>lua require('spectre').open_visual({select_word=true})<cr>",
- "Replace Word",
- },
- f = { "<cmd>lua require('spectre').open_file_search()<cr>", "Replace Buffer" },
-}
-options.builtin.which_key.mappings.f = {
- "<cmd>lua require('lir.float').toggle()<cr>",
- "Files",
-}
-options.builtin.which_key.mappings.v = { "<cmd>vsplit<cr>", "Vertical Split" }
-options.builtin.which_key.mappings.h = { "<cmd>split<cr>", "Horizontal Split" }
-
--- options.builtin.nvimtree.auto_open = 0
-
--- Treesitter
-options.builtin.treesitter.ensure_installed = "maintained"
-options.builtin.treesitter.autotag.enable = false
-options.builtin.treesitter.playground.enable = false
-options.builtin.treesitter.indent.disable = { "python" }
-
-options.builtin.which_key.mappings["z"] = { "<cmd>ZenMode<cr>", "Zen" }
-options.builtin.which_key.mappings["r"] = {
- name = "Replace",
- r = { "<cmd>lua require('spectre').open()<cr>", "Replace" },
- w = {
- "<cmd>lua require('spectre').open_visual({select_word=true})<cr>",
- "Replace Word",
- },
- f = { "<cmd>lua require('spectre').open_file_search()<cr>", "Replace Buffer" },
-}
-
-options.builtin.telescope.on_config_done = function()
- local actions = require "telescope.actions"
- options.builtin.telescope.defaults.mappings.i["<C-j>"] = actions.move_selection_next
- options.builtin.telescope.defaults.mappings.i["<C-k>"] =
- actions.move_selection_previous
- options.builtin.telescope.defaults.mappings.i["<C-n>"] = actions.cycle_history_next
- options.builtin.telescope.defaults.mappings.i["<C-p>"] = actions.cycle_history_prev
-end
-
--- Extra plugings
-
-options.plugins = {
- {
- "folke/trouble.nvim",
- cmd = "TroubleToggle",
- },
-
- {
- "nvim-telescope/telescope-project.nvim",
- event = "BufWinEnter",
- setup = function()
- vim.cmd [[packadd telescope.nvim]]
- end,
- },
-
- {
- "nacro90/numb.nvim",
- event = "BufRead",
- config = function()
- require("extra.numb").config()
- end,
- },
-
- {
- "unblevable/quick-scope",
- config = function()
- require "extra.quickscope"
- end,
- },
-
- {
- "phaazon/hop.nvim",
- event = "BufRead",
- config = function()
- require("extra.hop").config()
- end,
- },
-
- {
- "tamago324/lir.nvim",
- config = function()
- require "extra.lir"
- end,
- },
-
- {
- "norcalli/nvim-colorizer.lua",
- config = function()
- require("extra.colorizer").config()
- end,
- },
-
- {
- "windwp/nvim-spectre",
- event = "BufRead",
- config = function()
- require("extra.spectre").config()
- end,
- },
-
- {
- "folke/zen-mode.nvim",
- config = function()
- require("extra.zen").config()
- end,
- },
-
- {
- "karb94/neoscroll.nvim",
- config = function()
- require("extra.neoscroll").config()
- end,
- },
-
- {
- "kevinhwang91/nvim-bqf",
- event = "BufRead",
- },
-
- {
- "sindrets/diffview.nvim",
- event = "BufRead",
- },
-}
diff --git a/.config/nvim/ftdetect/nix.lua b/.config/nvim/ftdetect/nix.lua
deleted file mode 100644
index a85bcfd..0000000
--- a/.config/nvim/ftdetect/nix.lua
+++ /dev/null
@@ -1 +0,0 @@
-vim.cmd [[ au BufRead,BufNewFile *.nix set filetype=nix ]]
diff --git a/.config/nvim/ftdetect/zig.lua b/.config/nvim/ftdetect/zig.lua
deleted file mode 100644
index 7edf1f6..0000000
--- a/.config/nvim/ftdetect/zig.lua
+++ /dev/null
@@ -1,4 +0,0 @@
-vim.cmd [[
- au BufRead,BufNewFile *.zig set filetype=zig
- au BufRead,BufNewFile *.zir set filetype=zir
-]]
diff --git a/.config/nvim/ftplugin/json.lua b/.config/nvim/ftplugin/json.lua
deleted file mode 100644
index a2047cd..0000000
--- a/.config/nvim/ftplugin/json.lua
+++ /dev/null
@@ -1,2 +0,0 @@
-local formatters = require "lsp.null-ls.formatters"
-formatters.setup { { exe = "prettier", filetypes = { "json" } } }
diff --git a/.config/nvim/ftplugin/lua.lua b/.config/nvim/ftplugin/lua.lua
deleted file mode 100644
index 6e10a53..0000000
--- a/.config/nvim/ftplugin/lua.lua
+++ /dev/null
@@ -1,2 +0,0 @@
-local formatters = require "lsp.null-ls.formatters"
-formatters.setup { { exe = "stylua", filetypes = { "lua" } } }
diff --git a/.config/nvim/ftplugin/python.lua b/.config/nvim/ftplugin/python.lua
deleted file mode 100644
index a725200..0000000
--- a/.config/nvim/ftplugin/python.lua
+++ /dev/null
@@ -1,4 +0,0 @@
-local formatters = require "lsp.null-ls.formatters"
-local linters = require "lsp.null-ls.linters"
-formatters.setup { { exe = "black", filetypes = { "python" } } }
-linters.setup { { exe = "flake8", filetypes = { "python" } } }
diff --git a/.config/nvim/ftplugin/sh.lua b/.config/nvim/ftplugin/sh.lua
deleted file mode 100644
index 6fcc649..0000000
--- a/.config/nvim/ftplugin/sh.lua
+++ /dev/null
@@ -1,4 +0,0 @@
-local formatters = require "lsp.null-ls.formatters"
-formatters.setup {
- { exe = "shellcheck", args = { "--sverity", "error" }, filetypes = { "sh" } },
-}
diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua
deleted file mode 100644
index 1810297..0000000
--- a/.config/nvim/init.lua
+++ /dev/null
@@ -1,17 +0,0 @@
-require("bootstrap"):init()
-
-require("config"):load()
-
-local plugins = require "plugins"
-require("plugin-loader").load { plugins, options.plugins }
-
-local Log = require "core.log"
-Log:debug "Starting NeoVim"
-
-vim.g.colors_name = options.colorscheme -- Colorscheme must get called after plugins are loaded or it will break new installs.
-vim.cmd("colorscheme " .. options.colorscheme)
-
-local commands = require "core.commands"
-commands.load(commands.defaults)
-
-require("lsp").setup()
diff --git a/.config/nvim/lsp-settings/jsonls.json b/.config/nvim/lsp-settings/jsonls.json
deleted file mode 100644
index e69de29..0000000
--- a/.config/nvim/lsp-settings/jsonls.json
+++ /dev/null
diff --git a/.config/nvim/lsp-settings/pyright.json b/.config/nvim/lsp-settings/pyright.json
deleted file mode 100644
index cc5a352..0000000
--- a/.config/nvim/lsp-settings/pyright.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "python.analysis.typeCheckingMode": "off"
-}
diff --git a/.config/nvim/lsp-settings/rust_analyzer.json b/.config/nvim/lsp-settings/rust_analyzer.json
deleted file mode 100644
index 8130c24..0000000
--- a/.config/nvim/lsp-settings/rust_analyzer.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "rust-analyzer.lens.enable": true,
- "rust-analyzer.lens.references": true
-}
diff --git a/.config/nvim/lsp-settings/terraformls.json b/.config/nvim/lsp-settings/terraformls.json
deleted file mode 100644
index 050973c..0000000
--- a/.config/nvim/lsp-settings/terraformls.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- "terraform-ls.experimentalFeatures": {
- "validateOnSave": true
- }
-}
diff --git a/.config/nvim/lua/bootstrap.lua b/.config/nvim/lua/bootstrap.lua
deleted file mode 100644
index 4247f04..0000000
--- a/.config/nvim/lua/bootstrap.lua
+++ /dev/null
@@ -1,77 +0,0 @@
-local M = {}
-
----Join path segments that were passed as input
----@return string
-function _G.join_paths(...)
- local path_sep = "/"
- local result = table.concat({ ... }, path_sep)
- return result
-end
-
----Get the full path to `$LUNARVIM_RUNTIME_DIR`
----@return string
-function _G.get_runtime_dir()
- -- when nvim is used directly
- return vim.fn.stdpath "config"
-end
-
----Get the full path to `$LUNARVIM_CONFIG_DIR`
----@return string
-function _G.get_config_dir()
- return vim.fn.stdpath "config"
-end
-
-function _G.get_data_dir()
- return vim.fn.stdpath "data"
-end
-
----Get the full path to `$LUNARVIM_CACHE_DIR`
----@return string
-function _G.get_cache_dir()
- return vim.fn.stdpath "cache"
-end
-
----Initialize the `&runtimepath` variables and prepare for startup
----@return table
-function M:init()
- self.runtime_dir = get_runtime_dir()
- self.config_dir = get_config_dir()
- self.cache_path = get_cache_dir()
- self.data_dir = get_data_dir()
- self.repo_dir = join_paths(self.runtime_dir, "nvim")
-
- self.pack_dir = join_paths(self.data_dir, "site", "pack")
- self.packer_install_dir = join_paths(
- self.data_dir,
- "site",
- "pack",
- "packer",
- "start",
- "packer.nvim"
- )
- self.packer_cache_path = join_paths(self.config_dir, "plugin", "packer_compiled.lua")
- vim.fn.mkdir(vim.fn.stdpath "cache", "p")
-
- local config = require "config"
- config:init {
- path = join_paths(self.config_dir, "config.lua"),
- }
-
- require("plugin-loader"):init {
- package_root = self.pack_dir,
- install_path = self.packer_install_dir,
- }
-
- return self
-end
-
----pulls the latest changes from github and, resets the startup cache
-function M:update()
- package.loaded["utils.hooks"] = nil
- local _, hooks = pcall(require, "utils.hooks")
- hooks.run_pre_update()
- M:update_repo()
- hooks.run_post_update()
-end
-
-return M
diff --git a/.config/nvim/lua/config/defaults.lua b/.config/nvim/lua/config/defaults.lua
deleted file mode 100644
index 87ef57a..0000000
--- a/.config/nvim/lua/config/defaults.lua
+++ /dev/null
@@ -1,39 +0,0 @@
-return {
- leader = "space",
- colorscheme = "dark",
- line_wrap_cursor_movement = true,
- transparent_window = false,
- format_on_save = {
- ---@usage pattern string pattern used for the autocommand (Default: '*')
- pattern = "*",
- ---@usage timeout number timeout in ms for the format request (Default: 1000)
- timeout = 1000,
- },
- keys = {},
-
- builtin = {},
-
- plugins = {
- -- use config.lua for this not put here
- },
-
- autocommands = {},
- lang = {},
- log = {
- ---@usage can be { "trace", "debug", "info", "warn", "error", "fatal" },
- level = "warn",
- viewer = {
- ---@usage this will fallback on "less +F" if not found
- cmd = "lnav",
- layout_config = {
- ---@usage direction = 'vertical' | 'horizontal' | 'window' | 'float',
- direction = "horizontal",
- open_mapping = "",
- size = 40,
- float_opts = {},
- },
- },
- -- currently disabled due to instabilities
- override_notify = false,
- },
-}
diff --git a/.config/nvim/lua/config/init.lua b/.config/nvim/lua/config/init.lua
deleted file mode 100644
index 63f4d0f..0000000
--- a/.config/nvim/lua/config/init.lua
+++ /dev/null
@@ -1,127 +0,0 @@
-local utils = require "utils"
-local Log = require "core.log"
-
-local M = {}
-local user_config_dir = get_config_dir()
-local user_config_file = utils.join_paths(user_config_dir, "config.lua")
-
-local function apply_defaults(configs, defaults)
- configs = configs or {}
- return vim.tbl_deep_extend("keep", configs, defaults)
-end
-
----Get the full path to the user configuration file
----@return string
-function M:get_user_config_path()
- return user_config_file
-end
-
---- Initialize nvim default configuration
--- Define options global variable
-function M:init()
- if vim.tbl_isempty(nvim or {}) then
- options = vim.deepcopy(require "config.defaults")
- local home_dir = vim.loop.os_homedir()
- options.vsnip_dir = utils.join_paths(home_dir, ".config", "snippets")
- options.database = {
- save_location = utils.join_paths(home_dir, ".config", "lunarvim_db"),
- auto_execute = 1,
- }
- end
-
- local builtins = require "core.builtins"
- builtins.config { user_config_file = user_config_file }
-
- local settings = require "config.settings"
- settings.load_options()
-
- local default_keymaps = require("keymappings").get_defaults()
- options.keys = apply_defaults(options.keys, default_keymaps)
-
- local autocmds = require "core.autocmds"
- options.autocommands = apply_defaults(options.autocommands, autocmds.load_augroups())
-
- local lsp_config = require "lsp.config"
- options.lsp = apply_defaults(options.lsp, vim.deepcopy(lsp_config))
-
- local supported_languages = require "config.supported_languages"
- require("lsp.manager").init_defaults(supported_languages)
-end
-
-local function handle_deprecated_settings()
- local function deprecation_notice(setting)
- local in_headless = #vim.api.nvim_list_uis() == 0
- if in_headless then
- return
- end
-
- local msg = string.format(
- "Deprecation notice: [%s] setting is no longer supported. See https://github.com/LunarVim/LunarVim#breaking-changes",
- setting
- )
- vim.schedule(function()
- Log:warn(msg)
- end)
- end
-
- for lang, entry in pairs(options.lang) do
- local deprecated_config = entry.formatters or entry.linters or {}
- if not vim.tbl_isempty(deprecated_config) then
- deprecation_notice(string.format("lang.%s", lang))
- end
- end
-end
-
---- Override the configuration with a user provided one
--- @param config_path The path to the configuration overrides
-function M:load(config_path)
- local autocmds = require "core.autocmds"
- config_path = config_path or self.get_user_config_path()
- local ok, err = pcall(dofile, config_path)
- if not ok then
- if utils.is_file(user_config_file) then
- Log:warn("Invalid configuration: " .. err)
- else
- Log:warn(string.format("Unable to find configuration file [%s]", config_path))
- end
- end
-
- handle_deprecated_settings()
-
- autocmds.define_augroups(options.autocommands)
-
- vim.g.mapleader = (options.leader == "space" and " ") or options.leader
- require("keymappings").load(options.keys)
-
- local settings = require "config.settings"
- settings.load_commands()
-end
-
---- Override the configuration with a user provided one
--- @param config_path The path to the configuration overrides
-function M:reload()
- local core_modules = {}
- for module, _ in pairs(package.loaded) do
- if module:match "core" then
- package.loaded[module] = nil
- table.insert(core_modules, module)
- end
- end
-
- M:init()
- M:load()
-
- local plugins = require "plugins"
- local autocmds = require "core.autocmds"
- autocmds.configure_format_on_save()
- local plugin_loader = require "plugin-loader"
- plugin_loader.cache_clear()
- plugin_loader.load { plugins, options.plugins }
- vim.cmd ":PackerInstall"
- vim.cmd ":PackerCompile"
- -- vim.cmd ":PackerClean"
- require("lsp").setup()
- Log:info "Reloaded configuration"
-end
-
-return M
diff --git a/.config/nvim/lua/config/settings.lua b/.config/nvim/lua/config/settings.lua
deleted file mode 100644
index 4b5c340..0000000
--- a/.config/nvim/lua/config/settings.lua
+++ /dev/null
@@ -1,78 +0,0 @@
-local M = {}
-local utils = require "utils"
-
-M.load_options = function()
- local default_options = {
- backup = false, -- creates a backup file
- clipboard = "unnamedplus", -- allows neovim to access the system clipboard
- cmdheight = 2, -- more space in the neovim command line for displaying messages
- colorcolumn = "99999", -- fixes indentline for now
- completeopt = { "menuone", "noselect" },
- conceallevel = 0, -- so that `` is visible in markdown files
- fileencoding = "utf-8", -- the encoding written to a file
- foldmethod = "manual", -- folding, set to "expr" for treesitter based folding
- foldexpr = "", -- set to "nvim_treesitter#foldexpr()" for treesitter based folding
- guifont = "monospace:h17", -- the font used in graphical neovim applications
- hidden = true, -- required to keep multiple buffers and open multiple buffers
- hlsearch = true, -- highlight all matches on previous search pattern
- ignorecase = true, -- ignore case in search patterns
- mouse = "a", -- allow the mouse to be used in neovim
- pumheight = 10, -- pop up menu height
- showmode = false, -- we don't need to see things like -- INSERT -- anymore
- showtabline = 2, -- always show tabs
- smartcase = true, -- smart case
- smartindent = true, -- make indenting smarter again
- splitbelow = true, -- force all horizontal splits to go below current window
- splitright = true, -- force all vertical splits to go to the right of current window
- swapfile = false, -- creates a swapfile
- termguicolors = true, -- set term gui colors (most terminals support this)
- timeoutlen = 100, -- time to wait for a mapped sequence to complete (in milliseconds)
- title = true, -- set the title of window to the value of the titlestring
- -- opt.titlestring = "%<%F%=%l/%L - nvim" -- what the title of the window will be set to
- undodir = utils.join_paths(get_cache_dir(), "undo"), -- set an undo directory
- undofile = true, -- enable persistent undo
- updatetime = 300, -- faster completion
- writebackup = false, -- if a file is being edited by another program (or was written to file while editing with another program), it is not allowed to be edited
- expandtab = true, -- convert tabs to spaces
- shiftwidth = 2, -- the number of spaces inserted for each indentation
- tabstop = 2, -- insert 2 spaces for a tab
- cursorline = true, -- highlight the current line
- number = true, -- set numbered lines
- relativenumber = true, -- set relative numbered lines
- numberwidth = 4, -- set number column width to 2 {default 4}
- signcolumn = "yes", -- always show the sign column, otherwise it would shift the text each time
- wrap = false, -- display lines as one long line
- spell = false,
- spelllang = "en",
- scrolloff = 8, -- is one of my fav
- sidescrolloff = 8,
- } --- VIM ONLY COMMANDS ---cmd "filetype plugin on"cmd('let &titleold="' .. TERMINAL .. '"')cmd "set inccommand=split"cmd "set iskeyword+=-"
-
- --- SETTINGS ---
-
- vim.opt.shortmess:append "c"
-
- for k, v in pairs(default_options) do
- vim.opt[k] = v
- end
-end
-
-M.load_commands = function()
- local cmd = vim.cmd
- if options.line_wrap_cursor_movement then
- cmd "set whichwrap+=<,>,[,],h,l"
- end
-
- if options.transparent_window then
- cmd "au ColorScheme * hi Normal ctermbg=none guibg=none"
- cmd "au ColorScheme * hi SignColumn ctermbg=none guibg=none"
- cmd "au ColorScheme * hi NormalNC ctermbg=none guibg=none"
- cmd "au ColorScheme * hi MsgArea ctermbg=none guibg=none"
- cmd "au ColorScheme * hi TelescopeBorder ctermbg=none guibg=none"
- cmd "au ColorScheme * hi NvimTreeNormal ctermbg=none guibg=none"
- cmd "au ColorScheme * hi EndOfBuffer ctermbg=none guibg=none"
- cmd "let &fcs='eob: '"
- end
-end
-
-return M
diff --git a/.config/nvim/lua/config/supported_languages.lua b/.config/nvim/lua/config/supported_languages.lua
deleted file mode 100644
index db28df1..0000000
--- a/.config/nvim/lua/config/supported_languages.lua
+++ /dev/null
@@ -1,94 +0,0 @@
-return {
- "asm",
- "bash",
- "beancount",
- "bibtex",
- "bicep",
- "c",
- "c_sharp",
- "clojure",
- "cmake",
- "comment",
- "commonlisp",
- "cpp",
- "crystal",
- "cs",
- "css",
- "cuda",
- "d",
- "dart",
- "dockerfile",
- "dot",
- "elixir",
- "elm",
- "emmet",
- "erlang",
- "fennel",
- "fish",
- "fortran",
- "gdscript",
- "glimmer",
- "go",
- "gomod",
- "graphql",
- "haskell",
- "hcl",
- "heex",
- "html",
- "java",
- "javascript",
- "javascriptreact",
- "jsdoc",
- "json",
- "json5",
- "jsonc",
- "julia",
- "kotlin",
- "latex",
- "ledger",
- "less",
- "lua",
- "markdown",
- "nginx",
- "nix",
- "ocaml",
- "ocaml_interface",
- "perl",
- "php",
- "pioasm",
- "ps1",
- "puppet",
- "python",
- "ql",
- "query",
- "r",
- "regex",
- "rst",
- "ruby",
- "rust",
- "scala",
- "scss",
- "sh",
- "solidity",
- "sparql",
- "sql",
- "supercollider",
- "surface",
- "svelte",
- "swift",
- "tailwindcss",
- "terraform",
- "tex",
- "tlaplus",
- "toml",
- "tsx",
- "turtle",
- "typescript",
- "typescriptreact",
- "verilog",
- "vim",
- "vue",
- "yaml",
- "yang",
- "zig",
-}
diff --git a/.config/nvim/lua/core/autocmds.lua b/.config/nvim/lua/core/autocmds.lua
deleted file mode 100644
index 046b7c0..0000000
--- a/.config/nvim/lua/core/autocmds.lua
+++ /dev/null
@@ -1,145 +0,0 @@
-local M = {}
-local Log = require "core.log"
-
---- Load the default set of autogroups and autocommands.
-function M.load_augroups()
- local user_config_file = require("config"):get_user_config_path()
-
- return {
- _general_settings = {
- { "FileType", "qf,help,man", "nnoremap <silent> <buffer> q :close<CR>" },
- {
- "TextYankPost",
- "*",
- "lua require('vim.highlight').on_yank({higroup = 'Search', timeout = 200})",
- },
- {
- "BufWinEnter",
- "dashboard",
- "setlocal cursorline signcolumn=yes cursorcolumn number",
- },
- { "BufWritePost", user_config_file, "lua require('config'):reload()" },
- { "FileType", "qf", "set nobuflisted" },
- -- { "VimLeavePre", "*", "set title set titleold=" },
- },
- _formatoptions = {
- {
- "BufWinEnter,BufRead,BufNewFile",
- "*",
- "setlocal formatoptions-=c formatoptions-=r formatoptions-=o",
- },
- },
- _filetypechanges = {
- { "BufWinEnter", ".tf", "setlocal filetype=terraform" },
- { "BufRead", "*.tf", "setlocal filetype=terraform" },
- { "BufNewFile", "*.tf", "setlocal filetype=terraform" },
- { "BufWinEnter", ".zsh", "setlocal filetype=sh" },
- { "BufRead", "*.zsh", "setlocal filetype=sh" },
- { "BufNewFile", "*.zsh", "setlocal filetype=sh" },
- },
- _git = {
- { "FileType", "gitcommit", "setlocal wrap" },
- { "FileType", "gitcommit", "setlocal spell" },
- },
- _markdown = {
- { "FileType", "markdown", "setlocal wrap" },
- { "FileType", "markdown", "setlocal spell" },
- },
- _buffer_bindings = {
- { "FileType", "floaterm", "nnoremap <silent> <buffer> q :q<CR>" },
- },
- _auto_resize = {
- -- will cause split windows to be resized evenly if main window is resized
- { "VimResized", "*", "tabdo wincmd =" },
- },
- _general_lsp = {
- {
- "FileType",
- "lspinfo,lsp-installer,null-ls-info",
- "nnoremap <silent> <buffer> q :close<CR>",
- },
- },
- custom_groups = {},
- }
-end
-
-local get_format_on_save_opts = function()
- local defaults = require("config.defaults").format_on_save
- -- accept a basic boolean `format_on_save=true`
- if type(options.format_on_save) ~= "table" then
- return defaults
- end
-
- return {
- pattern = options.format_on_save.pattern or defaults.pattern,
- timeout = options.format_on_save.timeout or defaults.timeout,
- }
-end
-
-function M.enable_format_on_save(opts)
- local fmd_cmd = string.format(
- ":silent lua vim.lsp.buf.formatting_sync({}, %s)",
- opts.timeout_ms
- )
- M.define_augroups {
- format_on_save = { { "BufWritePre", opts.pattern, fmd_cmd } },
- }
- Log:debug "enabled format-on-save"
-end
-
-function M.disable_format_on_save()
- M.remove_augroup "format_on_save"
- Log:debug "disabled format-on-save"
-end
-
-function M.configure_format_on_save()
- if options.format_on_save then
- if vim.fn.exists "#format_on_save#BufWritePre" == 1 then
- M.remove_augroup "format_on_save"
- Log:debug "reloading format-on-save configuration"
- end
- local opts = get_format_on_save_opts()
- M.enable_format_on_save(opts)
- else
- M.disable_format_on_save()
- end
-end
-
-function M.toggle_format_on_save()
- if vim.fn.exists "#format_on_save#BufWritePre" == 0 then
- local opts = get_format_on_save_opts()
- M.enable_format_on_save(opts)
- else
- M.disable_format_on_save()
- end
-end
-
-function M.remove_augroup(name)
- if vim.fn.exists("#" .. name) == 1 then
- vim.cmd("au! " .. name)
- end
-end
-
-function M.define_augroups(definitions) -- {{{1
- -- Create autocommand groups based on the passed definitions
- --
- -- The key will be the name of the group, and each definition
- -- within the group should have:
- -- 1. Trigger
- -- 2. Pattern
- -- 3. Text
- -- just like how they would normally be defined from Vim itself
- for group_name, definition in pairs(definitions) do
- vim.cmd("augroup " .. group_name)
- vim.cmd "autocmd!"
-
- for _, def in pairs(definition) do
- local command = table.concat(vim.tbl_flatten { "autocmd", def }, " ")
- vim.cmd(command)
- end
-
- vim.cmd "augroup END"
- end
-end
-
-return M
diff --git a/.config/nvim/lua/core/autopairs.lua b/.config/nvim/lua/core/autopairs.lua
deleted file mode 100644
index 0759fd6..0000000
--- a/.config/nvim/lua/core/autopairs.lua
+++ /dev/null
@@ -1,79 +0,0 @@
-local M = {}
-
-function M.config()
- options.builtin.autopairs = {
- active = true,
- on_config_done = nil,
- ---@usage -- modifies the function or method delimiter by filetypes
- map_char = {
- all = "(",
- tex = "{",
- },
- enable_check_bracket_line = false,
- ---@usage check treesitter
- check_ts = true,
- ts_config = {
- lua = { "string" },
- javascript = { "template_string" },
- java = false,
- },
- }
-end
-
-M.setup = function()
- local autopairs = require "nvim-autopairs"
- local Rule = require "nvim-autopairs.rule"
- local cond = require "nvim-autopairs.conds"
-
- autopairs.setup {
- check_ts = options.builtin.autopairs.check_ts,
- enable_check_bracket_line = options.builtin.autopairs.enable_check_bracket_line,
- ts_config = options.builtin.autopairs.ts_config,
- }
-
- -- vim.g.completion_confirm_key = ""
-
- autopairs.add_rule(Rule("$$", "$$", "tex"))
- autopairs.add_rules {
- Rule("$", "$", { "tex", "latex" }) -- don't add a pair if the next character is %
- :with_pair(cond.not_after_regex_check "%%") -- don't add a pair if the previous character is xxx
- :with_pair(cond.not_before_regex_check("xxx", 3)) -- don't move right when repeat character
- :with_move(cond.none()) -- don't delete if the next character is xx
- :with_del(cond.not_after_regex_check "xx") -- disable add newline when press <cr>
- :with_cr(cond.none()),
- }
- autopairs.add_rules {
- Rule("$$", "$$", "tex"):with_pair(function(opts)
- print(vim.inspect(opts))
- if opts.line == "aa $$" then
- -- don't add pair on that line
- return false
- end
- end),
- }
-
- local cmp_status_ok, cmp = pcall(require, "cmp")
- if cmp_status_ok then
- -- If you want insert `(` after select function or method item
- local cmp_autopairs = require "nvim-autopairs.completion.cmp"
- local map_char = options.builtin.autopairs.map_char
- cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done { map_char = map_char })
- end
-
- require("nvim-treesitter.configs").setup { autopairs = { enable = true } }
-
- local ts_conds = require "nvim-autopairs.ts-conds"
-
- -- TODO: can these rules be safely added from "config.lua" ?
- -- press % => %% is only inside comment or string
- autopairs.add_rules {
- Rule("%", "%", "lua"):with_pair(ts_conds.is_ts_node { "string", "comment" }),
- Rule("$", "$", "lua"):with_pair(ts_conds.is_not_ts_node { "function" }),
- }
-
- if options.builtin.autopairs.on_config_done then
- options.builtin.autopairs.on_config_done(autopairs)
- end
-end
-
-return M
diff --git a/.config/nvim/lua/core/bufferline.lua b/.config/nvim/lua/core/bufferline.lua
deleted file mode 100644
index ebd7a64..0000000
--- a/.config/nvim/lua/core/bufferline.lua
+++ /dev/null
@@ -1,21 +0,0 @@
-local M = {}
-
-M.config = function()
- options.builtin.bufferline = {
- active = true,
- on_config_done = nil,
- keymap = {
- normal_mode = {},
- },
- }
-end
-
-M.setup = function()
- require("keymappings").load(options.builtin.bufferline.keymap)
-
- if options.builtin.bufferline.on_config_done then
- options.builtin.bufferline.on_config_done()
- end
-end
-
-return M
diff --git a/.config/nvim/lua/core/builtins/init.lua b/.config/nvim/lua/core/builtins/init.lua
deleted file mode 100644
index 10ce680..0000000
--- a/.config/nvim/lua/core/builtins/init.lua
+++ /dev/null
@@ -1,26 +0,0 @@
-local M = {}
-
-local builtins = {
- "core.which-key",
- "core.gitsigns",
- "core.cmp",
- "core.dashboard",
- "core.terminal",
- "core.telescope",
- "core.treesitter",
- "core.nvimtree",
- "core.project",
- "core.bufferline",
- "core.autopairs",
- "core.comment",
- "core.lualine",
-}
-
-function M.config(config)
- for _, builtin_path in ipairs(builtins) do
- local builtin = require(builtin_path)
- builtin.config(config)
- end
-end
-
-return M
diff --git a/.config/nvim/lua/core/cmp.lua b/.config/nvim/lua/core/cmp.lua
deleted file mode 100644
index fe4119f..0000000
--- a/.config/nvim/lua/core/cmp.lua
+++ /dev/null
@@ -1,309 +0,0 @@
-local M = {}
-M.methods = {}
-
----checks if the character preceding the cursor is a space character
----@return boolean true if it is a space character, false otherwise
-local check_backspace = function()
- local col = vim.fn.col "." - 1
- return col == 0 or vim.fn.getline("."):sub(col, col):match "%s"
-end
-M.methods.check_backspace = check_backspace
-
-local function T(str)
- return vim.api.nvim_replace_termcodes(str, true, true, true)
-end
-
----wraps vim.fn.feedkeys while replacing key codes with escape codes
----Ex: feedkeys("<CR>", "n") becomes feedkeys("^M", "n")
----@param key string
----@param mode string
-local function feedkeys(key, mode)
- vim.fn.feedkeys(T(key), mode)
-end
-M.methods.feedkeys = feedkeys
-
----checks if emmet_ls is available and active in the buffer
----@return boolean true if available, false otherwise
-local is_emmet_active = function()
- local clients = vim.lsp.buf_get_clients()
-
- for _, client in pairs(clients) do
- if client.name == "emmet_ls" then
- return true
- end
- end
- return false
-end
-M.methods.is_emmet_active = is_emmet_active
-
----when inside a snippet, seeks to the nearest luasnip field if possible, and checks if it is jumpable
----@param dir number 1 for forward, -1 for backward; defaults to 1
----@return boolean true if a jumpable luasnip field is found while inside a snippet
-local function jumpable(dir)
- local luasnip_ok, luasnip = pcall(require, "luasnip")
- if not luasnip_ok then
- return
- end
-
- local win_get_cursor = vim.api.nvim_win_get_cursor
- local get_current_buf = vim.api.nvim_get_current_buf
-
- local function inside_snippet()
- -- for outdated versions of luasnip
- if not luasnip.session.current_nodes then
- return false
- end
-
- local node = luasnip.session.current_nodes[get_current_buf()]
- if not node then
- return false
- end
-
- local snip_begin_pos, snip_end_pos = node.parent.snippet.mark:pos_begin_end()
- local pos = win_get_cursor(0)
- pos[1] = pos[1] - 1 -- LuaSnip is 0-based not 1-based like nvim for rows
- return pos[1] >= snip_begin_pos[1] and pos[1] <= snip_end_pos[1]
- end
-
- ---sets the current buffer's luasnip to the one nearest the cursor
- ---@return boolean true if a node is found, false otherwise
- local function seek_luasnip_cursor_node()
- -- for outdated versions of luasnip
- if not luasnip.session.current_nodes then
- return false
- end
-
- local pos = win_get_cursor(0)
- pos[1] = pos[1] - 1
- local node = luasnip.session.current_nodes[get_current_buf()]
- if not node then
- return false
- end
-
- local snippet = node.parent.snippet
- local exit_node = snippet.insert_nodes[0]
-
- -- exit early if we're past the exit node
- if exit_node then
- local exit_pos_end = exit_node.mark:pos_end()
- if
- (pos[1] > exit_pos_end[1])
- or (pos[1] == exit_pos_end[1] and pos[2] > exit_pos_end[2])
- then
- snippet:remove_from_jumplist()
- luasnip.session.current_nodes[get_current_buf()] = nil
-
- return false
- end
- end
-
- node = snippet.inner_first:jump_into(1, true)
- while node ~= nil and node.next ~= nil and node ~= snippet do
- local n_next = node.next
- local next_pos = n_next and n_next.mark:pos_begin()
- local candidate = n_next ~= snippet and next_pos and (pos[1] < next_pos[1])
- or (pos[1] == next_pos[1] and pos[2] < next_pos[2])
-
- -- Past unmarked exit node, exit early
- if n_next == nil or n_next == snippet.next then
- snippet:remove_from_jumplist()
- luasnip.session.current_nodes[get_current_buf()] = nil
-
- return false
- end
-
- if candidate then
- luasnip.session.current_nodes[get_current_buf()] = node
- return true
- end
-
- local ok
- ok, node = pcall(node.jump_from, node, 1, true) -- no_move until last stop
- if not ok then
- snippet:remove_from_jumplist()
- luasnip.session.current_nodes[get_current_buf()] = nil
-
- return false
- end
- end
-
- -- No candidate, but have an exit node
- if exit_node then
- -- to jump to the exit node, seek to snippet
- luasnip.session.current_nodes[get_current_buf()] = snippet
- return true
- end
-
- -- No exit node, exit from snippet
- snippet:remove_from_jumplist()
- luasnip.session.current_nodes[get_current_buf()] = nil
- return false
- end
-
- if dir == -1 then
- return inside_snippet() and luasnip.jumpable(-1)
- else
- return inside_snippet() and seek_luasnip_cursor_node() and luasnip.jumpable()
- end
-end
-M.methods.jumpable = jumpable
-
-M.config = function()
- local status_cmp_ok, cmp = pcall(require, "cmp")
- if not status_cmp_ok then
- return
- end
- local status_luasnip_ok, luasnip = pcall(require, "luasnip")
- if not status_luasnip_ok then
- return
- end
-
- options.builtin.cmp = {
- confirm_opts = {
- behavior = cmp.ConfirmBehavior.Replace,
- select = false,
- },
- completion = {
- ---@usage The minimum length of a word to complete on.
- keyword_length = 1,
- },
- experimental = {
- ghost_text = true,
- native_menu = false,
- },
- formatting = {
- fields = { "kind", "abbr", "menu" },
- kind_icons = {
- Class = " ",
- Color = " ",
- Constant = "ﲀ ",
- Constructor = " ",
- Enum = "練",
- EnumMember = " ",
- Event = " ",
- Field = " ",
- File = "",
- Folder = " ",
- Function = " ",
- Interface = "ﰮ ",
- Keyword = " ",
- Method = " ",
- Module = " ",
- Operator = "",
- Property = " ",
- Reference = " ",
- Snippet = " ",
- Struct = " ",
- Text = " ",
- TypeParameter = " ",
- Unit = "塞",
- Value = " ",
- Variable = " ",
- },
- source_names = {
- nvim_lsp = "(LSP)",
- path = "(Path)",
- calc = "(Calc)",
- cmp_tabnine = "(Tabnine)",
- vsnip = "(Snippet)",
- luasnip = "(Snippet)",
- buffer = "(Buffer)",
- },
- duplicates = {
- buffer = 1,
- path = 1,
- nvim_lsp = 0,
- luasnip = 1,
- },
- duplicates_default = 0,
- format = function(entry, vim_item)
- vim_item.kind = options.builtin.cmp.formatting.kind_icons[vim_item.kind]
- vim_item.menu = options.builtin.cmp.formatting.source_names[entry.source.name]
- vim_item.dup = options.builtin.cmp.formatting.duplicates[entry.source.name]
- or options.builtin.cmp.formatting.duplicates_default
- return vim_item
- end,
- },
- snippet = {
- expand = function(args)
- require("luasnip").lsp_expand(args.body)
- end,
- },
- documentation = {
- border = { "╭", "─", "╮", "│", "╯", "─", "╰", "│" },
- },
- sources = {
- { name = "nvim_lsp" },
- { name = "path" },
- { name = "luasnip" },
- { name = "cmp_tabnine" },
- { name = "nvim_lua" },
- { name = "buffer", keyword_length = 5 },
- { name = "calc" },
- { name = "treesitter" },
- { name = "crates" },
- },
- mapping = {
- ["<C-k>"] = cmp.mapping.select_prev_item(),
- ["<C-j>"] = cmp.mapping.select_next_item(),
- ["<C-d>"] = cmp.mapping.scroll_docs(-4),
- ["<C-f>"] = cmp.mapping.scroll_docs(4),
- -- TODO: potentially fix emmet nonsense
- ["<Tab>"] = cmp.mapping(function(fallback)
- if cmp.visible() then
- cmp.select_next_item()
- elseif luasnip.expandable() then
- luasnip.expand()
- elseif jumpable() then
- luasnip.jump(1)
- elseif check_backspace() then
- fallback()
- elseif is_emmet_active() then
- return vim.fn["cmp#complete"]()
- else
- fallback()
- end
- end, {
- "i",
- "s",
- }),
- ["<S-Tab>"] = cmp.mapping(function(fallback)
- if cmp.visible() then
- cmp.select_prev_item()
- elseif jumpable(-1) then
- luasnip.jump(-1)
- else
- fallback()
- end
- end, {
- "i",
- "s",
- }),
-
- ["<C-Space>"] = cmp.mapping.complete(),
- ["<C-e>"] = cmp.mapping.abort(),
- ["<CR>"] = cmp.mapping(function(fallback)
- if cmp.visible() and cmp.confirm(options.builtin.cmp.confirm_opts) then
- if jumpable() then
- luasnip.jump(1)
- end
- return
- end
-
- if jumpable() then
- if not luasnip.jump(1) then
- fallback()
- end
- else
- fallback()
- end
- end),
- },
- }
-end
-
-M.setup = function()
- require("cmp").setup(options.builtin.cmp)
-end
-
-return M
diff --git a/.config/nvim/lua/core/commands.lua b/.config/nvim/lua/core/commands.lua
deleted file mode 100644
index bb22dea..0000000
--- a/.config/nvim/lua/core/commands.lua
+++ /dev/null
@@ -1,28 +0,0 @@
-local M = {}
-
-M.defaults = {
- [[
- function! QuickFixToggle()
- if empty(filter(getwininfo(), 'v:val.quickfix'))
- copen
- else
- cclose
- endif
- endfunction
- ]],
- -- :NvimInfo
- [[ command! NvimInfo lua require('core.info').toggle_popup(vim.bo.filetype) ]],
- [[ command! NvimCacheReset lua require('utils.hooks').reset_cache() ]],
- [[ command! NvimUpdate lua require('bootstrap').update() ]],
- [[ command! NvimSyncCorePlugins lua require('plugin-loader'):sync_core_plugins() ]],
- [[ command! NvimReload lua require('config'):reload() ]],
- [[ command! NvimToggleFormatOnSave lua require('core.autocmds').toggle_format_on_save() ]],
-}
-
-M.load = function(commands)
- for _, command in ipairs(commands) do
- vim.cmd(command)
- end
-end
-
-return M
diff --git a/.config/nvim/lua/core/comment.lua b/.config/nvim/lua/core/comment.lua
deleted file mode 100644
index f8d62c2..0000000
--- a/.config/nvim/lua/core/comment.lua
+++ /dev/null
@@ -1,71 +0,0 @@
-local M = {}
-
-function M.config()
- local pre_hook = nil
- if options.builtin.treesitter.context_commentstring.enable then
- pre_hook = function(_ctx)
- return require("ts_context_commentstring.internal").calculate_commentstring()
- end
- end
- options.builtin.comment = {
- active = true,
- on_config_done = nil,
- ---Add a space b/w comment and the line
- ---@type boolean
- padding = true,
-
- ---Lines to be ignored while comment/uncomment.
- ---Could be a regex string or a function that returns a regex string.
- ---Example: Use '^$' to ignore empty lines
- ---@type string|function
- ignore = "^$",
-
- ---Whether to create basic (operator-pending) and extra mappings for NORMAL/VISUAL mode
- ---@type table
- mappings = {
- ---operator-pending mapping
- ---Includes `gcc`, `gcb`, `gc[count]{motion}` and `gb[count]{motion}`
- basic = true,
- ---extended mapping
- ---Includes `g>`, `g<`, `g>[count]{motion}` and `g<[count]{motion}`
- extra = false,
- },
-
- ---LHS of line and block comment toggle mapping in NORMAL/VISUAL mode
- ---@type table
- toggler = {
- ---line-comment toggle
- line = "gcc",
- ---block-comment toggle
- block = "gbc",
- },
-
- ---LHS of line and block comment operator-mode mapping in NORMAL/VISUAL mode
- ---@type table
- opleader = {
- ---line-comment opfunc mapping
- line = "gc",
- ---block-comment opfunc mapping
- block = "gb",
- },
-
- ---Pre-hook, called before commenting the line
- ---@type function|nil
- pre_hook = pre_hook,
-
- ---Post-hook, called after commenting is done
- ---@type function|nil
- post_hook = nil,
- }
-end
-
-function M.setup()
- local nvim_comment = require "Comment"
-
- nvim_comment.setup(options.builtin.comment)
- if options.builtin.comment.on_config_done then
- options.builtin.comment.on_config_done(nvim_comment)
- end
-end
-
-return M
diff --git a/.config/nvim/lua/core/dashboard.lua b/.config/nvim/lua/core/dashboard.lua
deleted file mode 100644
index 20edd22..0000000
--- a/.config/nvim/lua/core/dashboard.lua
+++ /dev/null
@@ -1,112 +0,0 @@
-local M = {}
-local utils = require "utils"
-
-M.config = function(config)
- options.builtin.dashboard = {
- active = false,
- on_config_done = nil,
- search_handler = "telescope",
- disable_at_vim_enter = 0,
- session_directory = utils.join_paths(get_cache_dir(), "sessions"),
- custom_header = {
- " ##############..... ############## ",
- " ##############......############## ",
- " ##########..........########## ",
- " ##########........########## ",
- " ##########.......########## ",
- " ##########.....##########.. ",
- " ##########....##########..... ",
- " ..##########..##########......... ",
- " ....##########.#########............. ",
- " ..################JJJ............ ",
- " ################............. ",
- " ##############.JJJ.JJJJJJJJJJ ",
- " ############...JJ...JJ..JJ JJ ",
- " ##########....JJ...JJ..JJ JJ ",
- " ########......JJJ..JJJ JJJ JJJ ",
- " ###### ......... ",
- " ..... ",
- " . ",
- },
-
- custom_section = {
- a = {
- description = { " Find File " },
- command = "Telescope find_files",
- },
- b = {
- description = { " New File " },
- command = ":ene!",
- },
- c = {
- description = { " Recent Projects " },
- command = "Telescope projects",
- },
- d = {
- description = { " Recently Used Files" },
- command = "Telescope oldfiles",
- },
- e = {
- description = { " Find Word " },
- command = "Telescope live_grep",
- },
- f = {
- description = { " Configuration " },
- command = ":e " .. config.user_config_file,
- },
- },
- }
-end
-
-M.setup = function()
- vim.g.dashboard_disable_at_vimenter = options.builtin.dashboard.disable_at_vim_enter
-
- vim.g.dashboard_custom_header = options.builtin.dashboard.custom_header
-
- vim.g.dashboard_default_executive = options.builtin.dashboard.search_handler
-
- vim.g.dashboard_custom_section = options.builtin.dashboard.custom_section
-
- options.builtin.which_key.mappings[";"] = { "<cmd>Dashboard<CR>", "Dashboard" }
-
- vim.g.dashboard_session_directory = options.builtin.dashboard.session_directory
-
- local num_plugins_loaded = #vim.fn.globpath(
- get_data_dir() .. "/site/pack/packer/start",
- "*",
- 0,
- 1
- )
-
- local footer = {
- "nvim loaded " .. num_plugins_loaded .. " plugins ",
- "",
- }
-
- local text = require "interface.text"
- vim.g.dashboard_custom_footer = text.align_center({ width = 0 }, footer, 0.49) -- Use 0.49 as  counts for 2 characters
-
- require("core.autocmds").define_augroups {
- _dashboard = {
- -- seems to be nobuflisted that makes my stuff disappear will do more testing
- {
- "FileType",
- "dashboard",
- "setlocal nocursorline noswapfile synmaxcol& signcolumn=no norelativenumber nocursorcolumn nospell nolist nonumber bufhidden=wipe colorcolumn= foldcolumn=0 matchpairs= ",
- },
- {
- "FileType",
- "dashboard",
- "set showtabline=0 | autocmd BufLeave <buffer> set showtabline="
- .. vim.opt.showtabline._value,
- },
- { "FileType", "dashboard", "nnoremap <silent> <buffer> q :q<CR>" },
- },
- }
-
- if options.builtin.dashboard.on_config_done then
- options.builtin.dashboard.on_config_done()
- end
-end
-
-return M
diff --git a/.config/nvim/lua/core/gitsigns.lua b/.config/nvim/lua/core/gitsigns.lua
deleted file mode 100644
index 97f5314..0000000
--- a/.config/nvim/lua/core/gitsigns.lua
+++ /dev/null
@@ -1,61 +0,0 @@
-local M = {}
-local Log = require "core.log"
-
-M.config = function()
- options.builtin.gitsigns = {
- signs = {
- add = {
- hl = "GitSignsAdd",
- text = "▎",
- numhl = "GitSignsAddNr",
- linehl = "GitSignsAddLn",
- },
- change = {
- hl = "GitSignsChange",
- text = "▎",
- numhl = "GitSignsChangeNr",
- linehl = "GitSignsChangeLn",
- },
- delete = {
- hl = "GitSignsDelete",
- text = "契",
- numhl = "GitSignsDeleteNr",
- linehl = "GitSignsDeleteLn",
- },
- topdelete = {
- hl = "GitSignsDelete",
- text = "契",
- numhl = "GitSignsDeleteNr",
- linehl = "GitSignsDeleteLn",
- },
- changedelete = {
- hl = "GitSignsChange",
- text = "▎",
- numhl = "GitSignsChangeNr",
- linehl = "GitSignsChangeLn",
- },
- },
- numhl = false,
- linehl = false,
- keymaps = {
- -- Default keymap options
- noremap = true,
- buffer = true,
- },
- watch_gitdir = { interval = 1000 },
- sign_priority = 6,
- update_debounce = 200,
- status_formatter = nil, -- Use default
- }
-end
-
-M.setup = function()
- local status_ok, gitsigns = pcall(require, "gitsigns")
- if not status_ok then
- Log:get_default().error "Failed to load gitsigns"
- return
- end
- gitsigns.setup(options.builtin.gitsigns)
-end
-
-return M
diff --git a/.config/nvim/lua/core/info.lua b/.config/nvim/lua/core/info.lua
deleted file mode 100644
index 646cf71..0000000
--- a/.config/nvim/lua/core/info.lua
+++ /dev/null
@@ -1,206 +0,0 @@
-local M = {
- banner = {
- "",
- [[ _ ___ ]],
- [[| | / (_)___ ___ ]],
- [[| | / / / __ `__ \]],
- [[| |/ / / / / / / /]],
- [[|___/_/_/ /_/ /_/ ]],
- },
-}
-
-local fmt = string.format
-local text = require "interface.text"
-local lsp_utils = require "lsp.utils"
-
-local function str_list(list)
- return fmt("[ %s ]", table.concat(list, ", "))
-end
-
-local function make_formatters_info(ft)
- local null_formatters = require "lsp.null-ls.formatters"
- local registered_formatters = null_formatters.list_registered_providers(ft)
- local supported_formatters = null_formatters.list_available(ft)
- local section = {
- "Formatters info",
- fmt(
- "* Active: %s%s",
- table.concat(registered_formatters, "  , "),
- vim.tbl_count(registered_formatters) > 0 and "  " or ""
- ),
- fmt("* Supported: %s", str_list(supported_formatters)),
- }
-
- return section
-end
-
-local function make_code_actions_info(ft)
- local null_actions = require "lsp.null-ls.code_actions"
- local registered_actions = null_actions.list_registered_providers(ft)
- local supported_actions = null_actions.list_available(ft)
- local section = {
- "Code actions info",
- fmt(
- "* Active: %s%s",
- table.concat(registered_actions, "  , "),
- vim.tbl_count(registered_actions) > 0 and "  " or ""
- ),
- fmt("* Supported: %s", str_list(supported_actions)),
- }
-
- return section
-end
-
-local function make_linters_info(ft)
- local null_linters = require "lsp.null-ls.linters"
- local supported_linters = null_linters.list_available(ft)
- local registered_linters = null_linters.list_registered_providers(ft)
- local section = {
- "Linters info",
- fmt(
- "* Active: %s%s",
- table.concat(registered_linters, "  , "),
- vim.tbl_count(registered_linters) > 0 and "  " or ""
- ),
- fmt("* Supported: %s", str_list(supported_linters)),
- }
-
- return section
-end
-
-local function tbl_set_highlight(terms, highlight_group)
- for _, v in pairs(terms) do
- vim.cmd('let m=matchadd("' .. highlight_group .. '", "' .. v .. "[ ,│']\")")
- end
-end
-
-local function make_client_info(client)
- local client_enabled_caps = lsp_utils.get_client_capabilities(client.id)
- local name = client.name
- local id = client.id
- local filetypes = lsp_utils.get_supported_filetypes(name)
- local document_formatting = client.resolved_capabilities.document_formatting
- local attached_buffers_list = table.concat(
- vim.lsp.get_buffers_by_client_id(client.id),
- ", "
- )
- local client_info = {
- fmt("* Name: %s", name),
- fmt("* Id: [%s]", tostring(id)),
- fmt("* filetype(s): [%s]", table.concat(filetypes, ", ")),
- fmt("* Attached buffers: [%s]", tostring(attached_buffers_list)),
- fmt("* Supports formatting: %s", tostring(document_formatting)),
- }
- if not vim.tbl_isempty(client_enabled_caps) then
- local caps_text = "* Capabilities list: "
- local caps_text_len = caps_text:len()
- local enabled_caps = text.format_table(client_enabled_caps, 3, " | ")
- enabled_caps = text.shift_right(enabled_caps, caps_text_len)
- enabled_caps[1] = fmt("%s%s", caps_text, enabled_caps[1]:sub(caps_text_len + 1))
- vim.list_extend(client_info, enabled_caps)
- end
-
- return client_info
-end
-
-function M.toggle_popup(ft)
- local clients = lsp_utils.get_active_clients_by_ft(ft)
- local client_names = {}
- local bufnr = vim.api.nvim_get_current_buf()
- local ts_active_buffers = vim.tbl_keys(vim.treesitter.highlighter.active)
- local is_treesitter_active = function()
- local status = "inactive"
- if vim.tbl_contains(ts_active_buffers, bufnr) then
- status = "active"
- end
- return status
- end
- local header = {
- fmt("Detected filetype: %s", ft),
- fmt("Current buffer number: [%s]", bufnr),
- }
-
- local ts_info = {
- "Treesitter info",
- fmt("* current buffer: %s", is_treesitter_active()),
- fmt("* list: [%s]", table.concat(ts_active_buffers, ", ")),
- }
-
- local lsp_info = {
- "Language Server Protocol (LSP) info",
- fmt "* Active server(s):",
- }
-
- for _, client in pairs(clients) do
- vim.list_extend(lsp_info, make_client_info(client))
- table.insert(client_names, client.name)
- end
-
- local formatters_info = make_formatters_info(ft)
-
- local linters_info = make_linters_info(ft)
-
- local code_actions_info = make_code_actions_info(ft)
-
- local content_provider = function(popup)
- local content = {}
-
- for _, section in ipairs {
- M.banner,
- { "" },
- { "" },
- header,
- { "" },
- ts_info,
- { "" },
- lsp_info,
- { "" },
- formatters_info,
- { "" },
- linters_info,
- } do
- vim.list_extend(content, section)
- end
-
- return text.align_left(popup, content, 0.5)
- end
-
- local function set_syntax_hl()
- vim.cmd [[highlight NvimInfoIdentifier gui=bold]]
- vim.cmd [[highlight link NvimInfoHeader Type]]
- vim.cmd [[let m=matchadd("NvimInfoHeader", "Treesitter info")]]
- vim.cmd [[let m=matchadd("NvimInfoHeader", "Language Server Protocol (LSP) info")]]
- vim.cmd [[let m=matchadd("NvimInfoHeader", "Formatters info")]]
- vim.cmd [[let m=matchadd("NvimInfoHeader", "Linters info")]]
- vim.cmd [[let m=matchadd("NvimInfoHeader", "Code actions info")]]
- vim.cmd('let m=matchadd("NvimInfoIdentifier", " ' .. ft .. '$")')
- vim.cmd 'let m=matchadd("string", "true")'
- vim.cmd 'let m=matchadd("string", "active")'
- vim.cmd 'let m=matchadd("boolean", "inactive")'
- vim.cmd 'let m=matchadd("string", "")'
- vim.cmd 'let m=matchadd("error", "false")'
- -- tbl_set_highlight(registered_providers, "NvimInfoIdentifier")
- tbl_set_highlight(
- require("lsp.null-ls.formatters").list_available(ft),
- "NvimInfoIdentifier"
- )
- tbl_set_highlight(
- require("lsp.null-ls.linters").list_available(ft),
- "NvimInfoIdentifier"
- )
- tbl_set_highlight(
- require("lsp.null-ls.code_actions").list_available(ft),
- "NvimInfoIdentifier"
- )
- end
-
- local Popup = require("interface.popup"):new {
- win_opts = { number = false },
- buf_opts = { modifiable = false, filetype = "lspinfo" },
- }
- Popup:display(content_provider)
- set_syntax_hl()
-
- return Popup
-end
-return M
diff --git a/.config/nvim/lua/core/log.lua b/.config/nvim/lua/core/log.lua
deleted file mode 100644
index 815aeb1..0000000
--- a/.config/nvim/lua/core/log.lua
+++ /dev/null
@@ -1,127 +0,0 @@
-local Log = {}
-
-local logfile = string.format("%s/%s.log", get_cache_dir(), "nvim")
-
-Log.levels = {
- TRACE = 1,
- DEBUG = 2,
- INFO = 3,
- WARN = 4,
- ERROR = 5,
-}
-
-vim.tbl_add_reverse_lookup(Log.levels)
-
-function Log:init()
- local status_ok, structlog = pcall(require, "structlog")
- if not status_ok then
- return nil
- end
-
- local log_level = Log.levels[(options.log.level):upper() or "WARN"]
- local nvim_log = {
- nvim = {
- sinks = {
- structlog.sinks.Console(log_level, {
- async = false,
- processors = {
- structlog.processors.Namer(),
- structlog.processors.StackWriter(
- { "line", "file" },
- { max_parents = 0, stack_level = 2 }
- ),
- structlog.processors.Timestamper "%H:%M:%S",
- },
- formatter = structlog.formatters.FormatColorizer( --
- "%s [%-5s] %s: %-30s",
- { "timestamp", "level", "logger_name", "msg" },
- { level = structlog.formatters.FormatColorizer.color_level() }
- ),
- }),
- structlog.sinks.File(Log.levels.TRACE, logfile, {
- processors = {
- structlog.processors.Namer(),
- structlog.processors.StackWriter(
- { "line", "file" },
- { max_parents = 3, stack_level = 2 }
- ),
- structlog.processors.Timestamper "%H:%M:%S",
- },
- formatter = structlog.formatters.Format( --
- "%s [%-5s] %s: %-30s",
- { "timestamp", "level", "logger_name", "msg" }
- ),
- }),
- },
- },
- }
-
- structlog.configure(nvim_log)
-
- local logger = structlog.get_logger "nvim"
-
- return logger
-end
-
---- Adds a log entry using Plenary.log
----@fparam msg any
----@param level string [same as vim.log.log_levels]
-function Log:add_entry(level, msg, event)
- if self.__handle then
- self.__handle:log(level, vim.inspect(msg), event)
- return
- end
-
- local logger = self:init()
- if not logger then
- return
- end
-
- self.__handle = logger
- self.__handle:log(level, vim.inspect(msg), event)
-end
-
----Retrieves the path of the logfile
----@return string path of the logfile
-function Log:get_path()
- return logfile
-end
-
----Add a log entry at TRACE level
----@param msg any
----@param event any
-function Log:trace(msg, event)
- self:add_entry(self.levels.TRACE, msg, event)
-end
-
----Add a log entry at DEBUG level
----@param msg any
----@param event any
-function Log:debug(msg, event)
- self:add_entry(self.levels.DEBUG, msg, event)
-end
-
----Add a log entry at INFO level
----@param msg any
----@param event any
-function Log:info(msg, event)
- self:add_entry(self.levels.INFO, msg, event)
-end
-
----Add a log entry at WARN level
----@param msg any
----@param event any
-function Log:warn(msg, event)
- self:add_entry(self.levels.WARN, msg, event)
-end
-
----Add a log entry at ERROR level
----@param msg any
----@param event any
-function Log:error(msg, event)
- self:add_entry(self.levels.ERROR, msg, event)
-end
-
-setmetatable({}, Log)
-
-return Log
diff --git a/.config/nvim/lua/core/lualine/colors.lua b/.config/nvim/lua/core/lualine/colors.lua
deleted file mode 100644
index f922d3f..0000000
--- a/.config/nvim/lua/core/lualine/colors.lua
+++ /dev/null
@@ -1,19 +0,0 @@
-local colors = {
- bg = "#171717",
- fg = "#D0D0D0",
- grey = "#D0D0D0",
- blue = "#569CD6",
- green = "#608B4E",
- yellow = "#DCDCAA",
- orange = "#FF8800",
- purple = "#C586C0",
- magenta = "#D16D9E",
- cyan = "#4EC9B0",
- red = "#D16969",
- error_red = "#F44747",
- warning_orange = "#FF8800",
- info_yellow = "#FFCC66",
- hint_blue = "#9CDCFE",
-}
-
-return colors
diff --git a/.config/nvim/lua/core/lualine/components.lua b/.config/nvim/lua/core/lualine/components.lua
deleted file mode 100644
index 42ec112..0000000
--- a/.config/nvim/lua/core/lualine/components.lua
+++ /dev/null
@@ -1,179 +0,0 @@
-local conditions = require "core.lualine.conditions"
-local colors = require "core.lualine.colors"
-
-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
-
-return {
- mode = {
- function()
- local alias = {
- n = "NORMAL",
- i = "INSERT",
- c = "COMMAND",
- V = "VISUAL",
- [""] = "VISUAL",
- v = "VISUAL",
- R = "REPLACE",
- }
- local alias_mode = alias[vim.fn.mode()]
- if alias_mode == nil then
- alias_mode = vim.fn.mode()
- end
- return alias_mode .. " "
- -- return " "
- end,
- padding = { left = 0, right = 0 },
- cond = nil,
- color = { fg = colors.fg, bg = colors.bg },
- },
- branch = {
- "b:gitsigns_head",
- icon = " ",
- color = { gui = "bold", fg = colors.fg, bg = colors.bg },
- cond = conditions.hide_in_width,
- },
- filename = {
- "filename",
- color = { fg = colors.fg, bg = colors.bg },
- cond = nil,
- },
- diff = {
- "diff",
- source = diff_source,
- symbols = { added = "  ", modified = "柳", removed = " " },
- diff_color = {
- added = { fg = colors.green },
- modified = { fg = colors.yellow },
- removed = { fg = colors.red },
- },
- color = {},
- cond = nil,
- },
- python_env = {
- function()
- local utils = require "core.lualine.utils"
- if vim.bo.filetype == "python" then
- local venv = os.getenv "CONDA_DEFAULT_ENV"
- if venv then
- return string.format("  (%s)", utils.env_cleanup(venv))
- end
- venv = os.getenv "VIRTUAL_ENV"
- if venv then
- return string.format("  (%s)", utils.env_cleanup(venv))
- end
- return ""
- end
- return ""
- end,
- color = { fg = colors.green },
- cond = conditions.hide_in_width,
- },
- diagnostics = {
- "diagnostics",
- sources = { "nvim_lsp" },
- symbols = { error = " ", warn = " ", info = " ", hint = " " },
- color = {},
- cond = conditions.hide_in_width,
- },
- treesitter = {
- function()
- local b = vim.api.nvim_get_current_buf()
- if next(vim.treesitter.highlighter.active[b]) then
- return "  "
- end
- return ""
- end,
- color = { fg = colors.green },
- cond = conditions.hide_in_width,
- },
- lsp = {
- function(msg)
- msg = msg or "LS Inactive"
- local buf_clients = vim.lsp.buf_get_clients()
- if next(buf_clients) == nil then
- if type(msg) == "boolean" or #msg == 0 then
- return "LS Inactive"
- end
- return msg
- end
- local buf_ft = vim.bo.filetype
- local buf_client_names = {}
-
- -- add client
- for _, client in pairs(buf_clients) do
- if client.name ~= "null-ls" then
- table.insert(buf_client_names, client.name)
- end
- end
-
- -- add formatter
- local formatters = require "lsp.null-ls.formatters"
- local supported_formatters = formatters.list_registered_providers(buf_ft)
- vim.list_extend(buf_client_names, supported_formatters)
-
- -- add linter
- local linters = require "lsp.null-ls.linters"
- local supported_linters = linters.list_registered_providers(buf_ft)
- vim.list_extend(buf_client_names, supported_linters)
-
- return "[" .. table.concat(buf_client_names, ", ") .. "]"
- end,
- color = { fg = colors.fg, bg = colors.bg },
- cond = conditions.hide_in_width,
- },
- location = { "location", cond = conditions.hide_in_width, color = {} },
- progress = { "progress", cond = conditions.hide_in_width, color = {} },
- spaces = {
- function()
- if not vim.api.nvim_buf_get_option(0, "expandtab") then
- return "Tab size: " .. vim.api.nvim_buf_get_option(0, "tabstop") .. " "
- end
- local size = vim.api.nvim_buf_get_option(0, "shiftwidth")
- if size == 0 then
- size = vim.api.nvim_buf_get_option(0, "tabstop")
- end
- return "Spaces: " .. size .. " "
- end,
- color = {},
- cond = conditions.hide_in_width,
- },
- encoding = {
- "o:encoding",
- fmt = string.upper,
- color = { fg = colors.fg, bg = colors.bg },
- cond = conditions.hide_in_width,
- },
- filetype = { "filetype", cond = conditions.hide_in_width, color = {} },
- scrollbar = {
- function()
- local current_line = vim.fn.line "."
- local total_lines = vim.fn.line "$"
- local chars = {
- "__",
- "▁▁",
- "▂▂",
- "▃▃",
- "▄▄",
- "▅▅",
- "▆▆",
- "▇▇",
- "██",
- }
- local line_ratio = current_line / total_lines
- local index = math.ceil(line_ratio * #chars)
- return chars[index]
- end,
- padding = { left = 0, right = 0 },
- cond = nil,
- color = { fg = colors.yellow, bg = colors.bg },
- },
-}
diff --git a/.config/nvim/lua/core/lualine/conditions.lua b/.config/nvim/lua/core/lualine/conditions.lua
deleted file mode 100644
index 6e120b2..0000000
--- a/.config/nvim/lua/core/lualine/conditions.lua
+++ /dev/null
@@ -1,17 +0,0 @@
-local window_width_limit = 70
-
-local conditions = {
- buffer_not_empty = function()
- return vim.fn.empty(vim.fn.expand "%:t") ~= 1
- end,
- hide_in_width = function()
- return vim.fn.winwidth(0) > window_width_limit
- end,
- -- check_git_workspace = function()
- -- 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/.config/nvim/lua/core/lualine/init.lua b/.config/nvim/lua/core/lualine/init.lua
deleted file mode 100644
index 7d67559..0000000
--- a/.config/nvim/lua/core/lualine/init.lua
+++ /dev/null
@@ -1,47 +0,0 @@
-local M = {}
-M.config = function()
- options.builtin.lualine = {
- active = true,
- style = "options",
- options = {
- icons_enabled = nil,
- component_separators = nil,
- section_separators = nil,
- theme = nil,
- disabled_filetypes = nil,
- },
- sections = {
- lualine_a = nil,
- lualine_b = nil,
- lualine_c = nil,
- lualine_x = nil,
- lualine_y = nil,
- lualine_z = nil,
- },
- inactive_sections = {
- lualine_a = nil,
- lualine_b = nil,
- lualine_c = nil,
- lualine_x = nil,
- lualine_y = nil,
- lualine_z = nil,
- },
- tabline = nil,
- extensions = nil,
- on_config_done = nil,
- }
-end
-
-M.setup = function()
- require("core.lualine.styles").update()
- require("core.lualine.utils").validate_theme()
-
- local lualine = require "lualine"
- lualine.setup(options.builtin.lualine)
-
- if options.builtin.lualine.on_config_done then
- options.builtin.lualine.on_config_done(lualine)
- end
-end
-
-return M
diff --git a/.config/nvim/lua/core/lualine/styles.lua b/.config/nvim/lua/core/lualine/styles.lua
deleted file mode 100644
index 8caf349..0000000
--- a/.config/nvim/lua/core/lualine/styles.lua
+++ /dev/null
@@ -1,185 +0,0 @@
-local M = {}
-local components = require "core.lualine.components"
-
-local styles = {
- lvim = nil,
- default = nil,
- none = nil,
- dark = nil,
-}
-
-styles.dark = {
- style = "dark",
- options = {
- icons_enabled = true,
- component_separators = { left = "", right = "" },
- section_separators = { left = "", right = "" },
- disabled_filetypes = { "dashboard", "NvimTree", "Outline" },
- },
- sections = {
- lualine_a = {
- components.mode,
- },
- lualine_b = {
- components.branch,
- components.filename,
- },
- lualine_c = {
- components.diff,
- components.python_env,
- },
- lualine_x = {
- components.diagnostics,
- components.treesitter,
- components.lsp,
- components.filetype,
- },
- lualine_y = {},
- lualine_z = {
- components.location,
- components.progress,
- components.encoding,
- },
- },
- inactive_sections = {
- lualine_a = {
- "filename",
- },
- lualine_b = {},
- lualine_c = {},
- lualine_x = {},
- lualine_y = {},
- lualine_z = {},
- },
- tabline = {},
- extensions = { "nvim-tree" },
-}
-
-styles.none = {
- style = "none",
- options = {
- icons_enabled = true,
- component_separators = { left = "", right = "" },
- section_separators = { left = "", right = "" },
- disabled_filetypes = {},
- },
- sections = {
- lualine_a = {},
- lualine_b = {},
- lualine_c = {},
- lualine_x = {},
- lualine_y = {},
- lualine_z = {},
- },
- inactive_sections = {
- lualine_a = {},
- lualine_b = {},
- lualine_c = {},
- lualine_x = {},
- lualine_y = {},
- lualine_z = {},
- },
- tabline = {},
- extensions = {},
-}
-
-styles.default = {
- style = "default",
- options = {
- icons_enabled = true,
- component_separators = { "", "" },
- section_separators = { "", "" },
- disabled_filetypes = {},
- },
- sections = {
- lualine_a = { "mode" },
- lualine_b = { "branch" },
- lualine_c = { "filename" },
- lualine_x = { "encoding", "fileformat", "filetype" },
- lualine_y = { "progress" },
- lualine_z = { "location" },
- },
- inactive_sections = {
- lualine_a = {},
- lualine_b = {},
- lualine_c = { "filename" },
- lualine_x = { "location" },
- lualine_y = {},
- lualine_z = {},
- },
- tabline = {},
- extensions = {},
-}
-
-styles.lvim = {
- style = "lvim",
- options = {
- icons_enabled = true,
- component_separators = { left = "", right = "" },
- section_separators = { left = "", right = "" },
- disabled_filetypes = { "dashboard" },
- },
- sections = {
- lualine_a = {
- components.mode,
- },
- lualine_b = {
- components.branch,
- components.filename,
- },
- lualine_c = {
- components.diff,
- components.python_env,
- },
- lualine_x = {
- components.diagnostics,
- components.treesitter,
- components.lsp,
- components.filetype,
- },
- lualine_y = {},
- lualine_z = {
- components.scrollbar,
- },
- },
- inactive_sections = {
- lualine_a = {
- "filename",
- },
- lualine_b = {},
- lualine_c = {},
- lualine_x = {},
- lualine_y = {},
- lualine_z = {},
- },
- tabline = {},
- extensions = { "nvim-tree" },
-}
-
-function M.get_style(style)
- local style_keys = vim.tbl_keys(styles)
- if not vim.tbl_contains(style_keys, style) then
- local Log = require "core.log"
- Log:error(
- "Invalid lualine style",
- string.format('"%s"', style),
- "options are: ",
- string.format('"%s"', table.concat(style_keys, '", "'))
- )
- Log:debug '"lvim" style is applied.'
- style = "lvim"
- end
-
- return vim.deepcopy(styles[style])
-end
-
-function M.update()
- local style = M.get_style(options.builtin.lualine.style)
- if options.builtin.lualine.options.theme == nil then
- options.builtin.lualine.options.theme = options.colorscheme
- end
-
- options.builtin.lualine = vim.tbl_deep_extend("keep", options.builtin.lualine, style)
-end
-
-return M
diff --git a/.config/nvim/lua/core/lualine/utils.lua b/.config/nvim/lua/core/lualine/utils.lua
deleted file mode 100644
index 48756a7..0000000
--- a/.config/nvim/lua/core/lualine/utils.lua
+++ /dev/null
@@ -1,27 +0,0 @@
-local M = {}
-
-function M.validate_theme()
- local theme = options.builtin.lualine.options.theme
- if type(theme) == "table" then
- return
- end
-
- local lualine_loader = require "lualine.utils.loader"
- local ok = pcall(lualine_loader.load_theme, theme)
- if not ok then
- options.builtin.lualine.options.theme = "auto"
- end
-end
-
-function M.env_cleanup(venv)
- if string.find(venv, "/") then
- local final_venv = venv
- for w in venv:gmatch "([^/]+)" do
- final_venv = w
- end
- venv = final_venv
- end
- return venv
-end
-
-return M
diff --git a/.config/nvim/lua/core/nvimtree.lua b/.config/nvim/lua/core/nvimtree.lua
deleted file mode 100644
index b525351..0000000
--- a/.config/nvim/lua/core/nvimtree.lua
+++ /dev/null
@@ -1,175 +0,0 @@
-local M = {}
-local Log = require "core.log"
-
-function M.config()
- options.builtin.nvimtree = {
- active = true,
- on_config_done = nil,
- setup = {
- disable_netrw = true,
- hijack_netrw = true,
- open_on_setup = false,
- ignore_ft_on_setup = {
- "startify",
- "dashboard",
- "alpha",
- },
- update_to_buf_dir = {
- enable = true,
- auto_open = true,
- },
- auto_close = true,
- open_on_tab = false,
- hijack_cursor = false,
- update_cwd = false,
- diagnostics = {
- enable = true,
- icons = {
- hint = "",
- info = "",
- warning = "",
- error = "",
- },
- },
- update_focused_file = {
- enable = true,
- update_cwd = true,
- ignore_list = {},
- },
- system_open = {
- cmd = nil,
- args = {},
- },
- git = {
- enable = true,
- ignore = true,
- timeout = 200,
- },
- view = {
- width = 30,
- height = 30,
- side = "left",
- auto_resize = true,
- number = false,
- relativenumber = false,
- mappings = {
- custom_only = false,
- list = {},
- },
- },
- filters = {
- dotfiles = true,
- custom = { ".git", "node_modules", ".cache" },
- },
- },
- show_icons = {
- git = 1,
- folders = 1,
- files = 1,
- folder_arrows = 1,
- tree_width = 30,
- },
- quit_on_open = 0,
- git_hl = 1,
- disable_window_picker = 0,
- root_folder_modifier = ":t",
- icons = {
- default = "",
- symlink = "",
- git = {
- unstaged = "",
- staged = "S",
- unmerged = "",
- renamed = "➜",
- deleted = "",
- untracked = "U",
- ignored = "◌",
- },
- folder = {
- default = "",
- open = "",
- empty = "",
- empty_open = "",
- symlink = "",
- },
- },
- }
- options.builtin.which_key.mappings["e"] = { "<cmd>NvimTreeToggle<CR>", "Explorer" }
-end
-
-function M.setup()
- local status_ok, nvim_tree_config = pcall(require, "nvim-tree.config")
- if not status_ok then
- Log:error "Failed to load nvim-tree.config"
- return
- end
- local g = vim.g
-
- for opt, val in pairs(options.builtin.nvimtree) do
- g["nvim_tree_" .. opt] = val
- end
-
- -- Implicitly update nvim-tree when project module is active
- if options.builtin.project.active then
- options.builtin.nvimtree.respect_buf_cwd = 1
- options.builtin.nvimtree.setup.update_cwd = true
- options.builtin.nvimtree.setup.disable_netrw = false
- options.builtin.nvimtree.setup.hijack_netrw = false
- vim.g.netrw_banner = false
- end
-
- local tree_cb = nvim_tree_config.nvim_tree_callback
-
- if not options.builtin.nvimtree.setup.view.mappings.list then
- options.builtin.nvimtree.setup.view.mappings.list = {
- { key = { "l", "<CR>", "o" }, cb = tree_cb "edit" },
- { key = "h", cb = tree_cb "close_node" },
- { key = "v", cb = tree_cb "vsplit" },
- }
- end
-
- local tree_view = require "nvim-tree.view"
-
- -- Add nvim_tree open callback
- local open = tree_view.open
- tree_view.open = function()
- M.on_open()
- open()
- end
-
- vim.cmd "au WinClosed * lua require('core.nvimtree').on_close()"
-
- if options.builtin.nvimtree.on_config_done then
- options.builtin.nvimtree.on_config_done(nvim_tree_config)
- end
- require("nvim-tree").setup(options.builtin.nvimtree.setup)
-end
-
-function M.on_open()
- if
- package.loaded["bufferline.state"]
- and options.builtin.nvimtree.setup.view.side == "left"
- then
- require("bufferline.state").set_offset(
- options.builtin.nvimtree.setup.view.width + 1,
- ""
- )
- end
-end
-
-function M.on_close()
- local buf = tonumber(vim.fn.expand "<abuf>")
- local ft = vim.api.nvim_buf_get_option(buf, "filetype")
- if ft == "NvimTree" and package.loaded["bufferline.state"] then
- require("bufferline.state").set_offset(0)
- end
-end
-
-function M.change_tree_dir(dir)
- local lib_status_ok, lib = pcall(require, "nvim-tree.lib")
- if lib_status_ok then
- lib.change_dir(dir)
- end
-end
-
-return M
diff --git a/.config/nvim/lua/core/project.lua b/.config/nvim/lua/core/project.lua
deleted file mode 100644
index b2d4f5f..0000000
--- a/.config/nvim/lua/core/project.lua
+++ /dev/null
@@ -1,51 +0,0 @@
-local M = {}
-
-function M.config()
- options.builtin.project = {
- ---@usage set to false to disable project.nvim.
- --- This is on by default since it's currently the expected behavior.
- active = true,
-
- on_config_done = nil,
-
- ---@usage set to true to disable setting the current-woriking directory
- --- Manual mode doesn't automatically change your root directory, so you have
- --- the option to manually do so using `:ProjectRoot` command.
- manual_mode = false,
-
- ---@usage Methods of detecting the root directory
- --- Allowed values: **"lsp"** uses the native neovim lsp
- --- **"pattern"** uses vim-rooter like glob pattern matching. Here
- --- order matters: if one is not detected, the other is used as fallback. You
- --- can also delete or rearangne the detection methods.
- detection_methods = { "lsp", "pattern" },
-
- ---@usage patterns used to detect root dir, when **"pattern"** is in detection_methods
- patterns = { ".git", "_darcs", ".hg", ".bzr", ".svn", "Makefile", "package.json" },
-
- ---@ Show hidden files in telescope when searching for files in a project
- show_hidden = false,
-
- ---@usage When set to false, you will get a message when project.nvim changes your directory.
- -- When set to false, you will get a message when project.nvim changes your directory.
- silent_chdir = true,
-
- ---@usage list of lsp client names to ignore when using **lsp** detection. eg: { "efm", ... }
- ignore_lsp = {},
-
- ---@type string
- ---@usage path to store the project history for use in telescope
- datapath = get_cache_dir(),
- }
-end
-
-function M.setup()
- local project = require "project_nvim"
-
- project.setup(options.builtin.project)
- if options.builtin.project.on_config_done then
- options.builtin.project.on_config_done(project)
- end
-end
-
-return M
diff --git a/.config/nvim/lua/core/telescope.lua b/.config/nvim/lua/core/telescope.lua
deleted file mode 100644
index 7ef2e58..0000000
--- a/.config/nvim/lua/core/telescope.lua
+++ /dev/null
@@ -1,159 +0,0 @@
-local M = {}
-
-function M.config()
- -- Define this minimal config so that it's available if telescope is not yet available.
- options.builtin.telescope = {
- ---@usage disable telescope completely [not recommeded]
- active = true,
- on_config_done = nil,
- }
-
- local status_ok, actions = pcall(require, "telescope.actions")
- if not status_ok then
- return
- end
-
- options.builtin.telescope = vim.tbl_extend("force", options.builtin.telescope, {
- defaults = {
- prompt_prefix = " ",
- selection_caret = " ",
- entry_prefix = " ",
- initial_mode = "insert",
- selection_strategy = "reset",
- sorting_strategy = "ascending",
- layout_strategy = "horizontal",
- layout_config = {
- width = 0.75,
- prompt_position = "top",
- preview_cutoff = 120,
- horizontal = { mirror = false },
- vertical = { mirror = false },
- },
- vimgrep_arguments = {
- "rg",
- "--color=never",
- "--no-heading",
- "--with-filename",
- "--line-number",
- "--column",
- "--smart-case",
- "--hidden",
- },
- mappings = {
- i = {
- ["<C-n>"] = actions.move_selection_next,
- ["<C-p>"] = actions.move_selection_previous,
- ["<C-c>"] = actions.close,
- ["<C-j>"] = actions.cycle_history_next,
- ["<C-k>"] = actions.cycle_history_prev,
- ["<C-q>"] = actions.smart_send_to_qflist + actions.open_qflist,
- ["<CR>"] = actions.select_default + actions.center,
- },
- n = {
- ["<C-n>"] = actions.move_selection_next,
- ["<C-p>"] = actions.move_selection_previous,
- ["<C-q>"] = actions.smart_send_to_qflist + actions.open_qflist,
- },
- },
- file_ignore_patterns = {},
- path_display = { shorten = 5 },
- winblend = 0,
- border = {},
- borderchars = { "─", "│", "─", "│", "╭", "╮", "╯", "╰" },
- color_devicons = true,
- set_env = { ["COLORTERM"] = "truecolor" }, -- default = nil,
- pickers = {
- find_files = {
- find_command = { "fd", "--type=file", "--hidden", "--smart-case" },
- },
- live_grep = {
- --@usage don't include the filename in the search results
- only_sort_text = true,
- },
- },
- },
- extensions = {
- 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"
- },
- },
- })
-end
-
-function M.code_actions()
- local opts = {
- winblend = 15,
- layout_config = {
- prompt_position = "top",
- width = 80,
- height = 12,
- },
- borderchars = {
- prompt = { "─", "│", " ", "│", "╭", "╮", "│", "│" },
- results = { "─", "│", "─", "│", "├", "┤", "╯", "╰" },
- preview = { "─", "│", "─", "│", "╭", "╮", "╯", "╰" },
- },
- border = {},
- previewer = false,
- shorten_path = false,
- }
- require("telescope.builtin").lsp_code_actions(
- require("telescope.themes").get_dropdown(opts)
- )
-end
-
-function M.setup()
- local previewers = require "telescope.previewers"
- local sorters = require "telescope.sorters"
- local actions = require "telescope.actions"
-
- options.builtin.telescope = vim.tbl_extend("keep", {
- file_previewer = previewers.vim_buffer_cat.new,
- grep_previewer = previewers.vim_buffer_vimgrep.new,
- qflist_previewer = previewers.vim_buffer_qflist.new,
- file_sorter = sorters.get_fuzzy_file,
- generic_sorter = sorters.get_generic_fuzzy_sorter,
- ---@usage Mappings are fully customizable. Many familiar mapping patterns are setup as defaults.
- mappings = {
- i = {
- ["<C-n>"] = actions.move_selection_next,
- ["<C-p>"] = actions.move_selection_previous,
- ["<C-c>"] = actions.close,
- ["<C-j>"] = actions.cycle_history_next,
- ["<C-k>"] = actions.cycle_history_prev,
- ["<C-q>"] = actions.smart_send_to_qflist + actions.open_qflist,
- ["<CR>"] = actions.select_default + actions.center,
- },
- n = {
- ["<C-n>"] = actions.move_selection_next,
- ["<C-p>"] = actions.move_selection_previous,
- ["<C-q>"] = actions.smart_send_to_qflist + actions.open_qflist,
- },
- },
- }, options.builtin.telescope)
-
- local telescope = require "telescope"
-
- telescope.setup(options.builtin.telescope)
-
- if options.builtin.project.active then
- pcall(function()
- require("telescope").load_extension "projects"
- end)
- end
-
- if options.builtin.telescope.on_config_done then
- options.builtin.telescope.on_config_done(telescope)
- end
-
- if
- options.builtin.telescope.extensions and options.builtin.telescope.extensions.fzf
- then
- require("telescope").load_extension "fzf"
- end
-end
-
-return M
diff --git a/.config/nvim/lua/core/terminal.lua b/.config/nvim/lua/core/terminal.lua
deleted file mode 100644
index 1a7b0bc..0000000
--- a/.config/nvim/lua/core/terminal.lua
+++ /dev/null
@@ -1,118 +0,0 @@
-local M = {}
-local Log = require "core.log"
-
-M.config = function()
- options.builtin["terminal"] = {
- on_config_done = nil,
- -- size can be a number or function which is passed the current terminal
- size = 20,
- -- open_mapping = [[<c-\>]],
- open_mapping = [[<c-t>]],
- hide_numbers = true, -- hide the number column in toggleterm buffers
- shade_filetypes = {},
- shade_terminals = true,
- shading_factor = 2, -- the degree by which to darken to terminal colour, default: 1 for dark backgrounds, 3 for light
- start_in_insert = true,
- insert_mappings = true, -- whether or not the open mapping applies in insert mode
- persist_size = false,
- -- direction = 'vertical' | 'horizontal' | 'window' | 'float',
- direction = "float",
- close_on_exit = true, -- close the terminal window when the process exits
- shell = vim.o.shell, -- change the default shell
- -- This field is only relevant if direction is set to 'float'
- float_opts = {
- -- The border key is *almost* the same as 'nvim_win_open'
- -- see :h nvim_win_open for details on borders however
- -- the 'curved' border is a custom border type
- -- not natively supported but implemented in this plugin.
- -- border = 'single' | 'double' | 'shadow' | 'curved' | ... other options supported by win open
- border = "curved",
- -- width = <value>,
- -- height = <value>,
- winblend = 0,
- highlights = {
- border = "Normal",
- background = "Normal",
- },
- },
- -- Add executables on the config.lua
- -- { exec, keymap, name}
- -- options.builtin.terminal.execs = {{}} to overwrite
- -- options.builtin.terminal.execs[#options.builtin.terminal.execs+1] = {"gdb", "tg", "GNU Debugger"}
- execs = {
- { "lazygit", "gg", "LazyGit" },
- },
- }
-end
-
-M.setup = function()
- local terminal = require "toggleterm"
- for _, exec in pairs(options.builtin.terminal.execs) do
- require("core.terminal").add_exec(exec[1], exec[2], exec[3])
- end
- terminal.setup(options.builtin.terminal)
-
- if options.builtin.terminal.on_config_done then
- options.builtin.terminal.on_config_done(terminal)
- end
-end
-
-M.add_exec = function(exec, keymap, name)
- vim.api.nvim_set_keymap(
- "n",
- "<leader>" .. keymap,
- "<cmd>lua require('core.terminal')._exec_toggle('" .. exec .. "')<CR>",
- { noremap = true, silent = true }
- )
- options.builtin.which_key.mappings[keymap] = name
-end
-
-M._split = function(inputstr, sep)
- if sep == nil then
- sep = "%s"
- end
- local t = {}
- for str in string.gmatch(inputstr, "([^" .. sep .. "]+)") do
- table.insert(t, str)
- end
- return t
-end
-
-M._exec_toggle = function(exec)
- local binary = M._split(exec)[1]
- if vim.fn.executable(binary) ~= 1 then
- Log:error(
- "Unable to run executable "
- .. binary
- .. ". Please make sure it is installed properly."
- )
- return
- end
- local Terminal = require("toggleterm.terminal").Terminal
- local exec_term = Terminal:new { cmd = exec, hidden = true }
- exec_term:toggle()
-end
-
----Toggles a log viewer according to log.viewer.layout_config
----@param logfile string the fullpath to the logfile
-M.toggle_log_view = function(logfile)
- local log_viewer = options.log.viewer.cmd
- if vim.fn.executable(log_viewer) ~= 1 then
- log_viewer = "less +F"
- end
- log_viewer = log_viewer .. " " .. logfile
- local term_opts = vim.tbl_deep_extend("force", options.builtin.terminal, {
- cmd = log_viewer,
- open_mapping = options.log.viewer.layout_config.open_mapping,
- direction = options.log.viewer.layout_config.direction,
- -- TODO: this might not be working as expected
- size = options.log.viewer.layout_config.size,
- float_opts = options.log.viewer.layout_config.float_opts,
- })
-
- local Terminal = require("toggleterm.terminal").Terminal
- local log_view = Terminal:new(term_opts)
- log_view:toggle()
-end
-
-return M
diff --git a/.config/nvim/lua/core/treesitter.lua b/.config/nvim/lua/core/treesitter.lua
deleted file mode 100644
index b56c245..0000000
--- a/.config/nvim/lua/core/treesitter.lua
+++ /dev/null
@@ -1,94 +0,0 @@
-local M = {}
-local Log = require "core.log"
-
-M.config = function()
- options.builtin.treesitter = {
- on_config_done = nil,
- ensure_installed = {}, -- one of "all", "maintained" (parsers with maintainers), or a list of languages
- ignore_install = {},
- matchup = {
- enable = false, -- mandatory, false will disable the whole extension
- -- disable = { "c", "ruby" }, -- optional, list of language that will be disabled
- },
- highlight = {
- enable = true, -- false will disable the whole extension
- additional_vim_regex_highlighting = true,
- disable = { "latex" },
- },
- context_commentstring = {
- enable = true,
- config = {
- -- Languages that have a single comment style
- typescript = "// %s",
- css = "/* %s */",
- scss = "/* %s */",
- html = "<!-- %s -->",
- svelte = "<!-- %s -->",
- vue = "<!-- %s -->",
- json = "",
- },
- },
- -- indent = {enable = true, disable = {"python", "html", "javascript"}},
- -- TODO seems to be broken
- indent = { enable = true, disable = { "yaml" } },
- autotag = { enable = false },
- textobjects = {
- swap = {
- enable = false,
- -- swap_next = textobj_swap_keymaps,
- },
- -- move = textobj_move_keymaps,
- select = {
- enable = false,
- -- keymaps = textobj_sel_keymaps,
- },
- },
- textsubjects = {
- enable = false,
- keymaps = { ["."] = "textsubjects-smart", [";"] = "textsubjects-big" },
- },
- playground = {
- enable = false,
- disable = {},
- updatetime = 25, -- Debounced time for highlighting nodes in the playground from source code
- persist_queries = false, -- Whether the query persists across vim sessions
- keybindings = {
- toggle_query_editor = "o",
- toggle_hl_groups = "i",
- toggle_injected_languages = "t",
- toggle_anonymous_nodes = "a",
- toggle_language_display = "I",
- focus_language = "f",
- unfocus_language = "F",
- update = "R",
- goto_node = "<cr>",
- show_help = "?",
- },
- },
- rainbow = {
- enable = false,
- extended_mode = true, -- Highlight also non-parentheses delimiters, boolean or table: lang -> boolean
- max_file_lines = 1000, -- Do not enable for files with more than 1000 lines, int
- },
- }
-end
-
-M.setup = function()
- local status_ok, treesitter_configs = pcall(require, "nvim-treesitter.configs")
- if not status_ok then
- Log:get_default().error "Failed to load nvim-treesitter.configs"
- return
- end
-
- local opts = vim.deepcopy(options.builtin.treesitter)
-
- -- avoid running any installers in headless mode since it's harder to detect failures
- opts.ensure_installed = #vim.api.nvim_list_uis() == 0 and {} or opts.ensure_installed
- treesitter_configs.setup(opts)
-
- if options.builtin.treesitter.on_config_done then
- options.builtin.treesitter.on_config_done(treesitter_configs)
- end
-end
-
-return M
diff --git a/.config/nvim/lua/core/which-key.lua b/.config/nvim/lua/core/which-key.lua
deleted file mode 100644
index 333ce6d..0000000
--- a/.config/nvim/lua/core/which-key.lua
+++ /dev/null
@@ -1,283 +0,0 @@
-local M = {}
-
-M.config = function()
- options.builtin.which_key = {
- ---@usage disable which-key completely [not recommeded]
- active = true,
- on_config_done = nil,
- setup = {
- plugins = {
- marks = true, -- shows a list of your marks on ' and `
- registers = true, -- shows your registers on " in NORMAL or <C-r> in INSERT mode
- -- the presets plugin, adds help for a bunch of default keybindings in Neovim
- -- No actual key bindings are created
- presets = {
- operators = false, -- adds help for operators like d, y, ...
- motions = false, -- adds help for motions
- text_objects = false, -- help for text objects triggered after entering an operator
- windows = true, -- default bindings on <c-w>
- nav = true, -- misc bindings to work with windows
- z = true, -- bindings for folds, spelling and others prefixed with z
- g = true, -- bindings for prefixed with g
- },
- spelling = { enabled = true, suggestions = 20 }, -- use which-key for spelling hints
- },
- icons = {
- breadcrumb = "»", -- symbol used in the command line area that shows your active key combo
- separator = "➜", -- symbol used between a key and it's label
- group = "+", -- symbol prepended to a group
- },
- window = {
- border = "single", -- none, single, double, shadow
- position = "bottom", -- bottom, top
- margin = { 1, 0, 1, 0 }, -- extra window margin [top, right, bottom, left]
- padding = { 2, 2, 2, 2 }, -- extra window padding [top, right, bottom, left]
- },
- layout = {
- height = { min = 4, max = 25 }, -- min and max height of the columns
- width = { min = 20, max = 50 }, -- min and max width of the columns
- spacing = 3, -- spacing between columns
- },
- hidden = { "<silent>", "<cmd>", "<Cmd>", "<CR>", "call", "lua", "^:", "^ " }, -- hide mapping boilerplate
- show_help = true, -- show help message on the command line when the popup is visible
- },
-
- opts = {
- mode = "n", -- NORMAL mode
- prefix = "<leader>",
- buffer = nil, -- Global mappings. Specify a buffer number for buffer local mappings
- silent = true, -- use `silent` when creating keymaps
- noremap = true, -- use `noremap` when creating keymaps
- nowait = true, -- use `nowait` when creating keymaps
- },
- vopts = {
- mode = "v", -- VISUAL mode
- prefix = "<leader>",
- buffer = nil, -- Global mappings. Specify a buffer number for buffer local mappings
- silent = true, -- use `silent` when creating keymaps
- noremap = true, -- use `noremap` when creating keymaps
- nowait = true, -- use `nowait` when creating keymaps
- },
- -- NOTE: Prefer using : over <cmd> as the latter avoids going back in normal-mode.
- -- see https://neovim.io/doc/user/map.html#:map-cmd
- vmappings = {
- ["k"] = {
- "<ESC><CMD>lua require('Comment.api').gc(vim.fn.visualmode())<CR>",
- "Comment",
- },
- },
- mappings = {
- ["w"] = { "<cmd>w!<CR>", "Save" },
- ["q"] = { "<cmd>q!<CR>", "Quit" },
- ["k"] = { "<cmd>lua require('Comment').toggle()<CR>", "Comment" },
- ["c"] = { "<cmd>BufferClose!<CR>", "Close Buffer" },
- ["f"] = { "<cmd>Telescope find_files<CR>", "Find File" },
- ["n"] = { "<cmd>nohlsearch<CR>", "No Highlight" },
- b = {
- name = "Buffers",
- j = { "<cmd>BufferPick<cr>", "Jump" },
- f = { "<cmd>Telescope buffers<cr>", "Find" },
- b = { "<cmd>b#<cr>", "Previous" },
- w = { "<cmd>BufferWipeout<cr>", "Wipeout" },
- e = {
- "<cmd>BufferCloseAllButCurrent<cr>",
- "Close all but current",
- },
- h = { "<cmd>BufferCloseBuffersLeft<cr>", "Close all to the left" },
- l = {
- "<cmd>BufferCloseBuffersRight<cr>",
- "Close all to the right",
- },
- D = {
- "<cmd>BufferOrderByDirectory<cr>",
- "Sort by directory",
- },
- L = {
- "<cmd>BufferOrderByLanguage<cr>",
- "Sort by language",
- },
- },
- p = {
- name = "Packer",
- c = { "<cmd>PackerCompile<cr>", "Compile" },
- i = { "<cmd>PackerInstall<cr>", "Install" },
- r = { "<cmd>lua require('plugin-loader').recompile()<cr>", "Re-compile" },
- s = { "<cmd>PackerSync<cr>", "Sync" },
- S = { "<cmd>PackerStatus<cr>", "Status" },
- u = { "<cmd>PackerUpdate<cr>", "Update" },
- },
-
- -- " Available Debug Adapters:
- -- " https://microsoft.github.io/debug-adapter-protocol/implementors/adapters/
- -- " Adapter configuration and installation instructions:
- -- " https://github.com/mfussenegger/nvim-dap/wiki/Debug-Adapter-installation
- -- " Debug Adapter protocol:
- -- " https://microsoft.github.io/debug-adapter-protocol/
- -- " Debugging
- g = {
- name = "Git",
- j = { "<cmd>lua require 'gitsigns'.next_hunk()<cr>", "Next Hunk" },
- k = { "<cmd>lua require 'gitsigns'.prev_hunk()<cr>", "Prev Hunk" },
- l = { "<cmd>lua require 'gitsigns'.blame_line()<cr>", "Blame" },
- p = { "<cmd>lua require 'gitsigns'.preview_hunk()<cr>", "Preview Hunk" },
- r = { "<cmd>lua require 'gitsigns'.reset_hunk()<cr>", "Reset Hunk" },
- R = { "<cmd>lua require 'gitsigns'.reset_buffer()<cr>", "Reset Buffer" },
- s = { "<cmd>lua require 'gitsigns'.stage_hunk()<cr>", "Stage Hunk" },
- u = {
- "<cmd>lua require 'gitsigns'.undo_stage_hunk()<cr>",
- "Undo Stage Hunk",
- },
- o = { "<cmd>Telescope git_status<cr>", "Open changed file" },
- b = { "<cmd>Telescope git_branches<cr>", "Checkout branch" },
- c = { "<cmd>Telescope git_commits<cr>", "Checkout commit" },
- C = {
- "<cmd>Telescope git_bcommits<cr>",
- "Checkout commit(for current file)",
- },
- d = {
- "<cmd>Gitsigns diffthis HEAD<cr>",
- "Git Diff",
- },
- },
-
- l = {
- name = "LSP",
- a = {
- "<cmd>lua require('core.telescope').code_actions()<cr>",
- "Code Action",
- },
- d = {
- "<cmd>Telescope lsp_document_diagnostics<cr>",
- "Document Diagnostics",
- },
- w = {
- "<cmd>Telescope lsp_workspace_diagnostics<cr>",
- "Workspace Diagnostics",
- },
- f = { "<cmd>lua vim.lsp.buf.formatting()<cr>", "Format" },
- i = { "<cmd>LspInfo<cr>", "Info" },
- I = { "<cmd>LspInstallInfo<cr>", "Installer Info" },
- j = {
- "<cmd>lua vim.lsp.diagnostic.goto_next({popup_opts = {border = lsp.popup_border}})<cr>",
- "Next Diagnostic",
- },
- k = {
- "<cmd>lua vim.lsp.diagnostic.goto_prev({popup_opts = {border = lsp.popup_border}})<cr>",
- "Prev Diagnostic",
- },
- l = { "<cmd>lua vim.lsp.codelens.run()<cr>", "CodeLens Action" },
- p = {
- name = "Peek",
- d = { "<cmd>lua require('lsp.peek').Peek('definition')<cr>", "Definition" },
- t = {
- "<cmd>lua require('lsp.peek').Peek('typeDefinition')<cr>",
- "Type Definition",
- },
- i = {
- "<cmd>lua require('lsp.peek').Peek('implementation')<cr>",
- "Implementation",
- },
- },
- q = { "<cmd>lua vim.lsp.diagnostic.set_loclist()<cr>", "Quickfix" },
- r = { "<cmd>lua vim.lsp.buf.rename()<cr>", "Rename" },
- s = { "<cmd>Telescope lsp_document_symbols<cr>", "Document Symbols" },
- S = {
- "<cmd>Telescope lsp_dynamic_workspace_symbols<cr>",
- "Workspace Symbols",
- },
- },
- L = {
- name = "+NeoVim",
- c = {
- "<cmd>edit " .. get_config_dir() .. "/config.lua<cr>",
- "Edit config.lua",
- },
- k = { "<cmd>Telescope keymaps<cr>", "View NeoVim's keymappings" },
- i = {
- "<cmd>lua require('core.info').toggle_popup(vim.bo.filetype)<cr>",
- "Toggle NeoVim Info",
- },
- I = {
- "<cmd>lua require('core.telescope.custom-finders').view_lunarvim_changelog()<cr>",
- "View NeoVim's changelog",
- },
- l = {
- name = "+logs",
- d = {
- "<cmd>lua require('core.terminal').toggle_log_view(require('core.log').get_path())<cr>",
- "view default log",
- },
- D = {
- "<cmd>lua vim.fn.execute('edit ' .. require('core.log').get_path())<cr>",
- "Open the default logfile",
- },
- l = {
- "<cmd>lua require('core.terminal').toggle_log_view(vim.lsp.get_log_path())<cr>",
- "view lsp log",
- },
- L = {
- "<cmd>lua vim.fn.execute('edit ' .. vim.lsp.get_log_path())<cr>",
- "Open the LSP logfile",
- },
- n = {
- "<cmd>lua require('core.terminal').toggle_log_view(os.getenv('NVIM_LOG_FILE'))<cr>",
- "view neovim log",
- },
- N = { "<cmd>edit $NVIM_LOG_FILE<cr>", "Open the Neovim logfile" },
- p = {
- "<cmd>lua require('core.terminal').toggle_log_view('packer.nvim')<cr>",
- "view packer log",
- },
- P = {
- "<cmd>exe 'edit '.stdpath('cache').'/packer.nvim.log'<cr>",
- "Open the Packer logfile",
- },
- },
- r = { "<cmd>NvimReload<cr>", "Reload Neovim's configuration" },
- u = { "<cmd>NvimUpdate<cr>", "Update NeoVim" },
- },
- s = {
- name = "Search",
- b = { "<cmd>Telescope git_branches<cr>", "Checkout branch" },
- c = { "<cmd>Telescope colorscheme<cr>", "Colorscheme" },
- f = { "<cmd>Telescope find_files<cr>", "Find File" },
- h = { "<cmd>Telescope help_tags<cr>", "Find Help" },
- M = { "<cmd>Telescope man_pages<cr>", "Man Pages" },
- r = { "<cmd>Telescope oldfiles<cr>", "Open Recent File" },
- R = { "<cmd>Telescope registers<cr>", "Registers" },
- t = { "<cmd>Telescope live_grep<cr>", "Text" },
- k = { "<cmd>Telescope keymaps<cr>", "Keymaps" },
- C = { "<cmd>Telescope commands<cr>", "Commands" },
- p = {
- "<cmd>lua require('telescope.builtin.internal').colorscheme({enable_preview = true})<cr>",
- "Colorscheme with Preview",
- },
- },
- T = {
- name = "Treesitter",
- i = { ":TSConfigInfo<cr>", "Info" },
- },
- },
- }
-end
-
-M.setup = function()
- local which_key = require "which-key"
-
- which_key.setup(options.builtin.which_key.setup)
-
- local opts = options.builtin.which_key.opts
- local vopts = options.builtin.which_key.vopts
-
- local mappings = options.builtin.which_key.mappings
- local vmappings = options.builtin.which_key.vmappings
-
- which_key.register(mappings, opts)
- which_key.register(vmappings, vopts)
-
- if options.builtin.which_key.on_config_done then
- options.builtin.which_key.on_config_done(which_key)
- end
-end
-
-return M
diff --git a/.config/nvim/lua/dark/Git.lua b/.config/nvim/lua/dark/Git.lua
deleted file mode 100644
index b47ccf2..0000000
--- a/.config/nvim/lua/dark/Git.lua
+++ /dev/null
@@ -1,10 +0,0 @@
-local Git = {
- SignAdd = { fg = C.sign_add },
- SignChange = { fg = C.sign_change },
- SignDelete = { fg = C.sign_delete },
- GitSignsAdd = { fg = C.sign_add },
- GitSignsChange = { fg = C.sign_change },
- GitSignsDelete = { fg = C.sign_delete },
-}
-
-return Git
diff --git a/.config/nvim/lua/dark/LSP.lua b/.config/nvim/lua/dark/LSP.lua
deleted file mode 100644
index 85d0d7e..0000000
--- a/.config/nvim/lua/dark/LSP.lua
+++ /dev/null
@@ -1,92 +0,0 @@
-local LSP = {
- LspDiagnosticsDefaultError = { fg = C.error_red },
- LspDiagnosticsDefaultWarning = { fg = C.warning_orange },
- LspDiagnosticsDefaultInformation = { fg = C.info_yellow },
- LspDiagnosticsDefaultHint = { fg = C.hint_blue },
- LspDiagnosticsVirtualTextError = { fg = C.error_red },
- LspDiagnosticsVirtualTextWarning = { fg = C.warning_orange },
- LspDiagnosticsVirtualTextInformation = { fg = C.info_yellow },
- LspDiagnosticsVirtualTextHint = { fg = C.hint_blue },
- LspDiagnosticsFloatingError = { fg = C.error_red },
- LspDiagnosticsFloatingWarning = { fg = C.warning_orange },
- LspDiagnosticsFloatingInformation = { fg = C.info_yellow },
- LspDiagnosticsFloatingHint = { fg = C.hint_blue },
- LspDiagnosticsSignError = { fg = C.error_red },
- LspDiagnosticsSignWarning = { fg = C.warning_orange },
- LspDiagnosticsSignInformation = { fg = C.info_yellow },
- LspDiagnosticsSignHint = { fg = C.hint_blue },
- LspDiagnosticsError = { fg = C.error_red },
- LspDiagnosticsWarning = { fg = C.warning_orange },
- LspDiagnosticsInformation = { fg = C.info_yellow },
- LspDiagnosticsHint = { fg = C.hint_blue },
- LspDiagnosticsUnderlineError = { fg = C.error_red },
- LspDiagnosticsUnderlineWarning = { fg = C.warning_orange },
- LspDiagnosticsUnderlineInformation = { fg = C.info_yellow },
- LspDiagnosticsUnderlineHint = { fg = C.hint_blue },
- QuickScopePrimary = { fg = C.cyan_test, style = "underline" },
- QuickScopeSecondary = { fg = C.purple_test, style = "underline" },
- TelescopeSelection = { fg = C.hint_blue },
- TelescopeMatching = { fg = C.info_yellow, style = "bold" },
- TelescopeBorder = { fg = C.gray, bg = C.bg },
- NvimTreeFolderIcon = { fg = C.blue },
- NvimTreeIndentMarker = { fg = C.gray },
- NvimTreeNormal = { fg = C.light_gray, bg = C.alt_bg },
- NvimTreeVertSplit = { fg = C.alt_bg, bg = C.alt_bg },
- NvimTreeFolderName = { fg = C.blue },
- NvimTreeOpenedFolderName = { fg = C.cyan, style = "italic" },
- NvimTreeImageFile = { fg = C.purple },
- NvimTreeSpecialFile = { fg = C.orange },
- NvimTreeGitStaged = { fg = C.sign_add },
- NvimTreeGitNew = { fg = C.sign_add },
- NvimTreeGitDirty = { fg = C.sign_add },
- NvimTreeGitDeleted = { fg = C.sign_delete },
- NvimTreeGitMerge = { fg = C.sign_change },
- NvimTreeGitRenamed = { fg = C.sign_change },
- NvimTreeSymlink = { fg = C.cyan },
- NvimTreeRootFolder = { fg = C.fg, style = "bold" },
- NvimTreeExecFile = { fg = C.green },
- BufferCurrent = { fg = C.fg, bg = C.bg },
- BufferCurrentIndex = { fg = C.fg, bg = C.bg },
- BufferCurrentMod = { fg = C.info_yellow, bg = C.bg },
- BufferCurrentSign = { fg = C.hint_blue, bg = C.bg },
- BufferCurrentTarget = { fg = C.red, bg = C.bg, style = "bold" },
- BufferVisible = { fg = C.fg, bg = C.bg },
- BufferVisibleIndex = { fg = C.fg, bg = C.bg },
- BufferVisibleMod = { fg = C.info_yellow, bg = C.bg },
- BufferVisibleSign = { fg = C.hint_blue, bg = C.bg },
- BufferVisibleTarget = { fg = C.red, bg = C.bg, style = "bold" },
- BufferInactive = { fg = C.gray, bg = C.alt_bg },
- BufferInactiveIndex = { fg = C.gray, bg = C.alt_bg },
- BufferInactiveMod = { fg = C.info_yellow, bg = C.alt_bg },
- BufferInactiveSign = { fg = C.gray, bg = C.alt_bg },
- BufferInactiveTarget = { fg = C.red, bg = C.alt_bg, style = "bold" },
- StatusLine = { fg = C.alt_bg },
- StatusLineNC = { fg = C.alt_bg },
- StatusLineSeparator = { fg = C.alt_bg },
- StatusLineTerm = { fg = C.alt_bg },
- StatusLineTermNC = { fg = C.alt_bg },
- CodiVirtualText = { fg = C.pale_purple },
- IndentBlanklineContextChar = { fg = C.accent },
- DashboardHeader = { fg = C.blue },
- DashboardCenter = { fg = C.white },
- DashboardFooter = { fg = C.gray },
- CompeDocumentation = { bg = C.alt_bg },
- DiffViewNormal = { fg = C.gray, bg = C.alt_bg },
- DiffviewStatusAdded = { fg = C.sign_add },
- DiffviewStatusModified = { fg = C.sign_change },
- DiffviewStatusRenamed = { fg = C.sign_change },
- DiffviewStatusDeleted = { fg = C.sign_delete },
- DiffviewFilePanelInsertion = { fg = C.sign_add },
- DiffviewFilePanelDeletion = { fg = C.sign_delete },
- DiffviewVertSplit = { bg = C.bg },
- diffAdded = { fg = C.sign_add },
- diffRemoved = { fg = C.sign_delete },
- diffFileId = { fg = C.blue, style = "bold,reverse" },
- diffFile = { fg = C.alt_bg },
- diffNewFile = { fg = C.green },
- diffOldFile = { fg = C.red },
- debugPc = { bg = C.cyan },
- debugBreakpoint = { fg = C.red, style = "reverse" },
-}
-
-return LSP
diff --git a/.config/nvim/lua/dark/Treesitter.lua b/.config/nvim/lua/dark/Treesitter.lua
deleted file mode 100644
index da9482d..0000000
--- a/.config/nvim/lua/dark/Treesitter.lua
+++ /dev/null
@@ -1,56 +0,0 @@
-local Treesitter = {
- TSComment = { fg = C.gray },
- TSAnnotation = { fg = C.white },
- TSAttribute = { fg = C.white },
- TSConstructor = { fg = C.white },
- TSType = { fg = C.orange },
- TSTypeBuiltin = { fg = C.white },
- TSConditional = { fg = C.red },
- TSException = { fg = C.red },
- TSInclude = { fg = C.red },
- TSKeyword = { fg = C.red },
- TSKeywordFunction = { fg = C.red },
- TSLabel = { fg = C.white },
- TSNamespace = { fg = C.white },
- TSRepeat = { fg = C.red },
- TSConstant = { fg = C.orange },
- TSConstBuiltin = { fg = C.orange },
- TSFloat = { fg = C.blue },
- TSNumber = { fg = C.blue },
- TSBoolean = { fg = C.blue },
- TSCharacter = { fg = C.light_green },
- TSError = { fg = C.error_red },
- TSFunction = { fg = C.white },
- TSFuncBuiltin = { fg = C.white },
- TSMethod = { fg = C.white },
- TSConstMacro = { fg = C.white },
- TSFuncMacro = { fg = C.white },
- TSVariable = { fg = C.white },
- TSVariableBuiltin = { fg = C.white },
- TSProperty = { fg = C.white },
- TSOperator = { fg = C.white },
- TSField = { fg = C.white },
- TSParameter = { fg = C.white },
- TSParameterReference = { fg = C.white },
- TSSymbol = { fg = C.gray },
- TSText = { fg = C.fg },
- TSPunctDelimiter = { fg = C.white },
- TSTagDelimiter = { fg = C.white },
- TSPunctBracket = { fg = C.white },
- TSPunctSpecial = { fg = C.gray },
- TSString = { fg = C.gray },
- TSStringRegex = { fg = C.gray },
- TSStringEscape = { fg = C.gray },
- TSTag = { fg = C.pale_purple },
- TSEmphasis = { style = "italic" },
- TSUnderline = { style = "underline" },
- TSTitle = { fg = C.gray },
- TSLiteral = { fg = C.gray },
- TSURI = { fg = C.cyan, style = "underline" },
- TSKeywordOperator = { fg = C.gray },
- TSStructure = { fg = C.purple_test },
- TSStrong = { fg = C.gray },
- TSQueryLinterError = { fg = C.warning_orange },
-}
-
-return Treesitter
diff --git a/.config/nvim/lua/dark/Whichkey.lua b/.config/nvim/lua/dark/Whichkey.lua
deleted file mode 100644
index 9b9fb60..0000000
--- a/.config/nvim/lua/dark/Whichkey.lua
+++ /dev/null
@@ -1,9 +0,0 @@
-local Whichkey = {
- WhichKey = { fg = C.light_gray },
- WhichKeySeperator = { fg = C.gray },
- WhichKeyGroup = { fg = C.yellow },
- WhichKeyDesc = { fg = C.light_gray },
- WhichKeyFloat = { bg = C.bg },
-}
-
-return Whichkey
diff --git a/.config/nvim/lua/dark/config.lua b/.config/nvim/lua/dark/config.lua
deleted file mode 100644
index ebac710..0000000
--- a/.config/nvim/lua/dark/config.lua
+++ /dev/null
@@ -1,23 +0,0 @@
-local config
-
-vim = vim or { g = {}, o = {} }
-
-local function opt(key, default)
- if vim.g[key] == nil then
- return default
- end
- if vim.g[key] == 0 then
- return false
- end
- return vim.g[key]
-end
-
-config = {
- transparent_background = opt("transparent_background", false),
- italic_comments = opt("italic_keywords", true) and "italic" or "NONE",
- italic_keywords = opt("italic_keywords", true) and "italic" or "NONE",
- italic_functions = opt("italic_function", false) and "italic" or "NONE",
- italic_variables = opt("italic_variables", true) and "italic" or "NONE",
-}
-
-return config
diff --git a/.config/nvim/lua/dark/highlights.lua b/.config/nvim/lua/dark/highlights.lua
deleted file mode 100644
index 45008b7..0000000
--- a/.config/nvim/lua/dark/highlights.lua
+++ /dev/null
@@ -1,99 +0,0 @@
-local highlights = {
- Normal = { fg = C.fg, bg = Config.transparent_background and "NONE" or C.bg },
- SignColumn = { bg = C.bg },
- MsgArea = { fg = C.fg, bg = C.bg },
- ModeMsg = { fg = C.fg, bg = C.bg },
- MsgSeparator = { fg = C.fg, bg = C.bg },
- SpellBad = { fg = C.error_red, style = "underline" },
- SpellCap = { fg = C.yellow, style = "underline" },
- SpellLocal = { fg = C.green, style = "underline" },
- SpellRare = { fg = C.purple, style = "underline" },
- NormalNC = { fg = C.fg, bg = C.bg },
- Pmenu = { fg = C.white, bg = C.accent },
- PmenuSel = { fg = C.blue, bg = C.alt_bg },
- WildMenu = { fg = C.blue, bg = C.alt_bg },
- CursorLineNr = { fg = C.light_gray, style = "bold" },
- Comment = { fg = C.blue, style = "italic" },
- Folded = { fg = C.light_gray, bg = C.alt_bg },
- FoldColumn = { fg = C.light_gray, bg = C.alt_bg },
- LineNr = { fg = C.gray },
- FloatBoder = { fg = C.gray, bg = C.alt_bg },
- Whitespace = { fg = C.gray },
- VertSplit = { fg = C.bg, bg = C.accent },
- CursorLine = { bg = C.alt_bg },
- CursorColumn = { bg = C.alt_bg },
- ColorColumn = { bg = C.alt_bg },
- NormalFloat = { bg = C.alt_bg },
- Visual = { bg = C.gray },
- VisualNOS = { bg = C.alt_bg },
- WarningMsg = { fg = C.error_red, bg = C.bg },
- DiffAdd = { fg = C.alt_bg, bg = C.sign_add },
- DiffChange = { fg = C.alt_bg, bg = C.sign_change, style = "underline" },
- DiffDelete = { fg = C.alt_bg, bg = C.sign_delete },
- QuickFixLine = { bg = C.accent },
- PmenuSbar = { bg = C.alt_bg },
- PmenuThumb = { bg = C.white },
- MatchWord = { style = "underline" },
- MatchParen = { fg = C.pale_purple, bg = C.bg, style = "underline" },
- MatchWordCur = { style = "underline" },
- MatchParenCur = { style = "underline" },
- Cursor = { fg = C.cursor_fg, bg = C.cursor_bg },
- lCursor = { fg = C.cursor_fg, bg = C.cursor_bg },
- CursorIM = { fg = C.cursor_fg, bg = C.cursor_bg },
- TermCursor = { fg = C.cursor_fg, bg = C.cursor_bg },
- TermCursorNC = { fg = C.cursor_fg, bg = C.cursor_bg },
- Conceal = { fg = C.accent },
- Directory = { fg = C.blue },
- SpecialKey = { fg = C.blue },
- Title = { fg = C.blue },
- ErrorMsg = { fg = C.error_red, bg = C.bg, style = "bold" },
- Search = { fg = C.hint_blue, bg = C.alt_bg },
- IncSearch = { fg = C.hint_blue, bg = C.alt_bg },
- Substitute = { fg = C.alt_bg, bg = C.gray_blue },
- MoreMsg = { fg = C.cyan },
- Question = { fg = C.cyan },
- EndOfBuffer = { fg = C.bg },
- NonText = { fg = C.bg },
- Variable = { fg = C.white },
- String = { fg = C.blue },
- Character = { fg = C.light_green },
- Constant = { fg = C.orange },
- Number = { fg = C.red },
- Boolean = { fg = C.red },
- Float = { fg = C.red },
- Identifier = { fg = C.white },
- Function = { fg = C.purple },
- Operator = { fg = C.orange },
- Type = { fg = C.white },
- StorageClass = { fg = C.yellow },
- Structure = { fg = C.orange },
- Typedef = { fg = C.purple },
- Keyword = { fg = C.orange },
- Statement = { fg = C.orange },
- Conditional = { fg = C.orange },
- Repeat = { fg = C.orange },
- Label = { fg = C.orange },
- Exception = { fg = C.orange },
- Include = { fg = C.orange },
- PreProc = { fg = C.orange },
- Define = { fg = C.orange },
- Macro = { fg = C.orange },
- PreCondit = { fg = C.orange },
- Special = { fg = C.orange },
- SpecialChar = { fg = C.orange },
- Tag = { fg = C.pale_purple },
- Debug = { fg = C.red },
- Delimiter = { fg = C.gray },
- SpecialComment = { fg = C.blue },
- Underlined = { style = "underline" },
- Bold = { style = "bold" },
- Italic = { style = "italic" },
- Ignore = { fg = C.cyan, bg = C.bg, style = "bold" },
- Todo = { fg = C.red, bg = C.bg, style = "bold" },
- Error = { fg = C.error_red, bg = C.bg, style = "bold" },
- TabLine = { fg = C.white, bg = C.alt_bg },
- TabLineSel = { fg = C.white, bg = C.alt_bg },
- TabLineFill = { fg = C.white, bg = C.alt_bg },
-}
-
-return highlights
diff --git a/.config/nvim/lua/dark/init.lua b/.config/nvim/lua/dark/init.lua
deleted file mode 100644
index dd24d95..0000000
--- a/.config/nvim/lua/dark/init.lua
+++ /dev/null
@@ -1,30 +0,0 @@
-vim.api.nvim_command "hi clear"
-if vim.fn.exists "syntax_on" then
- vim.api.nvim_command "syntax reset"
-end
-vim.o.background = "dark"
-vim.o.termguicolors = true
-vim.g.colors_name = "dark"
-
-local util = require "dark.util"
-Config = require "dark.config"
-C = require "dark.palette"
-local highlights = require "dark.highlights"
-local Treesitter = require "dark.Treesitter"
-local markdown = require "dark.markdown"
-local Whichkey = require "dark.Whichkey"
-local Git = require "dark.Git"
-local LSP = require "dark.LSP"
-
-local skeletons = {
- highlights,
- Treesitter,
- markdown,
- Whichkey,
- Git,
- LSP,
-}
-
-for _, skeleton in ipairs(skeletons) do
- util.initialise(skeleton)
-end
diff --git a/.config/nvim/lua/dark/markdown.lua b/.config/nvim/lua/dark/markdown.lua
deleted file mode 100644
index 2b83e05..0000000
--- a/.config/nvim/lua/dark/markdown.lua
+++ /dev/null
@@ -1,27 +0,0 @@
-local markdown = {
- markdownBlockquote = { fg = C.accent },
- markdownBold = { fg = C.yellow, style = "bold" },
- markdownCode = { fg = C.green },
- markdownCodeBlock = { fg = C.green },
- markdownCodeDelimiter = { fg = C.green },
- markdownH1 = { fg = C.blue },
- markdownH2 = { fg = C.blue },
- markdownH3 = { fg = C.blue },
- markdownH4 = { fg = C.blue },
- markdownH5 = { fg = C.blue },
- markdownH6 = { fg = C.blue },
- markdownHeadingDelimiter = { fg = C.red },
- markdownHeadingRule = { fg = C.accent },
- markdownId = { fg = C.purple },
- markdownIdDeclaration = { fg = C.blue },
- markdownIdDelimiter = { fg = C.light_gray },
- markdownLinkDelimiter = { fg = C.light_gray },
- markdownItalic = { style = "italic" },
- markdownLinkText = { fg = C.blue },
- markdownListMarker = { fg = C.red },
- markdownOrderedListMarker = { fg = C.red },
- markdownRule = { fg = C.accent },
- markdownUrl = { fg = C.cyan, style = "underline" },
-}
-
-return markdown
diff --git a/.config/nvim/lua/dark/palette.lua b/.config/nvim/lua/dark/palette.lua
deleted file mode 100644
index 92ff012..0000000
--- a/.config/nvim/lua/dark/palette.lua
+++ /dev/null
@@ -1,33 +0,0 @@
-local colors = {
- fg = "#F2F6F3",
- bg = "#151515",
- alt_bg = "#171717",
- accent = "#202020",
- white = "#F2F6F3",
- gray = "#606060",
- light_gray = "#D0D0D0",
- blue = "#A5D6FF",
- gray_blue = "#5F819D",
- cyan = "#75B5AA",
- red = "#CC6666",
- green = "#90A959",
- light_green = "#90A959",
- yellow = "#F4BF75",
- orange = "#FFA557",
- purple = "#AA749F",
- pale_purple = "#A5D6FF",
- magenta = "#AA759F",
- cursor_fg = "#D0D0D0",
- cursor_bg = "#151515",
- sign_add = "#A1B56C",
- sign_change = "#A5D6FF",
- sign_delete = "#AA4142",
- error_red = "#AC4142",
- warning_orange = "#F4BF75",
- info_yellow = "#F4BF75",
- hint_blue = "#A5D6FF",
- purple_test = "#ff00ff",
- cyan_test = "#00ffff",
-}
-
-return colors
diff --git a/.config/nvim/lua/dark/util.lua b/.config/nvim/lua/dark/util.lua
deleted file mode 100644
index dbac18a..0000000
--- a/.config/nvim/lua/dark/util.lua
+++ /dev/null
@@ -1,25 +0,0 @@
-local M = {}
-
-local function highlight(group, properties)
- local bg = properties.bg == nil and "" or "guibg=" .. properties.bg
- local fg = properties.fg == nil and "" or "guifg=" .. properties.fg
- local style = properties.style == nil and "" or "gui=" .. properties.style
-
- local cmd = table.concat({
- "highlight",
- group,
- bg,
- fg,
- style,
- }, " ")
-
- vim.api.nvim_command(cmd)
-end
-
-function M.initialise(skeleton)
- for group, properties in pairs(skeleton) do
- highlight(group, properties)
- end
-end
-
-return M
diff --git a/.config/nvim/lua/extra/colorizer.lua b/.config/nvim/lua/extra/colorizer.lua
deleted file mode 100644
index 04b7367..0000000
--- a/.config/nvim/lua/extra/colorizer.lua
+++ /dev/null
@@ -1,22 +0,0 @@
-local M = {}
-local Log = require "core.log"
-
-M.config = function()
- local status_ok, colorizer = pcall(require, "colorizer")
- if not status_ok then
- Log:get_default().error "Failed to load colorizer"
- return
- end
-
- colorizer.setup({ "*" }, {
- RGB = true, -- #RGB hex codes
- RRGGBB = true, -- #RRGGBB hex codes
- RRGGBBAA = true, -- #RRGGBBAA hex codes
- rgb_fn = true, -- CSS rgb() and rgba() functions
- hsl_fn = true, -- CSS hsl() and hsla() functions
- css = true, -- Enable all CSS features: rgb_fn, hsl_fn, names, RGB, RRGGBB
- css_fn = true, -- Enable all CSS *functions*: rgb_fn, hsl_fn
- })
-end
-
-return M
diff --git a/.config/nvim/lua/extra/hop.lua b/.config/nvim/lua/extra/hop.lua
deleted file mode 100644
index 834f97a..0000000
--- a/.config/nvim/lua/extra/hop.lua
+++ /dev/null
@@ -1,15 +0,0 @@
-local M = {}
-local Log = require "core.log"
-
-M.config = function()
- local status_ok, hop = pcall(require, "hop")
- if not status_ok then
- Log:get_default().error "Failed to load hop"
- return
- end
- hop.setup()
- vim.api.nvim_set_keymap("n", "s", ":HopChar2<cr>", { silent = true })
- vim.api.nvim_set_keymap("n", "S", ":HopWord<cr>", { silent = true })
-end
-
-return M
diff --git a/.config/nvim/lua/extra/lir.lua b/.config/nvim/lua/extra/lir.lua
deleted file mode 100644
index 271afb1..0000000
--- a/.config/nvim/lua/extra/lir.lua
+++ /dev/null
@@ -1,96 +0,0 @@
-local status_ok, lir = pcall(require, "lir")
-if not status_ok then
- return
-end
-local actions = require "lir.actions"
-local mark_actions = require "lir.mark.actions"
-local clipboard_actions = require "lir.clipboard.actions"
-
-lir.setup {
- show_hidden_files = false,
- devicons_enable = true,
- mappings = {
- ["l"] = actions.edit,
- ["<cr>"] = actions.edit,
- ["<C-s>"] = actions.split,
- ["v"] = actions.vsplit,
- ["<C-t>"] = actions.tabedit,
-
- ["h"] = actions.up,
- ["q"] = actions.quit,
-
- ["A"] = actions.mkdir,
- ["a"] = actions.newfile,
- ["r"] = actions.rename,
- ["@"] = actions.cd,
- ["Y"] = actions.yank_path,
- ["."] = actions.toggle_show_hidden,
- ["D"] = actions.delete,
-
- ["J"] = function()
- mark_actions.toggle_mark()
- vim.cmd "normal! j"
- end,
- ["C"] = clipboard_actions.copy,
- ["X"] = clipboard_actions.cut,
- ["P"] = clipboard_actions.paste,
- },
- float = {
- winblend = 0,
-
- -- -- You can define a function that returns a table to be passed as the third
- -- -- argument of nvim_open_win().
- win_opts = function()
- -- local width = math.floor(vim.o.columns * 0.8)
- -- local height = math.floor(vim.o.lines * 0.8)
- return {
- border = "single",
- -- border = require("lir.float.helper").make_border_opts({
- -- "+",
- -- "─",
- -- "+",
- -- "│",
- -- "+",
- -- "─",
- -- "+",
- -- "│",
- -- }, "Normal"),
- -- width = width,
- -- height = height,
- -- row = 1,
- -- col = math.floor((vim.o.columns - width) / 2),
- }
- end,
- },
- hide_cursor = false,
-}
-
--- custom folder icon
-require("nvim-web-devicons").setup {
- override = {
- lir_folder_icon = {
- icon = "",
- color = "#569CD6",
- name = "LirFolderNode",
- },
- },
-}
-
--- use visual mode
-function _G.LirSettings()
- vim.api.nvim_buf_set_keymap(
- 0,
- "x",
- "J",
- ':<C-u>lua require"lir.mark.actions".toggle_mark("v")<CR>',
- { noremap = true, silent = true }
- )
-
- -- echo cwd
- vim.api.nvim_echo({ { vim.fn.expand "%:p", "Normal" } }, false, {})
-end
-
-vim.cmd [[augroup lir-settings]]
-vim.cmd [[ autocmd!]]
-vim.cmd [[ autocmd Filetype lir :lua LirSettings()]]
-vim.cmd [[augroup END]]
diff --git a/.config/nvim/lua/extra/lsp_signature.lua b/.config/nvim/lua/extra/lsp_signature.lua
deleted file mode 100644
index 7e67a4d..0000000
--- a/.config/nvim/lua/extra/lsp_signature.lua
+++ /dev/null
@@ -1,14 +0,0 @@
-local M = {}
-local Log = require "core.log"
-
-M.config = function()
- local status_ok, lsp_signature = pcall(require, "lsp_signature")
- if not status_ok then
- Log:get_default().error "Failed to load lsp_signature"
- return
- end
-
- lsp_signature.on_attach()
-end
-
-return M
diff --git a/.config/nvim/lua/extra/neoscroll.lua b/.config/nvim/lua/extra/neoscroll.lua
deleted file mode 100644
index 65f486b..0000000
--- a/.config/nvim/lua/extra/neoscroll.lua
+++ /dev/null
@@ -1,25 +0,0 @@
-local M = {}
-local Log = require "core.log"
-
-M.config = function()
- local status_ok, neoscroll = pcall(require, "neoscroll")
- if not status_ok then
- Log:get_default().error "Failed to load hop"
- return
- end
-
- neoscroll.setup {
- -- All these keys will be mapped to their corresponding default scrolling animation
- mappings = { "<C-u>", "<C-d>", "<C-b>", "<C-f>", "<C-y>", "<C-e>", "zt", "zz", "zb" },
- hide_cursor = true, -- Hide cursor while scrolling
- stop_eof = true, -- Stop at <EOF> when scrolling downwards
- use_local_scrolloff = false, -- Use the local scope of scrolloff instead of the global scope
- respect_scrolloff = false, -- Stop scrolling when the cursor reaches the scrolloff margin of the file
- cursor_scrolls_alone = true, -- The cursor will keep on scrolling even if the window cannot scroll further
- easing_function = nil, -- Default easing function
- pre_hook = nil, -- Function to run before the scrolling animation starts
- post_hook = nil, -- Function to run after the scrolling animation ends
- }
-end
-
-return M
diff --git a/.config/nvim/lua/extra/numb.lua b/.config/nvim/lua/extra/numb.lua
deleted file mode 100644
index 17d9f6b..0000000
--- a/.config/nvim/lua/extra/numb.lua
+++ /dev/null
@@ -1,17 +0,0 @@
-local M = {}
-local Log = require "core.log"
-
-M.config = function()
- local status_ok, numb = pcall(require, "numb")
- if not status_ok then
- Log:get_default().error "Failed to load numb"
- return
- end
-
- numb.setup {
- show_numbers = true, -- Enable 'number' for the window while peeking
- show_cursorline = true, -- Enable 'cursorline' for the window while peeking
- }
-end
-
-return M
diff --git a/.config/nvim/lua/extra/octo.lua b/.config/nvim/lua/extra/octo.lua
deleted file mode 100644
index f4d177c..0000000
--- a/.config/nvim/lua/extra/octo.lua
+++ /dev/null
@@ -1,139 +0,0 @@
-local M = {}
-
-local Log = require "core.log"
-
-M.config = function()
- local status_ok, octo = pcall(require, "octo")
- if not status_ok then
- Log:get_default().error "Failed to load octo"
- return
- end
-
- octo.setup {
- default_remote = { "upstream", "origin" }, -- order to try remotes
- reaction_viewer_hint_icon = "", -- marker for user reactions
- user_icon = " ", -- user icon
- timeline_marker = "", -- timeline marker
- timeline_indent = "2", -- timeline indentation
- right_bubble_delimiter = "", -- Bubble delimiter
- left_bubble_delimiter = "", -- Bubble delimiter
- github_hostname = "", -- GitHub Enterprise host
- snippet_context_lines = 4, -- number or lines around commented lines
- file_panel = {
- size = 10, -- changed files panel rows
- use_icons = true, -- use web-devicons in file panel
- },
- mappings = {
- issue = {
- close_issue = "<space>ic", -- close issue
- reopen_issue = "<space>io", -- reopen issue
- list_issues = "<space>il", -- list open issues on same repo
- reload = "<C-r>", -- reload issue
- open_in_browser = "<C-b>", -- open issue in browser
- copy_url = "<C-y>", -- copy url to system clipboard
- add_assignee = "<space>aa", -- add assignee
- remove_assignee = "<space>ad", -- remove assignee
- create_label = "<space>lc", -- create label
- add_label = "<space>la", -- add label
- remove_label = "<space>ld", -- remove label
- goto_issue = "<space>gi", -- navigate to a local repo issue
- add_comment = "<space>ca", -- add comment
- delete_comment = "<space>cd", -- delete comment
- next_comment = "]c", -- go to next comment
- prev_comment = "[c", -- go to previous comment
- react_hooray = "<space>rp", -- add/remove 🎉 reaction
- react_heart = "<space>rh", -- add/remove ❤️ reaction
- react_eyes = "<space>re", -- add/remove 👀 reaction
- react_thumbs_up = "<space>r+", -- add/remove 👍 reaction
- react_thumbs_down = "<space>r-", -- add/remove 👎 reaction
- react_rocket = "<space>rr", -- add/remove 🚀 reaction
- react_laugh = "<space>rl", -- add/remove 😄 reaction
- react_confused = "<space>rc", -- add/remove 😕 reaction
- },
- pull_request = {
- checkout_pr = "<space>po", -- checkout PR
- merge_pr = "<space>pm", -- merge PR
- list_commits = "<space>pc", -- list PR commits
- list_changed_files = "<space>pf", -- list PR changed files
- show_pr_diff = "<space>pd", -- show PR diff
- add_reviewer = "<space>va", -- add reviewer
- remove_reviewer = "<space>vd", -- remove reviewer request
- close_issue = "<space>ic", -- close PR
- reopen_issue = "<space>io", -- reopen PR
- list_issues = "<space>il", -- list open issues on same repo
- reload = "<C-r>", -- reload PR
- open_in_browser = "<C-b>", -- open PR in browser
- copy_url = "<C-y>", -- copy url to system clipboard
- add_assignee = "<space>aa", -- add assignee
- remove_assignee = "<space>ad", -- remove assignee
- create_label = "<space>lc", -- create label
- add_label = "<space>la", -- add label
- remove_label = "<space>ld", -- remove label
- goto_issue = "<space>gi", -- navigate to a local repo issue
- add_comment = "<space>ca", -- add comment
- delete_comment = "<space>cd", -- delete comment
- next_comment = "]c", -- go to next comment
- prev_comment = "[c", -- go to previous comment
- react_hooray = "<space>rp", -- add/remove 🎉 reaction
- react_heart = "<space>rh", -- add/remove ❤️ reaction
- react_eyes = "<space>re", -- add/remove 👀 reaction
- react_thumbs_up = "<space>r+", -- add/remove 👍 reaction
- react_thumbs_down = "<space>r-", -- add/remove 👎 reaction
- react_rocket = "<space>rr", -- add/remove 🚀 reaction
- react_laugh = "<space>rl", -- add/remove 😄 reaction
- react_confused = "<space>rc", -- add/remove 😕 reaction
- },
- review_thread = {
- goto_issue = "<space>gi", -- navigate to a local repo issue
- add_comment = "<space>ca", -- add comment
- add_suggestion = "<space>sa", -- add suggestion
- delete_comment = "<space>cd", -- delete comment
- next_comment = "]c", -- go to next comment
- prev_comment = "[c", -- go to previous comment
- select_next_entry = "]q", -- move to previous changed file
- select_prev_entry = "[q", -- move to next changed file
- close_review_tab = "<C-c>", -- close review tab
- react_hooray = "<space>rp", -- add/remove 🎉 reaction
- react_heart = "<space>rh", -- add/remove ❤️ reaction
- react_eyes = "<space>re", -- add/remove 👀 reaction
- react_thumbs_up = "<space>r+", -- add/remove 👍 reaction
- react_thumbs_down = "<space>r-", -- add/remove 👎 reaction
- react_rocket = "<space>rr", -- add/remove 🚀 reaction
- react_laugh = "<space>rl", -- add/remove 😄 reaction
- react_confused = "<space>rc", -- add/remove 😕 reaction
- },
- submit_win = {
- approve_review = "<C-a>", -- approve review
- comment_review = "<C-m>", -- comment review
- request_changes = "<C-r>", -- request changes review
- close_review_tab = "<C-c>", -- close review tab
- },
- review_diff = {
- add_review_comment = "<space>ca", -- add a new review comment
- add_review_suggestion = "<space>sa", -- add a new review suggestion
- focus_files = "<leader>e", -- move focus to changed file panel
- toggle_files = "<leader>b", -- hide/show changed files panel
- next_thread = "]t", -- move to next thread
- prev_thread = "[t", -- move to previous thread
- select_next_entry = "]q", -- move to previous changed file
- select_prev_entry = "[q", -- move to next changed file
- close_review_tab = "<C-c>", -- close review tab
- toggle_viewed = "<leader><space>", -- toggle viewer viewed state
- },
- file_panel = {
- next_entry = "j", -- move to next changed file
- prev_entry = "k", -- move to previous changed file
- select_entry = "<cr>", -- show selected changed file diffs
- refresh_files = "R", -- refresh changed files panel
- focus_files = "<leader>e", -- move focus to changed file panel
- toggle_files = "<leader>b", -- hide/show changed files panel
- select_next_entry = "]q", -- move to previous changed file
- select_prev_entry = "[q", -- move to next changed file
- close_review_tab = "<C-c>", -- close review tab
- toggle_viewed = "<leader><space>", -- toggle viewer viewed state
- },
- },
- }
-end
-
-return M
diff --git a/.config/nvim/lua/extra/quickscope.lua b/.config/nvim/lua/extra/quickscope.lua
deleted file mode 100644
index 99b4196..0000000
--- a/.config/nvim/lua/extra/quickscope.lua
+++ /dev/null
@@ -1,3 +0,0 @@
-vim.cmd [[
- let g:qs_highlight_on_keys = ['f', 'F', 't', 'T']
- ]]
diff --git a/.config/nvim/lua/extra/spectre.lua b/.config/nvim/lua/extra/spectre.lua
deleted file mode 100644
index 12133d8..0000000
--- a/.config/nvim/lua/extra/spectre.lua
+++ /dev/null
@@ -1,144 +0,0 @@
-local M = {}
-local Log = require "core.log"
-
-M.config = function()
- local status_ok, spectre = pcall(require, "spectre")
- if not status_ok then
- Log:get_default().error "Failed to load hop"
- return
- end
-
- spectre.setup {
-
- color_devicons = true,
- highlight = {
- ui = "String",
- search = "DiffChange",
- replace = "DiffDelete",
- },
- mapping = {
- ["toggle_line"] = {
- map = "t",
- cmd = "<cmd>lua require('spectre').toggle_line()<CR>",
- desc = "toggle current item",
- },
- ["enter_file"] = {
- map = "<cr>",
- cmd = "<cmd>lua require('spectre.actions').select_entry()<CR>",
- desc = "goto current file",
- },
- ["send_to_qf"] = {
- map = "Q",
- cmd = "<cmd>lua require('spectre.actions').send_to_qf()<CR>",
- desc = "send all item to quickfix",
- },
- ["replace_cmd"] = {
- map = "c",
- cmd = "<cmd>lua require('spectre.actions').replace_cmd()<CR>",
- desc = "input replace vim command",
- },
- ["show_option_menu"] = {
- map = "o",
- cmd = "<cmd>lua require('spectre').show_options()<CR>",
- desc = "show option",
- },
- ["run_replace"] = {
- map = "R",
- cmd = "<cmd>lua require('spectre.actions').run_replace()<CR>",
- desc = "replace all",
- },
- ["change_view_mode"] = {
- map = "m",
- cmd = "<cmd>lua require('spectre').change_view()<CR>",
- desc = "change result view mode",
- },
- ["toggle_ignore_case"] = {
- map = "I",
- cmd = "<cmd>lua require('spectre').change_options('ignore-case')<CR>",
- desc = "toggle ignore case",
- },
- ["toggle_ignore_hidden"] = {
- map = "H",
- cmd = "<cmd>lua require('spectre').change_options('hidden')<CR>",
- desc = "toggle search hidden",
- },
- -- you can put your mapping here it only use normal mode
- },
- find_engine = {
- -- rg is map with finder_cmd
- ["rg"] = {
- cmd = "rg",
- -- default args
- args = {
- "--color=never",
- "--no-heading",
- "--with-filename",
- "--line-number",
- "--column",
- },
- options = {
- ["ignore-case"] = {
- value = "--ignore-case",
- icon = "[I]",
- desc = "ignore case",
- },
- ["hidden"] = {
- value = "--hidden",
- desc = "hidden file",
- icon = "[H]",
- },
- -- you can put any option you want here it can toggle with
- -- show_option function
- },
- },
- ["ag"] = {
- cmd = "ag",
- args = {
- "--vimgrep",
- "-s",
- },
- options = {
- ["ignore-case"] = {
- value = "-i",
- icon = "[I]",
- desc = "ignore case",
- },
- ["hidden"] = {
- value = "--hidden",
- desc = "hidden file",
- icon = "[H]",
- },
- },
- },
- },
- replace_engine = {
- ["sed"] = {
- cmd = "sed",
- args = nil,
- },
- options = {
- ["ignore-case"] = {
- value = "--ignore-case",
- icon = "[I]",
- desc = "ignore case",
- },
- },
- },
- default = {
- find = {
- --pick one of item in find_engine
- cmd = "rg",
- options = { "ignore-case" },
- },
- replace = {
- --pick one of item in replace_engine
- cmd = "sed",
- },
- },
- replace_vim_cmd = "cdo",
- is_open_target_win = true, --open file on opener window
- is_insert_mode = false, -- start open panel on is_insert_mode
- }
-end
-
-return M
diff --git a/.config/nvim/lua/extra/zen.lua b/.config/nvim/lua/extra/zen.lua
deleted file mode 100644
index 9bfaf1a..0000000
--- a/.config/nvim/lua/extra/zen.lua
+++ /dev/null
@@ -1,48 +0,0 @@
-local M = {}
-local Log = require "core.log"
-
-M.config = function()
- local status_ok, zen_mode = pcall(require, "zen-mode")
- if not status_ok then
- Log:get_default().error "Failed to load zen-mode"
- return
- end
-
- zen_mode.setup {
- window = {
- backdrop = 1,
- height = 0.9, -- height of the Zen window
- width = 0.65,
- options = {
- signcolumn = "no", -- disable signcolumn
- number = false, -- disable number column
- relativenumber = false, -- disable relative numbers
- -- cursorline = false, -- disable cursorline
- -- cursorcolumn = false, -- disable cursor column
- -- foldcolumn = "0", -- disable fold column
- -- list = false, -- disable whitespace characters
- },
- },
- plugins = {
- gitsigns = { enabled = false }, -- disables git signs
- tmux = { enabled = true },
- twilight = { enabled = true },
- },
- -- on_open = function()
- -- vim.lsp.diagnostic.disable()
- -- vim.cmd [[
- -- set foldlevel=10
- -- IndentBlanklineDisable
- -- ]]
- -- end,
- -- on_close = function()
- -- vim.lsp.diagnostic.enable()
- -- vim.cmd [[
- -- set foldlevel=5
- -- IndentBlanklineEnable
- -- ]]
- -- end,
- }
-end
-
-return M
diff --git a/.config/nvim/lua/impatient.lua b/.config/nvim/lua/impatient.lua
deleted file mode 100644
index e428c7e..0000000
--- a/.config/nvim/lua/impatient.lua
+++ /dev/null
@@ -1,359 +0,0 @@
--- modified version from https://github.com/lewis6991/impatient.nvim
-
-local vim = vim
-local uv = vim.loop
-local impatient_load_start = uv.hrtime()
-local api = vim.api
-local ffi = require "ffi"
-
-local get_option, set_option = api.nvim_get_option, api.nvim_set_option
-local get_runtime_file = api.nvim_get_runtime_file
-
-local impatient_dur
-
-local M = {
- cache = {},
- profile = nil,
- dirty = false,
- path = nil,
- log = {},
-}
-
-_G.__luacache = M
-
---{{{
-local cachepack = {}
-
--- using double for packing/unpacking numbers has no conversion overhead
--- 32-bit ARM causes a bus error when casting to double, so use int there
-local number_t = jit.arch ~= "arm" and "double" or "int"
-ffi.cdef("typedef " .. number_t .. " number_t;")
-
-local c_number_t = ffi.typeof "number_t[1]"
-local c_sizeof_number_t = ffi.sizeof "number_t"
-
-local out_buf = {}
-
-function out_buf.write_number(buf, num)
- buf[#buf + 1] = ffi.string(c_number_t(num), c_sizeof_number_t)
-end
-
-function out_buf.write_string(buf, str)
- out_buf.write_number(buf, #str)
- buf[#buf + 1] = str
-end
-
-function out_buf.to_string(buf)
- return table.concat(buf)
-end
-
-local in_buf = {}
-
-function in_buf.read_number(buf)
- if buf.size < buf.pos then
- error "buffer access violation"
- end
- local res = ffi.cast("number_t*", buf.ptr + buf.pos)[0]
- buf.pos = buf.pos + c_sizeof_number_t
- return res
-end
-
-function in_buf.read_string(buf)
- local len = in_buf.read_number(buf)
- local res = ffi.string(buf.ptr + buf.pos, len)
- buf.pos = buf.pos + len
-
- return res
-end
-
-function cachepack.pack(cache)
- local total_keys = vim.tbl_count(cache)
- local buf = {}
-
- out_buf.write_number(buf, total_keys)
- for k, v in pairs(cache) do
- out_buf.write_string(buf, k)
- out_buf.write_string(buf, v[1] or "")
- out_buf.write_number(buf, v[2] or 0)
- out_buf.write_string(buf, v[3] or "")
- end
-
- return out_buf.to_string(buf)
-end
-
-function cachepack.unpack(str, raw_buf_size)
- if raw_buf_size == 0 or str == nil or (raw_buf_size == nil and #str == 0) then
- return {}
- end
-
- local buf = {
- ptr = raw_buf_size and str or ffi.new("const char[?]", #str, str),
- pos = 0,
- size = raw_buf_size or #str,
- }
- local cache = {}
-
- local total_keys = in_buf.read_number(buf)
- for _ = 1, total_keys do
- local k = in_buf.read_string(buf)
- local v = {
- in_buf.read_string(buf),
- in_buf.read_number(buf),
- in_buf.read_string(buf),
- }
- cache[k] = v
- end
-
- return cache
-end
---}}}
-
-local function log(...)
- M.log[#M.log + 1] = table.concat({ string.format(...) }, " ")
-end
-
-function M.print_log()
- for _, l in ipairs(M.log) do
- print(l)
- end
-end
-
-function M.enable_profile()
- M.profile = {}
- M.print_profile = function()
- M.profile["impatient"] = {
- resolve = 0,
- load = impatient_dur,
- loader = "standard",
- }
- require("impatient.profile").print_profile(M.profile)
- end
- vim.cmd [[command! LuaCacheProfile lua _G.__luacache.print_profile()]]
-end
-
-local function is_cacheable(path)
- -- Don't cache files in /tmp since they are not likely to persist.
- -- Note: Appimage versions of Neovim mount $VIMRUNTIME in /tmp in a unique
- -- directory on each launch.
- return not vim.startswith(path, "/tmp/")
-end
-
-local function hash(modpath)
- local stat = uv.fs_stat(modpath)
- if stat then
- return stat.mtime.sec
- end
-end
-
-local function hrtime()
- if M.profile then
- return uv.hrtime()
- end
-end
-
-local function load_package_with_cache(name, loader)
- local resolve_start = hrtime()
-
- local basename = name:gsub("%.", "/")
- local paths = { "lua/" .. basename .. ".lua", "lua/" .. basename .. "/init.lua" }
-
- for _, path in ipairs(paths) do
- local modpath = get_runtime_file(path, false)[1]
- if modpath then
- local load_start = hrtime()
- local chunk, err = loadfile(modpath)
-
- if M.profile then
- M.profile[name] = {
- resolve = load_start - resolve_start,
- load = hrtime() - load_start,
- loader = loader or "standard",
- }
- end
-
- if chunk == nil then
- return err
- end
-
- if is_cacheable(modpath) then
- log("Creating cache for module %s", name)
- M.cache[name] = { modpath, hash(modpath), string.dump(chunk) }
- M.dirty = true
- else
- log("Unable to cache module %s", name)
- end
-
- return chunk
- end
- end
- return nil
-end
-
-local reduced_rtp
-
--- Speed up non-cached loads by reducing the rtp path during requires
-function M.update_reduced_rtp()
- local luadirs = get_runtime_file("lua/", true)
-
- for i = 1, #luadirs do
- luadirs[i] = luadirs[i]:sub(1, -6)
- end
-
- reduced_rtp = table.concat(luadirs, ",")
-end
-
-local function load_package_with_cache_reduced_rtp(name)
- local orig_rtp = get_option "runtimepath"
- local orig_ei = get_option "eventignore"
-
- if not reduced_rtp then
- M.update_reduced_rtp()
- end
-
- set_option("eventignore", "all")
- set_option("rtp", reduced_rtp)
-
- local found = load_package_with_cache(name, "reduced")
-
- set_option("rtp", orig_rtp)
- set_option("eventignore", orig_ei)
-
- return found
-end
-
-local function load_from_cache(name)
- local resolve_start = hrtime()
- if M.cache[name] == nil then
- log("No cache for module %s", name)
- return "No cache entry"
- end
-
- local modpath, mhash, codes = unpack(M.cache[name])
-
- if mhash ~= hash(modpath) then
- log("Stale cache for module %s", name)
- M.cache[name] = nil
- M.dirty = true
- return "Stale cache"
- end
-
- local load_start = hrtime()
- local chunk = loadstring(codes)
-
- if M.profile then
- M.profile[name] = {
- resolve = load_start - resolve_start,
- load = hrtime() - load_start,
- loader = "cache",
- }
- end
-
- if not chunk then
- M.cache[name] = nil
- M.dirty = true
- log("Error loading cache for module. Invalidating", name)
- return "Cache error"
- end
-
- return chunk
-end
-
-function M.save_cache()
- if M.dirty then
- log("Updating cache file: %s", M.path)
- local f = io.open(M.path, "w+b")
- f:write(cachepack.pack(M.cache))
- f:flush()
- M.dirty = false
- end
-end
-
-function M.clear_cache()
- M.cache = {}
- os.remove(M.path)
-end
-
-impatient_dur = uv.hrtime() - impatient_load_start
-
-function M.setup(opts)
- opts = opts or {}
- M.path = opts.path or vim.fn.stdpath "cache" .. "/nvim_cache"
-
- if opts.enable_profiling then
- M.enable_profile()
- end
-
- local impatient_setup_start = uv.hrtime()
- local stat = uv.fs_stat(M.path)
- if stat then
- log("Loading cache file %s", M.path)
- local ok
- -- Linux/macOS lets us easily mmap the cache file for faster reads without passing to Lua
- if jit.os == "Linux" or jit.os == "OSX" then
- local size = stat.size
-
- local C = ffi.C
- local O_RDONLY = 0x00
- local PROT_READ = 0x01
- local MAP_PRIVATE = 0x02
-
- ffi.cdef [[
- int open(const char *pathname, int flags);
- int close(int fd);
- void *mmap(void *addr, size_t length, int prot, int flags, int fd, long int offset);
- int munmap(void *addr, size_t length);
- ]]
- local f = C.open(M.path, O_RDONLY)
-
- local addr = C.mmap(nil, size, PROT_READ, MAP_PRIVATE, f, 0)
- ok = ffi.cast("intptr_t", addr) ~= -1
-
- if ok then
- M.cache = cachepack.unpack(ffi.cast("char *", addr), size)
- C.munmap(addr, size)
- end
-
- C.close(f)
- else
- local f = io.open(M.path, "rb")
- ok, M.cache = pcall(function()
- return cachepack.unpack(f:read "*a")
- end)
- end
-
- if not ok then
- log("Corrupted cache file, %s. Invalidating...", M.path)
- os.remove(M.path)
- M.cache = {}
- end
- M.dirty = not ok
- end
-
- local insert = table.insert
- local package = package
-
- -- Fix the position of the preloader. This also makes loading modules like 'ffi'
- -- and 'bit' quicker
- if package.loaders[1] == vim._load_package then
- -- Move vim._load_package to the second position
- local vim_load = table.remove(package.loaders, 1)
- insert(package.loaders, 2, vim_load)
- end
-
- insert(package.loaders, 2, load_from_cache)
- insert(package.loaders, 3, load_package_with_cache_reduced_rtp)
- insert(package.loaders, 4, load_package_with_cache)
-
- vim.cmd [[
- augroup impatient
- autocmd VimEnter,VimLeave * lua _G.__luacache.save_cache()
- autocmd OptionSet runtimepath lua _G.__luacache.update_reduced_rtp(true)
- augroup END
- command! LuaCacheClear lua _G.__luacache.clear_cache()
- command! LuaCacheLog lua _G.__luacache.print_log()
- ]]
-
- impatient_dur = impatient_dur + (uv.hrtime() - impatient_setup_start)
-end
-
-return M
diff --git a/.config/nvim/lua/impatient/profile.lua b/.config/nvim/lua/impatient/profile.lua
deleted file mode 100644
index d057386..0000000
--- a/.config/nvim/lua/impatient/profile.lua
+++ /dev/null
@@ -1,156 +0,0 @@
-local M = {}
-
-local api = vim.api
-
-function M.print_profile(profile)
- if not profile then
- print "Error: profiling was not enabled"
- return
- end
-
- local total_resolve = 0
- local total_load = 0
- local name_pad = 0
- local modules = {}
- local plugins = {}
-
- for module, p in pairs(profile) do
- p.resolve = p.resolve / 1000000
- p.load = p.load / 1000000
- p.total = p.resolve + p.load
- p.module = module:gsub("/", ".")
-
- local plugin = p.module:match "([^.]+)"
- if plugin then
- if not plugins[plugin] then
- plugins[plugin] = {
- module = plugin,
- resolve = 0,
- load = 0,
- total = 0,
- }
- end
- local r = plugins[plugin]
-
- r.resolve = r.resolve + p.resolve
- r.load = r.load + p.load
- r.total = r.total + p.total
-
- if not r.loader then
- r.loader = p.loader
- elseif r.loader ~= p.loader then
- r.loader = "mixed"
- end
- end
-
- total_resolve = total_resolve + p.resolve
- total_load = total_load + p.load
-
- if #module > name_pad then
- name_pad = #module
- end
-
- modules[#modules + 1] = p
- end
-
- table.sort(modules, function(a, b)
- return a.module > b.module
- end)
-
- do
- local plugins_a = {}
- for _, v in pairs(plugins) do
- plugins_a[#plugins_a + 1] = v
- end
- plugins = plugins_a
- end
-
- table.sort(plugins, function(a, b)
- return a.total > b.total
- end)
-
- local lines = {}
- local function add(...)
- lines[#lines + 1] = string.format(...)
- end
-
- local l = string.rep("─", name_pad + 1)
-
- add(
- "%s┬───────────┬────────────┬────────────┬────────────┐",
- l
- )
- add(
- "%-"
- .. name_pad
- .. "s │ Loader │ Resolve │ Load │ Total │",
- ""
- )
- add(
- "%s┼───────────┼────────────┼────────────┼────────────┤",
- l
- )
- add(
- "%-" .. name_pad .. "s │ │ %8.4fms │ %8.4fms │ %8.4fms │",
- "Total",
- total_resolve,
- total_load,
- total_resolve + total_load
- )
- add(
- "%s┴───────────┴────────────┴────────────┴────────────┤",
- l
- )
- add(
- "%-" .. name_pad .. "s │",
- "By Plugin"
- )
- add(
- "%s┬───────────┬────────────┬────────────┬────────────┤",
- l
- )
- for _, p in ipairs(plugins) do
- add(
- "%-" .. name_pad .. "s │ %9s │ %8.4fms │ %8.4fms │ %8.4fms │",
- p.module,
- p.loader,
- p.resolve,
- p.load,
- p.total
- )
- end
- add(
- "%s┴───────────┴────────────┴────────────┴────────────┤",
- l
- )
- add(
- "%-" .. name_pad .. "s │",
- "By Module"
- )
- add(
- "%s┬───────────┬────────────┬────────────┬────────────┤",
- l
- )
- for _, p in pairs(modules) do
- add(
- "%-" .. name_pad .. "s │ %9s │ %8.4fms │ %8.4fms │ %8.4fms │",
- p.module,
- p.loader,
- p.resolve,
- p.load,
- p.total
- )
- end
- add(
- "%s┴───────────┴────────────┴────────────┴────────────┘",
- l
- )
-
- local bufnr = api.nvim_create_buf(false, false)
- api.nvim_buf_set_lines(bufnr, 0, 0, false, lines)
- api.nvim_buf_set_option(bufnr, "buftype", "nofile")
- api.nvim_buf_set_name(bufnr, "Impatient Profile Report")
- api.nvim_set_current_buf(bufnr)
-end
-
-return M
diff --git a/.config/nvim/lua/interface/popup.lua b/.config/nvim/lua/interface/popup.lua
deleted file mode 100644
index b628125..0000000
--- a/.config/nvim/lua/interface/popup.lua
+++ /dev/null
@@ -1,62 +0,0 @@
-local Popup = {}
-
---- Create a new floating window
--- @param config The configuration passed to vim.api.nvim_open_win
--- @param win_opts The options registered with vim.api.nvim_win_set_option
--- @param buf_opts The options registered with vim.api.nvim_buf_set_option
--- @return A new popup
-function Popup:new(opts)
- opts = opts or {}
- opts.layout = opts.layout or {}
- opts.win_opts = opts.win_opts or {}
- opts.buf_opts = opts.buf_opts or {}
-
- Popup.__index = Popup
-
- local editor_layout = {
- height = vim.o.lines - vim.o.cmdheight - 2, -- Add margin for status and buffer line
- width = vim.o.columns,
- }
- local popup_layout = {
- relative = "editor",
- height = math.floor(editor_layout.height * 0.9),
- width = math.floor(editor_layout.width * 0.8),
- style = "minimal",
- border = "rounded",
- }
- popup_layout.row = math.floor((editor_layout.height - popup_layout.height) / 2)
- popup_layout.col = math.floor((editor_layout.width - popup_layout.width) / 2)
-
- local obj = {
- buffer = vim.api.nvim_create_buf(false, true),
- layout = vim.tbl_deep_extend("force", popup_layout, opts.layout),
- win_opts = opts.win_opts,
- buf_opts = opts.buf_opts,
- }
-
- setmetatable(obj, Popup)
-
- return obj
-end
-
---- Display the popup with the provided content
--- @param content_provider A function accepting the popup's layout and returning the content to display
-function Popup:display(content_provider)
- self.win_id = vim.api.nvim_open_win(self.buffer, true, self.layout)
- vim.lsp.util.close_preview_autocmd({ "BufHidden", "BufLeave" }, self.win_id)
-
- local lines = content_provider(self.layout)
- vim.api.nvim_buf_set_lines(self.bufnr, 0, -1, false, lines)
-
- -- window options
- for key, value in pairs(self.win_opts) do
- vim.api.nvim_win_set_option(self.win_id, key, value)
- end
-
- -- buffer options
- for key, value in pairs(self.buf_opts) do
- vim.api.nvim_buf_set_option(self.buffer, key, value)
- end
-end
-
-return Popup
diff --git a/.config/nvim/lua/interface/text.lua b/.config/nvim/lua/interface/text.lua
deleted file mode 100644
index c17d403..0000000
--- a/.config/nvim/lua/interface/text.lua
+++ /dev/null
@@ -1,98 +0,0 @@
-local M = {}
-
-local function max_len_line(lines)
- local max_len = 0
-
- for _, line in ipairs(lines) do
- local line_len = line:len()
- if line_len > max_len then
- max_len = line_len
- end
- end
-
- return max_len
-end
-
---- Center align lines relatively to the parent container
--- @param container The container where lines will be displayed
--- @param lines The text to align
--- @param alignment The alignment value, range: [0-1]
-function M.align_left(container, lines, alignment)
- local max_len = max_len_line(lines)
- local indent_amount = math.ceil(math.max(container.width - max_len, 0) * alignment)
- return M.shift_right(lines, indent_amount)
-end
-
---- Center align lines relatively to the parent container
--- @param container The container where lines will be displayed
--- @param lines The text to align
--- @param alignment The alignment value, range: [0-1]
-function M.align_center(container, lines, alignment)
- local output = {}
- local max_len = max_len_line(lines)
-
- for _, line in ipairs(lines) do
- local padding = string.rep(
- " ",
- (math.max(container.width, max_len) - line:len()) * alignment
- )
- table.insert(output, padding .. line)
- end
-
- return output
-end
-
---- Shift lines by a given amount
--- @params lines The lines the shift
--- @param amount The amount of spaces to add
-function M.shift_right(lines, amount)
- local output = {}
- local padding = string.rep(" ", amount)
-
- for _, line in ipairs(lines) do
- table.insert(output, padding .. line)
- end
-
- return output
-end
-
---- Pretty format tables
--- @param entries The table to format
--- @param col_count The number of column to span the table on
--- @param col_sep The separator between each colummn, default: " "
-function M.format_table(entries, col_count, col_sep)
- col_sep = col_sep or " "
-
- local col_rows = math.ceil(vim.tbl_count(entries) / col_count)
- local cols = {}
- local count = 0
-
- for i, entry in ipairs(entries) do
- if ((i - 1) % col_rows) == 0 then
- table.insert(cols, {})
- count = count + 1
- end
- table.insert(cols[count], entry)
- end
-
- local col_max_len = {}
- for _, col in ipairs(cols) do
- table.insert(col_max_len, max_len_line(col))
- end
-
- local output = {}
- for i, col in ipairs(cols) do
- for j, entry in ipairs(col) do
- if not output[j] then
- output[j] = entry
- else
- local padding = string.rep(" ", col_max_len[i - 1] - cols[i - 1][j]:len())
- output[j] = output[j] .. padding .. col_sep .. entry
- end
- end
- end
-
- return output
-end
-
-return M
diff --git a/.config/nvim/lua/keymappings.lua b/.config/nvim/lua/keymappings.lua
deleted file mode 100644
index 8319ab3..0000000
--- a/.config/nvim/lua/keymappings.lua
+++ /dev/null
@@ -1,203 +0,0 @@
-local M = {}
-local Log = require "core.log"
-
-local generic_opts_any = { noremap = true, silent = true }
-
-local generic_opts = {
- insert_mode = generic_opts_any,
- normal_mode = generic_opts_any,
- visual_mode = generic_opts_any,
- visual_block_mode = generic_opts_any,
- command_mode = generic_opts_any,
- term_mode = { silent = true },
-}
-
-local mode_adapters = {
- insert_mode = "i",
- normal_mode = "n",
- term_mode = "t",
- visual_mode = "v",
- visual_block_mode = "x",
- command_mode = "c",
-}
-
-local defaults = {
- ---@usage change or add keymappings for insert mode
- insert_mode = {
- -- 'jk' for quitting insert mode
- ["jk"] = "<ESC>",
- -- 'kj' for quitting insert mode
- ["kj"] = "<ESC>",
- -- 'jj' for quitting insert mode
- ["jj"] = "<ESC>",
- -- Move current line / block with Alt-j/k ala vscode.
- ["<A-j>"] = "<Esc>:m .+1<CR>==gi",
- -- Move current line / block with Alt-j/k ala vscode.
- ["<A-k>"] = "<Esc>:m .-2<CR>==gi",
- -- navigation
- ["<A-Up>"] = "<C-\\><C-N><C-w>k",
- ["<A-Down>"] = "<C-\\><C-N><C-w>j",
- ["<A-Left>"] = "<C-\\><C-N><C-w>h",
- ["<A-Right>"] = "<C-\\><C-N><C-w>l",
- },
-
- ---@usage change or add keymappings for normal mode
- normal_mode = {
- -- Better window movement
- ["<C-h>"] = "<C-w>h",
- ["<C-j>"] = "<C-w>j",
- ["<C-k>"] = "<C-w>k",
- ["<C-l>"] = "<C-w>l",
-
- -- Resize with arrows
- ["<C-Up>"] = ":resize -2<CR>",
- ["<C-Down>"] = ":resize +2<CR>",
- ["<C-Left>"] = ":vertical resize -2<CR>",
- ["<C-Right>"] = ":vertical resize +2<CR>",
-
- -- Tab switch buffer
- ["<S-l>"] = ":BufferNext<CR>",
- ["<S-h>"] = ":BufferPrevious<CR>",
-
- -- Move current line / block with Alt-j/k a la vscode.
- ["<A-j>"] = ":m .+1<CR>==",
- ["<A-k>"] = ":m .-2<CR>==",
-
- -- QuickFix
- ["]q"] = ":cnext<CR>",
- ["[q"] = ":cprev<CR>",
- ["<C-q>"] = ":call QuickFixToggle()<CR>",
- },
-
- ---@usage change or add keymappings for terminal mode
- term_mode = {
- -- Terminal window navigation
- ["<C-h>"] = "<C-\\><C-N><C-w>h",
- ["<C-j>"] = "<C-\\><C-N><C-w>j",
- ["<C-k>"] = "<C-\\><C-N><C-w>k",
- ["<C-l>"] = "<C-\\><C-N><C-w>l",
- },
-
- ---@usage change or add keymappings for visual mode
- visual_mode = {
- -- Better indenting
- ["<"] = "<gv",
- [">"] = ">gv",
-
- -- ["p"] = '"0p',
- -- ["P"] = '"0P',
- },
-
- ---@usage change or add keymappings for visual block mode
- visual_block_mode = {
- -- Move selected line / block of text in visual mode
- ["K"] = ":move '<-2<CR>gv-gv",
- ["J"] = ":move '>+1<CR>gv-gv",
-
- -- Move current line / block with Alt-j/k ala vscode.
- ["<A-j>"] = ":m '>+1<CR>gv-gv",
- ["<A-k>"] = ":m '<-2<CR>gv-gv",
- },
-
- ---@usage change or add keymappings for command mode
- command_mode = {
- -- navigate tab completion with <c-j> and <c-k>
- -- runs conditionally
- ["<C-j>"] = {
- 'pumvisible() ? "\\<C-n>" : "\\<C-j>"',
- { expr = true, noremap = true },
- },
- ["<C-k>"] = {
- 'pumvisible() ? "\\<C-p>" : "\\<C-k>"',
- { expr = true, noremap = true },
- },
- },
-}
-
-if vim.fn.has "mac" == 1 then
- defaults.normal_mode["<A-Up>"] = defaults.normal_mode["<C-Up>"]
- defaults.normal_mode["<A-Down>"] = defaults.normal_mode["<C-Down>"]
- defaults.normal_mode["<A-Left>"] = defaults.normal_mode["<C-Left>"]
- defaults.normal_mode["<A-Right>"] = defaults.normal_mode["<C-Right>"]
- Log:debug "Activated mac keymappings"
-end
-
--- Append key mappings to lunarvim's defaults for a given mode
--- @param keymaps The table of key mappings containing a list per mode (normal_mode, insert_mode, ..)
-function M.append_to_defaults(keymaps)
- for mode, mappings in pairs(keymaps) do
- for k, v in pairs(mappings) do
- defaults[mode][k] = v
- end
- end
-end
-
--- Unsets all keybindings defined in keymaps
--- @param keymaps The table of key mappings containing a list per mode (normal_mode, insert_mode, ..)
-function M.clear(keymaps)
- local default = M.get_defaults()
- for mode, mappings in pairs(keymaps) do
- local translated_mode = mode_adapters[mode] or mode
- for key, _ in pairs(mappings) do
- -- some plugins may override default bindings that the user hasn't manually overriden
- if
- default[mode][key] ~= nil
- or (default[translated_mode] ~= nil and default[translated_mode][key] ~= nil)
- then
- pcall(vim.api.nvim_del_keymap, translated_mode, key)
- end
- end
- end
-end
-
--- Set key mappings individually
--- @param mode The keymap mode, can be one of the keys of mode_adapters
--- @param key The key of keymap
--- @param val Can be form as a mapping or tuple of mapping and user defined opt
-function M.set_keymaps(mode, key, val)
- local opt = generic_opts[mode] or generic_opts_any
- if type(val) == "table" then
- opt = val[2]
- val = val[1]
- end
- if val then
- vim.api.nvim_set_keymap(mode, key, val, opt)
- else
- pcall(vim.api.nvim_del_keymap, mode, key)
- end
-end
-
--- Load key mappings for a given mode
--- @param mode The keymap mode, can be one of the keys of mode_adapters
--- @param keymaps The list of key mappings
-function M.load_mode(mode, keymaps)
- mode = mode_adapters[mode] or mode
- for k, v in pairs(keymaps) do
- M.set_keymaps(mode, k, v)
- end
-end
-
--- Load key mappings for all provided modes
--- @param keymaps A list of key mappings for each mode
-function M.load(keymaps)
- keymaps = keymaps or {}
- for mode, mapping in pairs(keymaps) do
- M.load_mode(mode, mapping)
- end
-end
-
--- Load the default keymappings
-function M.load_defaults()
- M.load(M.get_defaults())
- options.keys = {}
- for idx, _ in pairs(defaults) do
- options.keys[idx] = {}
- end
-end
-
--- Get the default keymappings
-function M.get_defaults()
- return defaults
-end
-
-return M
diff --git a/.config/nvim/lua/lsp/config.lua b/.config/nvim/lua/lsp/config.lua
deleted file mode 100644
index 61428aa..0000000
--- a/.config/nvim/lua/lsp/config.lua
+++ /dev/null
@@ -1,67 +0,0 @@
-return {
- templates_dir = join_paths(get_runtime_dir(), "site", "after", "ftplugin"),
- diagnostics = {
- signs = {
- active = true,
- values = {
- { name = "LspDiagnosticsSignError", text = "" },
- { name = "LspDiagnosticsSignWarning", text = "" },
- { name = "LspDiagnosticsSignHint", text = "" },
- { name = "LspDiagnosticsSignInformation", text = "" },
- },
- },
- virtual_text = true,
- update_in_insert = false,
- underline = true,
- severity_sort = true,
- },
- document_highlight = true,
- code_lens_refresh = true,
- popup_border = "single",
- on_attach_callback = nil,
- on_init_callback = nil,
- automatic_servers_installation = true,
- buffer_mappings = {
- normal_mode = {
- ["K"] = { "<cmd>lua vim.lsp.buf.hover()<CR>", "Show hover" },
- ["gd"] = { "<cmd>lua vim.lsp.buf.definition()<CR>", "Goto Definition" },
- ["gD"] = { "<cmd>lua vim.lsp.buf.declaration()<CR>", "Goto declaration" },
- ["gr"] = { "<cmd>lua vim.lsp.buf.references()<CR>", "Goto references" },
- ["gI"] = { "<cmd>lua vim.lsp.buf.implementation()<CR>", "Goto Implementation" },
- ["gs"] = { "<cmd>lua vim.lsp.buf.signature_help()<CR>", "show signature help" },
- ["gp"] = { "<cmd>lua require'lsp.peek'.Peek('definition')<CR>", "Peek definition" },
- ["gl"] = {
- "<cmd>lua require'lsp.handlers'.show_line_diagnostics()<CR>",
- "Show line diagnostics",
- },
- },
- insert_mode = {},
- visual_mode = {},
- },
- null_ls = {
- setup = {},
- config = {},
- },
- override = {
- "angularls",
- "ansiblels",
- "denols",
- "ember",
- "emmet_ls",
- "eslint",
- "eslintls",
- "graphql",
- "jedi_language_server",
- "ltex",
- "phpactor",
- "pylsp",
- "rome",
- "sorbet",
- "sqlls",
- "sqls",
- "stylelint_lsp",
- "tailwindcss",
- "tflint",
- "volar",
- },
-}
diff --git a/.config/nvim/lua/lsp/handlers.lua b/.config/nvim/lua/lsp/handlers.lua
deleted file mode 100644
index fcf7630..0000000
--- a/.config/nvim/lua/lsp/handlers.lua
+++ /dev/null
@@ -1,187 +0,0 @@
--- Set Default Prefix.
--- Note: You can set a prefix per lsp server in the lv-globals.lua file
-local M = {}
-
-function M.setup()
- local config = { -- your config
- virtual_text = options.lsp.diagnostics.virtual_text,
- signs = options.lsp.diagnostics.signs,
- underline = options.lsp.diagnostics.underline,
- update_in_insert = options.lsp.diagnostics.update_in_insert,
- severity_sort = options.lsp.diagnostics.severity_sort,
- }
- if vim.fn.has "nvim-0.5.1" > 0 then
- vim.lsp.handlers["textDocument/publishDiagnostics"] = function(_, result, ctx, _)
- local uri = result.uri
- local bufnr = vim.uri_to_bufnr(uri)
- if not bufnr then
- return
- end
-
- local diagnostics = result.diagnostics
- local ok, vim_diag = pcall(require, "vim.diagnostic")
- if ok then
- -- FIX: why can't we just use vim.diagnostic.get(buf_id)?
- config.signs = true
- for i, diagnostic in ipairs(diagnostics) do
- local rng = diagnostic.range
- diagnostics[i].lnum = rng["start"].line
- diagnostics[i].end_lnum = rng["end"].line
- diagnostics[i].col = rng["start"].character
- diagnostics[i].end_col = rng["end"].character
- end
- local namespace = vim.lsp.diagnostic.get_namespace(ctx.client_id)
-
- vim_diag.set(namespace, bufnr, diagnostics, config)
- if not vim.api.nvim_buf_is_loaded(bufnr) then
- return
- end
-
- vim_diag.show(namespace, bufnr, diagnostics, config)
- else
- vim.lsp.diagnostic.save(diagnostics, bufnr, ctx.client_id)
- if not vim.api.nvim_buf_is_loaded(bufnr) then
- return
- end
- vim.lsp.diagnostic.display(diagnostics, bufnr, ctx.client_id, config)
- end
- end
- else
- vim.lsp.handlers["textDocument/publishDiagnostics"] =
- function(_, _, params, client_id, _)
- local uri = params.uri
- local bufnr = vim.uri_to_bufnr(uri)
- if not bufnr then
- return
- end
-
- local diagnostics = params.diagnostics
- vim.lsp.diagnostic.save(diagnostics, bufnr, client_id)
- if not vim.api.nvim_buf_is_loaded(bufnr) then
- return
- end
- vim.lsp.diagnostic.display(diagnostics, bufnr, client_id, config)
- end
- end
-
- vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, {
- border = options.lsp.popup_border,
- })
-
- vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(
- vim.lsp.handlers.signature_help,
- {
- border = options.lsp.popup_border,
- }
- )
-end
-
-local function split_by_chunk(text, chunkSize)
- local s = {}
- for i = 1, #text, chunkSize do
- s[#s + 1] = text:sub(i, i + chunkSize - 1)
- end
- return s
-end
-
-function M.show_line_diagnostics()
- -- TODO: replace all this with vim.diagnostic.show_position_diagnostics()
- local diagnostics = vim.lsp.diagnostic.get_line_diagnostics()
- local severity_highlight = {
- "LspDiagnosticsFloatingError",
- "LspDiagnosticsFloatingWarning",
- "LspDiagnosticsFloatingInformation",
- "LspDiagnosticsFloatingHint",
- }
- local ok, vim_diag = pcall(require, "vim.diagnostic")
- if ok then
- local buf_id = vim.api.nvim_win_get_buf(0)
- local win_id = vim.api.nvim_get_current_win()
- local cursor_position = vim.api.nvim_win_get_cursor(win_id)
- severity_highlight = {
- "DiagnosticFloatingError",
- "DiagnosticFloatingWarn",
- "DiagnosticFloatingInfo",
- "DiagnosticFloatingHint",
- }
- diagnostics = vim_diag.get(buf_id, { lnum = cursor_position[1] - 1 })
- end
- local lines = {}
- local max_width = vim.fn.winwidth(0) - 5
- local height = #diagnostics
- local width = 0
- local opts = {}
- local close_events = { "CursorMoved", "CursorMovedI", "BufHidden", "InsertCharPre" }
- if height == 0 then
- return
- end
- local bufnr = vim.api.nvim_create_buf(false, true)
- local diag_message
- table.sort(diagnostics, function(a, b)
- return a.severity < b.severity
- end)
-
- local hash = {}
- local diagnostics_no_dupes = {}
- for _, v in ipairs(diagnostics) do
- if not hash[v["message"]] then
- diagnostics_no_dupes[#diagnostics_no_dupes + 1] = v -- you could print here instead of saving to result table if you wanted
- hash[v["message"]] = true
- end
- end
- -- print(vim.inspect(diagnostics_no_dupes))
-
- for i, diagnostic in ipairs(diagnostics_no_dupes) do
- local source = diagnostic.source
- diag_message = diagnostic.message:gsub("[\n\r]", " ")
- if source then
- if string.find(source, "/") then
- source = string.sub(
- diagnostic.source,
- string.find(diagnostic.source, "([%w-_]+)$")
- )
- end
- diag_message = string.format("%d. %s: %s", i, source, diag_message)
- else
- diag_message = string.format("%d. %s", i, diag_message)
- end
- if diagnostic.code then
- diag_message = string.format("%s [%s]", diag_message, diagnostic.code)
- end
- local msgs = split_by_chunk(diag_message, max_width)
- for _, diag in ipairs(msgs) do
- table.insert(lines, { message = diag, severity = diagnostic.severity })
- width = math.max(diag:len(), width)
- end
- end
- height = #lines
- opts = vim.lsp.util.make_floating_popup_options(width, height, opts)
- opts["style"] = "minimal"
- opts["border"] = "rounded"
- opts["focusable"] = true
-
- vim.api.nvim_buf_set_option(bufnr, "bufhidden", "wipe")
- local winnr = vim.api.nvim_open_win(bufnr, false, opts)
- vim.api.nvim_win_set_option(winnr, "winblend", 0)
- vim.api.nvim_buf_set_var(bufnr, "lsp_floating_window", winnr)
- for i, diag in ipairs(lines) do
- vim.api.nvim_buf_set_lines(bufnr, i - 1, i - 1, 0, { diag.message })
- vim.api.nvim_buf_add_highlight(
- bufnr,
- -1,
- severity_highlight[diag.severity],
- i - 1,
- 0,
- diag.message:len()
- )
- end
-
- vim.api.nvim_command(
- "autocmd QuitPre <buffer> ++nested ++once lua pcall(vim.api.nvim_win_close, "
- .. winnr
- .. ", true)"
- )
- vim.lsp.util.close_preview_autocmd(close_events, winnr)
-end
-
-return M
diff --git a/.config/nvim/lua/lsp/init.lua b/.config/nvim/lua/lsp/init.lua
deleted file mode 100644
index 9cb3e78..0000000
--- a/.config/nvim/lua/lsp/init.lua
+++ /dev/null
@@ -1,198 +0,0 @@
-local M = {}
-local Log = require "core.log"
-local utils = require "utils"
-
-local function lsp_highlight_document(client)
- if options.lsp.document_highlight == false then
- return -- we don't need further
- end
- -- Set autocommands conditional on server_capabilities
- if client.resolved_capabilities.document_highlight then
- vim.api.nvim_exec(
- [[
- augroup lsp_document_highlight
- autocmd! * <buffer>
- autocmd CursorHold <buffer> lua vim.lsp.buf.document_highlight()
- autocmd CursorMoved <buffer> lua vim.lsp.buf.clear_references()
- augroup END
- ]],
- false
- )
- end
-end
-
-local function lsp_code_lens_refresh(client)
- if options.lsp.code_lens_refresh == false then
- return
- end
-
- if client.resolved_capabilities.code_lens then
- vim.api.nvim_exec(
- [[
- augroup lsp_code_lens_refresh
- autocmd! * <buffer>
- autocmd InsertLeave <buffer> lua vim.lsp.codelens.refresh()
- autocmd InsertLeave <buffer> lua vim.lsp.codelens.display()
- augroup END
- ]],
- false
- )
- end
-end
-
-local function add_lsp_buffer_keybindings(bufnr)
- local mappings = {
- normal_mode = "n",
- insert_mode = "i",
- visual_mode = "v",
- }
-
- if options.builtin.which_key.active then
- -- Remap using which_key
- local status_ok, wk = pcall(require, "which-key")
- if not status_ok then
- return
- end
- for mode_name, mode_char in pairs(mappings) do
- wk.register(
- options.lsp.buffer_mappings[mode_name],
- { mode = mode_char, buffer = bufnr }
- )
- end
- else
- -- Remap using nvim api
- for mode_name, mode_char in pairs(mappings) do
- for key, remap in pairs(options.lsp.buffer_mappings[mode_name]) do
- vim.api.nvim_buf_set_keymap(
- bufnr,
- mode_char,
- key,
- remap[1],
- { noremap = true, silent = true }
- )
- end
- end
- end
-end
-
-function M.common_capabilities()
- local capabilities = vim.lsp.protocol.make_client_capabilities()
- capabilities.textDocument.completion.completionItem.snippetSupport = true
- capabilities.textDocument.completion.completionItem.resolveSupport = {
- properties = {
- "documentation",
- "detail",
- "additionalTextEdits",
- },
- }
-
- local status_ok, cmp_nvim_lsp = pcall(require, "cmp_nvim_lsp")
- if status_ok then
- capabilities = cmp_nvim_lsp.update_capabilities(capabilities)
- end
-
- return capabilities
-end
-
-local function select_default_formater(client)
- if
- client.name == "null-ls" or not client.resolved_capabilities.document_formatting
- then
- return
- end
- Log:debug("Checking for formatter overriding for " .. client.name)
- local formatters = require "lvim.lsp.null-ls.formatters"
- local client_filetypes = client.config.filetypes or {}
- for _, filetype in ipairs(client_filetypes) do
- if #vim.tbl_keys(formatters.list_registered_providers(filetype)) > 0 then
- Log:debug(
- "Formatter overriding detected. Disabling formatting capabilities for "
- .. client.name
- )
- client.resolved_capabilities.document_formatting = false
- client.resolved_capabilities.document_range_formatting = false
- end
- end
-end
-
-function M.common_on_init(client, bufnr)
- if options.lsp.on_init_callback then
- options.lsp.on_init_callback(client, bufnr)
- Log:debug "Called lsp.on_init_callback"
- return
- end
- select_default_formater(client)
-end
-
-function M.common_on_attach(client, bufnr)
- if options.lsp.on_attach_callback then
- options.lsp.on_attach_callback(client, bufnr)
- Log:debug "Called lsp.on_attach_callback"
- end
- lsp_highlight_document(client)
- lsp_code_lens_refresh(client)
- add_lsp_buffer_keybindings(bufnr)
-end
-
-local function bootstrap_nlsp(opts)
- opts = opts or {}
- local lsp_settings_status_ok, lsp_settings = pcall(require, "nlspsettings")
- if lsp_settings_status_ok then
- lsp_settings.setup(opts)
- end
-end
-
-function M.get_common_opts()
- return {
- on_attach = M.common_on_attach,
- on_init = M.common_on_init,
- capabilities = M.common_capabilities(),
- }
-end
-
-local LSP_DEPRECATED_SIGN_MAP = {
- ["LspDiagnosticsSignError"] = "DiagnosticSignError",
- ["LspDiagnosticsSignWarning"] = "DiagnosticSignWarn",
- ["LspDiagnosticsSignHint"] = "DiagnosticSignHint",
- ["LspDiagnosticsSignInformation"] = "DiagnosticSignInfo",
-}
-
-function M.setup()
- Log:debug "Setting up LSP support"
-
- local lsp_status_ok, _ = pcall(require, "lspconfig")
- if not lsp_status_ok then
- return
- end
-
- local is_neovim_nightly = vim.fn.has "nvim-0.5.1" > 0
-
- for _, sign in ipairs(options.lsp.diagnostics.signs.values) do
- local lsp_sign_name = LSP_DEPRECATED_SIGN_MAP[sign.name]
- if is_neovim_nightly and lsp_sign_name then
- vim.fn.sign_define(
- lsp_sign_name,
- { texthl = lsp_sign_name, text = sign.text, numhl = lsp_sign_name }
- )
- end
- vim.fn.sign_define(
- sign.name,
- { texthl = sign.name, text = sign.text, numhl = sign.name }
- )
- end
- require("lsp.handlers").setup()
-
- if not utils.is_directory(options.lsp.templates_dir) then
- require("lsp.templates").generate_templates()
- end
-
- Log:info(string.format("%s", options.lsp.templates_dir))
-
- bootstrap_nlsp { config_home = utils.join_paths(get_config_dir(), "lsp-settings") }
-
- require("lsp.null-ls").setup()
-
- require("core.autocmds").configure_format_on_save()
-end
-
-return M
diff --git a/.config/nvim/lua/lsp/manager.lua b/.config/nvim/lua/lsp/manager.lua
deleted file mode 100644
index 268e90d..0000000
--- a/.config/nvim/lua/lsp/manager.lua
+++ /dev/null
@@ -1,95 +0,0 @@
-local M = {}
-
-local Log = require "core.log"
-local lsp_utils = require "lsp.utils"
-
-function M.init_defaults(languages)
- for _, entry in ipairs(languages) do
- if not options.lang[entry] then
- options.lang[entry] = {
- formatters = {},
- linters = {},
- lsp = {},
- }
- end
- end
-end
-
----Resolve the configuration for a server based on both common and user configuration
----@param name string
----@param user_config table [optional]
----@return table
-local function resolve_config(name, user_config)
- local config = {
- on_attach = require("lsp").common_on_attach,
- on_init = require("lsp").common_on_init,
- capabilities = require("lsp").common_capabilities(),
- }
-
- local has_custom_provider, custom_config = pcall(require, "lsp/providers/" .. name)
- if has_custom_provider then
- Log:debug("Using custom configuration for requested server: " .. name)
- config = vim.tbl_deep_extend("force", config, custom_config)
- end
-
- if user_config then
- config = vim.tbl_deep_extend("force", config, user_config)
- end
-
- return config
-end
-
--- manually start the server and don't wait for the usual filetype trigger from lspconfig
-local function buf_try_add(server_name, bufnr)
- bufnr = bufnr or vim.api.nvim_get_current_buf()
- require("lspconfig")[server_name].manager.try_add_wrapper(bufnr)
-end
-
----Setup a language server by providing a name
----@param server_name string name of the language server
----@param user_config table [optional] when available it will take predence over any default configurations
-function M.setup(server_name, user_config)
- vim.validate { name = { server_name, "string" } }
-
- if lsp_utils.is_client_active(server_name) then
- return
- end
-
- local config = resolve_config(server_name, user_config)
- local servers = require "nvim-lsp-installer.servers"
- local server_available, requested_server = servers.get_server(server_name)
-
- local is_overridden = vim.tbl_contains(options.lsp.override, server_name)
- if not server_available or is_overridden then
- pcall(function()
- require("lspconfig")[server_name].setup(config)
- buf_try_add(server_name)
- end)
- return
- end
-
- local install_notification = false
-
- if not requested_server:is_installed() then
- if options.lsp.automatic_servers_installation then
- Log:debug "Automatic server installation detected"
- requested_server:install()
- install_notification = true
- else
- Log:debug(requested_server.name .. " is not managed by the automatic installer")
- end
- end
-
- requested_server:on_ready(function()
- if install_notification then
- vim.notify(
- string.format("Installation complete for [%s] server", requested_server.name),
- vim.log.levels.INFO
- )
- end
- install_notification = false
- requested_server:setup(config)
- end)
-end
-
-return M
diff --git a/.config/nvim/lua/lsp/null-ls/code_actions.lua b/.config/nvim/lua/lsp/null-ls/code_actions.lua
deleted file mode 100644
index 70cecda..0000000
--- a/.config/nvim/lua/lsp/null-ls/code_actions.lua
+++ /dev/null
@@ -1,81 +0,0 @@
-local M = {}
-
-local null_ls = require "null-ls"
-local services = require "lsp.null-ls.services"
-local Log = require "core.log"
-
-local METHOD = null_ls.methods.CODE_ACTION
-
-local is_registered = function(name)
- local query = {
- name = name,
- method = METHOD,
- }
- return require("null-ls.sources").is_registered(query)
-end
-
-function M.list_registered_providers(filetype)
- local registered_providers = services.list_registered_providers_names(filetype)
- return registered_providers[METHOD] or {}
-end
-
-function M.list_available(filetype)
- local availables = require("null-ls.sources").get_available(filetype, METHOD)
- local actors = vim.tbl_map(function(src)
- return src.name
- end, availables)
- table.sort(actors)
- return actors
-end
-
-function M.list_configured(actions_configs)
- local actors, errors = {}, {}
-
- for _, config in ipairs(actions_configs) do
- vim.validate {
- ["config.name"] = { config.name, "string" },
- }
-
- local name = config.name:gsub("-", "_")
- local actor = null_ls.builtins.code_actions[name]
-
- if not actor then
- Log:error("Not a valid code_actions: " .. config.name)
- errors[name] = {} -- Add data here when necessary
- elseif is_registered(config.name) then
- Log:trace "Skipping registering the source more than once"
- else
- local command
- if actor._opts.command then
- command = services.find_command(actor._opts.command)
- end
- if not command and actor._opts.command ~= nil then
- Log:warn("Not found: " .. actor._opts.command)
- errors[name] = {} -- Add data here when necessary
- else
- Log:debug("Using code_actions: " .. (command or config.name))
- table.insert(
- actors,
- actor.with {
- command = command, -- could be nil
- extra_args = config.args,
- filetypes = config.filetypes,
- }
- )
- end
- end
- end
-
- return { supported = actors, unsupported = errors }
-end
-
-function M.setup(actions_configs)
- if vim.tbl_isempty(actions_configs) then
- return
- end
-
- local actions = M.list_configured(actions_configs)
- null_ls.register { sources = actions.supported }
-end
-
-return M
diff --git a/.config/nvim/lua/lsp/null-ls/formatters.lua b/.config/nvim/lua/lsp/null-ls/formatters.lua
deleted file mode 100644
index 72d622a..0000000
--- a/.config/nvim/lua/lsp/null-ls/formatters.lua
+++ /dev/null
@@ -1,82 +0,0 @@
-local M = {}
-
-local null_ls = require "null-ls"
-local services = require "lsp.null-ls.services"
-local Log = require "core.log"
-
-local is_registered = function(name)
- local query = {
- name = name,
- method = require("null-ls").methods.FORMATTING,
- }
- return require("null-ls.sources").is_registered(query)
-end
-
-function M.list_registered_providers(filetype)
- local null_ls_methods = require "null-ls.methods"
- local formatter_method = null_ls_methods.internal["FORMATTING"]
- local registered_providers = services.list_registered_providers_names(filetype)
- return registered_providers[formatter_method] or {}
-end
-
-function M.list_available(filetype)
- local formatters = {}
- local tbl = require "utils.table"
- for _, provider in pairs(null_ls.builtins.formatting) do
- if
- tbl.contains(provider.filetypes or {}, function(ft)
- return ft == "*" or ft == filetype
- end)
- then
- table.insert(formatters, provider.name)
- end
- end
-
- table.sort(formatters)
- return formatters
-end
-
-function M.list_configured(formatter_configs)
- local formatters, errors = {}, {}
-
- for _, fmt_config in ipairs(formatter_configs) do
- local name = fmt_config.exe:gsub("-", "_")
- local formatter = null_ls.builtins.formatting[name]
-
- if not formatter then
- Log:error("Not a valid formatter: " .. fmt_config.exe)
- errors[name] = {} -- Add data here when necessary
- elseif is_registered(fmt_config.exe) then
- Log:trace "Skipping registering the source more than once"
- else
- local formatter_cmd = services.find_command(formatter._opts.command)
- if not formatter_cmd then
- Log:warn("Not found: " .. formatter._opts.command)
- errors[name] = {} -- Add data here when necessary
- else
- Log:debug("Using formatter: " .. formatter_cmd)
- table.insert(
- formatters,
- formatter.with {
- command = formatter_cmd,
- extra_args = fmt_config.args,
- filetypes = fmt_config.filetypes,
- }
- )
- end
- end
- end
-
- return { supported = formatters, unsupported = errors }
-end
-
-function M.setup(formatter_configs)
- if vim.tbl_isempty(formatter_configs) then
- return
- end
-
- local formatters = M.list_configured(formatter_configs)
- null_ls.register { sources = formatters.supported }
-end
-
-return M
diff --git a/.config/nvim/lua/lsp/null-ls/init.lua b/.config/nvim/lua/lsp/null-ls/init.lua
deleted file mode 100644
index adbc5b2..0000000
--- a/.config/nvim/lua/lsp/null-ls/init.lua
+++ /dev/null
@@ -1,22 +0,0 @@
-local M = {}
-
-local Log = require "core.log"
-
-function M:setup()
- local status_ok, null_ls = pcall(require, "null-ls")
- if not status_ok then
- Log:error "Missing null-ls dependency"
- return
- end
-
- null_ls.config(options.lsp.null_ls.config)
- local default_opts = require("lsp").get_common_opts()
-
- if vim.tbl_isempty(options.lsp.null_ls.setup or {}) then
- options.lsp.null_ls.setup = default_opts
- end
-
- require("lspconfig")["null-ls"].setup(options.lsp.null_ls.setup)
-end
-
-return M
diff --git a/.config/nvim/lua/lsp/null-ls/linters.lua b/.config/nvim/lua/lsp/null-ls/linters.lua
deleted file mode 100644
index ec5e25a..0000000
--- a/.config/nvim/lua/lsp/null-ls/linters.lua
+++ /dev/null
@@ -1,82 +0,0 @@
-local M = {}
-
-local null_ls = require "null-ls"
-local services = require "lsp.null-ls.services"
-local Log = require "core.log"
-
-local is_registered = function(name)
- local query = {
- name = name,
- method = require("null-ls").methods.DIAGNOSTICS,
- }
- return require("null-ls.sources").is_registered(query)
-end
-
-function M.list_registered_providers(filetype)
- local null_ls_methods = require "null-ls.methods"
- local linter_method = null_ls_methods.internal["DIAGNOSTICS"]
- local registered_providers = services.list_registered_providers_names(filetype)
- return registered_providers[linter_method] or {}
-end
-
-function M.list_available(filetype)
- local linters = {}
- local tbl = require "utils.table"
- for _, provider in pairs(null_ls.builtins.diagnostics) do
- if
- tbl.contains(provider.filetypes or {}, function(ft)
- return ft == "*" or ft == filetype
- end)
- then
- table.insert(linters, provider.name)
- end
- end
-
- table.sort(linters)
- return linters
-end
-
-function M.list_configured(linter_configs)
- local linters, errors = {}, {}
-
- for _, lnt_config in pairs(linter_configs) do
- local name = lnt_config.exe:gsub("-", "_")
- local linter = null_ls.builtins.diagnostics[name]
-
- if not linter then
- Log:error("Not a valid linter: " .. lnt_config.exe)
- errors[lnt_config.exe] = {} -- Add data here when necessary
- elseif is_registered(lnt_config.exe) then
- Log:trace "Skipping registering the source more than once"
- else
- local linter_cmd = services.find_command(linter._opts.command)
- if not linter_cmd then
- Log:warn("Not found: " .. linter._opts.command)
- errors[name] = {} -- Add data here when necessary
- else
- Log:debug("Using linter: " .. linter_cmd)
- table.insert(
- linters,
- linter.with {
- command = linter_cmd,
- extra_args = lnt_config.args,
- filetypes = lnt_config.filetypes,
- }
- )
- end
- end
- end
-
- return { supported = linters, unsupported = errors }
-end
-
-function M.setup(linter_configs)
- if vim.tbl_isempty(linter_configs) then
- return
- end
-
- local linters = M.list_configured(linter_configs)
- null_ls.register { sources = linters.supported }
-end
-
-return M
diff --git a/.config/nvim/lua/lsp/null-ls/services.lua b/.config/nvim/lua/lsp/null-ls/services.lua
deleted file mode 100644
index 6a52520..0000000
--- a/.config/nvim/lua/lsp/null-ls/services.lua
+++ /dev/null
@@ -1,61 +0,0 @@
-local M = {}
-
-local function find_root_dir()
- local util = require "lspconfig/util"
- local lsp_utils = require "lsp.utils"
-
- local ts_client = lsp_utils.is_client_active "typescript"
- if ts_client then
- return ts_client.config.root_dir
- end
- local dirname = vim.fn.expand "%:p:h"
- return util.root_pattern "package.json"(dirname)
-end
-
-local function from_node_modules(command)
- local root_dir = find_root_dir()
-
- if not root_dir then
- return nil
- end
-
- return root_dir .. "/node_modules/.bin/" .. command
-end
-
-local local_providers = {
- prettier = { find = from_node_modules },
- prettierd = { find = from_node_modules },
- prettier_d_slim = { find = from_node_modules },
- eslint_d = { find = from_node_modules },
- eslint = { find = from_node_modules },
- stylelint = { find = from_node_modules },
-}
-
-function M.find_command(command)
- if local_providers[command] then
- local local_command = local_providers[command].find(command)
- if local_command and vim.fn.executable(local_command) == 1 then
- return local_command
- end
- end
-
- if vim.fn.executable(command) == 1 then
- return command
- end
- return nil
-end
-
-function M.list_registered_providers_names(filetype)
- local s = require "null-ls.sources"
- local available_sources = s.get_available(filetype)
- local registered = {}
- for _, source in ipairs(available_sources) do
- for method in pairs(source.methods) do
- registered[method] = registered[method] or {}
- table.insert(registered[method], source.name)
- end
- end
- return registered
-end
-
-return M
diff --git a/.config/nvim/lua/lsp/peek.lua b/.config/nvim/lua/lsp/peek.lua
deleted file mode 100644
index 151c967..0000000
--- a/.config/nvim/lua/lsp/peek.lua
+++ /dev/null
@@ -1,166 +0,0 @@
-local M = {
- floating_buf = nil,
- floating_win = nil,
- prev_result = nil,
-}
-
-local function create_floating_file(location, opts)
- vim.validate {
- location = { location, "t" },
- opts = { opts, "t", true },
- }
-
- -- Set some defaults
- opts = opts or {}
- local close_events = opts.close_events
- or { "CursorMoved", "CursorMovedI", "BufHidden", "InsertCharPre" }
-
- -- location may be LocationLink or Location
- local uri = location.targetUri or location.uri
- if uri == nil then
- return
- end
- local bufnr = vim.uri_to_bufnr(uri)
- if not vim.api.nvim_buf_is_loaded(bufnr) then
- vim.fn.bufload(bufnr)
- end
-
- local range = location.targetRange or location.range
-
- local contents = vim.api.nvim_buf_get_lines(
- bufnr,
- range.start.line,
- math.min(
- range["end"].line + 1 + (opts.context or 10),
- range.start.line + (opts.max_height or 15)
- ), -- Don't let the window be more that 15 lines long(height)
- false
- )
- local width, height = vim.lsp.util._make_floating_popup_size(contents, opts)
- opts = vim.lsp.util.make_floating_popup_options(width, height, opts)
- -- Don't make it minimal as it is meant to be fully featured
- opts["style"] = nil
-
- vim.api.nvim_buf_set_option(bufnr, "bufhidden", "wipe")
-
- local winnr = vim.api.nvim_open_win(bufnr, false, opts)
- vim.api.nvim_win_set_option(winnr, "winblend", 0)
-
- vim.api.nvim_win_set_cursor(winnr, { range.start.line + 1, range.start.character })
- vim.api.nvim_buf_set_var(bufnr, "lsp_floating_window", winnr)
-
- -- Set some autocmds to close the window
- vim.api.nvim_command(
- "autocmd QuitPre <buffer> ++nested ++once lua pcall(vim.api.nvim_win_close, "
- .. winnr
- .. ", true)"
- )
- vim.lsp.util.close_preview_autocmd(close_events, winnr)
-
- return bufnr, winnr
-end
-
-local function preview_location_callback(result)
- if result == nil or vim.tbl_isempty(result) then
- return nil
- end
-
- local opts = {
- border = "rounded",
- context = 10,
- }
-
- if vim.tbl_islist(result) then
- M.prev_result = result[1]
- M.floating_buf, M.floating_win = create_floating_file(result[1], opts)
- else
- M.prev_result = result
- M.floating_buf, M.floating_win = create_floating_file(result, opts)
- end
-end
-
-local function preview_location_callback_old_signature(_, _, result)
- return preview_location_callback(result)
-end
-
-local function preview_location_callback_new_signature(_, result)
- return preview_location_callback(result)
-end
-
-function M.open_file()
- -- Get the file currently open in the floating window
- local filepath = vim.fn.expand "%:."
-
- if not filepath then
- print "peek: Unable to open the file!"
- return
- end
-
- -- Close the floating window
- pcall(vim.api.nvim_win_close, M.floating_win, true)
-
- -- Edit the file
- vim.cmd("edit " .. filepath)
-
- local winnr = vim.api.nvim_get_current_win()
-
- -- Set the cursor at the right position
- M.set_cursor_to_prev_pos(winnr)
-end
-
-function M.set_cursor_to_prev_pos(winnr)
- -- Get position of the thing to peek at
- local location = M.prev_result
- local range = location.targetRange or location.range
- local cursor_pos = { range.start.line + 1, range.start.character }
-
- -- Set the winnr to the floating window if none was passed in
- winnr = winnr or M.floating_win
- -- Set the cursor at the correct position in the floating window
- vim.api.nvim_win_set_cursor(winnr, cursor_pos)
-end
-
-function M.Peek(what)
- -- If a window already exists, focus it at the right position!
- if vim.tbl_contains(vim.api.nvim_list_wins(), M.floating_win) then
- local success_1, _ = pcall(vim.api.nvim_set_current_win, M.floating_win)
- if not success_1 then
- print "peek: You cannot edit the current file in a preview!"
- return
- end
-
- -- Set the cursor at the correct position in the floating window
- M.set_cursor_to_prev_pos()
-
- vim.api.nvim_buf_set_keymap(
- M.floating_buf,
- "n",
- "<CR>",
- ":lua require('lsp.peek').open_file()<CR>",
- { noremap = true, silent = true }
- )
- else
- -- Make a new request and then create the new window in the callback
- local params = vim.lsp.util.make_position_params()
- local preview_callback = preview_location_callback_old_signature
- if vim.fn.has "nvim-0.5.1" > 0 then
- preview_callback = preview_location_callback_new_signature
- end
- local success, _ = pcall(
- vim.lsp.buf_request,
- 0,
- "textDocument/" .. what,
- params,
- preview_callback
- )
- if not success then
- print(
- 'peek: Error calling LSP method "textDocument/'
- .. what
- .. '". The current language lsp might not support it.'
- )
- end
- end
-end
-
-return M
diff --git a/.config/nvim/lua/lsp/providers/jsonls.lua b/.config/nvim/lua/lsp/providers/jsonls.lua
deleted file mode 100644
index e81b2c3..0000000
--- a/.config/nvim/lua/lsp/providers/jsonls.lua
+++ /dev/null
@@ -1,198 +0,0 @@
-
-local default_schemas = nil
-local status_ok, jsonls_settings = pcall(require, "nlspsettings.jsonls")
-if status_ok then
- default_schemas = jsonls_settings.get_default_schemas()
-end
-
-local schemas = {
- {
- description = "TypeScript compiler configuration file",
- fileMatch = {
- "tsconfig.json",
- "tsconfig.*.json",
- },
- url = "https://json.schemastore.org/tsconfig.json",
- },
- {
- description = "Lerna config",
- fileMatch = { "lerna.json" },
- url = "https://json.schemastore.org/lerna.json",
- },
- {
- description = "Babel configuration",
- fileMatch = {
- ".babelrc.json",
- ".babelrc",
- "babel.config.json",
- },
- url = "https://json.schemastore.org/babelrc.json",
- },
- {
- description = "ESLint config",
- fileMatch = {
- ".eslintrc.json",
- ".eslintrc",
- },
- url = "https://json.schemastore.org/eslintrc.json",
- },
- {
- description = "Bucklescript config",
- fileMatch = { "bsconfig.json" },
- url = "https://raw.githubusercontent.com/rescript-lang/rescript-compiler/8.2.0/docs/docson/build-schema.json",
- },
- {
- description = "Prettier config",
- fileMatch = {
- ".prettierrc",
- ".prettierrc.json",
- "prettier.config.json",
- },
- url = "https://json.schemastore.org/prettierrc",
- },
- {
- description = "Vercel Now config",
- fileMatch = { "now.json" },
- url = "https://json.schemastore.org/now",
- },
- {
- description = "Stylelint config",
- fileMatch = {
- ".stylelintrc",
- ".stylelintrc.json",
- "stylelint.config.json",
- },
- url = "https://json.schemastore.org/stylelintrc",
- },
- {
- description = "A JSON schema for the ASP.NET LaunchSettings.json files",
- fileMatch = { "launchsettings.json" },
- url = "https://json.schemastore.org/launchsettings.json",
- },
- {
- description = "Schema for CMake Presets",
- fileMatch = {
- "CMakePresets.json",
- "CMakeUserPresets.json",
- },
- url = "https://raw.githubusercontent.com/Kitware/CMake/master/Help/manual/presets/schema.json",
- },
- {
- description = "Configuration file as an alternative for configuring your repository in the settings page.",
- fileMatch = {
- ".codeclimate.json",
- },
- url = "https://json.schemastore.org/codeclimate.json",
- },
- {
- description = "LLVM compilation database",
- fileMatch = {
- "compile_commands.json",
- },
- url = "https://json.schemastore.org/compile-commands.json",
- },
- {
- description = "Config file for Command Task Runner",
- fileMatch = {
- "commands.json",
- },
- url = "https://json.schemastore.org/commands.json",
- },
- {
- description = "AWS CloudFormation provides a common language for you to describe and provision all the infrastructure resources in your cloud environment.",
- fileMatch = {
- "*.cf.json",
- "cloudformation.json",
- },
- url = "https://raw.githubusercontent.com/awslabs/goformation/v5.2.9/schema/cloudformation.schema.json",
- },
- {
- description = "The AWS Serverless Application Model (AWS SAM, previously known as Project Flourish) extends AWS CloudFormation to provide a simplified way of defining the Amazon API Gateway APIs, AWS Lambda functions, and Amazon DynamoDB tables needed by your serverless application.",
- fileMatch = {
- "serverless.template",
- "*.sam.json",
- "sam.json",
- },
- url = "https://raw.githubusercontent.com/awslabs/goformation/v5.2.9/schema/sam.schema.json",
- },
- {
- description = "Json schema for properties json file for a GitHub Workflow template",
- fileMatch = {
- ".github/workflow-templates/**.properties.json",
- },
- url = "https://json.schemastore.org/github-workflow-template-properties.json",
- },
- {
- description = "golangci-lint configuration file",
- fileMatch = {
- ".golangci.toml",
- ".golangci.json",
- },
- url = "https://json.schemastore.org/golangci-lint.json",
- },
- {
- description = "JSON schema for the JSON Feed format",
- fileMatch = {
- "feed.json",
- },
- url = "https://json.schemastore.org/feed.json",
- versions = {
- ["1"] = "https://json.schemastore.org/feed-1.json",
- ["1.1"] = "https://json.schemastore.org/feed.json",
- },
- },
- {
- description = "Packer template JSON configuration",
- fileMatch = {
- "packer.json",
- },
- url = "https://json.schemastore.org/packer.json",
- },
- {
- description = "NPM configuration file",
- fileMatch = {
- "package.json",
- },
- url = "https://json.schemastore.org/package.json",
- },
- {
- description = "JSON schema for Visual Studio component configuration files",
- fileMatch = {
- "*.vsconfig",
- },
- url = "https://json.schemastore.org/vsconfig.json",
- },
- {
- description = "Resume json",
- fileMatch = { "resume.json" },
- url = "https://raw.githubusercontent.com/jsonresume/resume-schema/v1.0.0/schema.json",
- },
-}
-
-local function extend(tab1, tab2)
- for _, value in ipairs(tab2) do
- table.insert(tab1, value)
- end
- return tab1
-end
-
-local extended_schemas = extend(schemas, default_schemas)
-
-local opts = {
- settings = {
- json = {
- schemas = extended_schemas,
- },
- },
- setup = {
- commands = {
- Format = {
- function()
- vim.lsp.buf.range_formatting({}, { 0, 0 }, { vim.fn.line "$", 0 })
- end,
- },
- },
- },
-}
-
-return opts
diff --git a/.config/nvim/lua/lsp/providers/sumneko_lua.lua b/.config/nvim/lua/lsp/providers/sumneko_lua.lua
deleted file mode 100644
index 25693a9..0000000
--- a/.config/nvim/lua/lsp/providers/sumneko_lua.lua
+++ /dev/null
@@ -1,19 +0,0 @@
-local opts = {
- settings = {
- Lua = {
- diagnostics = {
- globals = { "vim", "nvim" },
- },
- workspace = {
- library = {
- [require("utils").join_paths(get_runtime_dir(), "lua")] = true,
- [vim.fn.expand "$VIMRUNTIME/lua"] = true,
- [vim.fn.expand "$VIMRUNTIME/lua/vim/lsp"] = true,
- },
- maxPreload = 100000,
- preloadFileSize = 10000,
- },
- },
- },
-}
-return opts
diff --git a/.config/nvim/lua/lsp/providers/vuels.lua b/.config/nvim/lua/lsp/providers/vuels.lua
deleted file mode 100644
index 0d93c61..0000000
--- a/.config/nvim/lua/lsp/providers/vuels.lua
+++ /dev/null
@@ -1,28 +0,0 @@
-local opts = {
- setup = {
- root_dir = function(fname)
- local util = require "lspconfig/util"
- return util.root_pattern "package.json"(fname)
- or util.root_pattern "vue.config.js"(fname)
- or vim.fn.getcwd()
- end,
- init_options = {
- config = {
- vetur = {
- completion = {
- autoImport = true,
- tagCasing = "kebab",
- useScaffoldSnippets = true,
- },
- useWorkspaceDependencies = true,
- validation = {
- script = true,
- style = true,
- template = true,
- },
- },
- },
- },
- },
-}
-return opts
diff --git a/.config/nvim/lua/lsp/providers/yamlls.lua b/.config/nvim/lua/lsp/providers/yamlls.lua
deleted file mode 100644
index 156a35b..0000000
--- a/.config/nvim/lua/lsp/providers/yamlls.lua
+++ /dev/null
@@ -1,30 +0,0 @@
-local opts = {
- settings = {
- yaml = {
- hover = true,
- completion = true,
- validate = true,
- schemaStore = {
- enable = true,
- url = "https://www.schemastore.org/api/json/catalog.json",
- },
- schemas = {
- kubernetes = {
- "daemon.{yml,yaml}",
- "manager.{yml,yaml}",
- "restapi.{yml,yaml}",
- "role.{yml,yaml}",
- "role_binding.{yml,yaml}",
- "*onfigma*.{yml,yaml}",
- "*ngres*.{yml,yaml}",
- "*ecre*.{yml,yaml}",
- "*eployment*.{yml,yaml}",
- "*ervic*.{yml,yaml}",
- "kubectl-edit*.yaml",
- },
- },
- },
- },
-}
-
-return opts
diff --git a/.config/nvim/lua/lsp/templates.lua b/.config/nvim/lua/lsp/templates.lua
deleted file mode 100644
index 084c1f9..0000000
--- a/.config/nvim/lua/lsp/templates.lua
+++ /dev/null
@@ -1,74 +0,0 @@
-local M = {}
-
-local Log = require "core.log"
-local utils = require "utils"
-local lsp_utils = require "lsp.utils"
-
-local ftplugin_dir = options.lsp.templates_dir
-
-local join_paths = _G.join_paths
-
-function M.remove_template_files()
- -- remove any outdated files
- for _, file in ipairs(vim.fn.glob(ftplugin_dir .. "/*.lua", 1, 1)) do
- vim.fn.delete(file)
- end
-end
-
----Generates an ftplugin file based on the server_name in the selected directory
----@param server_name string name of a valid language server, e.g. pyright, gopls, tsserver, etc.
----@param dir string the full path to the desired directory
-function M.generate_ftplugin(server_name, dir)
- local has_custom_provider, _ = pcall(require, "lsp/providers/" .. server_name)
- if
- vim.tbl_contains(options.lsp.override, server_name) and not has_custom_provider
- then
- return
- end
-
- -- we need to go through lspconfig to get the corresponding filetypes currently
- local filetypes = lsp_utils.get_supported_filetypes(server_name) or {}
- if not filetypes then
- return
- end
-
- for _, filetype in ipairs(filetypes) do
- local filename = join_paths(dir, filetype .. ".lua")
- local setup_cmd = string.format([[require("lsp.manager").setup(%q)]], server_name)
- -- print("using setup_cmd: " .. setup_cmd)
- -- overwrite the file completely
- utils.write_file(filename, setup_cmd .. "\n", "a")
- end
-end
-
----Generates ftplugin files based on a list of server_names
----The files are generated to a runtimepath: "$LUNARVIM_RUNTIME_DIR/site/after/ftplugin/template.lua"
----@param servers_names table list of servers to be enabled. Will add all by default
-function M.generate_templates(servers_names)
- servers_names = servers_names or {}
-
- Log:debug "Templates installation in progress"
-
- M.remove_template_files()
-
- if vim.tbl_isempty(servers_names) then
- local available_servers =
- require("nvim-lsp-installer.servers").get_available_servers()
-
- for _, server in pairs(available_servers) do
- table.insert(servers_names, server.name)
- end
- end
-
- -- create the directory if it didn't exist
- if not utils.is_directory(options.lsp.templates_dir) then
- vim.fn.mkdir(ftplugin_dir, "p")
- end
-
- for _, server in ipairs(servers_names) do
- M.generate_ftplugin(server, ftplugin_dir)
- end
- Log:debug "Templates installation is complete"
-end
-
-return M
diff --git a/.config/nvim/lua/lsp/utils.lua b/.config/nvim/lua/lsp/utils.lua
deleted file mode 100644
index afc3eba..0000000
--- a/.config/nvim/lua/lsp/utils.lua
+++ /dev/null
@@ -1,67 +0,0 @@
-local M = {}
-
-local tbl = require "utils.table"
-
-function M.is_client_active(name)
- local clients = vim.lsp.get_active_clients()
- return tbl.find_first(clients, function(client)
- return client.name == name
- end)
-end
-
-function M.get_active_clients_by_ft(filetype)
- local matches = {}
- local clients = vim.lsp.get_active_clients()
- for _, client in pairs(clients) do
- local supported_filetypes = client.config.filetypes or {}
- if client.name ~= "null-ls" and vim.tbl_contains(supported_filetypes, filetype) then
- table.insert(matches, client)
- end
- end
- return matches
-end
-
-function M.get_client_capabilities(client_id)
- if not client_id then
- local buf_clients = vim.lsp.buf_get_clients()
- for _, buf_client in ipairs(buf_clients) do
- if buf_client.name ~= "null-ls" then
- client_id = buf_client.id
- break
- end
- end
- end
- if not client_id then
- error "Unable to determine client_id"
- return
- end
-
- local client = vim.lsp.get_client_by_id(tonumber(client_id))
-
- local enabled_caps = {}
- for capability, status in pairs(client.resolved_capabilities) do
- if status == true then
- table.insert(enabled_caps, capability)
- end
- end
-
- return enabled_caps
-end
-
-function M.get_supported_filetypes(server_name)
- -- temporary workaround: https://github.com/neovim/nvim-lspconfig/pull/1358
- if server_name == "dockerls" then
- return { "dockerfile" }
- end
- local lsp_installer_servers = require "nvim-lsp-installer.servers"
- local server_available, requested_server = lsp_installer_servers.get_server(
- server_name
- )
- if not server_available then
- return {}
- end
-
- return requested_server:get_supported_filetypes()
-end
-
-return M
diff --git a/.config/nvim/lua/plugin-loader.lua b/.config/nvim/lua/plugin-loader.lua
deleted file mode 100644
index 9c83e46..0000000
--- a/.config/nvim/lua/plugin-loader.lua
+++ /dev/null
@@ -1,110 +0,0 @@
-local plugin_loader = {}
-
-local utils = require "utils"
-local Log = require "core.log"
--- we need to reuse this outside of init()
-local compile_path = get_config_dir() .. "/plugin/packer_compiled.lua"
-
-function plugin_loader.init(opts)
- opts = opts or {}
-
- local install_path = opts.install_path
- or vim.fn.stdpath "data" .. "/site/pack/packer/start/packer.nvim"
- local package_root = opts.package_root or vim.fn.stdpath "data" .. "/site/pack"
-
- if vim.fn.empty(vim.fn.glob(install_path)) > 0 then
- vim.fn.system {
- "git",
- "clone",
- "--depth",
- "1",
- "https://github.com/wbthomason/packer.nvim",
- install_path,
- }
- vim.cmd "packadd packer.nvim"
- end
-
- if options.log and options.log.level then
- log_level = options.log.level
- end
-
- local _, packer = pcall(require, "packer")
- packer.init {
- package_root = package_root,
- compile_path = compile_path,
- log = { level = log_level },
- git = { clone_timeout = 300 },
- max_jobs = 50,
- display = {
- open_fn = function()
- return require("packer.util").float { border = "rounded" }
- end,
- },
- }
-end
-
--- packer expects a space separated list
-local function pcall_packer_command(cmd, kwargs)
- local status_ok, msg = pcall(function()
- require("packer")[cmd](unpack(kwargs or {}))
- end)
- if not status_ok then
- Log:warn(cmd .. " failed with: " .. vim.inspect(msg))
- Log:trace(vim.inspect(vim.fn.eval "v:errmsg"))
- end
-end
-
-function plugin_loader.cache_clear()
- if vim.fn.delete(compile_path) == 0 then
- Log:debug "deleted packer_compiled.lua"
- end
-end
-
-function plugin_loader.recompile()
- plugin_loader.cache_clear()
- pcall_packer_command "compile"
- if utils.is_file(compile_path) then
- Log:debug "generated packer_compiled.lua"
- end
-end
-
-function plugin_loader.load(configurations)
- Log:debug "loading plugins configuration"
- local packer_available, packer = pcall(require, "packer")
- if not packer_available then
- Log:warn "skipping loading plugins until Packer is installed"
- return
- end
- local status_ok, _ = xpcall(function()
- packer.startup(function(use)
- for _, plugins in ipairs(configurations) do
- for _, plugin in ipairs(plugins) do
- use(plugin)
- end
- end
- end)
- end, debug.traceback)
- if not status_ok then
- Log:warn "problems detected while loading plugins' configurations"
- Log:trace(debug.traceback())
- end
-end
-
-function plugin_loader.get_core_plugins()
- local list = {}
- local plugins = require "plugins"
- for _, item in pairs(plugins) do
- table.insert(list, item[1]:match "/(%S*)")
- end
- return list
-end
-
-function plugin_loader.sync_core_plugins()
- local core_plugins = plugin_loader.get_core_plugins()
- Log:trace(
- string.format("Syncing core plugins: [%q]", table.concat(core_plugins, ", "))
- )
- pcall_packer_command("sync", core_plugins)
-end
-
-return plugin_loader
diff --git a/.config/nvim/lua/plugins.lua b/.config/nvim/lua/plugins.lua
deleted file mode 100644
index a83fdf9..0000000
--- a/.config/nvim/lua/plugins.lua
+++ /dev/null
@@ -1,241 +0,0 @@
-local commit = {
- barbar = "6e638309efcad2f308eb9c5eaccf6f62b794bbab",
- cmp_buffer = "a706dc69c49110038fe570e5c9c33d6d4f67015b",
- cmp_luasnip = "16832bb50e760223a403ffa3042859845dd9ef9d",
- cmp_nvim_lsp = "134117299ff9e34adde30a735cd8ca9cf8f3db81",
- cmp_nvim_lua = "d276254e7198ab7d00f117e88e223b4bd8c02d21",
- cmp_path = "e30d3fdee650a07330654efab1951b2f1b91435e",
- comment = "a6e1c127fa7f19ec4e3edbffab1aacb2852b6db3",
- fixcursorhold = "0e4e22d21975da60b0fd2d302285b3b603f9f71e",
- friendly_snippets = "e3506d575e120253b4aa47ec2100786fd1e9c38d",
- gitsigns = "9678750f209671551c335c4f22658a6554c2f439",
- lualine = "1ae4f0aa74f0b34222c5ef3281b34602a76b2b00",
- luasnip = "7fc3cc24f3c1f1a43e861f589ca48ff3dff0b213",
- nlsp_settings = "199bc1b2859206488423b676da4a7d010b1a3373",
- null_ls = "128b8d85506e44f1e7e0f4acd9f2ba02fc7cee05",
- nvim_autopairs = "fba2503bd8cd0d8861054523aae39c4ac0680c07",
- nvim_cmp = "d17d41bdbd4731759d1b3d368204dc18ce3c84f3",
- nvim_lsp_installer = "a4016db22296e4eefbcda2e8b94de74db2d7cb65",
- nvim_lspconfig = "5b8624c1bcd332e9fd7ae33a2ca910adb31a7ae7",
- nvim_tree = "e842f088847c98da59e14eb543bde11c45c87ef7",
- nvim_treesitter = "8d1547f0bcd0831876678eeb238c3ba9a528189b",
- nvim_ts_context_commentstring = "9f5e422e1030e7073e593ad32c5354aa0bcb0176",
- nvim_web_devicons = "8df4988ecf8599fc1f8f387bbf2eae790e4c5ffb",
- packer = "db3c3e3379613443d94e677a6ac3f61278e36e47",
- plenary = "1c31adb35fcebe921f65e5c6ff6d5481fa5fa5ac",
- popup = "b7404d35d5d3548a82149238289fa71f7f6de4ac",
- project = "71d0e23dcfc43cfd6bb2a97dc5a7de1ab47a6538",
- structlog = "6f1403a192791ff1fa7ac845a73de9e860f781f1",
- telescope = "ef245548a858690fa8f2db1f1a0eaf41b93a6ef6",
- telescope_fzf_native = "b8662b076175e75e6497c59f3e2799b879d7b954",
- toggleterm = "265bbff68fbb8b2a5fb011272ec469850254ec9f",
- which_key = "d3032b6d3e0adb667975170f626cb693bfc66baa",
-}
-
-return {
- -- Packer can manage itself as an optional plugin
- { "wbthomason/packer.nvim", commit = commit.packer },
- { "neovim/nvim-lspconfig", commit = commit.nvim_lspconfig },
- { "tamago324/nlsp-settings.nvim", commit = commit.nlsp_settings },
- {
- "jose-elias-alvarez/null-ls.nvim",
- commit = commit.null_ls,
- },
- { "antoinemadec/FixCursorHold.nvim", commit = commit.fixcursorhold }, -- Needed while issue https://github.com/neovim/neovim/issues/12587 is still open
- {
- "williamboman/nvim-lsp-installer",
- commit = commit.nvim_lsp_installer,
- },
- { "Tastyep/structlog.nvim", commit = commit.structlog },
-
- { "nvim-lua/popup.nvim", commit = commit.popup },
- { "nvim-lua/plenary.nvim", commit = commit.plenary },
- -- Telescope
- {
- "nvim-telescope/telescope.nvim",
- commit = commit.telescope,
- config = function()
- require("core.telescope").setup()
- end,
- disable = not options.builtin.telescope.active,
- },
- {
- "nvim-telescope/telescope-fzf-native.nvim",
- commit = commit.telescope_fzf_native,
- run = "make",
- disable = not options.builtin.telescope.active,
- },
- -- Install nvim-cmp, and buffer source as a dependency
- {
- "hrsh7th/nvim-cmp",
- commit = commit.nvim_cmp,
- config = function()
- if options.builtin.cmp then
- require("core.cmp").setup()
- end
- end,
- requires = {
- "L3MON4D3/LuaSnip",
- "rafamadriz/friendly-snippets",
- },
- },
- {
- "rafamadriz/friendly-snippets",
- commit = commit.friendly_snippets,
- },
- {
- "L3MON4D3/LuaSnip",
- config = function()
- require("luasnip/loaders/from_vscode").lazy_load()
- end,
- commit = commit.luasnip,
- },
- {
- "hrsh7th/cmp-nvim-lsp",
- commit = commit.cmp_nvim_lsp,
- },
- {
- "saadparwaiz1/cmp_luasnip",
- commit = commit.cmp_luasnip,
- },
- {
- "hrsh7th/cmp-buffer",
- commit = commit.cmp_buffer,
- },
- {
- "hrsh7th/cmp-path",
- commit = commit.cmp_path,
- },
- {
- "hrsh7th/cmp-nvim-lua",
- commit = commit.cmp_nvim_lua,
- },
-
- -- Autopairs
- {
- "windwp/nvim-autopairs",
- commit = commit.nvim_autopairs,
- -- event = "InsertEnter",
- config = function()
- require("core.autopairs").setup()
- end,
- disable = not options.builtin.autopairs.active,
- },
-
- -- Treesitter
- {
- "nvim-treesitter/nvim-treesitter",
- commit = commit.treesitter,
- branch = "0.5-compat",
- -- run = ":TSUpdate",
- config = function()
- require("core.treesitter").setup()
- end,
- },
- {
- "JoosepAlviste/nvim-ts-context-commentstring",
- commit = commit.nvim_ts_context_commentstring,
- event = "BufReadPost",
- },
-
- -- NvimTree
- {
- "kyazdani42/nvim-tree.lua",
- -- event = "BufWinOpen",
- -- cmd = "NvimTreeToggle",
- commit = commit.nvim_tree,
- config = function()
- require("core.nvimtree").setup()
- end,
- disable = not options.builtin.nvimtree.active,
- },
-
- {
- "lewis6991/gitsigns.nvim",
- commit = commit.gitsigns,
-
- config = function()
- require("core.gitsigns").setup()
- end,
- event = "BufRead",
- disable = not options.builtin.gitsigns.active,
- },
-
- -- Whichkey
- {
- "folke/which-key.nvim",
- commit = commit.which_key,
- config = function()
- require("core.which-key").setup()
- end,
- event = "BufWinEnter",
- disable = not options.builtin.which_key.active,
- },
-
- -- Comments
- {
- "numToStr/Comment.nvim",
- commit = commit.comment,
- event = "BufRead",
- config = function()
- require("core.comment").setup()
- end,
- disable = not options.builtin.comment.active,
- },
-
- -- project.nvim
- {
- "ahmedkhalf/project.nvim",
- commit = commit.project,
- config = function()
- require("core.project").setup()
- end,
- disable = not options.builtin.project.active,
- },
-
- -- Icons
- { "kyazdani42/nvim-web-devicons", commit = commit.nvim_web_devicons },
-
- -- Status Line and Bufferline
- {
- -- "hoob3rt/lualine.nvim",
- "nvim-lualine/lualine.nvim",
- commit = commit.lualine,
- -- "Lunarvim/lualine.nvim",
- config = function()
- require("core.lualine").setup()
- end,
- disable = not options.builtin.lualine.active,
- },
-
- {
- "romgrk/barbar.nvim",
- commit = commit.barbar,
- config = function()
- require("core.bufferline").setup()
- end,
- event = "BufWinEnter",
- disable = not options.builtin.bufferline.active,
- },
-
- -- Dashboard
- {
- "ChristianChiarulli/dashboard-nvim",
- event = "BufWinEnter",
- config = function()
- require("core.dashboard").setup()
- end,
- disable = not options.builtin.dashboard.active,
- },
-
- -- Terminal
- {
- "akinsho/toggleterm.nvim",
- commit = commit.toggleterm,
- event = "BufWinEnter",
- config = function()
- require("core.terminal").setup()
- end,
- disable = not options.builtin.terminal.active,
- },
-}
diff --git a/.config/nvim/lua/utils/hooks.lua b/.config/nvim/lua/utils/hooks.lua
deleted file mode 100644
index fa667cf..0000000
--- a/.config/nvim/lua/utils/hooks.lua
+++ /dev/null
@@ -1,33 +0,0 @@
-local M = {}
-
-local Log = require "core.log"
-local in_headless = #vim.api.nvim_list_uis() == 0
-
-function M.run_pre_update()
- Log:debug "Starting pre-update hook"
-end
-
----Reset any startup cache files used by Packer and Impatient
----Tip: Useful for clearing any outdated settings
-function M.reset_cache()
- _G.__luacache.clear_cache()
- require("plugin-loader"):cache_reset()
-end
-
-function M.run_post_update()
- M.reset_cache()
- Log:debug "Starting post-update hook"
- package.loaded["lsp.templates"] = nil
- require("lsp.templates").generate_templates()
-
- if not in_headless then
- vim.schedule(function()
- require("packer").install()
- -- TODO: add a changelog
- vim.notify("Update complete", vim.log.levels.INFO)
- vim.cmd "LspStart"
- end)
- end
-end
-
-return M
diff --git a/.config/nvim/lua/utils/init.lua b/.config/nvim/lua/utils/init.lua
deleted file mode 100644
index 0d06b1f..0000000
--- a/.config/nvim/lua/utils/init.lua
+++ /dev/null
@@ -1,179 +0,0 @@
-local utils = {}
-local uv = vim.loop
-
--- recursive Print (structure, limit, separator)
-local function r_inspect_settings(structure, limit, separator)
- limit = limit or 100 -- default item limit
- separator = separator or "." -- indent string
- if limit < 1 then
- print "ERROR: Item limit reached."
- return limit - 1
- end
- if structure == nil then
- io.write("-- O", separator:sub(2), " = nil\n")
- return limit - 1
- end
- local ts = type(structure)
-
- if ts == "table" then
- for k, v in pairs(structure) do
- -- replace non alpha keys with ["key"]
- if tostring(k):match "[^%a_]" then
- k = '["' .. tostring(k) .. '"]'
- end
- limit = r_inspect_settings(v, limit, separator .. "." .. tostring(k))
- if limit < 0 then
- break
- end
- end
- return limit
- end
-
- if ts == "string" then
- -- escape sequences
- structure = string.format("%q", structure)
- end
- separator = separator:gsub("%.%[", "%[")
- if type(structure) == "function" then
- -- don't print functions
- io.write("-- options", separator:sub(2), " = function ()\n")
- else
- io.write("options", separator:sub(2), " = ", tostring(structure), "\n")
- end
- return limit - 1
-end
-
-function utils.generate_settings()
- -- Opens a file in append mode
- local file = io.open("lv-settings.lua", "w")
-
- -- sets the default output file as test.lua
- io.output(file)
-
- -- write all `options` related settings to `lv-settings.lua` file
- r_inspect_settings(options, 10000, ".")
-
- -- closes the open file
- io.close(file)
-end
-
-function utils.unrequire(m)
- package.loaded[m] = nil
- _G[m] = nil
-end
-
-function utils.gsub_args(args)
- if args == nil or type(args) ~= "table" then
- return args
- end
- local buffer_filepath = vim.fn.fnameescape(vim.api.nvim_buf_get_name(0))
- for i = 1, #args do
- args[i] = string.gsub(args[i], "${FILEPATH}", buffer_filepath)
- end
- return args
-end
-
---- Returns a table with the default values that are missing.
---- either paramter can be empty.
---@param config (table) table containing entries that take priority over defaults
---@param default_config (table) table contatining default values if found
-function utils.apply_defaults(config, default_config)
- config = config or {}
- default_config = default_config or {}
- local new_config = vim.tbl_deep_extend("keep", vim.empty_dict(), config)
- new_config = vim.tbl_deep_extend("keep", new_config, default_config)
- return new_config
-end
-
---- Checks whether a given path exists and is a file.
---@param path (string) path to check
---@returns (bool)
-function utils.is_file(path)
- local stat = uv.fs_stat(path)
- return stat and stat.type == "file" or false
-end
-
---- Checks whether a given path exists and is a directory
---@param path (string) path to check
---@returns (bool)
-function utils.is_directory(path)
- local stat = uv.fs_stat(path)
- return stat and stat.type == "directory" or false
-end
-
-utils.join_paths = _G.join_paths
-
-function utils.write_file(path, txt, flag)
- uv.fs_open(path, flag, 438, function(open_err, fd)
- assert(not open_err, open_err)
- uv.fs_write(fd, txt, -1, function(write_err)
- assert(not write_err, write_err)
- uv.fs_close(fd, function(close_err)
- assert(not close_err, close_err)
- end)
- end)
- end)
-end
-
-function utils.debounce(ms, fn)
- local timer = vim.loop.new_timer()
- return function(...)
- local argv = { ... }
- timer:start(ms, 0, function()
- timer:stop()
- vim.schedule_wrap(fn)(unpack(argv))
- end)
- end
-end
-
-function utils.search_file(file, args)
- local Job = require "plenary.job"
- local stderr = {}
- local stdout, ret = Job
- :new({
- command = "grep",
- args = { args, file },
- cwd = get_cache_dir(),
- on_stderr = function(_, data)
- table.insert(stderr, data)
- end,
- })
- :sync()
- return stdout, ret, stderr
-end
-
-function utils.file_contains(file, query)
- local stdout, ret, stderr = utils.search_file(file, query)
- if ret == 0 then
- return true
- end
- if not vim.tbl_isempty(stderr) then
- error(vim.inspect(stderr))
- end
- if not vim.tbl_isempty(stdout) then
- error(vim.inspect(stdout))
- end
- return false
-end
-
-function utils.log_contains(query)
- local logfile = require("core.log"):get_path()
- local stdout, ret, stderr = utils.search_file(logfile, query)
- if ret == 0 then
- return true
- end
- if not vim.tbl_isempty(stderr) then
- error(vim.inspect(stderr))
- end
- if not vim.tbl_isempty(stdout) then
- error(vim.inspect(stdout))
- end
- if not vim.tbl_isempty(stderr) then
- error(vim.inspect(stderr))
- end
- return false
-end
-
-return utils
-
--- TODO: find a new home for these autocommands
diff --git a/.config/nvim/lua/utils/table.lua b/.config/nvim/lua/utils/table.lua
deleted file mode 100644
index 1ac5949..0000000
--- a/.config/nvim/lua/utils/table.lua
+++ /dev/null
@@ -1,24 +0,0 @@
-local Table = {}
-
---- Find the first entry for which the predicate returns true.
--- @param t The table
--- @param predicate The function called for each entry of t
--- @return The entry for which the predicate returned True or nil
-function Table.find_first(t, predicate)
- for _, entry in pairs(t) do
- if predicate(entry) then
- return entry
- end
- end
- return nil
-end
-
---- Check if the predicate returns True for at least one entry of the table.
--- @param t The table
--- @param predicate The function called for each entry of t
--- @return True if predicate returned True at least once, false otherwise
-function Table.contains(t, predicate)
- return Table.find_first(t, predicate) ~= nil
-end
-
-return Table
diff --git a/.config/nvim/spell/en.utf-8.add b/.config/nvim/spell/en.utf-8.add
deleted file mode 100644
index a4f2f9c..0000000
--- a/.config/nvim/spell/en.utf-8.add
+++ /dev/null
@@ -1,6 +0,0 @@
-emnist
-json
-num
-np
-#qvae
-#qvae
diff --git a/.config/nvim/spell/en.utf-8.add.spl b/.config/nvim/spell/en.utf-8.add.spl
deleted file mode 100644
index a68894b..0000000
--- a/.config/nvim/spell/en.utf-8.add.spl
+++ /dev/null
Binary files differ