diff options
Diffstat (limited to '.config/nvim')
-rw-r--r-- | .config/nvim/.gitignore | 2 | ||||
-rw-r--r-- | .config/nvim/config.lua | 39 | ||||
-rw-r--r-- | .config/nvim/ftplugin/json.lua | 1 | ||||
-rw-r--r-- | .config/nvim/ftplugin/python.lua | 2 | ||||
-rw-r--r-- | .config/nvim/ftplugin/sh.lua | 1 | ||||
-rw-r--r-- | .config/nvim/init.lua | 5 | ||||
-rw-r--r-- | .config/nvim/lua/bootstrap.lua | 1 | ||||
-rw-r--r-- | .config/nvim/lua/core/dashboard.lua | 2 | ||||
-rw-r--r-- | .config/nvim/lua/core/lualine/styles.lua | 2 | ||||
-rw-r--r-- | .config/nvim/lua/core/which-key.lua | 2 | ||||
-rw-r--r-- | .config/nvim/lua/dark/Treesitter.lua | 8 | ||||
-rw-r--r-- | .config/nvim/lua/extra/json_schemas.lua | 102 | ||||
-rw-r--r-- | .config/nvim/lua/lsp/config.lua | 2 | ||||
-rw-r--r-- | .config/nvim/lua/lsp/init.lua | 29 | ||||
-rw-r--r-- | .config/nvim/lua/lsp/null-ls/init.lua | 5 | ||||
-rw-r--r-- | .config/nvim/lua/lsp/providers/sumneko_lua.lua | 4 |
16 files changed, 73 insertions, 134 deletions
diff --git a/.config/nvim/.gitignore b/.config/nvim/.gitignore index 002933c..009ad45 100644 --- a/.config/nvim/.gitignore +++ b/.config/nvim/.gitignore @@ -10,3 +10,5 @@ wiki/ pack/ lua-language-server/ site/ +package.json +package-lock.json diff --git a/.config/nvim/config.lua b/.config/nvim/config.lua index d1103df..6ff78f0 100644 --- a/.config/nvim/config.lua +++ b/.config/nvim/config.lua @@ -18,9 +18,9 @@ options.builtin.dashboard.active = true options.builtin.terminal.active = true options.builtin.telescope.active = true options.builtin.bufferline.active = true --- options.builtin.nvimtree.active = true options.builtin.lualine.active = true options.builtin.lualine.style = "dark" +options.builtin.dap.active = false -- Whichkey options.builtin.which_key.mappings.l.d = { "<cmd>TroubleToggle<cr>", "Diagnostics" } @@ -59,6 +59,35 @@ options.builtin.treesitter.autotag.enable = false options.builtin.treesitter.playground.enable = false options.builtin.treesitter.indent.disable = { "python" } +-- LSP Linters and formatters +options.lang.json.formatters = { + { + exe = "prettier", + }, +} + +options.lang.lua.formatters = { + { + exe = "stylua", + }, +} + +options.lang.python.formatters = { + { + exe = "black", + }, +} + +options.lang.python.linters = { + { + exe = "flake8", + }, +} + +options.lang.sh.linters = { { exe = "shellcheck", args = { "--sverity", "error" } } } + +-- Extra plugings + options.plugins = { { "folke/trouble.nvim", @@ -89,14 +118,6 @@ options.plugins = { end, }, - -- { - -- "ray-x/lsp_signature.nvim", - -- event = "InsertEnter", - -- config = function() - -- require("extra.lsp_signature").config() - -- end, - -- }, - { "unblevable/quick-scope", config = function() diff --git a/.config/nvim/ftplugin/json.lua b/.config/nvim/ftplugin/json.lua index 9483cd0..53a6790 100644 --- a/.config/nvim/ftplugin/json.lua +++ b/.config/nvim/ftplugin/json.lua @@ -1,6 +1,5 @@ options.lang.json.formatters = { { exe = "prettier", - args = {}, }, } diff --git a/.config/nvim/ftplugin/python.lua b/.config/nvim/ftplugin/python.lua index 81812fc..2ec643d 100644 --- a/.config/nvim/ftplugin/python.lua +++ b/.config/nvim/ftplugin/python.lua @@ -1,13 +1,11 @@ options.lang.python.formatters = { { exe = "black", - args = {}, }, } options.lang.python.linters = { { exe = "flake8", - args = {}, }, } diff --git a/.config/nvim/ftplugin/sh.lua b/.config/nvim/ftplugin/sh.lua new file mode 100644 index 0000000..442273a --- /dev/null +++ b/.config/nvim/ftplugin/sh.lua @@ -0,0 +1 @@ +options.lang.sh.linters = { { exe = "shellcheck", args = { "--sverity", "error" } } } diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua index 042e95b..42af218 100644 --- a/.config/nvim/init.lua +++ b/.config/nvim/init.lua @@ -1,8 +1,5 @@ require("bootstrap"):init() - -local config = require "config" --- config:init() -config:load() +require("config"):load() local plugins = require "plugins" require("plugin-loader"):load { plugins, options.plugins } diff --git a/.config/nvim/lua/bootstrap.lua b/.config/nvim/lua/bootstrap.lua index 20cf26f..03256d7 100644 --- a/.config/nvim/lua/bootstrap.lua +++ b/.config/nvim/lua/bootstrap.lua @@ -6,7 +6,6 @@ local _, hooks = pcall(require, "utils.hooks") ---Join path segments that were passed as input ---@return string function _G.join_paths(...) - local uv = vim.loop local path_sep = "/" local result = table.concat({ ... }, path_sep) return result diff --git a/.config/nvim/lua/core/dashboard.lua b/.config/nvim/lua/core/dashboard.lua index 8df581e..0f27ccf 100644 --- a/.config/nvim/lua/core/dashboard.lua +++ b/.config/nvim/lua/core/dashboard.lua @@ -68,7 +68,7 @@ M.setup = function() vim.g.dashboard_session_directory = options.builtin.dashboard.session_directory local num_plugins_loaded = #vim.fn.globpath( - get_runtime_dir() .. "/site/pack/packer/start", + get_data_dir() .. "/site/pack/packer/start", "*", 0, 1 diff --git a/.config/nvim/lua/core/lualine/styles.lua b/.config/nvim/lua/core/lualine/styles.lua index eb71730..8caf349 100644 --- a/.config/nvim/lua/core/lualine/styles.lua +++ b/.config/nvim/lua/core/lualine/styles.lua @@ -9,7 +9,7 @@ local styles = { } styles.dark = { - style = "lvim", + style = "dark", options = { icons_enabled = true, component_separators = { left = "", right = "" }, diff --git a/.config/nvim/lua/core/which-key.lua b/.config/nvim/lua/core/which-key.lua index ef95ce6..fe38358 100644 --- a/.config/nvim/lua/core/which-key.lua +++ b/.config/nvim/lua/core/which-key.lua @@ -225,8 +225,8 @@ M.config = function() "<cmd>exe 'edit '.stdpath('cache').'/packer.nvim.log'<cr>", "Open the Packer logfile", }, - r = { "<cmd>lua require('utils').reload_config()<cr>", "Reload configurations" }, }, + r = { "<cmd>lua require('utils').reload_config()<cr>", "Reload configurations" }, }, s = { name = "Search", diff --git a/.config/nvim/lua/dark/Treesitter.lua b/.config/nvim/lua/dark/Treesitter.lua index e644b8b..3c2b294 100644 --- a/.config/nvim/lua/dark/Treesitter.lua +++ b/.config/nvim/lua/dark/Treesitter.lua @@ -1,6 +1,6 @@ local Treesitter = { TSComment = { fg = C.gray }, - TSAnnotation = { fg = C.purple }, + TSAnnotation = { fg = C.gray_blue }, TSAttribute = { fg = C.white }, TSConstructor = { fg = C.orange }, TSType = { fg = C.orange }, @@ -20,9 +20,9 @@ local Treesitter = { TSBoolean = { fg = C.blue }, TSCharacter = { fg = C.light_green }, TSError = { fg = C.error_red }, - TSFunction = { fg = C.purple }, - TSFuncBuiltin = { fg = C.purple }, - TSMethod = { fg = C.purple }, + TSFunction = { fg = C.gray_blue }, + TSFuncBuiltin = { fg = C.gray_blue }, + TSMethod = { fg = C.gray_blue }, TSConstMacro = { fg = C.orange }, TSFuncMacro = { fg = C.orange }, TSVariable = { fg = C.white }, diff --git a/.config/nvim/lua/extra/json_schemas.lua b/.config/nvim/lua/extra/json_schemas.lua deleted file mode 100644 index d48d932..0000000 --- a/.config/nvim/lua/extra/json_schemas.lua +++ /dev/null @@ -1,102 +0,0 @@ --- -- https://www.schemastore.org/json/ --- local M = {} - --- M.setup = function() --- local schemas = { --- { --- description = "Package JSON file", --- fileMatch = { "package.json" }, --- url = "https://json.schemastore.org/package.json", --- }, --- { --- description = "TypeScript compiler configuration file", --- fileMatch = { "tsconfig.json", "tsconfig.*.json" }, --- url = "http://json.schemastore.org/tsconfig", --- }, --- { --- description = "Lerna config", --- fileMatch = { "lerna.json" }, --- url = "http://json.schemastore.org/lerna", --- }, --- { --- description = "Babel configuration", --- fileMatch = { ".babelrc.json", ".babelrc", "babel.config.json" }, --- url = "http://json.schemastore.org/lerna", --- }, --- { --- description = "ESLint config", --- fileMatch = { ".eslintrc.json", ".eslintrc" }, --- url = "http://json.schemastore.org/eslintrc", --- }, --- { --- description = "Bucklescript config", --- fileMatch = { "bsconfig.json" }, --- url = "https://bucklescript.github.io/bucklescript/docson/build-schema.json", --- }, --- { --- description = "Prettier config", --- fileMatch = { ".prettierrc", ".prettierrc.json", "prettier.config.json" }, --- url = "http://json.schemastore.org/prettierrc", --- }, --- { --- description = "Vercel Now config", --- fileMatch = { "now.json" }, --- url = "http://json.schemastore.org/now", --- }, --- { --- description = "Stylelint config", --- fileMatch = { ".stylelintrc", ".stylelintrc.json", "stylelint.config.json" }, --- url = "http://json.schemastore.org/stylelintrc", --- }, --- { --- name = "Helm Chart.yaml", --- description = "The Chart.lock file locks dependencies from Chart.yaml", --- fileMatch = { "Chart.lock" }, --- url = "https://json.schemastore.org/chart-lock.json", --- }, --- { --- name = "CircleCI config.yml", --- description = "Schema for CircleCI 2.0 config files", --- fileMatch = { ".circleci/config.yml" }, --- url = "https://json.schemastore.org/circleciconfig.json", --- }, --- { --- name = "yamllint", --- description = "yamllint uses a set of rules to check source files for problems", --- fileMatch = { "**/.yamllint", "**/.yamllint.yaml", "**/.yamllint.yml" }, --- url = "https://json.schemastore.org/yamllint.json", --- }, --- { --- name = "Hadolint", --- description = "A smarter Dockerfile linter that helps you build best practice Docker images.", --- fileMatch = { ".hadolint.yaml", "hadolint.yaml", ".hadolint.yml", "hadolint.yml" }, --- url = "https://raw.githubusercontent.com/hadolint/hadolint/master/contrib/hadolint.json", --- }, --- { --- name = "kustomization.yaml", --- description = "Kubernetes native configuration management", --- fileMatch = { "kustomization.yaml", "kustomization.yml" }, --- url = "https://json.schemastore.org/kustomization.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, --- require("nlspsettings.jsonls").get_default_schemas() --- ) - --- options.lang.json.lsp.setup.settings = { --- json = { --- schemas = extended_schemas, --- }, --- } --- end - --- return M diff --git a/.config/nvim/lua/lsp/config.lua b/.config/nvim/lua/lsp/config.lua index f13d965..9c25249 100644 --- a/.config/nvim/lua/lsp/config.lua +++ b/.config/nvim/lua/lsp/config.lua @@ -1,5 +1,5 @@ return { - templates_dir = join_paths(get_runtime_dir(), "site", "after", "ftplugin"), + templates_dir = join_paths(get_config_dir(), "ftplugin"), diagnostics = { signs = { active = true, diff --git a/.config/nvim/lua/lsp/init.lua b/.config/nvim/lua/lsp/init.lua index f421d99..42c2536 100644 --- a/.config/nvim/lua/lsp/init.lua +++ b/.config/nvim/lua/lsp/init.lua @@ -54,13 +54,22 @@ local function add_lsp_buffer_keybindings(bufnr) return end for mode_name, mode_char in pairs(mappings) do - wk.register(options.lsp.buffer_mappings[mode_name], { mode = mode_char, buffer = bufnr }) + 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 }) + vim.api.nvim_buf_set_keymap( + bufnr, + mode_char, + key, + remap[1], + { noremap = true, silent = true } + ) end end end @@ -94,8 +103,13 @@ local function select_default_formater(client) Log:debug("Checking for formatter overriding for " .. client.name) local client_filetypes = client.config.filetypes or {} for _, filetype in ipairs(client_filetypes) do - if options.lang[filetype] and #vim.tbl_keys(options.lang[filetype].formatters) > 0 then - Log:debug("Formatter overriding detected. Disabling formatting capabilities for " .. client.name) + if + options.lang[filetype] and #vim.tbl_keys(options.lang[filetype].formatters) > 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 @@ -146,7 +160,10 @@ function M.setup() end for _, sign in ipairs(options.lsp.diagnostics.signs.values) do - vim.fn.sign_define(sign.name, { texthl = sign.name, text = sign.text, numhl = sign.name }) + vim.fn.sign_define( + sign.name, + { texthl = sign.name, text = sign.text, numhl = sign.name } + ) end require("lsp.handlers").setup() @@ -154,6 +171,8 @@ function M.setup() 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() diff --git a/.config/nvim/lua/lsp/null-ls/init.lua b/.config/nvim/lua/lsp/null-ls/init.lua index fde9fed..a18209b 100644 --- a/.config/nvim/lua/lsp/null-ls/init.lua +++ b/.config/nvim/lua/lsp/null-ls/init.lua @@ -12,6 +12,11 @@ function M:setup() end 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) for filetype, config in pairs(options.lang) do if not vim.tbl_isempty(config.formatters) then diff --git a/.config/nvim/lua/lsp/providers/sumneko_lua.lua b/.config/nvim/lua/lsp/providers/sumneko_lua.lua index 4fee1fd..25693a9 100644 --- a/.config/nvim/lua/lsp/providers/sumneko_lua.lua +++ b/.config/nvim/lua/lsp/providers/sumneko_lua.lua @@ -2,11 +2,11 @@ local opts = { settings = { Lua = { diagnostics = { - globals = { "vim", "lvim" }, + globals = { "vim", "nvim" }, }, workspace = { library = { - [require("utils").join_paths(get_runtime_dir(), "lvim", "lua")] = true, + [require("utils").join_paths(get_runtime_dir(), "lua")] = true, [vim.fn.expand "$VIMRUNTIME/lua"] = true, [vim.fn.expand "$VIMRUNTIME/lua/vim/lsp"] = true, }, |