summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoradamstuck <adam.moloney.stuck@gmail.com>2022-03-12 17:38:32 +0100
committeradamstuck <adam.moloney.stuck@gmail.com>2022-03-13 18:07:03 +0100
commit7b46477a3ddd6ce80736cc058d2f7f3b58fdb966 (patch)
treebd3ad020f28d368fcd268038e3a47ff695ebac51
parent082c8cfa8fd385dff9b1662d0a58529ff89284b7 (diff)
nvim: better lazy loading
-rw-r--r--.config/nvim/lua/options.lua1
-rw-r--r--.config/nvim/lua/plugins.lua260
-rw-r--r--.config/nvim/lua/setup/indent-blankline.lua6
-rw-r--r--.config/nvim/lua/setup/lualine.lua2
-rw-r--r--.config/nvim/lua/setup/nvim-cmp.lua4
5 files changed, 155 insertions, 118 deletions
diff --git a/.config/nvim/lua/options.lua b/.config/nvim/lua/options.lua
index caeccc7..68d6705 100644
--- a/.config/nvim/lua/options.lua
+++ b/.config/nvim/lua/options.lua
@@ -1,7 +1,6 @@
vim.cmd('syntax enable')
vim.cmd('set undodir=$XDG_CACHE_HOME/nvim/undo')
vim.cmd('set undofile')
-require('onedark').load()
local set = vim.opt
set.mouse = "a"
diff --git a/.config/nvim/lua/plugins.lua b/.config/nvim/lua/plugins.lua
index 3164516..ec7545b 100644
--- a/.config/nvim/lua/plugins.lua
+++ b/.config/nvim/lua/plugins.lua
@@ -1,132 +1,170 @@
-local use = require('packer').use
-require('packer').startup(function()
- use 'wbthomason/packer.nvim'
- use 'adast9/onedark.nvim'
- use 'nathom/filetype.nvim'
- use {
- 'lewis6991/impatient.nvim',
+local packer = require("packer")
+
+local plugins = {
+ { "nathom/filetype.nvim" },
+
+ {
+ "nvim-lua/plenary.nvim",
+ opt = true,
+ },
+
+ {
+ "lewis6991/impatient.nvim",
+ config = function()
+ require("impatient")
+ end,
+ },
+
+ {
+ "wbthomason/packer.nvim",
+ event = "VimEnter",
+ },
+
+ {
+ "adast9/onedark.nvim",
+ after = "packer.nvim",
config = function()
- require("impatient")
- end
- }
-
- use 'tpope/vim-surround'
- use {
- 'b3nj5m1n/kommentary',
- keys = {
- {"n", "gcc"},
- {"n", "gc"},
- {"v", "gc"},
- },
+ require('onedark').load()
+ end,
+ },
+
+ {
+ "kyazdani42/nvim-web-devicons",
+ after = "onedark.nvim"
+ },
+
+ {
+ "nvim-lualine/lualine.nvim",
+ after = "nvim-web-devicons",
config = function()
- require "setup.kommentary"
- end
- }
+ require "setup.lualine"
+ end,
+ },
- use {
- 'williamboman/nvim-lsp-installer',
- -- after = 'nvim-lspconfig',
+ {
+ "lukas-reineke/indent-blankline.nvim",
+ event = { "BufRead" , "BufNewFile" },
config = function()
- require "setup.nvim-lsp-installer"
- end
- }
+ require "setup.indent-blankline"
+ end,
+ },
- use 'neovim/nvim-lspconfig'
- -- use {
- -- 'neovim/nvim-lspconfig',
- -- after = { 'nvim-cmp' },
- -- event = { 'BufRead', 'BufNewFile', 'InsertEnter' },
- -- }
+ {
+ "nvim-treesitter/nvim-treesitter",
+ event = { "BufRead" , "BufNewFile" },
+ config = function()
+ require "setup.nvim-treesitter"
+ end,
+ run = ':TSUpdate',
+ },
- use {
- 'hrsh7th/nvim-cmp',
- event = 'InsertEnter',
- config = function()
- require "setup.nvim-cmp"
+ {
+ "lewis6991/gitsigns.nvim",
+ event = { "BufRead" , "BufNewFile" },
+ wants = "plenary.nvim",
+ config = function()
+ require('gitsigns').setup()
+ end,
+ },
+
+ -- lsp stuff
+
+ { "neovim/nvim-lspconfig" },
+
+ {
+ "williamboman/nvim-lsp-installer",
+ after = "nvim-lspconfig",
+ config = function()
+ require "setup.nvim-lsp-installer"
end,
- wants = 'LuaSnip',
- requires = {
- {
- 'hrsh7th/cmp-nvim-lsp'
- },
- {
- "L3MON4D3/LuaSnip",
- wants = "friendly-snippets",
- event = "InsertCharPre",
- config = function()
- require("luasnip/loaders/from_vscode").lazy_load()
- end
- },
- {
- "rafamadriz/friendly-snippets",
- event = "InsertCharPre"
- },
- {
- "saadparwaiz1/cmp_luasnip",
- event = "InsertCharPre"
- }
- }
- }
-
- use {
+ },
+
+ {
"ray-x/lsp_signature.nvim",
+ after = "nvim-lspconfig",
event = 'InsertEnter',
- -- event = { 'BufRead' , 'BufNewFile' },
config = function()
require "setup.lsp_signature"
end
- }
+ },
- use {
- "windwp/nvim-autopairs",
- after = { 'nvim-cmp'},
- config = function()
- require('nvim-autopairs').setup{}
- end
- }
+ -- load luasnips + cmp related in insert mode only
- use {
- "lukas-reineke/indent-blankline.nvim",
- event = { 'BufRead' , 'BufNewFile' },
+ {
+ "L3MON4D3/LuaSnip",
+ wants = "friendly-snippets",
+ event = "InsertEnter",
config = function()
- require "setup.indent-blankline"
- end
- }
-
- use {
- 'nvim-telescope/telescope.nvim',
- requires = {
- 'nvim-lua/popup.nvim',
- 'nvim-lua/plenary.nvim',
- 'nvim-telescope/telescope-fzy-native.nvim',
- 'BurntSushi/ripgrep'
- }
- }
-
- use {
- 'lewis6991/gitsigns.nvim',
- requires = {
- 'nvim-lua/plenary.nvim'
- },
- event = { 'BufRead' , 'BufNewFile' },
+ require("luasnip/loaders/from_vscode").lazy_load()
+ end,
+ },
+
+ {
+ "rafamadriz/friendly-snippets",
+ module = "cmp_nvim_lsp",
+ },
+
+ {
+ "hrsh7th/nvim-cmp",
+ after = "LuaSnip",
config = function()
- require('gitsigns').setup()
- end
- }
+ require "setup.nvim-cmp"
+ end,
+ },
- use {
- 'nvim-treesitter/nvim-treesitter',
- run = ':TSUpdate',
+
+ {
+ "saadparwaiz1/cmp_luasnip",
+ after = "LuaSnip",
+ },
+
+ {
+ "hrsh7th/cmp-nvim-lsp",
+ after = "cmp_luasnip",
+ },
+
+ {
+ "windwp/nvim-autopairs",
+ after = "nvim-cmp",
config = function()
- require "setup.nvim-treesitter"
- end
- }
+ require('nvim-autopairs').setup{}
+ end,
+ },
+
+ {
+ "tpope/vim-surround",
+ event = { "BufRead" , "BufNewFile" },
+ },
- use {
- 'nvim-lualine/lualine.nvim',
- requires = {'kyazdani42/nvim-web-devicons', opt = true},
+ {
+ "b3nj5m1n/kommentary",
+ -- event = { "BufRead" , "BufNewFile" },
+ keys = { "gcc", "gc" },
config = function()
- require "setup.lualine"
- end
- }
+ require "setup.kommentary"
+ end,
+ },
+
+ {
+ "BurntSushi/ripgrep",
+ opt = true,
+ },
+
+ {
+ "nvim-telescope/telescope-fzf-native.nvim",
+ opt = true,
+ },
+
+ {
+ "nvim-telescope/telescope.nvim",
+ module = "telescope",
+ cmd = "Telescope",
+ wants = { "ripgrep", "telescope-fzf-native.nvim", "plenary.nvim" },
+ },
+}
+
+return packer.startup(function(use)
+ for _, v in pairs(plugins) do
+ use(v)
+ end
end)
diff --git a/.config/nvim/lua/setup/indent-blankline.lua b/.config/nvim/lua/setup/indent-blankline.lua
index ff81338..17dcdab 100644
--- a/.config/nvim/lua/setup/indent-blankline.lua
+++ b/.config/nvim/lua/setup/indent-blankline.lua
@@ -1,6 +1,6 @@
require("indent_blankline").setup {
- char = "▏",
+ char = "┊",
show_trailing_blankline_indent = false,
- buftype_exclude = {"startify", "help", "terminal"},
- filetype_exclude = {"startify", "help", "terminal"},
+ buftype_exclude = {'startify', 'help', 'terminal', 'packer'},
+ filetype_exclude = {'startify', 'help', 'terminal', 'packer'},
}
diff --git a/.config/nvim/lua/setup/lualine.lua b/.config/nvim/lua/setup/lualine.lua
index 0c07a4a..1182fce 100644
--- a/.config/nvim/lua/setup/lualine.lua
+++ b/.config/nvim/lua/setup/lualine.lua
@@ -4,7 +4,7 @@ require'lualine'.setup {
theme = 'onedark',
component_separators = {left = '', right = ''},
section_separators = {left = '', right = ''},
- disabled_filetypes = {'startify', 'terminal', 'netrw', 'NvimTree'}
+ disabled_filetypes = {'startify', 'terminal', 'netrw', 'NvimTree', 'packer'}
},
sections = {
lualine_a = {'mode'},
diff --git a/.config/nvim/lua/setup/nvim-cmp.lua b/.config/nvim/lua/setup/nvim-cmp.lua
index 42bf348..584da73 100644
--- a/.config/nvim/lua/setup/nvim-cmp.lua
+++ b/.config/nvim/lua/setup/nvim-cmp.lua
@@ -1,6 +1,6 @@
local has_words_before = function()
- local line, col = unpack(vim.api.nvim_win_get_cursor(0))
- return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
+ local line, col = unpack(vim.api.nvim_win_get_cursor(0))
+ return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
end
local luasnip = require("luasnip")