diff options
40 files changed, 521 insertions, 383 deletions
| @@ -52,12 +52,12 @@ O.timeoutlen = 100  O.leader_key = ' '  -- After changing plugin config it is recommended to run :PackerCompile -O.plugin.hop.active = true  O.plugin.colorizer.active = true +O.plugin.dashboard.active = true +O.plugin.floatterm.active = true +O.plugin.symbol_outline = true  O.plugin.trouble.active = true -O.plugin.lazygit.active = true  O.plugin.zen.active = true -O.plugin.markdown_preview.active = true  -- if you don't want all the parsers change this to a table of the ones you want  O.treesitter.ensure_installed = "all" @@ -73,11 +73,20 @@ O.lang.tsserver.formatter = 'prettier'  O.lang.tsserver.linter = nil  O.lang.tsserver.autoformat = true --- json -O.lang.json.autoformat = true +-- python +-- O.python.linter = 'flake8' +O.lang.python.isort = true +O.lang.python.diagnostics.virtual_text = true +O.lang.python.analysis.use_library_code_types = true  -- Additional Plugins --- O.user_plugins = {{"windwp/nvim-ts-autotag"}} +-- O.user_plugins = { +--     {"folke/tokyonight.nvim"}, { +--         "ray-x/lsp_signature.nvim", +--         config = function() require"lsp_signature".on_attach() end, +--         event = "InsertEnter" +--     }  +-- }  -- Autocommands (https://neovim.io/doc/user/autocmd.html)  -- O.user_autocommands = {{ "BufWinEnter", "*", "echo \"hi again\""}} @@ -112,7 +121,7 @@ To update plugins:  To update LunarVim: -``` +```bash  cd ~/.config/nvim && git pull  ``` diff --git a/ftplugin/c.lua b/ftplugin/c.lua index 7443cabe..f9064213 100644 --- a/ftplugin/c.lua +++ b/ftplugin/c.lua @@ -1,3 +1,7 @@ +if require("lv-utils").check_lsp_client_active "clangd" then +  return +end +  local clangd_flags = { "--background-index" }  if O.lang.clang.cross_file_rename then diff --git a/ftplugin/cmake.lua b/ftplugin/cmake.lua index 1b61ffb2..35369a15 100644 --- a/ftplugin/cmake.lua +++ b/ftplugin/cmake.lua @@ -1,3 +1,7 @@ +if require("lv-utils").check_lsp_client_active "cmake" then +  return +end +  require("lspconfig").cmake.setup {    cmd = { DATA_PATH .. "/lspinstall/cmake/venv/bin/cmake-language-server" },    on_attach = require("lsp").common_on_attach, diff --git a/ftplugin/cs.lua b/ftplugin/cs.lua index 7fdbbc66..e0a0f62a 100644 --- a/ftplugin/cs.lua +++ b/ftplugin/cs.lua @@ -1,6 +1,10 @@ +if require("lv-utils").check_lsp_client_active "omnisharp" then +  return +end +  -- C# language server (csharp/OmniSharp) setup -require("lspconfig").omnisharp.setup{ +require("lspconfig").omnisharp.setup {    on_attach = require("lsp").common_on_attach, -  root_dir = require("lspconfig").util.root_pattern(".sln",".git"), +  root_dir = require("lspconfig").util.root_pattern(".sln", ".git"),    cmd = { DATA_PATH .. "/lspinstall/csharp/omnisharp/run", "--languageserver", "--hostPID", tostring(vim.fn.getpid()) },  } diff --git a/ftplugin/css.lua b/ftplugin/css.lua index d51dee70..ff8c1004 100644 --- a/ftplugin/css.lua +++ b/ftplugin/css.lua @@ -1,10 +1,13 @@ --- npm install -g vscode-css-languageserver-bin -require("lspconfig").cssls.setup { -  cmd = { -    "node", -    DATA_PATH .. "/lspinstall/css/vscode-css/css-language-features/server/dist/node/cssServerMain.js", -    "--stdio", -  }, -  on_attach = require("lsp").common_on_attach, -} +if not require("lv-utils").check_lsp_client_active "cssls" then +  -- npm install -g vscode-css-languageserver-bin +  require("lspconfig").cssls.setup { +    cmd = { +      "node", +      DATA_PATH .. "/lspinstall/css/vscode-css/css-language-features/server/dist/node/cssServerMain.js", +      "--stdio", +    }, +    on_attach = require("lsp").common_on_attach, +  } +end +  vim.cmd "setl ts=2 sw=2" diff --git a/ftplugin/dart.lua b/ftplugin/dart.lua index 419d0400..a0de0fd5 100644 --- a/ftplugin/dart.lua +++ b/ftplugin/dart.lua @@ -1,3 +1,7 @@ +if require("lv-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, diff --git a/ftplugin/dockerfile.lua b/ftplugin/dockerfile.lua index 37b4317f..e0fa97af 100644 --- a/ftplugin/dockerfile.lua +++ b/ftplugin/dockerfile.lua @@ -1,3 +1,7 @@ +if require("lv-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" }, diff --git a/ftplugin/elixir.lua b/ftplugin/elixir.lua index fbb5b29b..f3869ee5 100644 --- a/ftplugin/elixir.lua +++ b/ftplugin/elixir.lua @@ -1,3 +1,7 @@ +if require("lv-utils").check_lsp_client_active "elixirls" then +  return +end +  require("lspconfig").elixirls.setup {    cmd = { DATA_PATH .. "/lspinstall/elixir/elixir-ls/language_server.sh" },  } diff --git a/ftplugin/elm.lua b/ftplugin/elm.lua index ffd97a2a..d1d6ee12 100644 --- a/ftplugin/elm.lua +++ b/ftplugin/elm.lua @@ -1,3 +1,7 @@ +if require("lv-utils").check_lsp_client_active "elmls" then +  return +end +  require("lspconfig").elmls.setup {    cmd = { DATA_PATH .. "/lspinstall/elm/node_modules/.bin/elm-language-server" },    init_options = { diff --git a/ftplugin/euphoria3.lua b/ftplugin/euphoria3.lua index c434c56a..7c3a1da3 100644 --- a/ftplugin/euphoria3.lua +++ b/ftplugin/euphoria3.lua @@ -1,3 +1,7 @@ +if require("lv-utils").check_lsp_client_active "elixirls" then +  return +end +  -- TODO Remove this at some point  require("lspconfig").elixirls.setup {    cmd = { DATA_PATH .. "/lspinstall/elixir/elixir-ls/language_server.sh" }, diff --git a/ftplugin/go.lua b/ftplugin/go.lua index 56b9cacc..fbad5a2b 100644 --- a/ftplugin/go.lua +++ b/ftplugin/go.lua @@ -1,10 +1,12 @@ -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, -} +if not require("lv-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  vim.opt_local.tabstop = 4  vim.opt_local.shiftwidth = 4 diff --git a/ftplugin/graphql.lua b/ftplugin/graphql.lua index df3dce9b..c9ce5437 100644 --- a/ftplugin/graphql.lua +++ b/ftplugin/graphql.lua @@ -1,2 +1,6 @@ +if require("lv-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 } diff --git a/ftplugin/html.lua b/ftplugin/html.lua index 312301b1..fa60e0a6 100644 --- a/ftplugin/html.lua +++ b/ftplugin/html.lua @@ -1,14 +1,17 @@ --- npm install -g vscode-html-languageserver-bin -local capabilities = vim.lsp.protocol.make_client_capabilities() -capabilities.textDocument.completion.completionItem.snippetSupport = true +if not require("lv-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 -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, -}  vim.cmd "setl ts=2 sw=2" diff --git a/ftplugin/java.lua b/ftplugin/java.lua index 00ca0091..15074d73 100644 --- a/ftplugin/java.lua +++ b/ftplugin/java.lua @@ -1,3 +1,7 @@ +if require("lv-utils").check_lsp_client_active "jdtls" then +  return +end +  local util = require "lspconfig/util"  -- In Vimscript  -- augroup lsp diff --git a/ftplugin/javascript.lua b/ftplugin/javascript.lua index ab370364..2c615784 100644 --- a/ftplugin/javascript.lua +++ b/ftplugin/javascript.lua @@ -1,38 +1,41 @@ --- npm install -g typescript typescript-language-server --- require'snippets'.use_suggested_mappings() --- local capabilities = vim.lsp.protocol.make_client_capabilities() --- capabilities.textDocument.completion.completionItem.snippetSupport = true; --- local on_attach_common = function(client) --- print("LSP Initialized") --- require'completion'.on_attach(client) --- require'illuminate'.on_attach(client) --- end -require("lspconfig").tsserver.setup { -  cmd = { -    DATA_PATH .. "/lspinstall/typescript/node_modules/.bin/typescript-language-server", -    "--stdio", -  }, -  filetypes = { -    "javascript", -    "javascriptreact", -    "javascript.jsx", -    "typescript", -    "typescriptreact", -    "typescript.tsx", -  }, -  on_attach = require("lsp").tsserver_on_attach, -  -- This makes sure tsserver is not used for formatting (I prefer prettier) -  -- on_attach = require'lsp'.common_on_attach, -  root_dir = require("lspconfig/util").root_pattern("package.json", "tsconfig.json", "jsconfig.json", ".git"), -  settings = { documentFormatting = false }, -  handlers = { -    ["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, { -      virtual_text = O.lang.tsserver.diagnostics.virtual_text, -      signs = O.lang.tsserver.diagnostics.signs, -      underline = O.lang.tsserver.diagnostics.underline, -      update_in_insert = true, -    }), -  }, -} -require("lsp.ts-fmt-lint").setup() +if not require("lv-utils").check_lsp_client_active "tsserver" then +  -- npm install -g typescript typescript-language-server +  -- require'snippets'.use_suggested_mappings() +  -- local capabilities = vim.lsp.protocol.make_client_capabilities() +  -- capabilities.textDocument.completion.completionItem.snippetSupport = true; +  -- local on_attach_common = function(client) +  -- print("LSP Initialized") +  -- require'completion'.on_attach(client) +  -- require'illuminate'.on_attach(client) +  -- end +  require("lspconfig").tsserver.setup { +    cmd = { +      DATA_PATH .. "/lspinstall/typescript/node_modules/.bin/typescript-language-server", +      "--stdio", +    }, +    filetypes = { +      "javascript", +      "javascriptreact", +      "javascript.jsx", +      "typescript", +      "typescriptreact", +      "typescript.tsx", +    }, +    on_attach = require("lsp").tsserver_on_attach, +    -- This makes sure tsserver is not used for formatting (I prefer prettier) +    -- on_attach = require'lsp'.common_on_attach, +    root_dir = require("lspconfig/util").root_pattern("package.json", "tsconfig.json", "jsconfig.json", ".git"), +    settings = { documentFormatting = false }, +    handlers = { +      ["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, { +        virtual_text = O.lang.tsserver.diagnostics.virtual_text, +        signs = O.lang.tsserver.diagnostics.signs, +        underline = O.lang.tsserver.diagnostics.underline, +        update_in_insert = true, +      }), +    }, +  } +  require("lsp.ts-fmt-lint").setup() +end +  vim.cmd "setl ts=2 sw=2" diff --git a/ftplugin/javascriptreact.lua b/ftplugin/javascriptreact.lua index ab370364..2c615784 100644 --- a/ftplugin/javascriptreact.lua +++ b/ftplugin/javascriptreact.lua @@ -1,38 +1,41 @@ --- npm install -g typescript typescript-language-server --- require'snippets'.use_suggested_mappings() --- local capabilities = vim.lsp.protocol.make_client_capabilities() --- capabilities.textDocument.completion.completionItem.snippetSupport = true; --- local on_attach_common = function(client) --- print("LSP Initialized") --- require'completion'.on_attach(client) --- require'illuminate'.on_attach(client) --- end -require("lspconfig").tsserver.setup { -  cmd = { -    DATA_PATH .. "/lspinstall/typescript/node_modules/.bin/typescript-language-server", -    "--stdio", -  }, -  filetypes = { -    "javascript", -    "javascriptreact", -    "javascript.jsx", -    "typescript", -    "typescriptreact", -    "typescript.tsx", -  }, -  on_attach = require("lsp").tsserver_on_attach, -  -- This makes sure tsserver is not used for formatting (I prefer prettier) -  -- on_attach = require'lsp'.common_on_attach, -  root_dir = require("lspconfig/util").root_pattern("package.json", "tsconfig.json", "jsconfig.json", ".git"), -  settings = { documentFormatting = false }, -  handlers = { -    ["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, { -      virtual_text = O.lang.tsserver.diagnostics.virtual_text, -      signs = O.lang.tsserver.diagnostics.signs, -      underline = O.lang.tsserver.diagnostics.underline, -      update_in_insert = true, -    }), -  }, -} -require("lsp.ts-fmt-lint").setup() +if not require("lv-utils").check_lsp_client_active "tsserver" then +  -- npm install -g typescript typescript-language-server +  -- require'snippets'.use_suggested_mappings() +  -- local capabilities = vim.lsp.protocol.make_client_capabilities() +  -- capabilities.textDocument.completion.completionItem.snippetSupport = true; +  -- local on_attach_common = function(client) +  -- print("LSP Initialized") +  -- require'completion'.on_attach(client) +  -- require'illuminate'.on_attach(client) +  -- end +  require("lspconfig").tsserver.setup { +    cmd = { +      DATA_PATH .. "/lspinstall/typescript/node_modules/.bin/typescript-language-server", +      "--stdio", +    }, +    filetypes = { +      "javascript", +      "javascriptreact", +      "javascript.jsx", +      "typescript", +      "typescriptreact", +      "typescript.tsx", +    }, +    on_attach = require("lsp").tsserver_on_attach, +    -- This makes sure tsserver is not used for formatting (I prefer prettier) +    -- on_attach = require'lsp'.common_on_attach, +    root_dir = require("lspconfig/util").root_pattern("package.json", "tsconfig.json", "jsconfig.json", ".git"), +    settings = { documentFormatting = false }, +    handlers = { +      ["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, { +        virtual_text = O.lang.tsserver.diagnostics.virtual_text, +        signs = O.lang.tsserver.diagnostics.signs, +        underline = O.lang.tsserver.diagnostics.underline, +        update_in_insert = true, +      }), +    }, +  } +  require("lsp.ts-fmt-lint").setup() +end +  vim.cmd "setl ts=2 sw=2" diff --git a/ftplugin/json.lua b/ftplugin/json.lua index 29a3096f..c7246e76 100644 --- a/ftplugin/json.lua +++ b/ftplugin/json.lua @@ -1,3 +1,7 @@ +if require("lv-utils").check_lsp_client_active "jsonls" then +  return +end +  -- npm install -g vscode-json-languageserver  require("lspconfig").jsonls.setup {    cmd = { diff --git a/ftplugin/kotlin.lua b/ftplugin/kotlin.lua index dbd800b9..8d034e6f 100644 --- a/ftplugin/kotlin.lua +++ b/ftplugin/kotlin.lua @@ -1,3 +1,7 @@ +if require("lv-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  --- diff --git a/ftplugin/lua.lua b/ftplugin/lua.lua index b1019acf..2ffaa472 100644 --- a/ftplugin/lua.lua +++ b/ftplugin/lua.lua @@ -1,34 +1,37 @@ --- 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" +if not require("lv-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" }, -      }, -      workspace = { -        -- Make the server aware of Neovim runtime files -        library = { -          [vim.fn.expand "$VIMRUNTIME/lua"] = true, -          [vim.fn.expand "$VIMRUNTIME/lua/vim/lsp"] = true, +  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" }, +        }, +        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,          }, -        maxPreload = 100000, -        preloadFileSize = 1000,        },      }, -  }, -} +  } +end +  if O.lang.lua.autoformat then    require("lv-utils").define_augroups {      _lua_autoformat = { diff --git a/ftplugin/php.lua b/ftplugin/php.lua index 4dc8e9e0..713ef44e 100644 --- a/ftplugin/php.lua +++ b/ftplugin/php.lua @@ -1,3 +1,7 @@ +if require("lv-utils").check_lsp_client_active "intelephense" then +  return +end +  require("lspconfig").intelephense.setup {    cmd = { DATA_PATH .. "/lspinstall/php/node_modules/.bin/intelephense", "--stdio" },    on_attach = require("lsp").common_on_attach, diff --git a/ftplugin/python.lua b/ftplugin/python.lua index a9b41648..0cf7c1a7 100644 --- a/ftplugin/python.lua +++ b/ftplugin/python.lua @@ -20,46 +20,50 @@ if O.lang.python.isort then    table.insert(python_arguments, isort)  end -require("lspconfig").efm.setup { -  -- init_options = {initializationOptions}, -  cmd = { DATA_PATH .. "/lspinstall/efm/efm-langserver" }, -  init_options = { documentFormatting = true, codeAction = false }, -  filetypes = { "python" }, -  settings = { -    rootMarkers = { ".git/", "requirements.txt" }, -    languages = { -      python = python_arguments, +if not require("lv-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 }, +    filetypes = { "python" }, +    settings = { +      rootMarkers = { ".git/", "requirements.txt" }, +      languages = { +        python = python_arguments, +      },      }, -  }, -} +  } +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, +if not require("lv-utils").check_lsp_client_active "pyright" then +  -- 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  if O.plugin.debug.active and O.plugin.dap_install.active then -  local dap_install = require("dap-install") +  local dap_install = require "dap-install"    dap_install.config("python_dbg", {})  end diff --git a/ftplugin/ruby.lua b/ftplugin/ruby.lua index bc844cd3..7f86ffb9 100644 --- a/ftplugin/ruby.lua +++ b/ftplugin/ruby.lua @@ -1,3 +1,7 @@ +if require("lv-utils").check_lsp_client_active "solargraph" then +  return +end +  -- If you are using rvm, make sure to change below configuration  require("lspconfig").solargraph.setup {    cmd = { DATA_PATH .. "/lspinstall/ruby/solargraph/solargraph", "stdio" }, diff --git a/ftplugin/rust.lua b/ftplugin/rust.lua index 2a106e7e..4fb47582 100644 --- a/ftplugin/rust.lua +++ b/ftplugin/rust.lua @@ -1,3 +1,7 @@ +if require("lv-utils").check_lsp_client_active "rust_analyzer" then +  return +end +  if O.lang.rust.rust_tools.active then    local opts = {      tools = { -- rust-tools options @@ -28,11 +32,11 @@ if O.lang.rust.rust_tools.active then          -- prefix for parameter hints          -- default: "<-" -        parameter_hints_prefix = "<-", +        parameter_hints_prefix = O.lang.rust.rust_tools.parameter_hints_prefix,          -- prefix for all the other hints (type, chaining)          -- default: "=>" -        other_hints_prefix = "=>", +        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, diff --git a/ftplugin/sh.lua b/ftplugin/sh.lua index c146e45f..c299f2de 100644 --- a/ftplugin/sh.lua +++ b/ftplugin/sh.lua @@ -1,9 +1,11 @@ --- 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" }, -} +if not require("lv-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  -- sh  local sh_arguments = {} @@ -19,15 +21,17 @@ if O.lang.sh.linter == "shellcheck" then    table.insert(sh_arguments, shellcheck)  end -require("lspconfig").efm.setup { -  -- init_options = {initializationOptions}, -  cmd = { DATA_PATH .. "/lspinstall/efm/efm-langserver" }, -  init_options = { documentFormatting = true, codeAction = false }, -  filetypes = { "sh" }, -  settings = { -    rootMarkers = { ".git/" }, -    languages = { -      sh = sh_arguments, +if not require("lv-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 }, +    filetypes = { "sh" }, +    settings = { +      rootMarkers = { ".git/" }, +      languages = { +        sh = sh_arguments, +      },      }, -  }, -} +  } +end diff --git a/ftplugin/tex.lua b/ftplugin/tex.lua index 71c484f7..7ad35000 100644 --- a/ftplugin/tex.lua +++ b/ftplugin/tex.lua @@ -1,3 +1,7 @@ +if require("lv-utils").check_lsp_client_active "texlab" then +  return +end +  require("lspconfig").texlab.setup {    cmd = { DATA_PATH .. "/lspinstall/latex/texlab" },    on_attach = require("lsp").common_on_attach, diff --git a/ftplugin/tf.lua b/ftplugin/tf.lua index d46affd5..7291cbd8 100644 --- a/ftplugin/tf.lua +++ b/ftplugin/tf.lua @@ -1,3 +1,7 @@ +if require("lv-utils").check_lsp_client_active "terraformls" then +  return +end +  require("lspconfig").terraformls.setup {    cmd = { DATA_PATH .. "/lspinstall/terraform/terraform-ls", "serve" },    on_attach = require("lsp").common_on_attach, diff --git a/ftplugin/typescript.lua b/ftplugin/typescript.lua index ab370364..2c615784 100644 --- a/ftplugin/typescript.lua +++ b/ftplugin/typescript.lua @@ -1,38 +1,41 @@ --- npm install -g typescript typescript-language-server --- require'snippets'.use_suggested_mappings() --- local capabilities = vim.lsp.protocol.make_client_capabilities() --- capabilities.textDocument.completion.completionItem.snippetSupport = true; --- local on_attach_common = function(client) --- print("LSP Initialized") --- require'completion'.on_attach(client) --- require'illuminate'.on_attach(client) --- end -require("lspconfig").tsserver.setup { -  cmd = { -    DATA_PATH .. "/lspinstall/typescript/node_modules/.bin/typescript-language-server", -    "--stdio", -  }, -  filetypes = { -    "javascript", -    "javascriptreact", -    "javascript.jsx", -    "typescript", -    "typescriptreact", -    "typescript.tsx", -  }, -  on_attach = require("lsp").tsserver_on_attach, -  -- This makes sure tsserver is not used for formatting (I prefer prettier) -  -- on_attach = require'lsp'.common_on_attach, -  root_dir = require("lspconfig/util").root_pattern("package.json", "tsconfig.json", "jsconfig.json", ".git"), -  settings = { documentFormatting = false }, -  handlers = { -    ["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, { -      virtual_text = O.lang.tsserver.diagnostics.virtual_text, -      signs = O.lang.tsserver.diagnostics.signs, -      underline = O.lang.tsserver.diagnostics.underline, -      update_in_insert = true, -    }), -  }, -} -require("lsp.ts-fmt-lint").setup() +if not require("lv-utils").check_lsp_client_active "tsserver" then +  -- npm install -g typescript typescript-language-server +  -- require'snippets'.use_suggested_mappings() +  -- local capabilities = vim.lsp.protocol.make_client_capabilities() +  -- capabilities.textDocument.completion.completionItem.snippetSupport = true; +  -- local on_attach_common = function(client) +  -- print("LSP Initialized") +  -- require'completion'.on_attach(client) +  -- require'illuminate'.on_attach(client) +  -- end +  require("lspconfig").tsserver.setup { +    cmd = { +      DATA_PATH .. "/lspinstall/typescript/node_modules/.bin/typescript-language-server", +      "--stdio", +    }, +    filetypes = { +      "javascript", +      "javascriptreact", +      "javascript.jsx", +      "typescript", +      "typescriptreact", +      "typescript.tsx", +    }, +    on_attach = require("lsp").tsserver_on_attach, +    -- This makes sure tsserver is not used for formatting (I prefer prettier) +    -- on_attach = require'lsp'.common_on_attach, +    root_dir = require("lspconfig/util").root_pattern("package.json", "tsconfig.json", "jsconfig.json", ".git"), +    settings = { documentFormatting = false }, +    handlers = { +      ["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, { +        virtual_text = O.lang.tsserver.diagnostics.virtual_text, +        signs = O.lang.tsserver.diagnostics.signs, +        underline = O.lang.tsserver.diagnostics.underline, +        update_in_insert = true, +      }), +    }, +  } +  require("lsp.ts-fmt-lint").setup() +end +  vim.cmd "setl ts=2 sw=2" diff --git a/ftplugin/typescriptreact.lua b/ftplugin/typescriptreact.lua index ab370364..2c615784 100644 --- a/ftplugin/typescriptreact.lua +++ b/ftplugin/typescriptreact.lua @@ -1,38 +1,41 @@ --- npm install -g typescript typescript-language-server --- require'snippets'.use_suggested_mappings() --- local capabilities = vim.lsp.protocol.make_client_capabilities() --- capabilities.textDocument.completion.completionItem.snippetSupport = true; --- local on_attach_common = function(client) --- print("LSP Initialized") --- require'completion'.on_attach(client) --- require'illuminate'.on_attach(client) --- end -require("lspconfig").tsserver.setup { -  cmd = { -    DATA_PATH .. "/lspinstall/typescript/node_modules/.bin/typescript-language-server", -    "--stdio", -  }, -  filetypes = { -    "javascript", -    "javascriptreact", -    "javascript.jsx", -    "typescript", -    "typescriptreact", -    "typescript.tsx", -  }, -  on_attach = require("lsp").tsserver_on_attach, -  -- This makes sure tsserver is not used for formatting (I prefer prettier) -  -- on_attach = require'lsp'.common_on_attach, -  root_dir = require("lspconfig/util").root_pattern("package.json", "tsconfig.json", "jsconfig.json", ".git"), -  settings = { documentFormatting = false }, -  handlers = { -    ["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, { -      virtual_text = O.lang.tsserver.diagnostics.virtual_text, -      signs = O.lang.tsserver.diagnostics.signs, -      underline = O.lang.tsserver.diagnostics.underline, -      update_in_insert = true, -    }), -  }, -} -require("lsp.ts-fmt-lint").setup() +if not require("lv-utils").check_lsp_client_active "tsserver" then +  -- npm install -g typescript typescript-language-server +  -- require'snippets'.use_suggested_mappings() +  -- local capabilities = vim.lsp.protocol.make_client_capabilities() +  -- capabilities.textDocument.completion.completionItem.snippetSupport = true; +  -- local on_attach_common = function(client) +  -- print("LSP Initialized") +  -- require'completion'.on_attach(client) +  -- require'illuminate'.on_attach(client) +  -- end +  require("lspconfig").tsserver.setup { +    cmd = { +      DATA_PATH .. "/lspinstall/typescript/node_modules/.bin/typescript-language-server", +      "--stdio", +    }, +    filetypes = { +      "javascript", +      "javascriptreact", +      "javascript.jsx", +      "typescript", +      "typescriptreact", +      "typescript.tsx", +    }, +    on_attach = require("lsp").tsserver_on_attach, +    -- This makes sure tsserver is not used for formatting (I prefer prettier) +    -- on_attach = require'lsp'.common_on_attach, +    root_dir = require("lspconfig/util").root_pattern("package.json", "tsconfig.json", "jsconfig.json", ".git"), +    settings = { documentFormatting = false }, +    handlers = { +      ["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, { +        virtual_text = O.lang.tsserver.diagnostics.virtual_text, +        signs = O.lang.tsserver.diagnostics.signs, +        underline = O.lang.tsserver.diagnostics.underline, +        update_in_insert = true, +      }), +    }, +  } +  require("lsp.ts-fmt-lint").setup() +end +  vim.cmd "setl ts=2 sw=2" diff --git a/ftplugin/vim.lua b/ftplugin/vim.lua index 449210b9..4a405698 100644 --- a/ftplugin/vim.lua +++ b/ftplugin/vim.lua @@ -1,3 +1,7 @@ +if require("lv-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" }, diff --git a/ftplugin/vue.lua b/ftplugin/vue.lua index ff44d761..96048164 100644 --- a/ftplugin/vue.lua +++ b/ftplugin/vue.lua @@ -1,3 +1,7 @@ +if require("lv-utils").check_lsp_client_active "vuels" then +  return +end +  -- Vue language server configuration (vetur)  require("lspconfig").vuels.setup {    cmd = { DATA_PATH .. "/lspinstall/vue/node_modules/.bin/vls", "--stdio" }, diff --git a/ftplugin/yaml.lua b/ftplugin/yaml.lua index e2847365..219022f5 100644 --- a/ftplugin/yaml.lua +++ b/ftplugin/yaml.lua @@ -1,3 +1,7 @@ +if require("lv-utils").check_lsp_client_active "yamlls" then +  return +end +  -- npm install -g yaml-language-server  require("lspconfig").yamlls.setup {    cmd = { DATA_PATH .. "/lspinstall/yaml/node_modules/.bin/yaml-language-server", "--stdio" }, diff --git a/ftplugin/zig.lua b/ftplugin/zig.lua index 92b4120d..55707d85 100644 --- a/ftplugin/zig.lua +++ b/ftplugin/zig.lua @@ -1,11 +1,14 @@ --- 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 { -  root_dir = require("lspconfig").util.root_pattern(".git", "build.zig", "zls.json"), -  on_attach = require("lsp").common_on_attach, -} +if not require("lv-utils").check_lsp_client_active "zls" then +  -- 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 { +    root_dir = require("lspconfig").util.root_pattern(".git", "build.zig", "zls.json"), +    on_attach = require("lsp").common_on_attach, +  } +end +  require("lv-utils").define_augroups {    _zig_autoformat = {      { "BufEnter", "*.zig", ':lua vim.api.nvim_buf_set_option(0, "commentstring", "// %s")' }, diff --git a/ftplugin/zsh.lua b/ftplugin/zsh.lua index b6fa9d5d..49cd103d 100644 --- a/ftplugin/zsh.lua +++ b/ftplugin/zsh.lua @@ -1,16 +1,11 @@ --- 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" }, -} - --- 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" }, -} +if not require("lv-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  -- sh  local sh_arguments = {} @@ -24,15 +19,17 @@ if O.lang.sh.linter == "shellcheck" then    table.insert(sh_arguments, shellcheck)  end -require("lspconfig").efm.setup { -  -- init_options = {initializationOptions}, -  cmd = { DATA_PATH .. "/lspinstall/efm/efm-langserver" }, -  init_options = { documentFormatting = true, codeAction = false }, -  filetypes = { "zsh" }, -  settings = { -    rootMarkers = { ".git/" }, -    languages = { -      sh = sh_arguments, +if not require("lv-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 }, +    filetypes = { "zsh" }, +    settings = { +      rootMarkers = { ".git/" }, +      languages = { +        sh = sh_arguments, +      },      }, -  }, -} +  } +end @@ -3,10 +3,11 @@ require "keymappings"  vim.cmd("luafile " .. CONFIG_PATH .. "/lv-config.lua")  require "settings"  require "plugins" +vim.g.colors_name = O.colorscheme -- Colorscheme must get called after plugins are loaded or it will break new installs.  require "lv-utils"  require "lv-treesitter"  if O.plugin.dashboard.active then -  require("lv-dashboard").config() +    require("lv-dashboard").config()  end  -- TODO these gues need to be in language files  -- require "lsp" diff --git a/lua/default-config.lua b/lua/default-config.lua index 45e93302..ea2642c2 100644 --- a/lua/default-config.lua +++ b/lua/default-config.lua @@ -8,6 +8,7 @@ O = {    auto_close_tree = 0,    auto_complete = true,    colorscheme = "lunar", +  clipboard = "unnamedplus",    hidden_files = true,    wrap_lines = false,    number = true, @@ -16,6 +17,7 @@ O = {    cmdheight = 2,    cursorline = true,    shell = "bash", +  scrolloff = 0,    timeoutlen = 100,    nvim_tree_disable_netrw = 0,    ignore_case = true, @@ -99,76 +101,76 @@ O = {    },    lang = { -    python = { -      linter = "", -      isort = false, +    cmake = {}, +    clang = {        diagnostics = {          virtual_text = { spacing = 0, prefix = "ï„‘" },          signs = true,          underline = true,        }, -      analysis = { -        type_checking = "basic", -        auto_search_paths = true, -        use_library_code_types = true, -      }, +      cross_file_rename = true, +      header_insertion = "never", +    }, +    css = { +      virtual_text = true,      },      dart = {        sdk_path = "/usr/lib/dart/bin/snapshots/analysis_server.dart.snapshot",      }, -    lua = { +    docker = {}, +    efm = {}, +    elm = {}, +    emmet = { active = true }, +    elixir = {}, +    graphql = {}, +    go = {}, +    html = {}, +    java = {}, +    json = {        diagnostics = {          virtual_text = { spacing = 0, prefix = "ï„‘" },          signs = true,          underline = true,        },      }, -    sh = { -      -- @usage can be 'shellcheck' -      linter = "", -      -- @usage can be 'shfmt' +    kotlin = {}, +    latex = {}, +    lua = {        diagnostics = {          virtual_text = { spacing = 0, prefix = "ï„‘" },          signs = true,          underline = true,        },      }, -    tsserver = { -      -- @usage can be 'eslint' -      linter = "", -      diagnostics = { -        virtual_text = { spacing = 0, prefix = "ï„‘" }, -        signs = true, -        underline = true, +    php = { +      format = { +        format = { +          default = "psr12", +        }, +      }, +      environment = { +        php_version = "7.4",        }, -    }, -    json = {        diagnostics = {          virtual_text = { spacing = 0, prefix = "ï„‘" },          signs = true,          underline = true,        }, +      filetypes = { "php", "phtml" },      }, -    tailwindcss = { -      active = false, -      filetypes = { -        "html", -        "css", -        "scss", -        "javascript", -        "javascriptreact", -        "typescript", -        "typescriptreact", -      }, -    }, -    clang = { +    python = { +      linter = "", +      isort = false,        diagnostics = {          virtual_text = { spacing = 0, prefix = "ï„‘" },          signs = true,          underline = true,        }, -      cross_file_rename = true, -      header_insertion = "never", +      analysis = { +        type_checking = "basic", +        auto_search_paths = true, +        use_library_code_types = true, +      },      },      ruby = {        diagnostics = { @@ -178,14 +180,11 @@ O = {        },        filetypes = { "rb", "erb", "rakefile", "ruby" },      }, -    go = {}, -    elixir = {}, -    vim = {}, -    yaml = {}, -    terraform = {},      rust = {        rust_tools = {          active = false, +        parameter_hints_prefix = "<-", +        other_hints_prefix = "=>", -- prefix for all the other hints (type, chaining)        },        linter = "",        diagnostics = { @@ -194,37 +193,41 @@ O = {          underline = true,        },      }, -    svelte = {}, - -    php = { -      format = { -        format = { -          default = "psr12", -        }, +    sh = { +      -- @usage can be 'shellcheck' +      linter = "", +      -- @usage can be 'shfmt' +      diagnostics = { +        virtual_text = { spacing = 0, prefix = "ï„‘" }, +        signs = true, +        underline = true,        }, -      environment = { -        php_version = "7.4", +    }, +    svelte = {}, +    tailwindcss = { +      active = false, +      filetypes = { +        "html", +        "css", +        "scss", +        "javascript", +        "javascriptreact", +        "typescript", +        "typescriptreact",        }, +    }, +    terraform = {}, +    tsserver = { +      -- @usage can be 'eslint' +      linter = "",        diagnostics = {          virtual_text = { spacing = 0, prefix = "ï„‘" },          signs = true,          underline = true,        }, -      filetypes = { "php", "phtml" }, -    }, -    latex = {}, -    kotlin = {}, -    html = {}, -    elm = {}, -    emmet = { active = true }, -    graphql = {}, -    efm = {}, -    docker = {}, -    cmake = {}, -    java = {}, -    css = { -      virtual_text = true,      }, +    vim = {}, +    yaml = {},    },    dashboard = { diff --git a/lua/keymappings.lua b/lua/keymappings.lua index 46247c4c..580595ee 100644 --- a/lua/keymappings.lua +++ b/lua/keymappings.lua @@ -5,15 +5,15 @@ vim.api.nvim_set_keymap("n", "<C-k>", "<C-w>k", { silent = true })  vim.api.nvim_set_keymap("n", "<C-l>", "<C-w>l", { silent = true })  -- Terminal window navigation -vim.api.nvim_set_keymap("t", "<C-h>", "<C-\\<C-N><C-w>h", {silent = true, noremap = true}) -vim.api.nvim_set_keymap("t", "<C-j>", "<C-\\<C-N><C-w>j", {silent = true, noremap = true}) -vim.api.nvim_set_keymap("t", "<C-k>", "<C-\\<C-N><C-w>k", {silent = true, noremap = true}) -vim.api.nvim_set_keymap("t", "<C-l>", "<C-\\<C-N><C-w>l", {silent = true, noremap = true}) -vim.api.nvim_set_keymap("i", "<C-h>", "<C-\\<C-N><C-w>h", {silent = true, noremap = true}) -vim.api.nvim_set_keymap("i", "<C-j>", "<C-\\<C-N><C-w>j", {silent = true, noremap = true}) -vim.api.nvim_set_keymap("i", "<C-k>", "<C-\\<C-N><C-w>k", {silent = true, noremap = true}) -vim.api.nvim_set_keymap("i", "<C-l>", "<C-\\<C-N><C-w>l", {silent = true, noremap = true}) -vim.api.nvim_set_keymap("t", "<Esc>", "<C-\\<C-n>", {silent = true, noremap = true}) +vim.api.nvim_set_keymap("t", "<C-h>", "<C-\\><C-N><C-w>h", {silent = true, noremap = true}) +vim.api.nvim_set_keymap("t", "<C-j>", "<C-\\><C-N><C-w>j", {silent = true, noremap = true}) +vim.api.nvim_set_keymap("t", "<C-k>", "<C-\\><C-N><C-w>k", {silent = true, noremap = true}) +vim.api.nvim_set_keymap("t", "<C-l>", "<C-\\><C-N><C-w>l", {silent = true, noremap = true}) +vim.api.nvim_set_keymap("i", "<C-h>", "<C-\\><C-N><C-w>h", {silent = true, noremap = true}) +vim.api.nvim_set_keymap("i", "<C-j>", "<C-\\><C-N><C-w>j", {silent = true, noremap = true}) +vim.api.nvim_set_keymap("i", "<C-k>", "<C-\\><C-N><C-w>k", {silent = true, noremap = true}) +vim.api.nvim_set_keymap("i", "<C-l>", "<C-\\><C-N><C-w>l", {silent = true, noremap = true}) +vim.api.nvim_set_keymap("t", "<Esc>", "<C-\\><C-n>", {silent = true, noremap = true})  -- TODO fix this  -- resize with arrows diff --git a/lua/lv-telescope/init.lua b/lua/lv-telescope/init.lua index 8175a7ed..51fc24e5 100644 --- a/lua/lv-telescope/init.lua +++ b/lua/lv-telescope/init.lua @@ -36,7 +36,7 @@ telescope.setup {      file_sorter = require("telescope.sorters").get_fzy_sorter,      file_ignore_patterns = {},      generic_sorter = require("telescope.sorters").get_generic_fuzzy_sorter, -    shorten_path = true, +    path_display = {"shorten"},      winblend = 0,      border = {},      borderchars = { "─", "│", "─", "│", "â•", "â•®", "╯", "â•°" }, diff --git a/lua/lv-utils/init.lua b/lua/lv-utils/init.lua index 3546d13c..e22524d7 100644 --- a/lua/lv-utils/init.lua +++ b/lua/lv-utils/init.lua @@ -8,6 +8,16 @@ function lv_utils.reload_lv_config()    vim.cmd ":PackerInstall"  end +function lv_utils.check_lsp_client_active(name) +  local clients = vim.lsp.get_active_clients() +  for _, client in pairs(clients) do +    if client.name == name then +      return true +    end +  end +  return false +end +  function lv_utils.define_augroups(definitions) -- {{{1    -- Create autocommand groups based on the passed definitions    -- diff --git a/lua/lv-which-key/init.lua b/lua/lv-which-key/init.lua index dbcbb9ae..ee664e4b 100644 --- a/lua/lv-which-key/init.lua +++ b/lua/lv-which-key/init.lua @@ -84,6 +84,12 @@ vim.api.nvim_set_keymap("v", "<leader>/", ":CommentToggle<CR>", { noremap = true  -- close buffer  vim.api.nvim_set_keymap("n", "<leader>c", ":BufferClose<CR>", { noremap = true, silent = true }) +-- Save +vim.api.nvim_set_keymap("n", "<leader>w", ":w!<CR>", { noremap = true, silent = true }) + +-- Quit  +vim.api.nvim_set_keymap("n", "<leader>q", ":q!<CR>", { noremap = true, silent = true }) +  -- open lv-config  vim.api.nvim_set_keymap(    "n", @@ -93,7 +99,8 @@ vim.api.nvim_set_keymap(  )  local mappings = { - +  ["w"] = "Save", +  ["q"] = "Quit",    ["."] = "LunarConfig",    ["/"] = "Comment",    ["c"] = "Close Buffer", diff --git a/lua/settings.lua b/lua/settings.lua index 3bf5d338..78e9e777 100644 --- a/lua/settings.lua +++ b/lua/settings.lua @@ -11,21 +11,17 @@ cmd "set inccommand=split"  cmd "set iskeyword+=-"  cmd "set whichwrap+=<,>,[,],h,l"  if O.transparent_window then -  cmd "au ColorScheme * hi Normal ctermbg=none guibg=none" -  cmd "au ColorScheme * hi SignColumn ctermbg=none guibg=none" +    cmd "au ColorScheme * hi Normal ctermbg=none guibg=none" +    cmd "au ColorScheme * hi SignColumn ctermbg=none guibg=none"  end ---- COLORSCHEME --- - -vim.g.colors_name = O.colorscheme -  ---  SETTINGS  ---  opt.backup = false -- creates a backup file -opt.clipboard = "unnamedplus" -- allows neovim to access the system clipboard +opt.clipboard = O.clipboard -- allows neovim to access the system clipboard  opt.cmdheight = O.cmdheight -- more space in the neovim command line for displaying messages  opt.colorcolumn = "99999" -- fix indentline for now -opt.completeopt = { "menuone", "noselect" } +opt.completeopt = {"menuone", "noselect"}  opt.conceallevel = 0 -- so that `` is visible in markdown files  opt.fileencoding = "utf-8" -- the encoding written to a file  opt.guifont = "monospace:h17" -- the font used in graphical neovim applications @@ -34,6 +30,7 @@ opt.hlsearch = O.hl_search -- highlight all matches on previous search pattern  opt.ignorecase = O.ignore_case -- ignore case in search patterns  opt.mouse = "a" -- allow the mouse to be used in neovim  opt.pumheight = 10 -- pop up menu height +opt.scrolloff = O.scrolloff -- minimal number of screen lines to keep above and below the cursor  opt.showmode = false -- we don't need to see things like -- INSERT -- anymore  opt.showtabline = 2 -- always show tabs  opt.smartcase = O.smart_case -- smart case | 
