summaryrefslogtreecommitdiff
path: root/.config/nvim/lua/lang
diff options
context:
space:
mode:
authorGustaf Rydholm <gustaf.rydholm@gmail.com>2021-08-10 23:15:04 +0200
committerGustaf Rydholm <gustaf.rydholm@gmail.com>2021-08-10 23:15:04 +0200
commit540268d618627079c9b958a955b586e1888b46a8 (patch)
tree1a22a5feb457135178b9d4fe8b6c1755f5ca66bc /.config/nvim/lua/lang
parente79bd3273f58ba38e8fcd716090b89326791afbb (diff)
Major refactor of nvim
Diffstat (limited to '.config/nvim/lua/lang')
-rw-r--r--.config/nvim/lua/lang/clang.lua156
-rw-r--r--.config/nvim/lua/lang/dart.lua59
-rw-r--r--.config/nvim/lua/lang/dockerfile.lua35
-rw-r--r--.config/nvim/lua/lang/elixir.lua61
-rw-r--r--.config/nvim/lua/lang/go.lua57
-rw-r--r--.config/nvim/lua/lang/graphql.lua31
-rw-r--r--.config/nvim/lua/lang/html.lua47
-rw-r--r--.config/nvim/lua/lang/javascript.lua25
-rw-r--r--.config/nvim/lua/lang/javascriptreact.lua25
-rw-r--r--.config/nvim/lua/lang/json.lua69
-rw-r--r--.config/nvim/lua/lang/kotlin.lua63
-rw-r--r--.config/nvim/lua/lang/lua.lua88
-rw-r--r--.config/nvim/lua/lang/python.lua92
-rw-r--r--.config/nvim/lua/lang/rust.lua152
-rw-r--r--.config/nvim/lua/lang/sh.lua62
-rw-r--r--.config/nvim/lua/lang/swift.lua55
-rw-r--r--.config/nvim/lua/lang/tex.lua159
-rw-r--r--.config/nvim/lua/lang/typescript.lua25
-rw-r--r--.config/nvim/lua/lang/typescriptreact.lua25
-rw-r--r--.config/nvim/lua/lang/vim.lua40
-rw-r--r--.config/nvim/lua/lang/yaml.lua54
-rw-r--r--.config/nvim/lua/lang/zig.lua58
-rw-r--r--.config/nvim/lua/lang/zsh.lua53
23 files changed, 0 insertions, 1491 deletions
diff --git a/.config/nvim/lua/lang/clang.lua b/.config/nvim/lua/lang/clang.lua
deleted file mode 100644
index 702d6f4..0000000
--- a/.config/nvim/lua/lang/clang.lua
+++ /dev/null
@@ -1,156 +0,0 @@
-local M = {}
-
-M.config = function()
- O.lang.clang = {
- diagnostics = {
- virtual_text = { spacing = 0, prefix = "" },
- signs = true,
- underline = true,
- },
- cross_file_rename = true,
- header_insertion = "never",
- filetypes = { "c", "cpp", "objc" },
- formatter = {
- exe = "clang-format",
- args = {},
- stdin = true,
- },
- linters = {
- "cppcheck",
- "clangtidy",
- },
- debug = {
- adapter = {
- command = "/usr/bin/lldb-vscode",
- },
- stop_on_entry = false,
- },
- }
-end
-
-M.format = function()
- local shared_config = {
- function()
- return {
- exe = O.lang.clang.formatter.exe,
- args = O.lang.clang.formatter.args,
- stdin = O.lang.clang.formatter.stdin,
- cwd = vim.fn.expand "%:h:p",
- }
- end,
- }
- O.formatters.filetype["c"] = shared_config
- O.formatters.filetype["cpp"] = shared_config
- O.formatters.filetype["objc"] = shared_config
-
- require("formatter.config").set_defaults {
- logging = false,
- filetype = O.formatters.filetype,
- }
-end
-
-M.lint = function()
- require("lint").linters_by_ft = {
- c = O.lang.clang.linters,
- cpp = O.lang.clang.linters,
- }
-end
-
-M.lsp = function()
- if require("utils").check_lsp_client_active "clangd" then
- return
- end
- local clangd_flags = { "--background-index" }
-
- if O.lang.clang.cross_file_rename then
- table.insert(clangd_flags, "--cross-file-rename")
- end
-
- table.insert(clangd_flags, "--header-insertion=" .. O.lang.clang.header_insertion)
-
- require("lspconfig").clangd.setup {
- cmd = { DATA_PATH .. "/lspinstall/cpp/clangd/bin/clangd", unpack(clangd_flags) },
- on_attach = require("lsp").common_on_attach,
- handlers = {
- ["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, {
- virtual_text = O.lang.clang.diagnostics.virtual_text,
- signs = O.lang.clang.diagnostics.signs,
- underline = O.lang.clang.diagnostics.underline,
- update_in_insert = true,
- }),
- },
- }
-end
-
-M.dap = function()
- if O.plugin.dap.active then
- local dap_install = require "dap-install"
- local dap = require "dap"
- dap_install.config("ccppr_vsc_dbg", {})
- dap.adapters.lldb = {
- type = "executable",
- command = O.lang.clang.debug.adapter.command,
- name = "lldb",
- }
- local shared_dap_config = {
- {
- name = "Launch",
- type = "lldb",
- request = "launch",
- program = function()
- return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/", "file")
- end,
- cwd = "${workspaceFolder}",
- stopOnEntry = O.lang.clang.debug.stop_on_entry,
- args = {},
- env = function()
- local variables = {}
- for k, v in pairs(vim.fn.environ()) do
- table.insert(variables, string.format("%s=%s", k, v))
- end
- return variables
- end,
- runInTerminal = false,
- },
- {
- -- If you get an "Operation not permitted" error using this, try disabling YAMA:
- -- echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope
- name = "Attach to process",
- type = "lldb", -- Adjust this to match your adapter name (`dap.adapters.<name>`)
- request = "attach",
- pid = function()
- local output = vim.fn.system { "ps", "a" }
- local lines = vim.split(output, "\n")
- local procs = {}
- for _, line in pairs(lines) do
- -- output format
- -- " 107021 pts/4 Ss 0:00 /bin/zsh <args>"
- local parts = vim.fn.split(vim.fn.trim(line), " \\+")
- local pid = parts[1]
- local name = table.concat({ unpack(parts, 5) }, " ")
- if pid and pid ~= "PID" then
- pid = tonumber(pid)
- if pid ~= vim.fn.getpid() then
- table.insert(procs, { pid = tonumber(pid), name = name })
- end
- end
- end
- local choices = { "Select process" }
- for i, proc in ipairs(procs) do
- table.insert(choices, string.format("%d: pid=%d name=%s", i, proc.pid, proc.name))
- end
- local choice = vim.fn.inputlist(choices)
- if choice < 1 or choice > #procs then
- return nil
- end
- return procs[choice].pid
- end,
- args = {},
- },
- }
- dap.configurations.c = shared_dap_config
- dap.configurations.cpp = shared_dap_config
- end
-end
-
-return M
diff --git a/.config/nvim/lua/lang/dart.lua b/.config/nvim/lua/lang/dart.lua
deleted file mode 100644
index 2ed5c33..0000000
--- a/.config/nvim/lua/lang/dart.lua
+++ /dev/null
@@ -1,59 +0,0 @@
-local M = {}
-
-M.config = function()
- O.lang.dart = {
- sdk_path = "/usr/lib/dart/bin/snapshots/analysis_server.dart.snapshot",
- formatter = {
- exe = "dart",
- args = { "format" },
- stdin = true,
- },
- }
-end
-
-M.format = function()
- O.formatters.filetype["dart"] = {
- function()
- return {
- exe = O.lang.dart.formatter.exe,
- args = O.lang.dart.formatter.args,
- stdin = O.lang.dart.formatter.stdin,
- }
- end,
- }
-
- require("formatter.config").set_defaults {
- logging = false,
- filetype = O.formatters.filetype,
- }
-end
-
-M.lint = function()
- -- TODO: implement linters (if applicable)
- return "No linters configured!"
-end
-
-M.lsp = function()
- if require("utils").check_lsp_client_active "dartls" then
- return
- end
-
- require("lspconfig").dartls.setup {
- cmd = { "dart", O.lang.dart.sdk_path, "--lsp" },
- on_attach = require("lsp").common_on_attach,
- init_options = {
- closingLabels = false,
- flutterOutline = false,
- onlyAnalyzeProjectsWithOpenFiles = false,
- outline = false,
- suggestFromUnimportedLibraries = true,
- },
- }
-end
-
-M.dap = function()
- -- TODO: implement dap
- return "No DAP configured!"
-end
-
-return M
diff --git a/.config/nvim/lua/lang/dockerfile.lua b/.config/nvim/lua/lang/dockerfile.lua
deleted file mode 100644
index 0009c30..0000000
--- a/.config/nvim/lua/lang/dockerfile.lua
+++ /dev/null
@@ -1,35 +0,0 @@
-local M = {}
-
-M.config = function()
- O.lang.docker = {}
-end
-
-M.format = function()
- -- TODO: implement formatter for language
- return "No formatter available!"
-end
-
-M.lint = function()
- -- TODO: implement linters (if applicable)
- return "No linters configured!"
-end
-
-M.lsp = function()
- if require("utils").check_lsp_client_active "dockerls" then
- return
- end
-
- -- npm install -g dockerfile-language-server-nodejs
- require("lspconfig").dockerls.setup {
- cmd = { DATA_PATH .. "/lspinstall/dockerfile/node_modules/.bin/docker-langserver", "--stdio" },
- on_attach = require("lsp").common_on_attach,
- root_dir = vim.loop.cwd,
- }
-end
-
-M.dap = function()
- -- TODO: implement dap
- return "No DAP configured!"
-end
-
-return M
diff --git a/.config/nvim/lua/lang/elixir.lua b/.config/nvim/lua/lang/elixir.lua
deleted file mode 100644
index 0959809..0000000
--- a/.config/nvim/lua/lang/elixir.lua
+++ /dev/null
@@ -1,61 +0,0 @@
-local M = {}
-
-M.config = function()
- O.lang.elixir = {
- formatter = {
- exe = "mix",
- args = { "format" },
- stdin = true,
- },
- lsp = {
- path = DATA_PATH .. "/lspinstall/elixir/elixir-ls/language_server.sh",
- },
- }
-end
-
-M.format = function()
- O.formatters.filetype["elixir"] = {
- function()
- return {
- exe = O.lang.elixir.formatter.exe,
- args = O.lang.elixir.formatter.args,
- stdin = O.lang.elixir.formatter.stdin,
- }
- end,
- }
-
- require("formatter.config").set_defaults {
- logging = false,
- filetype = O.formatters.filetype,
- }
-end
-
-M.lint = function()
- -- TODO: implement linters (if applicable)
- return "No linters configured!"
-end
-
-M.lsp = function()
- if require("utils").check_lsp_client_active "elixirls" then
- return
- end
-
- require("lspconfig").elixirls.setup {
- cmd = { O.lang.elixir.lsp.path },
- on_attach = require("lsp").common_on_attach,
- }
-end
-
-M.dap = function()
- -- TODO: implement dap
- return "No DAP configured!"
-end
-
--- needed for the LSP to recognize elixir files (alternativly just use elixir-editors/vim-elixir)
--- vim.cmd [[
--- au BufRead,BufNewFile *.ex,*.exs set filetype=elixir
--- au BufRead,BufNewFile *.eex,*.leex,*.sface set filetype=eelixir
--- au BufRead,BufNewFile mix.lock set filetype=elixir
--- ]]
-
-return M
diff --git a/.config/nvim/lua/lang/go.lua b/.config/nvim/lua/lang/go.lua
deleted file mode 100644
index 880e56d..0000000
--- a/.config/nvim/lua/lang/go.lua
+++ /dev/null
@@ -1,57 +0,0 @@
-local M = {}
-
-M.config = function()
- O.lang.go = {
- formatter = {
- exe = "gofmt",
- args = {},
- stdin = true,
- },
- linters = {
- "golangcilint",
- "revive",
- },
- }
-end
-
-M.format = function()
- O.formatters.filetype["go"] = {
- function()
- return {
- exe = O.lang.go.formatter.exe,
- args = O.lang.go.formatter.args,
- stdin = O.lang.go.formatter.stdin,
- }
- end,
- }
-
- require("formatter.config").set_defaults {
- logging = false,
- filetype = O.formatters.filetype,
- }
-end
-
-M.lint = function()
- require("lint").linters_by_ft = {
- go = O.lang.go.linters,
- }
-end
-
-M.lsp = function()
- if not require("utils").check_lsp_client_active "gopls" then
- require("lspconfig").gopls.setup {
- cmd = { DATA_PATH .. "/lspinstall/go/gopls" },
- settings = { gopls = { analyses = { unusedparams = true }, staticcheck = true } },
- root_dir = require("lspconfig").util.root_pattern(".git", "go.mod"),
- init_options = { usePlaceholders = true, completeUnimported = true },
- on_attach = require("lsp").common_on_attach,
- }
- end
-end
-
-M.dap = function()
- -- TODO: implement dap
- return "No DAP configured!"
-end
-
-return M
diff --git a/.config/nvim/lua/lang/graphql.lua b/.config/nvim/lua/lang/graphql.lua
deleted file mode 100644
index a3425a0..0000000
--- a/.config/nvim/lua/lang/graphql.lua
+++ /dev/null
@@ -1,31 +0,0 @@
-local M = {}
-
-M.config = function()
- O.lang.graphql = {}
-end
-
-M.format = function()
- -- TODO: implement formatter for language
- return "No formatter available!"
-end
-
-M.lint = function()
- -- TODO: implement linters (if applicable)
- return "No linters configured!"
-end
-
-M.lsp = function()
- if require("utils").check_lsp_client_active "graphql" then
- return
- end
-
- -- npm install -g graphql-language-service-cli
- require("lspconfig").graphql.setup { on_attach = require("lsp").common_on_attach }
-end
-
-M.dap = function()
- -- TODO: implement dap
- return "No DAP configured!"
-end
-
-return M
diff --git a/.config/nvim/lua/lang/html.lua b/.config/nvim/lua/lang/html.lua
deleted file mode 100644
index d5a02b6..0000000
--- a/.config/nvim/lua/lang/html.lua
+++ /dev/null
@@ -1,47 +0,0 @@
-local M = {}
-
-M.config = function()
- O.lang.html = {
- linters = {
- "tidy",
- -- https://docs.errata.ai/vale/scoping#html
- "vale",
- },
- }
-end
-
-M.format = function()
- -- TODO: implement formatters (if applicable)
- return "No formatters configured!"
-end
-
-M.lint = function()
- require("lint").linters_by_ft = {
- html = O.lang.html.linters,
- }
-end
-
-M.lsp = function()
- if not require("utils").check_lsp_client_active "html" then
- -- npm install -g vscode-html-languageserver-bin
- local capabilities = vim.lsp.protocol.make_client_capabilities()
- capabilities.textDocument.completion.completionItem.snippetSupport = true
-
- require("lspconfig").html.setup {
- cmd = {
- "node",
- DATA_PATH .. "/lspinstall/html/vscode-html/html-language-features/server/dist/node/htmlServerMain.js",
- "--stdio",
- },
- on_attach = require("lsp").common_on_attach,
- capabilities = capabilities,
- }
- end
-end
-
-M.dap = function()
- -- TODO: implement dap
- return "No DAP configured!"
-end
-
-return M
diff --git a/.config/nvim/lua/lang/javascript.lua b/.config/nvim/lua/lang/javascript.lua
deleted file mode 100644
index 178c6f5..0000000
--- a/.config/nvim/lua/lang/javascript.lua
+++ /dev/null
@@ -1,25 +0,0 @@
-local M = {}
-
-M.config = function()
- -- TODO: implement config for language
- return "No config available!"
-end
-
-M.format = function()
- -- TODO: implement formatter for language
- return "No formatter available!"
-end
-
-M.lint = function()
- -- TODO: implement linters (if applicable)
- return "No linters configured!"
-end
-
-M.lsp = function() end
-
-M.dap = function()
- -- TODO: implement dap
- return "No DAP configured!"
-end
-
-return M
diff --git a/.config/nvim/lua/lang/javascriptreact.lua b/.config/nvim/lua/lang/javascriptreact.lua
deleted file mode 100644
index 178c6f5..0000000
--- a/.config/nvim/lua/lang/javascriptreact.lua
+++ /dev/null
@@ -1,25 +0,0 @@
-local M = {}
-
-M.config = function()
- -- TODO: implement config for language
- return "No config available!"
-end
-
-M.format = function()
- -- TODO: implement formatter for language
- return "No formatter available!"
-end
-
-M.lint = function()
- -- TODO: implement linters (if applicable)
- return "No linters configured!"
-end
-
-M.lsp = function() end
-
-M.dap = function()
- -- TODO: implement dap
- return "No DAP configured!"
-end
-
-return M
diff --git a/.config/nvim/lua/lang/json.lua b/.config/nvim/lua/lang/json.lua
deleted file mode 100644
index 78bf669..0000000
--- a/.config/nvim/lua/lang/json.lua
+++ /dev/null
@@ -1,69 +0,0 @@
-local M = {}
-
-M.config = function()
- O.lang.json = {
- diagnostics = {
- virtual_text = { spacing = 0, prefix = "" },
- signs = true,
- underline = true,
- },
- formatter = {
- exe = "python",
- args = { "-m", "json.tool" },
- stdin = true,
- },
- }
-end
-
-M.format = function()
- O.formatters.filetype["json"] = {
- function()
- return {
- exe = O.lang.json.formatter.exe,
- args = O.lang.json.formatter.args,
- stdin = O.lang.json.formatter.stdin,
- }
- end,
- }
-
- require("formatter.config").set_defaults {
- logging = false,
- filetype = O.formatters.filetype,
- }
-end
-
-M.lint = function()
- -- TODO: implement linters (if applicable)
- return "No linters configured!"
-end
-
-M.lsp = function()
- if require("utils").check_lsp_client_active "jsonls" then
- return
- end
-
- -- npm install -g vscode-json-languageserver
- require("lspconfig").jsonls.setup {
- cmd = {
- "node",
- DATA_PATH .. "/lspinstall/json/vscode-json/json-language-features/server/dist/node/jsonServerMain.js",
- "--stdio",
- },
- on_attach = require("lsp").common_on_attach,
-
- commands = {
- Format = {
- function()
- vim.lsp.buf.range_formatting({}, { 0, 0 }, { vim.fn.line "$", 0 })
- end,
- },
- },
- }
-end
-
-M.dap = function()
- -- TODO: implement dap
- return "No DAP configured!"
-end
-
-return M
diff --git a/.config/nvim/lua/lang/kotlin.lua b/.config/nvim/lua/lang/kotlin.lua
deleted file mode 100644
index 3fe1dc9..0000000
--- a/.config/nvim/lua/lang/kotlin.lua
+++ /dev/null
@@ -1,63 +0,0 @@
-local M = {}
-
-M.config = function()
- O.lang.kotlin = {}
-end
-
-M.format = function()
- -- TODO: implement formatter for language
- return "No formatter available!"
-end
-
-M.lint = function()
- -- TODO: implement linters (if applicable)
- return "No linters configured!"
-end
-
-M.lsp = function()
- if require("utils").check_lsp_client_active "kotlin_language_server" then
- return
- end
-
- --- default config for gradle-projects of the
- --- kotlin-language-server: https://github.com/fwcd/kotlin-language-server
- ---
- --- This server requires vim to be aware of the kotlin-filetype.
- --- You could refer for this capability to:
- --- https://github.com/udalov/kotlin-vim (recommended)
- --- Note that there is no LICENSE specified yet.
-
- local util = require "lspconfig/util"
-
- local bin_name = DATA_PATH .. "/lspinstall/kotlin/server/bin/kotlin-language-server"
- if vim.fn.has "win32" == 1 then
- bin_name = bin_name .. ".bat"
- end
-
- local root_files = {
- "settings.gradle", -- Gradle (multi-project)
- "settings.gradle.kts", -- Gradle (multi-project)
- "build.xml", -- Ant
- "pom.xml", -- Maven
- }
-
- local fallback_root_files = {
- "build.gradle", -- Gradle
- "build.gradle.kts", -- Gradle
- }
-
- require("lspconfig").kotlin_language_server.setup {
- cmd = { bin_name },
- on_attach = require("lsp").common_on_attach,
- root_dir = function(fname)
- return util.root_pattern(unpack(root_files))(fname) or util.root_pattern(unpack(fallback_root_files))(fname)
- end,
- }
-end
-
-M.dap = function()
- -- TODO: implement dap
- return "No DAP configured!"
-end
-
-return M
diff --git a/.config/nvim/lua/lang/lua.lua b/.config/nvim/lua/lang/lua.lua
deleted file mode 100644
index c7305d0..0000000
--- a/.config/nvim/lua/lang/lua.lua
+++ /dev/null
@@ -1,88 +0,0 @@
-
-local M = {}
-
-M.config = function()
- O.lang.lua = {
- diagnostics = {
- virtual_text = { spacing = 0, prefix = "" },
- signs = true,
- underline = true,
- },
- formatter = {
- exe = "stylua",
- args = {},
- stdin = false,
- },
- linters = { "luacheck" },
- lsp = {
- path = DATA_PATH .. "/lspinstall/lua/sumneko-lua-language-server",
- },
- }
-end
-
-M.format = function()
- O.formatters.filetype["lua"] = {
- function()
- return {
- exe = O.lang.lua.formatter.exe,
- args = O.lang.lua.formatter.args,
- stdin = O.lang.lua.formatter.stdin,
- tempfile_prefix = ".formatter",
- }
- end,
- }
-
- require("formatter.config").set_defaults {
- logging = false,
- filetype = O.formatters.filetype,
- }
-end
-
-M.lint = function()
- require("lint").linters_by_ft = {
- lua = O.lang.lua.linters,
- }
-end
-
-M.lsp = function()
- if not require("utils").check_lsp_client_active "sumneko_lua" then
- -- https://github.com/sumneko/lua-language-server/wiki/Build-and-Run-(Standalone)
- local sumneko_root_path = DATA_PATH .. "/lspinstall/lua"
- local sumneko_binary = sumneko_root_path .. "/sumneko-lua-language-server"
-
- require("lspconfig").sumneko_lua.setup {
- cmd = { sumneko_binary, "-E", sumneko_root_path .. "/main.lua" },
- on_attach = require("lsp").common_on_attach,
- settings = {
- Lua = {
- runtime = {
- -- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim)
- version = "LuaJIT",
- -- Setup your lua path
- path = vim.split(package.path, ";"),
- },
- diagnostics = {
- -- Get the language server to recognize the `vim` global
- globals = { "vim", "O" },
- },
- workspace = {
- -- Make the server aware of Neovim runtime files
- library = {
- [vim.fn.expand "$VIMRUNTIME/lua"] = true,
- [vim.fn.expand "$VIMRUNTIME/lua/vim/lsp"] = true,
- },
- maxPreload = 100000,
- preloadFileSize = 1000,
- },
- },
- },
- }
- end
-end
-
-M.dap = function()
- -- TODO: implement dap
- return "No DAP configured!"
-end
-
-return M
diff --git a/.config/nvim/lua/lang/python.lua b/.config/nvim/lua/lang/python.lua
deleted file mode 100644
index b421e82..0000000
--- a/.config/nvim/lua/lang/python.lua
+++ /dev/null
@@ -1,92 +0,0 @@
-local M = {}
-
-M.config = function()
- O.lang.python = {
- -- @usage can be flake8 or yapf
- linter = "",
- isort = false,
- diagnostics = {
- virtual_text = { spacing = 0, prefix = "" },
- signs = true,
- underline = true,
- },
- analysis = {
- type_checking = "basic",
- auto_search_paths = true,
- use_library_code_types = true,
- },
- formatter = {
- exe = "yapf",
- args = {},
- stdin = true,
- },
- linters = {
- "flake8",
- "pylint",
- "mypy",
- },
- }
-end
-
-M.format = function()
- O.formatters.filetype["python"] = {
- function()
- return {
- exe = O.lang.python.formatter.exe,
- args = O.lang.python.formatter.args,
- stdin = O.lang.python.formatter.stdin,
- }
- end,
- }
-
- require("formatter.config").set_defaults {
- logging = false,
- filetype = O.formatters.filetype,
- }
-end
-
-M.lint = function()
- require("lint").linters_by_ft = {
- python = O.lang.python.linters,
- }
-end
-
-M.lsp = function()
- if require("utils").check_lsp_client_active "pyright" then
- return
- end
- -- npm i -g pyright
- require("lspconfig").pyright.setup {
- cmd = {
- DATA_PATH .. "/lspinstall/python/node_modules/.bin/pyright-langserver",
- "--stdio",
- },
- on_attach = require("lsp").common_on_attach,
- handlers = {
- ["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, {
- virtual_text = O.lang.python.diagnostics.virtual_text,
- signs = O.lang.python.diagnostics.signs,
- underline = O.lang.python.diagnostics.underline,
- update_in_insert = true,
- }),
- },
- settings = {
- python = {
- analysis = {
- typeCheckingMode = O.lang.python.analysis.type_checking,
- autoSearchPaths = O.lang.python.analysis.auto_search_paths,
- useLibraryCodeForTypes = O.lang.python.analysis.use_library_code_types,
- },
- },
- },
- }
-end
-
-M.dap = function()
- if O.plugin.dap.active then
- local dap_install = require "dap-install"
- dap_install.config("python_dbg", {})
- end
-end
-
-return M
diff --git a/.config/nvim/lua/lang/rust.lua b/.config/nvim/lua/lang/rust.lua
deleted file mode 100644
index 8726059..0000000
--- a/.config/nvim/lua/lang/rust.lua
+++ /dev/null
@@ -1,152 +0,0 @@
-local M = {}
-
-M.config = function()
- O.lang.rust = {
- rust_tools = {
- active = false,
- parameter_hints_prefix = "<-",
- other_hints_prefix = "=>", -- prefix for all the other hints (type, chaining)
- },
- -- @usage can be clippy
- formatter = {
- exe = "rustfmt",
- args = { "--emit=stdout", "--edition=2018" },
- stdin = true,
- },
- linter = "",
- diagnostics = {
- virtual_text = { spacing = 0, prefix = "" },
- signs = true,
- underline = true,
- },
- }
-end
-
-M.format = function()
- O.formatters.filetype["rust"] = {
- function()
- return {
- exe = O.lang.rust.formatter.exe,
- args = O.lang.rust.formatter.args,
- stdin = O.lang.rust.formatter.stdin,
- }
- end,
- }
-
- require("formatter.config").set_defaults {
- logging = false,
- filetype = O.formatters.filetype,
- }
-end
-
-M.lint = function()
- -- TODO: implement linters (if applicable)
- return "No linters configured!"
-end
-
-M.lsp = function()
- if require("utils").check_lsp_client_active "rust_analyzer" then
- return
- end
-
- if O.lang.rust.rust_tools.active then
- local opts = {
- tools = { -- rust-tools options
- -- automatically set inlay hints (type hints)
- -- There is an issue due to which the hints are not applied on the first
- -- opened file. For now, write to the file to trigger a reapplication of
- -- the hints or just run :RustSetInlayHints.
- -- default: true
- autoSetHints = true,
-
- -- whether to show hover actions inside the hover window
- -- this overrides the default hover handler
- -- default: true
- hover_with_actions = true,
-
- runnables = {
- -- whether to use telescope for selection menu or not
- -- default: true
- use_telescope = true,
-
- -- rest of the opts are forwarded to telescope
- },
-
- inlay_hints = {
- -- wheter to show parameter hints with the inlay hints or not
- -- default: true
- show_parameter_hints = true,
-
- -- prefix for parameter hints
- -- default: "<-"
- parameter_hints_prefix = O.lang.rust.rust_tools.parameter_hints_prefix,
-
- -- prefix for all the other hints (type, chaining)
- -- default: "=>"
- other_hints_prefix = O.lang.rust.rust_tools.other_hints_prefix,
-
- -- whether to align to the lenght of the longest line in the file
- max_len_align = false,
-
- -- padding from the left if max_len_align is true
- max_len_align_padding = 1,
-
- -- whether to align to the extreme right or not
- right_align = false,
-
- -- padding from the right if right_align is true
- right_align_padding = 7,
- },
-
- hover_actions = {
- -- the border that is used for the hover window
- -- see vim.api.nvim_open_win()
- border = {
- { "╭", "FloatBorder" },
- { "─", "FloatBorder" },
- { "╮", "FloatBorder" },
- { "│", "FloatBorder" },
- { "╯", "FloatBorder" },
- { "─", "FloatBorder" },
- { "╰", "FloatBorder" },
- { "│", "FloatBorder" },
- },
- },
- },
-
- -- all the opts to send to nvim-lspconfig
- -- these override the defaults set by rust-tools.nvim
- -- see https://github.com/neovim/nvim-lspconfig/blob/master/CONFIG.md#rust_analyzer
- server = {
- cmd = { DATA_PATH .. "/lspinstall/rust/rust-analyzer" },
- on_attach = require("lsp").common_on_attach,
- }, -- rust-analyser options
- }
- require("rust-tools").setup(opts)
- else
- require("lspconfig").rust_analyzer.setup {
- cmd = { DATA_PATH .. "/lspinstall/rust/rust-analyzer" },
- on_attach = require("lsp").common_on_attach,
- filetypes = { "rust" },
- root_dir = require("lspconfig.util").root_pattern("Cargo.toml", "rust-project.json"),
- }
- end
-
- -- TODO: fix these mappings
- vim.api.nvim_exec(
- [[
- autocmd Filetype rust nnoremap <leader>lm <Cmd>RustExpandMacro<CR>
- autocmd Filetype rust nnoremap <leader>lH <Cmd>RustToggleInlayHints<CR>
- autocmd Filetype rust nnoremap <leader>le <Cmd>RustRunnables<CR>
- autocmd Filetype rust nnoremap <leader>lh <Cmd>RustHoverActions<CR>
- ]],
- true
- )
-end
-
-M.dap = function()
- -- TODO: implement dap
- return "No DAP configured!"
-end
-
-return M
diff --git a/.config/nvim/lua/lang/sh.lua b/.config/nvim/lua/lang/sh.lua
deleted file mode 100644
index 2301e44..0000000
--- a/.config/nvim/lua/lang/sh.lua
+++ /dev/null
@@ -1,62 +0,0 @@
-local M = {}
-
-M.config = function()
- O.lang.sh = {
- -- @usage can be 'shellcheck'
- linter = "",
- -- @usage can be 'shfmt'
- diagnostics = {
- virtual_text = { spacing = 0, prefix = "" },
- signs = true,
- underline = true,
- },
- formatter = {
- exe = "shfmt",
- args = { "-w" },
- stdin = false,
- },
- linters = { "shellcheck" },
- }
-end
-
-M.format = function()
- O.formatters.filetype["sh"] = {
- function()
- return {
- exe = O.lang.sh.formatter.exe,
- args = O.lang.sh.formatter.args,
- stdin = O.lang.sh.formatter.stdin,
- tempfile_prefix = ".formatter",
- }
- end,
- }
-
- require("formatter.config").set_defaults {
- logging = false,
- filetype = O.formatters.filetype,
- }
-end
-
-M.lint = function()
- require("lint").linters_by_ft = {
- sh = O.lang.sh.linters,
- }
-end
-
-M.lsp = function()
- if not require("utils").check_lsp_client_active "bashls" then
- -- npm i -g bash-language-server
- require("lspconfig").bashls.setup {
- cmd = { DATA_PATH .. "/lspinstall/bash/node_modules/.bin/bash-language-server", "start" },
- on_attach = require("lsp").common_on_attach,
- filetypes = { "sh", "zsh" },
- }
- end
-end
-
-M.dap = function()
- -- TODO: implement dap
- return "No DAP configured!"
-end
-
-return M
diff --git a/.config/nvim/lua/lang/swift.lua b/.config/nvim/lua/lang/swift.lua
deleted file mode 100644
index 25c13f9..0000000
--- a/.config/nvim/lua/lang/swift.lua
+++ /dev/null
@@ -1,55 +0,0 @@
-local M = {}
-
-M.config = function()
- O.lang.swift = {
- formatter = {
- exe = "swiftformat",
- args = {},
- stdin = true,
- },
- lsp = {
- path = "sourcekit-lsp",
- },
- }
-end
-
-M.format = function()
- -- TODO: implement formatter (if applicable)
- return "No formatter configured!"
-end
-
-M.lint = function()
- O.formatters.filetype["swift"] = {
- function()
- return {
- exe = O.lang.swift.formatter.exe,
- args = O.lang.swift.formatter.args,
- stdin = O.lang.swift.formatter.stdin,
- }
- end,
- }
-
- require("formatter.config").set_defaults {
- logging = false,
- filetype = O.formatters.filetype,
- }
-end
-
-M.lsp = function()
- if require("utils").check_lsp_client_active "sourcekit" then
- return
- end
-
- require("lspconfig").sourcekit.setup {
- cmd = { "xcrun", O.lang.swift.lsp.path },
- on_attach = require("lsp").common_on_attach,
- filetypes = { "swift" },
- }
-end
-
-M.dap = function()
- -- TODO: implement dap
- return "No DAP configured!"
-end
-
-return M
diff --git a/.config/nvim/lua/lang/tex.lua b/.config/nvim/lua/lang/tex.lua
deleted file mode 100644
index 9ebf05f..0000000
--- a/.config/nvim/lua/lang/tex.lua
+++ /dev/null
@@ -1,159 +0,0 @@
-local M = {}
-
-M.config = function()
- O.lang.latex = {
- filetypes = { "tex", "bib" },
- aux_directory = nil,
- bibtex_formatter = "texlab",
- diagnostics_delay = 300,
- formatter_line_length = 80,
- latex_formatter = "latexindent",
- lsp = {
- path = DATA_PATH .. "/lspinstall/latex/texlab",
- },
- build = {
- executable = "latexmk",
- args = { "-pdf", "-interaction=nonstopmode", "-synctex=1", "%f" },
- on_save = false,
- forward_search_after = false,
- },
- chktex = {
- on_open_and_save = false,
- on_edit = false,
- },
- forward_search = {
- executable = nil,
- args = {},
- },
- latexindent = {
- ["local"] = nil,
- modify_line_breaks = false,
- },
- diagnostics = {
- virtual_text = { spacing = 0, prefix = "" },
- signs = true,
- underline = true,
- },
- linters = { "chktex" },
- auto_save = false,
- ignore_errors = {},
- }
-end
-
-M.format = function()
- -- TODO: implement formatter for language
- return "No formatter available!"
-end
-
-M.lint = function()
- require("lint").linters_by_ft = {
- tex = O.lang.latex.linters,
- }
-end
-
-M.lsp = function()
- if require("utils").check_lsp_client_active "texlab" then
- return
- end
-
- local preview_settings = {}
-
- local sumatrapdf_args = { "-reuse-instance", "%p", "-forward-search", "%f", "%l" }
- local evince_args = { "-f", "%l", "%p", '"code -g %f:%l"' }
- local okular_args = { "--unique", "file:%p#src:%l%f" }
- local zathura_args = { "--synctex-forward", "%l:1:%f", "%p" }
- local qpdfview_args = { "--unique", "%p#src:%f:%l:1" }
- local skim_args = { "%l", "%p", "%f" }
-
- if O.lang.latex.forward_search.executable == "C:/Users/{User}/AppData/Local/SumatraPDF/SumatraPDF.exe" then
- preview_settings = sumatrapdf_args
- elseif O.lang.latex.forward_search.executable == "evince-synctex" then
- preview_settings = evince_args
- elseif O.lang.latex.forward_search.executable == "okular" then
- preview_settings = okular_args
- elseif O.lang.latex.forward_search.executable == "zathura" then
- preview_settings = zathura_args
- elseif O.lang.latex.forward_search.executable == "qpdfview" then
- preview_settings = qpdfview_args
- elseif O.lang.latex.forward_search.executable == "/Applications/Skim.app/Contents/SharedSupport/displayline" then
- preview_settings = skim_args
- end
-
- require("lspconfig").texlab.setup {
- cmd = { O.lang.latex.lsp.path },
- on_attach = require("lsp").common_on_attach,
- handlers = {
- ["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, {
- virtual_text = O.lang.latex.diagnostics.virtual_text,
- signs = O.lang.latex.diagnostics.signs,
- underline = O.lang.latex.diagnostics.underline,
- update_in_insert = true,
- }),
- },
- filetypes = { "tex", "bib" },
- settings = {
- texlab = {
- auxDirectory = O.lang.latex.aux_directory,
- bibtexFormatter = O.lang.latex.bibtex_formatter,
- build = {
- args = O.lang.latex.build.args,
- executable = O.lang.latex.build.executable,
- forwardSearchAfter = O.lang.latex.build.forward_search_after,
- onSave = O.lang.latex.build.on_save,
- },
- chktex = {
- onEdit = O.lang.latex.chktex.on_edit,
- onOpenAndSave = O.lang.latex.chktex.on_open_and_save,
- },
- diagnosticsDelay = O.lang.latex.diagnostics_delay,
- formatterLineLength = O.lang.latex.formatter_line_length,
- forwardSearch = {
- args = preview_settings,
- executable = O.lang.latex.forward_search.executable,
- },
- latexFormatter = O.lang.latex.latex_formatter,
- latexindent = {
- modifyLineBreaks = O.lang.latex.latexindent.modify_line_breaks,
- },
- },
- },
- }
- vim.g.vimtex_compiler_method = "latexmk"
- vim.g.vimtex_view_method = "zathura"
- vim.g.vimtex_fold_enabled = 0
- vim.g.vimtex_quickfix_ignore_filters = O.lang.latex.ignore_errors
-
- O.plugin.which_key.mappings["t"] = {
- name = "+Latex",
- c = { "<cmd>VimtexCompile<cr>", "Toggle Compilation Mode" },
- f = { "<cmd>call vimtex#fzf#run()<cr>", "Fzf Find" },
- i = { "<cmd>VimtexInfo<cr>", "Project Information" },
- s = { "<cmd>VimtexStop<cr>", "Stop Project Compilation" },
- t = { "<cmd>VimtexTocToggle<cr>", "Toggle Table Of Content" },
- v = { "<cmd>VimtexView<cr>", "View PDF" },
- b = { "<cmd>TexlabBuild<cr>", "Build with Texlab" },
- p = { "<cmd>TexlabForward<cr>", "Preview with Texlab" },
- }
-
- -- Compile on initialization, cleanup on quit
- vim.api.nvim_exec(
- [[
- augroup vimtex_event_1
- au!
- au User VimtexEventQuit call vimtex#compiler#clean(0)
- au User VimtexEventInitPost call vimtex#compiler#compile()
- augroup END
- ]],
- false
- )
- if O.lang.latex.auto_save then
- vim.api.nvim_exec([[au FocusLost * :wa]], false)
- end
-end
-
-M.dap = function()
- -- TODO: implement dap
- return "No DAP configured!"
-end
-
-return M
diff --git a/.config/nvim/lua/lang/typescript.lua b/.config/nvim/lua/lang/typescript.lua
deleted file mode 100644
index 178c6f5..0000000
--- a/.config/nvim/lua/lang/typescript.lua
+++ /dev/null
@@ -1,25 +0,0 @@
-local M = {}
-
-M.config = function()
- -- TODO: implement config for language
- return "No config available!"
-end
-
-M.format = function()
- -- TODO: implement formatter for language
- return "No formatter available!"
-end
-
-M.lint = function()
- -- TODO: implement linters (if applicable)
- return "No linters configured!"
-end
-
-M.lsp = function() end
-
-M.dap = function()
- -- TODO: implement dap
- return "No DAP configured!"
-end
-
-return M
diff --git a/.config/nvim/lua/lang/typescriptreact.lua b/.config/nvim/lua/lang/typescriptreact.lua
deleted file mode 100644
index 178c6f5..0000000
--- a/.config/nvim/lua/lang/typescriptreact.lua
+++ /dev/null
@@ -1,25 +0,0 @@
-local M = {}
-
-M.config = function()
- -- TODO: implement config for language
- return "No config available!"
-end
-
-M.format = function()
- -- TODO: implement formatter for language
- return "No formatter available!"
-end
-
-M.lint = function()
- -- TODO: implement linters (if applicable)
- return "No linters configured!"
-end
-
-M.lsp = function() end
-
-M.dap = function()
- -- TODO: implement dap
- return "No DAP configured!"
-end
-
-return M
diff --git a/.config/nvim/lua/lang/vim.lua b/.config/nvim/lua/lang/vim.lua
deleted file mode 100644
index bab91e6..0000000
--- a/.config/nvim/lua/lang/vim.lua
+++ /dev/null
@@ -1,40 +0,0 @@
-local M = {}
-
-M.config = function()
- O.lang.vim = {
- linters = { "vint" },
- lsp = {
- path = DATA_PATH .. "/lspinstall/vim/node_modules/.bin/vim-language-server",
- },
- }
-end
-
-M.format = function()
- -- TODO: implement formatter for language
- return "No formatter available!"
-end
-
-M.lint = function()
- require("lint").linters_by_ft = {
- vim = O.lang.vim.linters,
- }
-end
-
-M.lsp = function()
- if require("utils").check_lsp_client_active "vimls" then
- return
- end
-
- -- npm install -g vim-language-server
- require("lspconfig").vimls.setup {
- cmd = { DATA_PATH .. "/lspinstall/vim/node_modules/.bin/vim-language-server", "--stdio" },
- on_attach = require("lsp").common_on_attach,
- }
-end
-
-M.dap = function()
- -- TODO: implement dap
- return "No DAP configured!"
-end
-
-return M
diff --git a/.config/nvim/lua/lang/yaml.lua b/.config/nvim/lua/lang/yaml.lua
deleted file mode 100644
index 7f9eb71..0000000
--- a/.config/nvim/lua/lang/yaml.lua
+++ /dev/null
@@ -1,54 +0,0 @@
-local M = {}
-
-M.config = function()
- O.lang.yaml = {
- formatter = {
- exe = "prettier",
- args = { "--stdin-filepath", vim.api.nvim_buf_get_name(0), "--single-quote" },
- stdin = true,
- },
- lsp = {
- path = DATA_PATH .. "/lspinstall/yaml/node_modules/.bin/yaml-language-server",
- },
- }
-end
-
-M.format = function()
- O.formatters.filetype["yaml"] = {
- function()
- return {
- exe = O.lang.yaml.formatter.exe,
- args = O.lang.yaml.formatter.args,
- stdin = O.lang.yaml.formatter.stdin,
- }
- end,
- }
- require("formatter.config").set_defaults {
- logging = false,
- filetype = O.formatters.filetype,
- }
-end
-
-M.lint = function()
- -- TODO: implement linters (if applicable)
- return "No linters configured!"
-end
-
-M.lsp = function()
- if require("utils").check_lsp_client_active "yamlls" then
- return
- end
-
- -- npm install -g yaml-language-server
- require("lspconfig").yamlls.setup {
- cmd = { O.lang.yaml.lsp.path, "--stdio" },
- on_attach = require("lsp").common_on_attach,
- }
-end
-
-M.dap = function()
- -- TODO: implement dap
- return "No DAP configured!"
-end
-
-return M
diff --git a/.config/nvim/lua/lang/zig.lua b/.config/nvim/lua/lang/zig.lua
deleted file mode 100644
index e000cfe..0000000
--- a/.config/nvim/lua/lang/zig.lua
+++ /dev/null
@@ -1,58 +0,0 @@
-local M = {}
-
-M.config = function()
- O.lang.zig = {
- formatter = {
- exe = "zig",
- args = { "fmt" },
- stdin = false,
- },
- lsp = {
- path = "zls",
- },
- }
-end
-
-M.format = function()
- O.formatters.filetype["zig"] = {
- function()
- return {
- exe = O.lang.zig.formatter.exe,
- args = O.lang.zig.formatter.args,
- stdin = O.lang.zig.formatter.stdin,
- }
- end,
- }
-
- require("formatter.config").set_defaults {
- logging = false,
- filetype = O.formatters.filetype,
- }
-end
-
-M.lint = function()
- -- TODO: implement linters (if applicable)
- return "No linters configured!"
-end
-
-M.lsp = function()
- if require("utils").check_lsp_client_active "zls" then
- return
- end
- -- Because lspinstall don't support zig yet,
- -- So we need zls preset in global lib
- -- Further custom install zls in
- -- https://github.com/zigtools/zls/wiki/Downloading-and-Building-ZLS
- require("lspconfig").zls.setup {
- cmd = { O.lang.zig.lsp.path },
- root_dir = require("lspconfig").util.root_pattern(".git", "build.zig", "zls.json"),
- on_attach = require("lsp").common_on_attach,
- }
-end
-
-M.dap = function()
- -- TODO: implement dap
- return "No DAP configured!"
-end
-
-return M
diff --git a/.config/nvim/lua/lang/zsh.lua b/.config/nvim/lua/lang/zsh.lua
deleted file mode 100644
index 31e9bf3..0000000
--- a/.config/nvim/lua/lang/zsh.lua
+++ /dev/null
@@ -1,53 +0,0 @@
-local M = {}
-
-M.config = function()
- O.lang.zsh = {
- lsp = {
- path = DATA_PATH .. "/lspinstall/bash/node_modules/.bin/bash-language-server",
- },
- }
-end
-
-M.format = function()
- -- TODO: implement format for language
- return "No format available!"
-end
-
-M.lint = function()
- -- zsh
- local zsh_arguments = {}
-
- if not require("utils").check_lsp_client_active "efm" then
- require("lspconfig").efm.setup {
- -- init_options = {initializationOptions},
- cmd = { DATA_PATH .. "/lspinstall/efm/efm-langserver" },
- init_options = { documentFormatting = true, codeAction = false },
- root_dir = require("lspconfig").util.root_pattern ".git/",
- filetypes = { "zsh" },
- settings = {
- rootMarkers = { ".git/" },
- languages = {
- zsh = zsh_arguments,
- },
- },
- }
- end
-end
-
-M.lsp = function()
- if not require("utils").check_lsp_client_active "bashls" then
- -- npm i -g bash-language-server
- require("lspconfig").bashls.setup {
- cmd = { O.lang.zsh.lsp.path, "start" },
- on_attach = require("lsp").common_on_attach,
- filetypes = { "sh", "zsh" },
- }
- end
-end
-
-M.dap = function()
- -- TODO: implement dap
- return "No DAP configured!"
-end
-
-return M