summaryrefslogtreecommitdiff
path: root/.config/nvim/lua/config
diff options
context:
space:
mode:
authorGustaf Rydholm <gustaf.rydholm@gmail.com>2022-01-13 19:12:32 +0100
committerGustaf Rydholm <gustaf.rydholm@gmail.com>2022-01-13 19:12:32 +0100
commit73a60f5ee71bb60265ec0c97be7531a5e7605d8c (patch)
treed46283a3d04285c5a5ead92d5bbb3b1fe424b736 /.config/nvim/lua/config
parent19c1942757f07387b95db3ddbc39d9b561d5b51d (diff)
Remove bloat nvim config
Diffstat (limited to '.config/nvim/lua/config')
-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
4 files changed, 0 insertions, 338 deletions
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",
-}