From 96db7b043067befa57a901abb86fc8218128cec6 Mon Sep 17 00:00:00 2001 From: Fabio Lenherr / DashieTM Date: Fri, 4 Nov 2022 00:14:43 +0100 Subject: [PATCH] refactor: remove unused plugins --- nvim/init.lua | 2 +- nvim/lua/settings/comment.lua | 24 --- nvim/lua/settings/indentline.lua | 4 + nvim/lua/settings/lsp.lua | 43 ----- nvim/lua/settings/lsp_config/bashls.lua | 37 ---- nvim/lua/settings/lsp_config/clangd.lua | 87 --------- nvim/lua/settings/lsp_config/csharp_ls.lua | 20 --- nvim/lua/settings/lsp_config/cssls.lua | 43 ----- nvim/lua/settings/lsp_config/eslint.lua | 165 ------------------ nvim/lua/settings/lsp_config/eslint_d.lua | 165 ------------------ nvim/lua/settings/lsp_config/handlers.lua | 100 ----------- nvim/lua/settings/lsp_config/html.lua | 43 ----- nvim/lua/settings/lsp_config/jdtls.lua | 17 -- nvim/lua/settings/lsp_config/pyright.lua | 55 ------ .../lua/settings/lsp_config/rust_analyzer.lua | 77 -------- nvim/lua/settings/lsp_config/sqls.lua | 23 --- nvim/lua/settings/lsp_config/sumneko_lua.lua | 16 -- nvim/lua/settings/lsp_config/texlab.lua | 16 -- nvim/lua/settings/lsp_config/tsserver.lua | 56 ------ nvim/lua/settings/plugins.lua | 99 +++++------ nvim/lua/settings/test.log | 57 ------ nvim/snippets/tex.snippets | 54 ------ 22 files changed, 53 insertions(+), 1150 deletions(-) delete mode 100644 nvim/lua/settings/comment.lua delete mode 100644 nvim/lua/settings/lsp_config/bashls.lua delete mode 100644 nvim/lua/settings/lsp_config/clangd.lua delete mode 100644 nvim/lua/settings/lsp_config/csharp_ls.lua delete mode 100644 nvim/lua/settings/lsp_config/cssls.lua delete mode 100644 nvim/lua/settings/lsp_config/eslint.lua delete mode 100644 nvim/lua/settings/lsp_config/eslint_d.lua delete mode 100644 nvim/lua/settings/lsp_config/handlers.lua delete mode 100644 nvim/lua/settings/lsp_config/html.lua delete mode 100644 nvim/lua/settings/lsp_config/jdtls.lua delete mode 100644 nvim/lua/settings/lsp_config/pyright.lua delete mode 100644 nvim/lua/settings/lsp_config/rust_analyzer.lua delete mode 100644 nvim/lua/settings/lsp_config/sqls.lua delete mode 100644 nvim/lua/settings/lsp_config/sumneko_lua.lua delete mode 100644 nvim/lua/settings/lsp_config/texlab.lua delete mode 100644 nvim/lua/settings/lsp_config/tsserver.lua delete mode 100644 nvim/lua/settings/test.log delete mode 100644 nvim/snippets/tex.snippets diff --git a/nvim/init.lua b/nvim/init.lua index 9426609..80a4da6 100644 --- a/nvim/init.lua +++ b/nvim/init.lua @@ -6,7 +6,6 @@ require("settings.devicons") require("settings.treesitter") require("settings.nvim-tree") require("settings.pairs") ---require("settings.comment") require("settings.indentline") require("settings.project") require("settings.dashboard") @@ -26,3 +25,4 @@ require("telescope").load_extension("fzy_native") require("impatient").enable_profile() require("nightfox") require('Comment').setup() +require('vgit').setup() diff --git a/nvim/lua/settings/comment.lua b/nvim/lua/settings/comment.lua deleted file mode 100644 index 97fbe60..0000000 --- a/nvim/lua/settings/comment.lua +++ /dev/null @@ -1,24 +0,0 @@ -local status_ok, comment = pcall(require, "Comment") -if not status_ok then - return -end - -comment.setup { - pre_hook = function(ctx) - local U = require "Comment.utils" - - local location = nil - if ctx.ctype == U.ctype.block then - location = require("ts_context_commentstring.utils").get_cursor_location() - elseif ctx.cmotion == U.cmotion.v or ctx.cmotion == U.cmotion.V then - location = require("ts_context_commentstring.utils").get_visual_start_location() - end - - return require("ts_context_commentstring.internal").calculate_commentstring { - key = ctx.ctype == U.ctype.line and "__default" or "__multiline", - location = location, - } - end, -} -vim.cmd([[highlight TabLineSel guifg=#192330 guibg=112e54]]) -vim.cmd([[highlight BufferDefaultCurrent guifg=#192330 guibg=112e54]]) diff --git a/nvim/lua/settings/indentline.lua b/nvim/lua/settings/indentline.lua index 6b09906..216456c 100644 --- a/nvim/lua/settings/indentline.lua +++ b/nvim/lua/settings/indentline.lua @@ -25,8 +25,12 @@ vim.g.indent_blankline_context_patterns = { "class", "return", "function", + "def", "method", "^if", + "^else", + "^else if", + "^elif", "^while", "jsx_element", "^for", diff --git a/nvim/lua/settings/lsp.lua b/nvim/lua/settings/lsp.lua index 90dd8e9..e03abc9 100644 --- a/nvim/lua/settings/lsp.lua +++ b/nvim/lua/settings/lsp.lua @@ -111,46 +111,3 @@ require("lspconfig")["hls"].setup({ --on_attach = on_attach, }) ---local status_ok2, lsp_installer = pcall(require, "mason") ---if not status_ok2 then --- return ---end --- ---local servers = {"jdtls" , "sumneko_lua" , "texlab", "pyright" , "eslint_d" , "html" , "cssls" , "rust_analyzer" , "bashls" , "csharp_ls" , "sqls" , "clangd" } --- ---lsp_installer.setup { --- ensure_installed = servers ---} --- ---for _, server in pairs(servers) do --- local opts = { --- on_attach = require("settings.lsp_config.handlers").on_attach, --- capabilities = require("settings.lsp_config.handlers").capabilities, --- } --- local has_custom_opts, server_custom_opts = pcall(require, "settings.lsp_config." .. server) --- if has_custom_opts then --- opts = vim.tbl_deep_extend("force", server_custom_opts, opts) --- end --- lspconfig[server].setup(opts) ---end --- --- ---local null_ls_status_ok, null_ls = pcall(require, "null-ls") ---if not null_ls_status_ok then --- return ---end --- ----- https://github.com/jose-elias-alvarez/null-ls.nvim/tree/main/lua/null-ls/builtins/formatting ---local formatting = null_ls.builtins.formatting ----- https://github.com/jose-elias-alvarez/null-ls.nvim/tree/main/lua/null-ls/builtins/diagnostics ---local diagnostics = null_ls.builtins.diagnostics --- ---null_ls.setup({ --- debug = false, --- sources = { --- formatting.prettier.with({ extra_args = { "--no-semi", "--single-quote", "--jsx-single-quote" } }), --- formatting.black.with({ extra_args = { "--fast" } }), --- formatting.stylua, --- -- diagnostics.flake8 --- }, ---}) diff --git a/nvim/lua/settings/lsp_config/bashls.lua b/nvim/lua/settings/lsp_config/bashls.lua deleted file mode 100644 index e2392e4..0000000 --- a/nvim/lua/settings/lsp_config/bashls.lua +++ /dev/null @@ -1,37 +0,0 @@ -local util = require 'lspconfig.util' - -local bin_name = 'bash-language-server' -local cmd = { bin_name, 'start' } - -if vim.fn.has 'win32' == 1 then - cmd = { 'cmd.exe', '/C', bin_name, 'start' } -end - -return { - default_config = { - cmd = cmd, - cmd_env = { - -- Prevent recursive scanning which will cause issues when opening a file - -- directly in the home directory (e.g. ~/foo.sh). - -- - -- Default upstream pattern is "**/*@(.sh|.inc|.bash|.command)". - GLOB_PATTERN = vim.env.GLOB_PATTERN or '*@(.sh|.inc|.bash|.command)', - }, - filetypes = { 'sh' }, - root_dir = util.find_git_ancestor, - single_file_support = true, - }, - docs = { - description = [[ -https://github.com/mads-hartmann/bash-language-server -`bash-language-server` can be installed via `npm`: -```sh -npm i -g bash-language-server -``` -Language server for bash, written using tree sitter in typescript. -]], - default_config = { - root_dir = [[util.find_git_ancestor]], - }, - }, -} diff --git a/nvim/lua/settings/lsp_config/clangd.lua b/nvim/lua/settings/lsp_config/clangd.lua deleted file mode 100644 index 65da8c0..0000000 --- a/nvim/lua/settings/lsp_config/clangd.lua +++ /dev/null @@ -1,87 +0,0 @@ -local util = require 'lspconfig.util' - --- https://clangd.llvm.org/extensions.html#switch-between-sourceheader -local function switch_source_header(bufnr) - bufnr = util.validate_bufnr(bufnr) - local clangd_client = util.get_active_client_by_name(bufnr, 'clangd') - local params = { uri = vim.uri_from_bufnr(bufnr) } - if clangd_client then - clangd_client.request('textDocument/switchSourceHeader', params, function(err, result) - if err then - error(tostring(err)) - end - if not result then - print 'Corresponding file cannot be determined' - return - end - vim.api.nvim_command('edit ' .. vim.uri_to_fname(result)) - end, bufnr) - else - print 'method textDocument/switchSourceHeader is not supported by any servers active on the current buffer' - end -end - -local root_files = { - '.clangd', - '.clang-tidy', - '.clang-format', - 'compile_commands.json', - 'compile_flags.txt', - 'configure.ac', -- AutoTools -} - -local default_capabilities = { - textDocument = { - completion = { - editsNearCursor = true, - }, - }, - offsetEncoding = { 'utf-8', 'utf-16' }, -} - -return { - default_config = { - cmd = { 'clangd' }, - filetypes = { 'c', 'cpp', 'objc', 'objcpp', 'cuda', 'proto' }, - root_dir = function(fname) - return util.root_pattern(unpack(root_files))(fname) or util.find_git_ancestor(fname) - end, - single_file_support = true, - capabilities = default_capabilities, - }, - commands = { - ClangdSwitchSourceHeader = { - function() - switch_source_header(0) - end, - description = 'Switch between source/header', - }, - }, - docs = { - description = [[ -https://clangd.llvm.org/installation.html -- **NOTE:** Clang >= 11 is recommended! See [#23](https://github.com/neovim/nvim-lsp/issues/23). -- If `compile_commands.json` lives in a build directory, you should - symlink it to the root of your source tree. - ``` - ln -s /path/to/myproject/build/compile_commands.json /path/to/myproject/ - ``` -- clangd relies on a [JSON compilation database](https://clang.llvm.org/docs/JSONCompilationDatabase.html) - specified as compile_commands.json, see https://clangd.llvm.org/installation#compile_commandsjson -]], - default_config = { - root_dir = [[ - root_pattern( - '.clangd', - '.clang-tidy', - '.clang-format', - 'compile_commands.json', - 'compile_flags.txt', - 'configure.ac', - '.git' - ) - ]], - capabilities = [[default capabilities, with offsetEncoding utf-8]], - }, - }, -} diff --git a/nvim/lua/settings/lsp_config/csharp_ls.lua b/nvim/lua/settings/lsp_config/csharp_ls.lua deleted file mode 100644 index a03a25b..0000000 --- a/nvim/lua/settings/lsp_config/csharp_ls.lua +++ /dev/null @@ -1,20 +0,0 @@ -local util = require 'lspconfig.util' - -return { - default_config = { - cmd = { 'csharp-ls' }, - root_dir = util.root_pattern('*.sln', '*.csproj', '*.fsproj', '.git'), - filetypes = { 'cs' }, - init_options = { - AutomaticWorkspaceInit = true, - }, - }, - docs = { - description = [[ -https://github.com/razzmatazz/csharp-language-server -Language Server for C#. -csharp-ls requires the [dotnet-sdk](https://dotnet.microsoft.com/download) to be installed. -The preferred way to install csharp-ls is with `dotnet tool install --global csharp-ls`. - ]], - }, -} diff --git a/nvim/lua/settings/lsp_config/cssls.lua b/nvim/lua/settings/lsp_config/cssls.lua deleted file mode 100644 index d1b7aa6..0000000 --- a/nvim/lua/settings/lsp_config/cssls.lua +++ /dev/null @@ -1,43 +0,0 @@ -local util = require 'lspconfig.util' - -local bin_name = 'vscode-css-language-server' -local cmd = { bin_name, '--stdio' } - -if vim.fn.has 'win32' == 1 then - cmd = { 'cmd.exe', '/C', bin_name, '--stdio' } -end - -return { - default_config = { - cmd = cmd, - filetypes = { 'css', 'scss', 'less' }, - root_dir = util.root_pattern('package.json', '.git'), - single_file_support = true, - settings = { - css = { validate = true }, - scss = { validate = true }, - less = { validate = true }, - }, - }, - docs = { - description = [[ -https://github.com/hrsh7th/vscode-langservers-extracted -`css-languageserver` can be installed via `npm`: -```sh -npm i -g vscode-langservers-extracted -``` -Neovim does not currently include built-in snippets. `vscode-css-language-server` only provides completions when snippet support is enabled. To enable completion, install a snippet plugin and add the following override to your language client capabilities during setup. -```lua ---Enable (broadcasting) snippet capability for completion -local capabilities = vim.lsp.protocol.make_client_capabilities() -capabilities.textDocument.completion.completionItem.snippetSupport = true -require'lspconfig'.cssls.setup { - capabilities = capabilities, -} -``` -]], - default_config = { - root_dir = [[root_pattern("package.json", ".git") or bufdir]], - }, - }, -} diff --git a/nvim/lua/settings/lsp_config/eslint.lua b/nvim/lua/settings/lsp_config/eslint.lua deleted file mode 100644 index d456970..0000000 --- a/nvim/lua/settings/lsp_config/eslint.lua +++ /dev/null @@ -1,165 +0,0 @@ -local util = require 'lspconfig.util' -local lsp = vim.lsp - -local function fix_all(opts) - opts = opts or {} - - local eslint_lsp_client = util.get_active_client_by_name(opts.bufnr, 'eslint') - if eslint_lsp_client == nil then - return - end - - local request - if opts.sync then - request = function(bufnr, method, params) - eslint_lsp_client.request_sync(method, params, nil, bufnr) - end - else - request = function(bufnr, method, params) - eslint_lsp_client.request(method, params, nil, bufnr) - end - end - - local bufnr = util.validate_bufnr(opts.bufnr or 0) - request(0, 'workspace/executeCommand', { - command = 'eslint.applyAllFixes', - arguments = { - { - uri = vim.uri_from_bufnr(bufnr), - version = lsp.util.buf_versions[bufnr], - }, - }, - }) -end - -local bin_name = 'vscode-eslint-language-server' -local cmd = { bin_name, '--stdio' } - -if vim.fn.has 'win32' == 1 then - cmd = { 'cmd.exe', '/C', bin_name, '--stdio' } -end - -return { - default_config = { - cmd = cmd, - filetypes = { - 'javascript', - 'javascriptreact', - 'javascript.jsx', - 'typescript', - 'typescriptreact', - 'typescript.tsx', - 'vue', - }, - -- https://eslint.org/docs/user-guide/configuring/configuration-files#configuration-file-formats - root_dir = util.root_pattern( - '.eslintrc', - '.eslintrc.js', - '.eslintrc.cjs', - '.eslintrc.yaml', - '.eslintrc.yml', - '.eslintrc.json', - 'package.json' - ), - -- Refer to https://github.com/Microsoft/vscode-eslint#settings-options for documentation. - settings = { - validate = 'on', - packageManager = 'npm', - useESLintClass = false, - codeActionOnSave = { - enable = false, - mode = 'all', - }, - format = true, - quiet = false, - onIgnoredFiles = 'off', - rulesCustomizations = {}, - run = 'onType', - -- nodePath configures the directory in which the eslint server should start its node_modules resolution. - -- This path is relative to the workspace folder (root dir) of the server instance. - nodePath = '', - -- use the workspace folder location or the file location (if no workspace folder is open) as the working directory - workingDirectory = { mode = 'location' }, - codeAction = { - disableRuleComment = { - enable = true, - location = 'separateLine', - }, - showDocumentation = { - enable = true, - }, - }, - }, - on_new_config = function(config, new_root_dir) - -- The "workspaceFolder" is a VSCode concept. It limits how far the - -- server will traverse the file system when locating the ESLint config - -- file (e.g., .eslintrc). - config.settings.workspaceFolder = { - uri = new_root_dir, - name = vim.fn.fnamemodify(new_root_dir, ':t'), - } - - -- Support Yarn2 (PnP) projects - local pnp_cjs = util.path.join(new_root_dir, '.pnp.cjs') - local pnp_js = util.path.join(new_root_dir, '.pnp.js') - if util.path.exists(pnp_cjs) or util.path.exists(pnp_js) then - config.cmd = vim.list_extend({ 'yarn', 'exec' }, cmd) - end - end, - handlers = { - ['eslint/openDoc'] = function(_, result) - if not result then - return - end - local sysname = vim.loop.os_uname().sysname - if sysname:match 'Windows' then - os.execute(string.format('start %q', result.url)) - elseif sysname:match 'Linux' then - os.execute(string.format('xdg-open %q', result.url)) - else - os.execute(string.format('open %q', result.url)) - end - return {} - end, - ['eslint/confirmESLintExecution'] = function(_, result) - if not result then - return - end - return 4 -- approved - end, - ['eslint/probeFailed'] = function() - vim.notify('[lspconfig] ESLint probe failed.', vim.log.levels.WARN) - return {} - end, - ['eslint/noLibrary'] = function() - vim.notify('[lspconfig] Unable to find ESLint library.', vim.log.levels.WARN) - return {} - end, - }, - }, - commands = { - EslintFixAll = { - function() - fix_all { sync = true, bufnr = 0 } - end, - description = 'Fix all eslint problems for this buffer', - }, - }, - docs = { - description = [[ -https://github.com/hrsh7th/vscode-langservers-extracted -`vscode-eslint-language-server` is a linting engine for JavaScript / Typescript. -It can be installed via `npm`: -```sh -npm i -g vscode-langservers-extracted -``` -`vscode-eslint-language-server` provides an `EslintFixAll` command that can be used to format a document on save: -```vim -autocmd BufWritePre *.tsx,*.ts,*.jsx,*.js EslintFixAll -``` -See [vscode-eslint](https://github.com/microsoft/vscode-eslint/blob/55871979d7af184bf09af491b6ea35ebd56822cf/server/src/eslintServer.ts#L216-L229) for configuration options. -Messages handled in lspconfig: `eslint/openDoc`, `eslint/confirmESLintExecution`, `eslint/probeFailed`, `eslint/noLibrary` -Additional messages you can handle: `eslint/noConfig` -]], - }, -} diff --git a/nvim/lua/settings/lsp_config/eslint_d.lua b/nvim/lua/settings/lsp_config/eslint_d.lua deleted file mode 100644 index d456970..0000000 --- a/nvim/lua/settings/lsp_config/eslint_d.lua +++ /dev/null @@ -1,165 +0,0 @@ -local util = require 'lspconfig.util' -local lsp = vim.lsp - -local function fix_all(opts) - opts = opts or {} - - local eslint_lsp_client = util.get_active_client_by_name(opts.bufnr, 'eslint') - if eslint_lsp_client == nil then - return - end - - local request - if opts.sync then - request = function(bufnr, method, params) - eslint_lsp_client.request_sync(method, params, nil, bufnr) - end - else - request = function(bufnr, method, params) - eslint_lsp_client.request(method, params, nil, bufnr) - end - end - - local bufnr = util.validate_bufnr(opts.bufnr or 0) - request(0, 'workspace/executeCommand', { - command = 'eslint.applyAllFixes', - arguments = { - { - uri = vim.uri_from_bufnr(bufnr), - version = lsp.util.buf_versions[bufnr], - }, - }, - }) -end - -local bin_name = 'vscode-eslint-language-server' -local cmd = { bin_name, '--stdio' } - -if vim.fn.has 'win32' == 1 then - cmd = { 'cmd.exe', '/C', bin_name, '--stdio' } -end - -return { - default_config = { - cmd = cmd, - filetypes = { - 'javascript', - 'javascriptreact', - 'javascript.jsx', - 'typescript', - 'typescriptreact', - 'typescript.tsx', - 'vue', - }, - -- https://eslint.org/docs/user-guide/configuring/configuration-files#configuration-file-formats - root_dir = util.root_pattern( - '.eslintrc', - '.eslintrc.js', - '.eslintrc.cjs', - '.eslintrc.yaml', - '.eslintrc.yml', - '.eslintrc.json', - 'package.json' - ), - -- Refer to https://github.com/Microsoft/vscode-eslint#settings-options for documentation. - settings = { - validate = 'on', - packageManager = 'npm', - useESLintClass = false, - codeActionOnSave = { - enable = false, - mode = 'all', - }, - format = true, - quiet = false, - onIgnoredFiles = 'off', - rulesCustomizations = {}, - run = 'onType', - -- nodePath configures the directory in which the eslint server should start its node_modules resolution. - -- This path is relative to the workspace folder (root dir) of the server instance. - nodePath = '', - -- use the workspace folder location or the file location (if no workspace folder is open) as the working directory - workingDirectory = { mode = 'location' }, - codeAction = { - disableRuleComment = { - enable = true, - location = 'separateLine', - }, - showDocumentation = { - enable = true, - }, - }, - }, - on_new_config = function(config, new_root_dir) - -- The "workspaceFolder" is a VSCode concept. It limits how far the - -- server will traverse the file system when locating the ESLint config - -- file (e.g., .eslintrc). - config.settings.workspaceFolder = { - uri = new_root_dir, - name = vim.fn.fnamemodify(new_root_dir, ':t'), - } - - -- Support Yarn2 (PnP) projects - local pnp_cjs = util.path.join(new_root_dir, '.pnp.cjs') - local pnp_js = util.path.join(new_root_dir, '.pnp.js') - if util.path.exists(pnp_cjs) or util.path.exists(pnp_js) then - config.cmd = vim.list_extend({ 'yarn', 'exec' }, cmd) - end - end, - handlers = { - ['eslint/openDoc'] = function(_, result) - if not result then - return - end - local sysname = vim.loop.os_uname().sysname - if sysname:match 'Windows' then - os.execute(string.format('start %q', result.url)) - elseif sysname:match 'Linux' then - os.execute(string.format('xdg-open %q', result.url)) - else - os.execute(string.format('open %q', result.url)) - end - return {} - end, - ['eslint/confirmESLintExecution'] = function(_, result) - if not result then - return - end - return 4 -- approved - end, - ['eslint/probeFailed'] = function() - vim.notify('[lspconfig] ESLint probe failed.', vim.log.levels.WARN) - return {} - end, - ['eslint/noLibrary'] = function() - vim.notify('[lspconfig] Unable to find ESLint library.', vim.log.levels.WARN) - return {} - end, - }, - }, - commands = { - EslintFixAll = { - function() - fix_all { sync = true, bufnr = 0 } - end, - description = 'Fix all eslint problems for this buffer', - }, - }, - docs = { - description = [[ -https://github.com/hrsh7th/vscode-langservers-extracted -`vscode-eslint-language-server` is a linting engine for JavaScript / Typescript. -It can be installed via `npm`: -```sh -npm i -g vscode-langservers-extracted -``` -`vscode-eslint-language-server` provides an `EslintFixAll` command that can be used to format a document on save: -```vim -autocmd BufWritePre *.tsx,*.ts,*.jsx,*.js EslintFixAll -``` -See [vscode-eslint](https://github.com/microsoft/vscode-eslint/blob/55871979d7af184bf09af491b6ea35ebd56822cf/server/src/eslintServer.ts#L216-L229) for configuration options. -Messages handled in lspconfig: `eslint/openDoc`, `eslint/confirmESLintExecution`, `eslint/probeFailed`, `eslint/noLibrary` -Additional messages you can handle: `eslint/noConfig` -]], - }, -} diff --git a/nvim/lua/settings/lsp_config/handlers.lua b/nvim/lua/settings/lsp_config/handlers.lua deleted file mode 100644 index 5695f84..0000000 --- a/nvim/lua/settings/lsp_config/handlers.lua +++ /dev/null @@ -1,100 +0,0 @@ -local M = {} - --- TODO: backfill this to template -M.setup = function() - local signs = { - { name = "DiagnosticSignError", text = "" }, - { name = "DiagnosticSignWarn", text = "" }, - { name = "DiagnosticSignHint", text = "" }, - { name = "DiagnosticSignInfo", text = "" }, - } - - for _, sign in ipairs(signs) do - vim.fn.sign_define(sign.name, { texthl = sign.name, text = sign.text, numhl = "" }) - end - - local config = { - -- disable virtual text - virtual_text = false, - -- show signs - signs = { - active = signs, - }, - update_in_insert = true, - underline = true, - severity_sort = true, - float = { - focusable = false, - style = "minimal", - border = "rounded", - source = "always", - header = "", - prefix = "", - }, - } - - vim.diagnostic.config(config) - - vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, { - border = "rounded", - }) - - vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, { - border = "rounded", - }) -end - -local function lsp_highlight_document(client) - -- Set autocommands conditional on server_capabilities - local status_ok, illuminate = pcall(require, "illuminate") - if not status_ok then - return - end - illuminate.on_attach(client) - -- end -end - -local function lsp_keymaps(bufnr) - local opts = { noremap = true, silent = true } - vim.api.nvim_buf_set_keymap(bufnr, "n", "gD", "lua vim.lsp.buf.declaration()", opts) - vim.api.nvim_buf_set_keymap(bufnr, "n", "gd", "lua vim.lsp.buf.definition()", opts) - vim.api.nvim_buf_set_keymap(bufnr, "n", "K", "lua vim.lsp.buf.hover()", opts) - vim.api.nvim_buf_set_keymap(bufnr, "n", "gi", "lua vim.lsp.buf.implementation()", opts) - vim.api.nvim_buf_set_keymap(bufnr, "n", "", "lua vim.lsp.buf.signature_help()", opts) - -- vim.api.nvim_buf_set_keymap(bufnr, "n", "rn", "lua vim.lsp.buf.rename()", opts) - vim.api.nvim_buf_set_keymap(bufnr, "n", "gr", "lua vim.lsp.buf.references()", opts) - -- vim.api.nvim_buf_set_keymap(bufnr, "n", "ca", "lua vim.lsp.buf.code_action()", opts) - -- vim.api.nvim_buf_set_keymap(bufnr, "n", "f", "lua vim.diagnostic.open_float()", opts) - vim.api.nvim_buf_set_keymap(bufnr, "n", "[d", 'lua vim.diagnostic.goto_prev({ border = "rounded" })', opts) - vim.api.nvim_buf_set_keymap( - bufnr, - "n", - "gl", - 'lua vim.diagnostic.open_float({ border = "rounded" })', - opts - ) - vim.api.nvim_buf_set_keymap(bufnr, "n", "]d", 'lua vim.diagnostic.goto_next({ border = "rounded" })', opts) - vim.api.nvim_buf_set_keymap(bufnr, "n", "q", "lua vim.diagnostic.setloclist()", opts) - vim.cmd [[ command! Format execute 'lua vim.lsp.buf.format { async = true }' ]] -end - -M.on_attach = function(client, bufnr) - -- vim.notify(client.name .. " starting...") - -- TODO: refactor this into a method that checks if string in list - if client.name == "tsserver" then - client.resolved_capabilities.document_formatting = false - end - lsp_keymaps(bufnr) - lsp_highlight_document(client) -end - -local capabilities = vim.lsp.protocol.make_client_capabilities() - -local status_ok, cmp_nvim_lsp = pcall(require, "cmp_nvim_lsp") -if not status_ok then - return -end - -M.capabilities = cmp_nvim_lsp.update_capabilities(capabilities) - -return M diff --git a/nvim/lua/settings/lsp_config/html.lua b/nvim/lua/settings/lsp_config/html.lua deleted file mode 100644 index b1771d3..0000000 --- a/nvim/lua/settings/lsp_config/html.lua +++ /dev/null @@ -1,43 +0,0 @@ -local util = require 'lspconfig.util' - -local bin_name = 'vscode-html-language-server' -local cmd = { bin_name, '--stdio' } - -if vim.fn.has 'win32' == 1 then - cmd = { 'cmd.exe', '/C', bin_name, '--stdio' } -end - -return { - default_config = { - cmd = cmd, - filetypes = { 'html' }, - root_dir = util.root_pattern('package.json', '.git'), - single_file_support = true, - settings = {}, - init_options = { - provideFormatter = true, - embeddedLanguages = { css = true, javascript = true }, - configurationSection = { 'html', 'css', 'javascript' }, - }, - }, - docs = { - description = [[ -https://github.com/hrsh7th/vscode-langservers-extracted -`vscode-html-language-server` can be installed via `npm`: -```sh -npm i -g vscode-langservers-extracted -``` -Neovim does not currently include built-in snippets. `vscode-html-language-server` only provides completions when snippet support is enabled. -To enable completion, install a snippet plugin and add the following override to your language client capabilities during setup. -The code-formatting feature of the lsp can be controlled with the `provideFormatter` option. -```lua ---Enable (broadcasting) snippet capability for completion -local capabilities = vim.lsp.protocol.make_client_capabilities() -capabilities.textDocument.completion.completionItem.snippetSupport = true -require'lspconfig'.html.setup { - capabilities = capabilities, -} -``` -]], - }, -} diff --git a/nvim/lua/settings/lsp_config/jdtls.lua b/nvim/lua/settings/lsp_config/jdtls.lua deleted file mode 100644 index 1254f9b..0000000 --- a/nvim/lua/settings/lsp_config/jdtls.lua +++ /dev/null @@ -1,17 +0,0 @@ -return { - settings = { - - java = { - diagnostics = { - globals = { "vim" }, - }, - workspace = { - library = { - [vim.fn.expand("$VIMRUNTIME/lua")] = true, - [vim.fn.stdpath("config") .. "/lua"] = true, - }, - }, - }, - }, -} - diff --git a/nvim/lua/settings/lsp_config/pyright.lua b/nvim/lua/settings/lsp_config/pyright.lua deleted file mode 100644 index 16513cc..0000000 --- a/nvim/lua/settings/lsp_config/pyright.lua +++ /dev/null @@ -1,55 +0,0 @@ -local util = require 'lspconfig.util' - -local bin_name = 'pyright-langserver' -local cmd = { bin_name, '--stdio' } - -if vim.fn.has 'win32' == 1 then - cmd = { 'cmd.exe', '/C', bin_name, '--stdio' } -end - -local root_files = { - 'pyproject.toml', - 'setup.py', - 'setup.cfg', - 'requirements.txt', - 'Pipfile', - 'pyrightconfig.json', -} - -local function organize_imports() - local params = { - command = 'pyright.organizeimports', - arguments = { vim.uri_from_bufnr(0) }, - } - vim.lsp.buf.execute_command(params) -end - -return { - default_config = { - cmd = cmd, - filetypes = { 'python' }, - root_dir = util.root_pattern(unpack(root_files)), - single_file_support = true, - settings = { - python = { - analysis = { - autoSearchPaths = true, - useLibraryCodeForTypes = true, - diagnosticMode = 'workspace', - }, - }, - }, - }, - commands = { - PyrightOrganizeImports = { - organize_imports, - description = 'Organize Imports', - }, - }, - docs = { - description = [[ -https://github.com/microsoft/pyright -`pyright`, a static type checker and language server for python -]], - }, -} diff --git a/nvim/lua/settings/lsp_config/rust_analyzer.lua b/nvim/lua/settings/lsp_config/rust_analyzer.lua deleted file mode 100644 index bc85596..0000000 --- a/nvim/lua/settings/lsp_config/rust_analyzer.lua +++ /dev/null @@ -1,77 +0,0 @@ -local util = require 'lspconfig.util' - -local function reload_workspace(bufnr) - bufnr = util.validate_bufnr(bufnr) - vim.lsp.buf_request(bufnr, 'rust-analyzer/reloadWorkspace', nil, function(err) - if err then - error(tostring(err)) - end - vim.notify 'Cargo workspace reloaded' - end) -end - -return { - default_config = { - cmd = { 'rust-analyzer' }, - filetypes = { 'rust' }, - root_dir = function(fname) - local cargo_crate_dir = util.root_pattern 'Cargo.toml'(fname) - local cmd = { 'cargo', 'metadata', '--no-deps', '--format-version', '1' } - if cargo_crate_dir ~= nil then - cmd[#cmd + 1] = '--manifest-path' - cmd[#cmd + 1] = util.path.join(cargo_crate_dir, 'Cargo.toml') - end - local cargo_metadata = '' - local cargo_metadata_err = '' - local cm = vim.fn.jobstart(cmd, { - on_stdout = function(_, d, _) - cargo_metadata = table.concat(d, '\n') - end, - on_stderr = function(_, d, _) - cargo_metadata_err = table.concat(d, '\n') - end, - stdout_buffered = true, - stderr_buffered = true, - }) - if cm > 0 then - cm = vim.fn.jobwait({ cm })[1] - else - cm = -1 - end - local cargo_workspace_dir = nil - if cm == 0 then - cargo_workspace_dir = vim.json.decode(cargo_metadata)['workspace_root'] - else - vim.notify( - string.format('[lspconfig] cmd (%q) failed:\n%s', table.concat(cmd, ' '), cargo_metadata_err), - vim.log.levels.WARN - ) - end - return util.path.sanitize(cargo_workspace_dir) - or cargo_crate_dir - or util.root_pattern 'rust-project.json'(fname) - or util.find_git_ancestor(fname) - end, - settings = { - ['rust-analyzer'] = {}, - }, - }, - commands = { - CargoReload = { - function() - reload_workspace(0) - end, - description = 'Reload current cargo workspace', - }, - }, - docs = { - description = [[ -https://github.com/rust-analyzer/rust-analyzer -rust-analyzer (aka rls 2.0), a language server for Rust -See [docs](https://github.com/rust-analyzer/rust-analyzer/tree/master/docs/user#settings) for extra settings. - ]], - default_config = { - root_dir = [[root_pattern("Cargo.toml", "rust-project.json")]], - }, - }, -} diff --git a/nvim/lua/settings/lsp_config/sqls.lua b/nvim/lua/settings/lsp_config/sqls.lua deleted file mode 100644 index bdbf27b..0000000 --- a/nvim/lua/settings/lsp_config/sqls.lua +++ /dev/null @@ -1,23 +0,0 @@ -local util = require 'lspconfig.util' - -return { - default_config = { - cmd = { 'sqls' }, - filetypes = { 'sql', 'mysql' }, - root_dir = util.root_pattern 'config.yml', - single_file_support = true, - settings = {}, - }, - docs = { - description = [[ -https://github.com/lighttiger2505/sqls -```lua -require'lspconfig'.sqls.setup{ - cmd = {"path/to/command", "-config", "path/to/config.yml"}; - ... -} -``` -Sqls can be installed via `go get github.com/lighttiger2505/sqls`. Instructions for compiling Sqls from the source can be found at [lighttiger2505/sqls](https://github.com/lighttiger2505/sqls). - ]], - }, -} diff --git a/nvim/lua/settings/lsp_config/sumneko_lua.lua b/nvim/lua/settings/lsp_config/sumneko_lua.lua deleted file mode 100644 index 0ac454a..0000000 --- a/nvim/lua/settings/lsp_config/sumneko_lua.lua +++ /dev/null @@ -1,16 +0,0 @@ -return { - settings = { - - Lua = { - diagnostics = { - globals = { "vim" }, - }, - workspace = { - library = { - [vim.fn.expand("$VIMRUNTIME/lua")] = true, - [vim.fn.stdpath("config") .. "/lua"] = true, - }, - }, - }, - }, -} diff --git a/nvim/lua/settings/lsp_config/texlab.lua b/nvim/lua/settings/lsp_config/texlab.lua deleted file mode 100644 index be0e199..0000000 --- a/nvim/lua/settings/lsp_config/texlab.lua +++ /dev/null @@ -1,16 +0,0 @@ -return { - settings = { - - latex = { - diagnostics = { - globals = { "vim" }, - }, - workspace = { - library = { - [vim.fn.expand("$VIMRUNTIME/lua")] = true, - [vim.fn.stdpath("config") .. "/lua"] = true, - }, - }, - }, - }, -} diff --git a/nvim/lua/settings/lsp_config/tsserver.lua b/nvim/lua/settings/lsp_config/tsserver.lua deleted file mode 100644 index 0af4cb6..0000000 --- a/nvim/lua/settings/lsp_config/tsserver.lua +++ /dev/null @@ -1,56 +0,0 @@ -local util = require 'lspconfig.util' - -local bin_name = 'typescript-language-server' -local cmd = { bin_name, '--stdio' } - -if vim.fn.has 'win32' == 1 then - cmd = { 'cmd.exe', '/C', bin_name, '--stdio' } -end - -return { - default_config = { - init_options = { hostInfo = 'neovim' }, - cmd = cmd, - filetypes = { - 'javascript', - 'javascriptreact', - 'javascript.jsx', - 'typescript', - 'typescriptreact', - 'typescript.tsx', - }, - root_dir = function(fname) - return util.root_pattern 'tsconfig.json'(fname) - or util.root_pattern('package.json', 'jsconfig.json', '.git')(fname) - end, - }, - docs = { - description = [[ -https://github.com/theia-ide/typescript-language-server -`typescript-language-server` depends on `typescript`. Both packages can be installed via `npm`: -```sh -npm install -g typescript typescript-language-server -``` -To configure typescript language server, add a -[`tsconfig.json`](https://www.typescriptlang.org/docs/handbook/tsconfig-json.html) or -[`jsconfig.json`](https://code.visualstudio.com/docs/languages/jsconfig) to the root of your -project. -Here's an example that disables type checking in JavaScript files. -```json -{ - "compilerOptions": { - "module": "commonjs", - "target": "es6", - "checkJs": false - }, - "exclude": [ - "node_modules" - ] -} -``` -]], - default_config = { - root_dir = [[root_pattern("package.json", "tsconfig.json", "jsconfig.json", ".git")]], - }, - }, -} diff --git a/nvim/lua/settings/plugins.lua b/nvim/lua/settings/plugins.lua index e102d91..7cc2760 100644 --- a/nvim/lua/settings/plugins.lua +++ b/nvim/lua/settings/plugins.lua @@ -1,55 +1,52 @@ local Plug = vim.fn["plug#"] vim.call("plug#begin", "~/.config/nvim/plugged") -Plug("folke/twilight.nvim") -Plug("nvim-lua/popup.nvim") -- An implementation of the Popup API from vim in Neovim -Plug("nvim-lua/plenary.nvim") -- Useful lua functions used ny lots of plugins -Plug("EdenEast/nightfox.nvim") -Plug("kyazdani42/nvim-web-devicons") -Plug("feline-nvim/feline.nvim") -Plug("lewis6991/gitsigns.nvim") -Plug("tanvirtin/vgit.nvim") -Plug("nvim-lua/plenary.nvim") -Plug("antoinemadec/FixCursorHold.nvim") -Plug("lambdalisue/fern.vim") -Plug("williamboman/mason.nvim") -Plug("williamboman/mason-lspconfig.nvim") -Plug("neovim/nvim-lspconfig") -Plug("jose-elias-alvarez/null-ls.nvim") -Plug("jayp0521/mason-null-ls.nvim") -Plug("mfussenegger/nvim-dap") -Plug("rcarriga/nvim-dap-ui") -Plug("theHamsta/nvim-dap-virtual-text") -Plug("jayp0521/mason-nvim-dap.nvim") -Plug("nvim-treesitter/nvim-treesitter", { ["do"] = vim.fn[":TSUpdate"] }) -Plug("hrsh7th/nvim-cmp") -Plug("hrsh7th/cmp-nvim-lsp") -Plug("hrsh7th/cmp-buffer") -Plug("hrsh7th/cmp-path") -Plug("hrsh7th/cmp-cmdline") -Plug("f3fora/cmp-spell") -Plug("saadparwaiz1/cmp_luasnip") -Plug("L3MON4D3/LuaSnip") -Plug("MarcWeber/vim-addon-mw-utils") -Plug("tomtom/tlib_vim") -Plug("garbas/vim-snipmate") -Plug("kyazdani42/nvim-tree.lua") -Plug("windwp/nvim-autopairs") -Plug("romgrk/barbar.nvim") -Plug("numToStr/Comment.nvim") -Plug("lukas-reineke/indent-blankline.nvim") -Plug("lewis6991/impatient.nvim") -Plug("lewis6991/spellsitter.nvim") -Plug("moll/vim-bbye") -Plug("nvim-telescope/telescope.nvim") -Plug("ahmedkhalf/project.nvim") -Plug("goolord/alpha-nvim") -Plug("lervag/vimtex") -Plug("weilbith/nvim-code-action-menu") -Plug("rafamadriz/friendly-snippets") -Plug("p00f/nvim-ts-rainbow") -Plug("nvim-telescope/telescope-ui-select.nvim") -Plug("nvim-telescope/telescope-file-browser.nvim") -Plug("nvim-telescope/telescope-fzy-native.nvim") -Plug 'folke/trouble.nvim' +Plug("nvim-lua/popup.nvim") -- An implementation of the Popup API from vim in Neovim +Plug("nvim-lua/plenary.nvim") -- Useful lua functions used ny lots of plugins +Plug("EdenEast/nightfox.nvim") -- dark theme +Plug("kyazdani42/nvim-web-devicons") -- icons +Plug("feline-nvim/feline.nvim") -- bottom bar +Plug("lewis6991/gitsigns.nvim") -- git signs on the bar and on the left +Plug("tanvirtin/vgit.nvim") -- git plugin +Plug("nvim-lua/plenary.nvim") -- library, don't delete +Plug("williamboman/mason.nvim") -- lsp and dap +Plug("williamboman/mason-lspconfig.nvim") -- lsp to mason bridge +Plug("neovim/nvim-lspconfig") -- nvim lsp +Plug("jose-elias-alvarez/null-ls.nvim") -- enables formatters +Plug("jayp0521/mason-null-ls.nvim") -- mason to formatter +Plug("mfussenegger/nvim-dap") -- debugging capabilities +Plug("rcarriga/nvim-dap-ui") -- debug ui +Plug("theHamsta/nvim-dap-virtual-text") -- more debug ui +Plug("jayp0521/mason-nvim-dap.nvim") -- debug mason bridge +Plug("nvim-treesitter/nvim-treesitter", +{ ["do"] = vim.fn[":TSUpdate"] }) -- syntax colors +Plug("hrsh7th/nvim-cmp") -- completions +Plug("hrsh7th/cmp-nvim-lsp") -- lsp integration with completions +Plug("hrsh7th/cmp-buffer") -- buffer completion +Plug("hrsh7th/cmp-path") -- path completion +Plug("hrsh7th/cmp-cmdline") -- command completion +Plug("f3fora/cmp-spell") -- spelling completion +Plug("saadparwaiz1/cmp_luasnip") -- snip completion +Plug("L3MON4D3/LuaSnip") -- snippet plugin +Plug("kyazdani42/nvim-tree.lua") -- file viewer on the right +Plug("windwp/nvim-autopairs") -- autopairs +Plug("romgrk/barbar.nvim") -- bar on the top +Plug("numToStr/Comment.nvim") -- fast comments +Plug("lukas-reineke/indent-blankline.nvim") -- indicators for indentation (needs config) +Plug("lewis6991/impatient.nvim") -- speedup startup +Plug("nvim-telescope/telescope.nvim") -- file/text search +Plug("ahmedkhalf/project.nvim") -- project management -> switch projects +Plug("goolord/alpha-nvim") -- dashboard +Plug("lervag/vimtex") -- latex plugin +Plug("weilbith/nvim-code-action-menu") -- code action menu +Plug("rafamadriz/friendly-snippets") -- some provided snippets +Plug("p00f/nvim-ts-rainbow") -- colors brackets +Plug("nvim-telescope/telescope-ui-select.nvim") -- telescope ui +Plug("nvim-telescope/telescope-file-browser.nvim") -- telescope file browser +Plug("nvim-telescope/telescope-fzy-native.nvim") -- telescope fuzzy search +Plug 'folke/trouble.nvim' -- provides warning/error explanation tab +--Plug("folke/twilight.nvim") --twilight dims code not being edited right now ? useless ? +--Plug("lambdalisue/fern.vim") -- likely not needed? +--Plug("MarcWeber/vim-addon-mw-utils") -- wtf? +--Plug("tomtom/tlib_vim") --wtf2? vim.call("plug#end") diff --git a/nvim/lua/settings/test.log b/nvim/lua/settings/test.log deleted file mode 100644 index 1a0e222..0000000 --- a/nvim/lua/settings/test.log +++ /dev/null @@ -1,57 +0,0 @@ -** -(test.tex -LaTeX2e <2020-10-01> patch level 4 -L3 programming layer <2021-02-18> (article.cls -Document Class: article 2020/04/10 v1.4m Standard LaTeX document class -(size10.clo -File: size10.clo 2020/04/10 v1.4m Standard LaTeX file (size option) -) -\c@part=\count175 -\c@section=\count176 -\c@subsection=\count177 -\c@subsubsection=\count178 -\c@paragraph=\count179 -\c@subparagraph=\count180 -\c@figure=\count181 -\c@table=\count182 -\abovecaptionskip=\skip47 -\belowcaptionskip=\skip48 -\bibindent=\dimen138 -) (l3backend-xetex.def -File: l3backend-xetex.def 2021-03-18 L3 backend support: XeTeX -\c__kernel_sys_dvipdfmx_version_int=\count183 -\l__color_backend_stack_int=\count184 -\g__color_backend_stack_int=\count185 -\g__graphics_track_int=\count186 -\l__pdf_internal_box=\box47 -\g__pdf_backend_object_int=\count187 -\g__pdf_backend_annotation_int=\count188 -\g__pdf_backend_link_int=\count189 -) (test.aux) -\openout1 = `test.aux'. - -LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line 2. -LaTeX Font Info: ... okay on input line 2. -LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line 2. -LaTeX Font Info: ... okay on input line 2. -LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line 2. -LaTeX Font Info: ... okay on input line 2. -LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line 2. -LaTeX Font Info: ... okay on input line 2. -LaTeX Font Info: Checking defaults for TS1/cmr/m/n on input line 2. -LaTeX Font Info: Trying to load font information for TS1+cmr on input line 2 -. - (ts1cmr.fd -File: ts1cmr.fd 2019/12/16 v2.5j Standard LaTeX font definitions -) -LaTeX Font Info: ... okay on input line 2. -LaTeX Font Info: Checking defaults for TU/lmr/m/n on input line 2. -LaTeX Font Info: ... okay on input line 2. -LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line 2. -LaTeX Font Info: ... okay on input line 2. -LaTeX Font Info: Checking defaults for U/cmr/m/n on input line 2. -LaTeX Font Info: ... okay on input line 2. - [1 - -] (test.aux) ) -Output written on test.xdv (1 page, 624 bytes). diff --git a/nvim/snippets/tex.snippets b/nvim/snippets/tex.snippets deleted file mode 100644 index 7ea597f..0000000 --- a/nvim/snippets/tex.snippets +++ /dev/null @@ -1,54 +0,0 @@ - -snippet mini \minipg{}{}[] - \\minipg{ - $1 - } - {${2}}[${3}] - -snippet code "code" - \\begin{lstlisting} - $1 - \\end{lstlisting} - -snippet list "list" - \\begin{itemize} - \\item $1 - \\item $2 - \\item $3 - \\item $4 - \\item $5 - \\vspace{-3mm} - \\end{itemize} - -snippet enum "enumerate" - \\begin{enumerate} - \\item $1 - \\item $2 - \\item $3 - \\item $4 - \\item $5 - \\vspace{-3mm} - \\end{enumerate} - -snippet table "table" - \\begin{table}[ht!] - \\section{${1}} - \\begin{tabular}{|m{0.2\linewidth}|m{0.755\linewidth}|} - \hline - $2 - \hline - \\end{tabular} - \\end{table} - -snippet tabular "tabular" - \\begin{tabular}{|m{0.2\linewidth}|m{0.755\linewidth}|} - \hline - $1 - \hline - \\end{tabular} - -snippet tx "textcolor" - \\textcolor{${1}}{${2}} - -snippet bm "vectormatrix" - \\begin{bmatrix} $1 \\ $2 \\ $3 \end{bmatrix}