diff --git a/.config/nvim/after/plugin/lsp.lua b/.config/nvim/after/plugin/lsp.lua index 52a5ba35..d37befae 100644 --- a/.config/nvim/after/plugin/lsp.lua +++ b/.config/nvim/after/plugin/lsp.lua @@ -9,14 +9,6 @@ lsp.ensure_installed({ "rust_analyzer", }) --- see documentation of null-null-ls for more configuration options! -local mason_nullls = require("mason-null-ls") -mason_nullls.setup({ - automatic_installation = true, - automatic_setup = true, -}) -mason_nullls.setup_handlers({}) - local Remap = require("rahcodes.keymap") local nnoremap = Remap.nnoremap local inoremap = Remap.inoremap @@ -32,10 +24,30 @@ local cmp_mappings = lsp.defaults.cmp_mappings({ [""] = cmp.mapping.confirm({ select = true }), [""] = cmp.mapping.complete(), }) + lsp.setup_nvim_cmp({ mapping = cmp_mappings, }) +lsp.configure("solargraph", { + settings = { + solargraph = { + diagnostics = false, + }, + }, + on_attach = function() + print("hello solargraph") + end, +}) + +lsp.configure("sumneko_lua", { + settings = { + Lua = { + diagnostics = { globals = { "vim" } }, + }, + }, +}) + lsp.on_attach = function(client, bufnr) -- Disable LSP server formatting, to prevent formatting twice. -- Once by the LSP server, second time by NULL-ls. @@ -110,3 +122,10 @@ lsp.on_attach = function(client, bufnr) end lsp.setup() + +local mason_nullls = require("mason-null-ls") +mason_nullls.setup({ + automatic_installation = true, + automatic_setup = true, +}) +mason_nullls.setup_handlers({}) diff --git a/.config/nvim/after/plugin/mason.lua b/.config/nvim/after/plugin/mason.lua deleted file mode 100644 index af02d2bf..00000000 --- a/.config/nvim/after/plugin/mason.lua +++ /dev/null @@ -1,33 +0,0 @@ -local mason_status, mason = pcall(require, "mason") -if not mason_status then - return -end - -local mason_lspconfig_status, mason_lspconfig = pcall(require, "mason-lspconfig") -if not mason_lspconfig_status then - return -end - -local mason_null_ls_status, mason_null_ls = pcall(require, "mason-null-ls") -if not mason_null_ls_status then - return -end - -mason.setup() - -mason_lspconfig.setup({ - ensure_installed = { - "tsserver", - "html", - "cssls", - "sumneko_lua", - }, -}) - -mason_null_ls.setup({ - ensure_installed = { - "prettier", - "stylua", - "eslint_d", - }, -}) diff --git a/.config/nvim/after/plugin/null-ls.lua b/.config/nvim/after/plugin/null-ls.lua index ab13c945..09fb5771 100644 --- a/.config/nvim/after/plugin/null-ls.lua +++ b/.config/nvim/after/plugin/null-ls.lua @@ -4,15 +4,37 @@ if not setup then end local formatting = null_ls.builtins.formatting -local diagnostics = null_ls.builtins.diagnostics +local conditional = function(fn) + local utils = require("null-ls.utils").make_conditional_utils() + return fn(utils) +end + local augroup = vim.api.nvim_create_augroup("LspFormatting", {}) null_ls.setup({ sources = { formatting.prettier, formatting.stylua, - diagnostics.eslint_d, - diagnostics.rubocop, + + -- Here we set a conditional to call the rubocop formatter. If we have a Gemfile in the project, we call "bundle exec rubocop", if not we only call "rubocop". + conditional(function(utils) + return utils.root_has_file("Gemfile") + and null_ls.builtins.formatting.rubocop.with({ + command = "bundle", + args = vim.list_extend({ "exec", "rubocop" }, null_ls.builtins.formatting.rubocop._opts.args), + }) + or null_ls.builtins.formatting.rubocop + end), + + -- Same as above, but with diagnostics.rubocop to make sure we use the proper rubocop version for the project + conditional(function(utils) + return utils.root_has_file("Gemfile") + and null_ls.builtins.diagnostics.rubocop.with({ + command = "bundle", + args = vim.list_extend({ "exec", "rubocop" }, null_ls.builtins.diagnostics.rubocop._opts.args), + }) + or null_ls.builtins.diagnostics.rubocop + end), }, -- format on save on_attach = function(client, bufnr) @@ -22,7 +44,6 @@ null_ls.setup({ group = augroup, buffer = bufnr, callback = function() - -- on 0.8, you should use vim.lsp.buf.format({ bufnr = bufnr }) instead vim.lsp.buf.format({ bufnr = bufnr, timeout_ms = 10000 }) end, }) diff --git a/.config/nvim/after/plugin/telescope.lua b/.config/nvim/after/plugin/telescope.lua index 8206f3e9..57adb12e 100644 --- a/.config/nvim/after/plugin/telescope.lua +++ b/.config/nvim/after/plugin/telescope.lua @@ -22,7 +22,6 @@ vim.keymap.set("n", "fh", builtin.help_tags, {}) vim.keymap.set("n", "m", builtin.oldfiles, {}) vim.keymap.set("n", "gb", builtin.git_branches, {}) --- vim.keymap.set('n', 'gs', builtin.git_status, {}) vim.keymap.set("n", "", builtin.git_files, {}) vim.keymap.set("n", "ps", function() builtin.grep_string({ search = vim.fn.input("Grep > ") }) diff --git a/.config/nvim/lua/rahcodes/remap.lua b/.config/nvim/lua/rahcodes/remap.lua index 12c838a2..6bfd17c0 100644 --- a/.config/nvim/lua/rahcodes/remap.lua +++ b/.config/nvim/lua/rahcodes/remap.lua @@ -48,7 +48,7 @@ nmap("sp", ":bprev") nmap("sn", ":bnext") vim.keymap.set("n", "f", function() - vim.lsp.buf.format() + vim.lsp.buf.format({ timeout_ms = 10000 }) end) vim.keymap.set("n", "F", function() vim.lsp.buf.range_format() diff --git a/.config/nvim/plugin/packer_compiled.lua b/.config/nvim/plugin/packer_compiled.lua index 71b942e8..7c384753 100644 --- a/.config/nvim/plugin/packer_compiled.lua +++ b/.config/nvim/plugin/packer_compiled.lua @@ -49,8 +49,8 @@ local function save_profiles(threshold) end time([[Luarocks path setup]], true) -local package_path_str = "/home/striderz/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?.lua;/home/striderz/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?/init.lua;/home/striderz/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?.lua;/home/striderz/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?/init.lua" -local install_cpath_pattern = "/home/striderz/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/lua/5.1/?.so" +local package_path_str = "/Users/rahsheen.porter/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?.lua;/Users/rahsheen.porter/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?/init.lua;/Users/rahsheen.porter/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?.lua;/Users/rahsheen.porter/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?/init.lua" +local install_cpath_pattern = "/Users/rahsheen.porter/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/lua/5.1/?.so" if not string.find(package.path, package_path_str, 1, true) then package.path = package.path .. ';' .. package_path_str end @@ -76,147 +76,147 @@ time([[Defining packer_plugins]], true) _G.packer_plugins = { LuaSnip = { loaded = true, - path = "/home/striderz/.local/share/nvim/site/pack/packer/start/LuaSnip", + path = "/Users/rahsheen.porter/.local/share/nvim/site/pack/packer/start/LuaSnip", url = "https://github.com/L3MON4D3/LuaSnip" }, ["cmp-buffer"] = { loaded = true, - path = "/home/striderz/.local/share/nvim/site/pack/packer/start/cmp-buffer", + path = "/Users/rahsheen.porter/.local/share/nvim/site/pack/packer/start/cmp-buffer", url = "https://github.com/hrsh7th/cmp-buffer" }, ["cmp-nvim-lsp"] = { loaded = true, - path = "/home/striderz/.local/share/nvim/site/pack/packer/start/cmp-nvim-lsp", + path = "/Users/rahsheen.porter/.local/share/nvim/site/pack/packer/start/cmp-nvim-lsp", url = "https://github.com/hrsh7th/cmp-nvim-lsp" }, ["cmp-nvim-lua"] = { loaded = true, - path = "/home/striderz/.local/share/nvim/site/pack/packer/start/cmp-nvim-lua", + path = "/Users/rahsheen.porter/.local/share/nvim/site/pack/packer/start/cmp-nvim-lua", url = "https://github.com/hrsh7th/cmp-nvim-lua" }, ["cmp-path"] = { loaded = true, - path = "/home/striderz/.local/share/nvim/site/pack/packer/start/cmp-path", + path = "/Users/rahsheen.porter/.local/share/nvim/site/pack/packer/start/cmp-path", url = "https://github.com/hrsh7th/cmp-path" }, cmp_luasnip = { loaded = true, - path = "/home/striderz/.local/share/nvim/site/pack/packer/start/cmp_luasnip", + path = "/Users/rahsheen.porter/.local/share/nvim/site/pack/packer/start/cmp_luasnip", url = "https://github.com/saadparwaiz1/cmp_luasnip" }, ["friendly-snippets"] = { loaded = true, - path = "/home/striderz/.local/share/nvim/site/pack/packer/start/friendly-snippets", + path = "/Users/rahsheen.porter/.local/share/nvim/site/pack/packer/start/friendly-snippets", url = "https://github.com/rafamadriz/friendly-snippets" }, ["gitsigns.nvim"] = { config = { "\27LJ\2\n6\0\0\3\0\3\0\0066\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\nsetup\rgitsigns\frequire\0" }, loaded = true, - path = "/home/striderz/.local/share/nvim/site/pack/packer/start/gitsigns.nvim", + path = "/Users/rahsheen.porter/.local/share/nvim/site/pack/packer/start/gitsigns.nvim", url = "https://github.com/lewis6991/gitsigns.nvim" }, harpoon = { loaded = true, - path = "/home/striderz/.local/share/nvim/site/pack/packer/start/harpoon", + path = "/Users/rahsheen.porter/.local/share/nvim/site/pack/packer/start/harpoon", url = "https://github.com/theprimeagen/harpoon" }, ["lsp-zero.nvim"] = { loaded = true, - path = "/home/striderz/.local/share/nvim/site/pack/packer/start/lsp-zero.nvim", + path = "/Users/rahsheen.porter/.local/share/nvim/site/pack/packer/start/lsp-zero.nvim", url = "https://github.com/VonHeikemen/lsp-zero.nvim" }, ["lualine.nvim"] = { loaded = true, - path = "/home/striderz/.local/share/nvim/site/pack/packer/start/lualine.nvim", + path = "/Users/rahsheen.porter/.local/share/nvim/site/pack/packer/start/lualine.nvim", url = "https://github.com/nvim-lualine/lualine.nvim" }, ["mason-lspconfig.nvim"] = { loaded = true, - path = "/home/striderz/.local/share/nvim/site/pack/packer/start/mason-lspconfig.nvim", + path = "/Users/rahsheen.porter/.local/share/nvim/site/pack/packer/start/mason-lspconfig.nvim", url = "https://github.com/williamboman/mason-lspconfig.nvim" }, ["mason-null-ls.nvim"] = { loaded = true, - path = "/home/striderz/.local/share/nvim/site/pack/packer/start/mason-null-ls.nvim", + path = "/Users/rahsheen.porter/.local/share/nvim/site/pack/packer/start/mason-null-ls.nvim", url = "https://github.com/jayp0521/mason-null-ls.nvim" }, ["mason.nvim"] = { loaded = true, - path = "/home/striderz/.local/share/nvim/site/pack/packer/start/mason.nvim", + path = "/Users/rahsheen.porter/.local/share/nvim/site/pack/packer/start/mason.nvim", url = "https://github.com/williamboman/mason.nvim" }, ["null-ls.nvim"] = { loaded = true, - path = "/home/striderz/.local/share/nvim/site/pack/packer/start/null-ls.nvim", + path = "/Users/rahsheen.porter/.local/share/nvim/site/pack/packer/start/null-ls.nvim", url = "https://github.com/jose-elias-alvarez/null-ls.nvim" }, ["nvim-cmp"] = { loaded = true, - path = "/home/striderz/.local/share/nvim/site/pack/packer/start/nvim-cmp", + path = "/Users/rahsheen.porter/.local/share/nvim/site/pack/packer/start/nvim-cmp", url = "https://github.com/hrsh7th/nvim-cmp" }, ["nvim-lspconfig"] = { loaded = true, - path = "/home/striderz/.local/share/nvim/site/pack/packer/start/nvim-lspconfig", + path = "/Users/rahsheen.porter/.local/share/nvim/site/pack/packer/start/nvim-lspconfig", url = "https://github.com/neovim/nvim-lspconfig" }, ["nvim-surround"] = { config = { "\27LJ\2\n?\0\0\3\0\3\0\a6\0\0\0'\2\1\0B\0\2\0029\0\2\0004\2\0\0B\0\2\1K\0\1\0\nsetup\18nvim-surround\frequire\0" }, loaded = true, - path = "/home/striderz/.local/share/nvim/site/pack/packer/start/nvim-surround", + path = "/Users/rahsheen.porter/.local/share/nvim/site/pack/packer/start/nvim-surround", url = "https://github.com/kylechui/nvim-surround" }, ["nvim-treesitter"] = { loaded = true, - path = "/home/striderz/.local/share/nvim/site/pack/packer/start/nvim-treesitter", + path = "/Users/rahsheen.porter/.local/share/nvim/site/pack/packer/start/nvim-treesitter", url = "https://github.com/nvim-treesitter/nvim-treesitter" }, ["nvim-web-devicons"] = { loaded = false, needs_bufread = false, - path = "/home/striderz/.local/share/nvim/site/pack/packer/opt/nvim-web-devicons", + path = "/Users/rahsheen.porter/.local/share/nvim/site/pack/packer/opt/nvim-web-devicons", url = "https://github.com/nvim-tree/nvim-web-devicons" }, ["packer.nvim"] = { loaded = true, - path = "/home/striderz/.local/share/nvim/site/pack/packer/start/packer.nvim", + path = "/Users/rahsheen.porter/.local/share/nvim/site/pack/packer/start/packer.nvim", url = "https://github.com/wbthomason/packer.nvim" }, ["plenary.nvim"] = { loaded = true, - path = "/home/striderz/.local/share/nvim/site/pack/packer/start/plenary.nvim", + path = "/Users/rahsheen.porter/.local/share/nvim/site/pack/packer/start/plenary.nvim", url = "https://github.com/nvim-lua/plenary.nvim" }, ["telescope-fzf-native.nvim"] = { loaded = true, - path = "/home/striderz/.local/share/nvim/site/pack/packer/start/telescope-fzf-native.nvim", + path = "/Users/rahsheen.porter/.local/share/nvim/site/pack/packer/start/telescope-fzf-native.nvim", url = "https://github.com/nvim-telescope/telescope-fzf-native.nvim" }, ["telescope.nvim"] = { loaded = true, - path = "/home/striderz/.local/share/nvim/site/pack/packer/start/telescope.nvim", + path = "/Users/rahsheen.porter/.local/share/nvim/site/pack/packer/start/telescope.nvim", url = "https://github.com/nvim-telescope/telescope.nvim", wants = { "telescope-fzf-native.nvim" } }, ["tokyonight.nvim"] = { loaded = true, - path = "/home/striderz/.local/share/nvim/site/pack/packer/start/tokyonight.nvim", + path = "/Users/rahsheen.porter/.local/share/nvim/site/pack/packer/start/tokyonight.nvim", url = "https://github.com/folke/tokyonight.nvim" }, ["trouble.nvim"] = { config = { "\27LJ\2\n9\0\0\3\0\3\0\a6\0\0\0'\2\1\0B\0\2\0029\0\2\0004\2\0\0B\0\2\1K\0\1\0\nsetup\ftrouble\frequire\0" }, loaded = true, - path = "/home/striderz/.local/share/nvim/site/pack/packer/start/trouble.nvim", + path = "/Users/rahsheen.porter/.local/share/nvim/site/pack/packer/start/trouble.nvim", url = "https://github.com/folke/trouble.nvim" }, ["vim-fugitive"] = { loaded = true, - path = "/home/striderz/.local/share/nvim/site/pack/packer/start/vim-fugitive", + path = "/Users/rahsheen.porter/.local/share/nvim/site/pack/packer/start/vim-fugitive", url = "https://github.com/tpope/vim-fugitive" }, ["vim-rhubarb"] = { loaded = true, - path = "/home/striderz/.local/share/nvim/site/pack/packer/start/vim-rhubarb", + path = "/Users/rahsheen.porter/.local/share/nvim/site/pack/packer/start/vim-rhubarb", url = "https://github.com/tpope/vim-rhubarb" } } @@ -226,14 +226,14 @@ time([[Defining packer_plugins]], false) time([[Config for gitsigns.nvim]], true) try_loadstring("\27LJ\2\n6\0\0\3\0\3\0\0066\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\nsetup\rgitsigns\frequire\0", "config", "gitsigns.nvim") time([[Config for gitsigns.nvim]], false) --- Config for: nvim-surround -time([[Config for nvim-surround]], true) -try_loadstring("\27LJ\2\n?\0\0\3\0\3\0\a6\0\0\0'\2\1\0B\0\2\0029\0\2\0004\2\0\0B\0\2\1K\0\1\0\nsetup\18nvim-surround\frequire\0", "config", "nvim-surround") -time([[Config for nvim-surround]], false) -- Config for: trouble.nvim time([[Config for trouble.nvim]], true) try_loadstring("\27LJ\2\n9\0\0\3\0\3\0\a6\0\0\0'\2\1\0B\0\2\0029\0\2\0004\2\0\0B\0\2\1K\0\1\0\nsetup\ftrouble\frequire\0", "config", "trouble.nvim") time([[Config for trouble.nvim]], false) +-- Config for: nvim-surround +time([[Config for nvim-surround]], true) +try_loadstring("\27LJ\2\n?\0\0\3\0\3\0\a6\0\0\0'\2\1\0B\0\2\0029\0\2\0004\2\0\0B\0\2\1K\0\1\0\nsetup\18nvim-surround\frequire\0", "config", "nvim-surround") +time([[Config for nvim-surround]], false) _G._packer.inside_compile = false if _G._packer.needs_bufread == true then