aboutsummaryrefslogtreecommitdiff
path: root/plugin-settings
diff options
context:
space:
mode:
authorA Farzat <a@farzat.xyz>2024-10-01 22:18:54 +0900
committerA Farzat <a@farzat.xyz>2024-10-01 23:37:38 +0900
commit8eb1e973395e2231cc0843ce09e4d5d6410cec8d (patch)
tree3ae8a05356368cf63fe4d42ca72351397eec5b5f /plugin-settings
parent03bbb615f265c08f108fbd6e824686ab05f7bcd3 (diff)
downloadnvim-8eb1e973395e2231cc0843ce09e4d5d6410cec8d.tar.gz
nvim-8eb1e973395e2231cc0843ce09e4d5d6410cec8d.zip
Add some plugin settings
Diffstat (limited to 'plugin-settings')
-rw-r--r--plugin-settings/Comment.lua3
-rw-r--r--plugin-settings/fzf.vim1
-rw-r--r--plugin-settings/indent-blankline.lua35
-rw-r--r--plugin-settings/lspconfig.lua92
4 files changed, 131 insertions, 0 deletions
diff --git a/plugin-settings/Comment.lua b/plugin-settings/Comment.lua
new file mode 100644
index 0000000..d063eac
--- /dev/null
+++ b/plugin-settings/Comment.lua
@@ -0,0 +1,3 @@
+require('Comment').setup({
+ ignore = '^$'
+})
diff --git a/plugin-settings/fzf.vim b/plugin-settings/fzf.vim
new file mode 100644
index 0000000..c8eb64e
--- /dev/null
+++ b/plugin-settings/fzf.vim
@@ -0,0 +1 @@
+let g:fzf_command_prefix = 'Fzf'
diff --git a/plugin-settings/indent-blankline.lua b/plugin-settings/indent-blankline.lua
new file mode 100644
index 0000000..a0f1096
--- /dev/null
+++ b/plugin-settings/indent-blankline.lua
@@ -0,0 +1,35 @@
+vim.api.nvim_set_hl(0, "IblScope", { ctermfg = "Gray" })
+vim.api.nvim_set_hl(0, "IblWhitespace", { ctermfg = "DarkGray" })
+vim.api.nvim_set_hl(0, "RainbowRed", { ctermfg = "Red" })
+vim.api.nvim_set_hl(0, "RainbowYellow", { ctermfg = "Yellow" })
+vim.api.nvim_set_hl(0, "RainbowBlue", { ctermfg = "Blue" })
+vim.api.nvim_set_hl(0, "RainbowGreen", { ctermfg = "Green" })
+vim.api.nvim_set_hl(0, "RainbowMagenta", { ctermfg = "Magenta" })
+vim.api.nvim_set_hl(0, "RainbowCyan", { ctermfg = "Cyan" })
+
+local highlight = {
+ "RainbowRed",
+ "RainbowYellow",
+ "RainbowBlue",
+ "RainbowGreen",
+ "RainbowMagenta",
+ "RainbowCyan",
+}
+
+require("ibl").setup {
+ indent = {
+ char = "›",
+ highlight = highlight,
+ },
+}
+
+vim.opt.list = true
+vim.opt.listchars = {
+ tab = "» ⇥",
+ lead = "·",
+ trail = "␣",
+ nbsp = "⍽",
+ extends = "❯",
+ precedes = "❮",
+ eol = "↴",
+}
diff --git a/plugin-settings/lspconfig.lua b/plugin-settings/lspconfig.lua
new file mode 100644
index 0000000..7bc12b8
--- /dev/null
+++ b/plugin-settings/lspconfig.lua
@@ -0,0 +1,92 @@
+local lspconfig = require("lspconfig")
+
+-- Mappings.
+-- See `:help vim.diagnostic.*` for documentation on any of the below functions
+local opts = { noremap = true, silent = true }
+vim.keymap.set("n", "<space>e", vim.diagnostic.open_float, opts)
+vim.keymap.set("n", "[d", vim.diagnostic.goto_prev, opts)
+vim.keymap.set("n", "]d", vim.diagnostic.goto_next, opts)
+vim.keymap.set("n", "<space>q", vim.diagnostic.setloclist, opts)
+-- See `:help vim.lsp.*` for documentation on any of the below functions
+vim.keymap.set("n", "<leader>D", vim.lsp.buf.declaration, opts)
+vim.keymap.set("n", "<leader>d", vim.lsp.buf.definition, opts)
+vim.keymap.set("n", "<leader>k", vim.lsp.buf.hover, opts)
+vim.keymap.set("n", "gi", vim.lsp.buf.implementation, opts)
+vim.keymap.set("n", "<space>sh", vim.lsp.buf.signature_help, opts)
+vim.keymap.set("n", "<space>wa", vim.lsp.buf.add_workspace_folder, opts)
+vim.keymap.set("n", "<space>wr", vim.lsp.buf.remove_workspace_folder, opts)
+vim.keymap.set("n", "<space>wl", function()
+ print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
+end, opts)
+vim.keymap.set("n", "<space>D", vim.lsp.buf.type_definition, opts)
+vim.keymap.set("n", "<space>rn", vim.lsp.buf.rename, opts)
+vim.keymap.set("n", "<space>ca", vim.lsp.buf.code_action, opts)
+vim.keymap.set("n", "<space>gr", vim.lsp.buf.references, opts)
+vim.keymap.set("n", "<space>f", function()
+ vim.lsp.buf.format({ async = true })
+end, opts)
+
+-- Use an on_attach function to only map the following keys
+-- after the language server attaches to the current buffer
+local on_attach = function(_, bufnr)
+ vim.api.nvim_set_option_value( -- Enable completion triggered by <c-x><c-o>
+ "omnifunc",
+ "v:lua.vim.lsp.omnifunc",
+ { buf = bufnr }
+ )
+end
+
+-- The nvim-cmp almost supports LSP's capabilities so You should advertise it to LSP servers..
+local capabilities = require("cmp_nvim_lsp").default_capabilities()
+
+local simple_servers = {
+ "bashls",
+ "clangd",
+ "jedi_language_server",
+ "jsonls",
+ "remark_ls",
+ "texlab",
+ "vimls",
+ "yamlls",
+}
+for _, lsp in ipairs(simple_servers) do
+ lspconfig[lsp].setup({ capabilities = capabilities, on_attach = on_attach })
+end
+
+require("lspconfig").lua_ls.setup({
+ on_init = function(client)
+ if client.workspace_folders then
+ local path = client.workspace_folders[1].name
+ if
+ vim.uv.fs_stat(path .. "/.luarc.json")
+ or vim.uv.fs_stat(path .. "/.luarc.jsonc")
+ then
+ return
+ end
+ end
+
+ client.config.settings.Lua =
+ vim.tbl_deep_extend("force", client.config.settings.Lua, {
+ runtime = {
+ -- Tell the language server which version of Lua you're using
+ -- (most likely LuaJIT in the case of Neovim)
+ version = "LuaJIT",
+ },
+ -- Make the server aware of Neovim runtime files
+ workspace = {
+ checkThirdParty = false,
+ library = {
+ vim.env.VIMRUNTIME,
+ -- Depending on the usage, you might want to add additional paths here.
+ -- "${3rd}/luv/library"
+ -- "${3rd}/busted/library",
+ },
+ -- or pull in all of 'runtimepath'. NOTE: this is a lot slower
+ -- library = vim.api.nvim_get_runtime_file("", true)
+ },
+ })
+ end,
+ settings = {
+ Lua = {},
+ },
+})