mirror of
https://github.com/ViViDboarder/vim-settings.git
synced 2025-01-08 09:27:36 +00:00
Refactor plugin loading
Make Packer lazy loaded and move lsp config into plugin rather than from packer
This commit is contained in:
parent
f4a7db3ea1
commit
70c31d66eb
@ -19,5 +19,10 @@ elseif vim.fn.executable("ack") == 1 then
|
|||||||
o.grepprg = "ack"
|
o.grepprg = "ack"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Disable polyglot for langauges I've added special support for
|
||||||
|
vim.g.polyglot_disabled = { "go", "rust" }
|
||||||
|
|
||||||
-- Plugins
|
-- Plugins
|
||||||
require("plugins")
|
-- Packer auto installs and then lazy loads itself on PackerCommand and require the plugins module
|
||||||
|
-- This command should only really be needed to bootstrap a new system
|
||||||
|
vim.cmd [[command! PackerBootstrap lua require("plugins")]]
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
-- Install packer
|
-- Install packer
|
||||||
local install_path = vim.fn.stdpath("data").."/site/pack/packer/start/packer.nvim"
|
local install_path = vim.fn.stdpath("data").."/site/pack/packer/opt/packer.nvim"
|
||||||
|
local packer_bootstrap = false
|
||||||
if vim.fn.empty(vim.fn.glob(install_path)) > 0 then
|
if vim.fn.empty(vim.fn.glob(install_path)) > 0 then
|
||||||
vim.fn.system({"git", "clone", "https://github.com/wbthomason/packer.nvim", install_path})
|
packer_bootstrap = vim.fn.system({"git", "clone", "https://github.com/wbthomason/packer.nvim", install_path})
|
||||||
vim.cmd "packadd packer.nvim"
|
|
||||||
end
|
end
|
||||||
|
vim.cmd "packadd packer.nvim"
|
||||||
|
|
||||||
-- Configures dark-notify to use colors from my environment
|
-- Configures dark-notify to use colors from my environment
|
||||||
local function config_dark_notify()
|
local function config_dark_notify()
|
||||||
@ -16,23 +16,63 @@ local function config_dark_notify()
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Disable polyglot for langauges I've added special support for
|
return require('packer').startup(function(use)
|
||||||
vim.g.polyglot_disabled = { "go", "rust" }
|
-- Load things faster!
|
||||||
|
-- use {'lewis6991/impatient.nvim', config = [[require('impatient')]]}
|
||||||
|
|
||||||
return require('packer').startup(function()
|
-- Let Packer manage and lazyload itself
|
||||||
-- luacheck: push globals use
|
use {
|
||||||
use {'lewis6991/impatient.nvim', config = [[require('impatient')]]}
|
"wbthomason/packer.nvim",
|
||||||
use {"wbthomason/packer.nvim", opt = true}
|
cmd = {
|
||||||
|
"PackerClean",
|
||||||
|
"PackerCompile",
|
||||||
|
"PackerInstall",
|
||||||
|
"PackerLoad",
|
||||||
|
"PackerProfile",
|
||||||
|
"PackerStatus",
|
||||||
|
"PackerSync",
|
||||||
|
"PackerUpdate",
|
||||||
|
},
|
||||||
|
config = [[require("plugins")]],
|
||||||
|
}
|
||||||
|
|
||||||
-- Quality of life
|
-- Colorschemes
|
||||||
|
use {
|
||||||
|
"vim-scripts/wombat256.vim",
|
||||||
|
{ "ViViDboarder/wombat.nvim", requires = "rktjmp/lush.nvim" },
|
||||||
|
{ "ViViDboarder/wombuddy.nvim", requires = "tjdevries/colorbuddy.vim" },
|
||||||
|
"ishan9299/nvim-solarized-lua",
|
||||||
|
{
|
||||||
|
"folke/tokyonight.nvim",
|
||||||
|
run = "fish -c 'echo \"set --path --prepend fish_themes_path \"(pwd)\"/extras\" > ~/.config/fish/conf.d/tokyonight.fish' || true", -- luacheck: no max line length
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
-- Auto and ends to some ifs and dos
|
||||||
use "tpope/vim-endwise"
|
use "tpope/vim-endwise"
|
||||||
|
|
||||||
|
-- Unix commands from vim? Yup!
|
||||||
use "tpope/vim-eunuch"
|
use "tpope/vim-eunuch"
|
||||||
|
|
||||||
|
-- Adds repeats for custom motions
|
||||||
use "tpope/vim-repeat"
|
use "tpope/vim-repeat"
|
||||||
|
|
||||||
|
-- Readline shortcuts
|
||||||
use "tpope/vim-rsi"
|
use "tpope/vim-rsi"
|
||||||
|
|
||||||
|
-- Surround motions
|
||||||
use "tpope/vim-surround"
|
use "tpope/vim-surround"
|
||||||
|
|
||||||
|
-- Better netrw
|
||||||
use "tpope/vim-vinegar"
|
use "tpope/vim-vinegar"
|
||||||
|
|
||||||
|
-- Easier jumping to lines
|
||||||
use "vim-scripts/file-line"
|
use "vim-scripts/file-line"
|
||||||
|
|
||||||
|
-- Auto ctags generation
|
||||||
use "ludovicchabant/vim-gutentags"
|
use "ludovicchabant/vim-gutentags"
|
||||||
|
|
||||||
|
-- Better commenting
|
||||||
use {
|
use {
|
||||||
"tomtom/tcomment_vim",
|
"tomtom/tcomment_vim",
|
||||||
config = function()
|
config = function()
|
||||||
@ -40,16 +80,21 @@ return require('packer').startup(function()
|
|||||||
vim.api.nvim_set_keymap("v", "//", ":TCommentBlock<CR>", {silent=true, noremap=true})
|
vim.api.nvim_set_keymap("v", "//", ":TCommentBlock<CR>", {silent=true, noremap=true})
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
-- Allow wrapping and joining of arguments across multiple lines
|
||||||
use {
|
use {
|
||||||
"FooSoft/vim-argwrap",
|
"FooSoft/vim-argwrap",
|
||||||
config = function()
|
config = function()
|
||||||
vim.api.nvim_set_keymap("n","<Leader>a", ":ArgWrap<CR>", {silent=true, noremap=true})
|
vim.api.nvim_set_keymap("n","<Leader>a", ":ArgWrap<CR>", {silent=true, noremap=true})
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
-- Adds git operations to vim
|
||||||
use {
|
use {
|
||||||
"tpope/vim-fugitive",
|
"tpope/vim-fugitive",
|
||||||
-- cmd = {"Git"},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
-- Quick toggling of Location and Quickfix lists
|
||||||
use {
|
use {
|
||||||
"milkypostman/vim-togglelist",
|
"milkypostman/vim-togglelist",
|
||||||
config = function()
|
config = function()
|
||||||
@ -57,37 +102,34 @@ return require('packer').startup(function()
|
|||||||
vim.api.nvim_set_keymap("n", "<F7>", ":call ToggleLocationList()<CR>", {silent=true, noremap=true})
|
vim.api.nvim_set_keymap("n", "<F7>", ":call ToggleLocationList()<CR>", {silent=true, noremap=true})
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
-- Find text everywhere!
|
||||||
use {
|
use {
|
||||||
"mhinz/vim-grepper",
|
"mhinz/vim-grepper",
|
||||||
config = function() require("plugins.grepper") end,
|
config = function() require("plugins.grepper") end,
|
||||||
}
|
}
|
||||||
|
|
||||||
-- UI
|
-- Highlight inline colors
|
||||||
use {
|
|
||||||
"ViViDboarder/wombat.nvim",
|
|
||||||
requires = "rktjmp/lush.nvim",
|
|
||||||
}
|
|
||||||
use {
|
|
||||||
"ViViDboarder/wombuddy.nvim",
|
|
||||||
requires = "tjdevries/colorbuddy.vim",
|
|
||||||
}
|
|
||||||
use "vim-scripts/wombat256.vim"
|
|
||||||
use "ishan9299/nvim-solarized-lua"
|
|
||||||
use {
|
use {
|
||||||
"norcalli/nvim-colorizer.lua",
|
"norcalli/nvim-colorizer.lua",
|
||||||
config = function() require("colorizer").setup() end,
|
config = function() require("colorizer").setup() end,
|
||||||
}
|
}
|
||||||
use {
|
|
||||||
"folke/tokyonight.nvim",
|
-- Custom status line
|
||||||
run = "fish -c 'echo \"set --path --prepend fish_themes_path \"(pwd)\"/extras\" > ~/.config/fish/conf.d/tokyonight.fish' || true", -- luacheck: no max line length
|
use { "SmiteshP/nvim-gps", requires = "nvim-treesitter/nvim-treesitter" }
|
||||||
}
|
|
||||||
use {
|
use {
|
||||||
"nvim-lualine/lualine.nvim",
|
"nvim-lualine/lualine.nvim",
|
||||||
config = function() require("plugins.lualine").config_lualine() end,
|
config = function() require("plugins.lualine").config_lualine() end,
|
||||||
requires = {
|
requires = {
|
||||||
"SmiteshP/nvim-gps",
|
-- Show my current location in my status bar
|
||||||
|
-- { "SmiteshP/nvim-gps", requires = "nvim-treesitter/nvim-treesitter" },
|
||||||
|
},
|
||||||
|
after = {
|
||||||
|
"nvim-gps"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
-- On Mac, update colors when dark mode changes
|
||||||
use {
|
use {
|
||||||
"cormacrelf/dark-notify",
|
"cormacrelf/dark-notify",
|
||||||
-- Download latest release on install
|
-- Download latest release on install
|
||||||
@ -95,37 +137,35 @@ return require('packer').startup(function()
|
|||||||
config = config_dark_notify,
|
config = config_dark_notify,
|
||||||
requires = "nvim-lualine/lualine.nvim",
|
requires = "nvim-lualine/lualine.nvim",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
-- Custom start screen
|
||||||
use {
|
use {
|
||||||
'mhinz/vim-startify',
|
'mhinz/vim-startify',
|
||||||
config = function() require("utils").require_with_local("plugins.startify") end,
|
config = function() require("utils").require_with_local("plugins.startify") end,
|
||||||
}
|
}
|
||||||
|
|
||||||
-- LSP
|
-- LSP
|
||||||
use {
|
|
||||||
"jose-elias-alvarez/null-ls.nvim",
|
-- Configure language servers
|
||||||
config = function() require("plugins.lsp").config_null_ls() end,
|
|
||||||
requires = {
|
|
||||||
"nvim-lua/plenary.nvim",
|
|
||||||
}
|
|
||||||
}
|
|
||||||
use {
|
use {
|
||||||
"neovim/nvim-lspconfig",
|
"neovim/nvim-lspconfig",
|
||||||
config = function() require("plugins.lsp").config_lsp() end,
|
|
||||||
requires = {
|
requires = {
|
||||||
"hrsh7th/cmp-nvim-lsp",
|
|
||||||
"jose-elias-alvarez/null-ls.nvim",
|
"jose-elias-alvarez/null-ls.nvim",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
-- NOTE: Disabled because it's got issues with Neovim 0.6.0
|
|
||||||
|
-- Generic linter/formatters in diagnostics API
|
||||||
|
use {
|
||||||
|
"jose-elias-alvarez/null-ls.nvim",
|
||||||
|
requires = { "nvim-lua/plenary.nvim", "neovim/nvim-lspconfig" },
|
||||||
|
}
|
||||||
|
|
||||||
|
-- Fancy LSP UIs
|
||||||
use {
|
use {
|
||||||
"glepnir/lspsaga.nvim",
|
"glepnir/lspsaga.nvim",
|
||||||
opt = true,
|
|
||||||
requires = "neovim/nvim-lspconfig",
|
requires = "neovim/nvim-lspconfig",
|
||||||
config = function() require("plugins.lsp").config_lsp_saga() end,
|
-- NOTE: Disabled because it's got issues with Neovim 0.6.0
|
||||||
}
|
disable = true,
|
||||||
use {
|
|
||||||
"SmiteshP/nvim-gps",
|
|
||||||
requires = "nvim-treesitter/nvim-treesitter",
|
|
||||||
}
|
}
|
||||||
|
|
||||||
-- Writing
|
-- Writing
|
||||||
@ -176,13 +216,17 @@ return require('packer').startup(function()
|
|||||||
"f3fora/cmp-spell",
|
"f3fora/cmp-spell",
|
||||||
"L3MON4D3/LuaSnip",
|
"L3MON4D3/LuaSnip",
|
||||||
"saadparwaiz1/cmp_luasnip",
|
"saadparwaiz1/cmp_luasnip",
|
||||||
}
|
},
|
||||||
|
event = "InsertEnter *",
|
||||||
}
|
}
|
||||||
|
|
||||||
-- Fuzzy Finder
|
-- Fuzzy Finder
|
||||||
use {
|
use {
|
||||||
"nvim-telescope/telescope.nvim",
|
"nvim-telescope/telescope.nvim",
|
||||||
requires = "nvim-lua/plenary.nvim",
|
requires = {
|
||||||
|
"nvim-lua/plenary.nvim",
|
||||||
|
"nvim-lua/popup.nvim",
|
||||||
|
},
|
||||||
config = function() require("plugins.telescope") end,
|
config = function() require("plugins.telescope") end,
|
||||||
}
|
}
|
||||||
--[[
|
--[[
|
||||||
@ -251,5 +295,8 @@ return require('packer').startup(function()
|
|||||||
cmd = {"StartupTime"},
|
cmd = {"StartupTime"},
|
||||||
}
|
}
|
||||||
|
|
||||||
-- luacheck: pop
|
-- Auto sync after bootstrapping on a fresh box
|
||||||
|
if packer_bootstrap then
|
||||||
|
require("packer").sync()
|
||||||
|
end
|
||||||
end)
|
end)
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
local M = {}
|
local M = {}
|
||||||
local utils = require("utils")
|
local utils = require("utils")
|
||||||
|
|
||||||
local function config_lsp_ui()
|
function M.config_lsp_ui()
|
||||||
-- Add floating window boarders
|
-- Add floating window boarders
|
||||||
vim.cmd [[autocmd ColorScheme * highlight NormalFloat guibg=#1f2335]]
|
vim.cmd [[autocmd ColorScheme * highlight NormalFloat guibg=#1f2335]]
|
||||||
vim.cmd [[autocmd ColorScheme * highlight FloatBorder guifg=white guibg=#1f2335]]
|
vim.cmd [[autocmd ColorScheme * highlight FloatBorder guifg=white guibg=#1f2335]]
|
||||||
@ -30,7 +30,6 @@ local function config_lsp_ui()
|
|||||||
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl })
|
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl })
|
||||||
end
|
end
|
||||||
|
|
||||||
-- vim.cmd [[autocmd CursorHold,CursorHoldI * lua vim.diagnostic.open_float(nil, {focus=false})]]
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local function default_attach(client, bufnr)
|
local function default_attach(client, bufnr)
|
||||||
@ -38,8 +37,6 @@ local function default_attach(client, bufnr)
|
|||||||
require('completion').on_attach()
|
require('completion').on_attach()
|
||||||
end
|
end
|
||||||
|
|
||||||
config_lsp_ui()
|
|
||||||
|
|
||||||
local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end
|
local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end
|
||||||
local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end
|
local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end
|
||||||
|
|
||||||
@ -64,6 +61,9 @@ local function default_attach(client, bufnr)
|
|||||||
buf_set_keymap('n', ']d', '<cmd>lua vim.lsp.diagnostic.goto_next()<CR>', opts)
|
buf_set_keymap('n', ']d', '<cmd>lua vim.lsp.diagnostic.goto_next()<CR>', opts)
|
||||||
buf_set_keymap('n', '<leader>q', '<cmd>lua vim.lsp.diagnostic.set_loclist()<CR>', opts)
|
buf_set_keymap('n', '<leader>q', '<cmd>lua vim.lsp.diagnostic.set_loclist()<CR>', opts)
|
||||||
|
|
||||||
|
-- Open diagnostic on hold
|
||||||
|
vim.cmd [[autocmd CursorHold,CursorHoldI * lua vim.diagnostic.open_float(nil, {focus=false})]]
|
||||||
|
|
||||||
-- Set some keybinds conditional on server capabilities
|
-- Set some keybinds conditional on server capabilities
|
||||||
if client.resolved_capabilities.document_formatting then
|
if client.resolved_capabilities.document_formatting then
|
||||||
buf_set_keymap("n", "<leader>f", "<cmd>lua vim.lsp.buf.formatting()<CR>", opts)
|
buf_set_keymap("n", "<leader>f", "<cmd>lua vim.lsp.buf.formatting()<CR>", opts)
|
||||||
@ -185,11 +185,6 @@ function M.config_null_ls()
|
|||||||
-- null_ls.builtins.formatting.rustfmt,
|
-- null_ls.builtins.formatting.rustfmt,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
--[[
|
|
||||||
require("lspconfig")["null-ls"].setup{
|
|
||||||
on_attach=default_attach,
|
|
||||||
}
|
|
||||||
--]]
|
|
||||||
end
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
11
neovim/plugin/lsp.lua
Normal file
11
neovim/plugin/lsp.lua
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
local utils = require("utils")
|
||||||
|
local lsp_config = require("plugins.lsp")
|
||||||
|
|
||||||
|
-- Configure my various lsp stuffs
|
||||||
|
lsp_config.config_null_ls()
|
||||||
|
lsp_config.config_lsp()
|
||||||
|
lsp_config.config_lsp_ui()
|
||||||
|
|
||||||
|
if utils.is_plugin_loaded("lspsaga.nvim") then
|
||||||
|
lsp_config.config_lsp_saga()
|
||||||
|
end
|
Loading…
Reference in New Issue
Block a user