summaryrefslogtreecommitdiff
path: root/.config/nvim/lua
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-12 22:47:03 +0100
commit8cc68ac8a50756dfc21ce269a969bd7897e173fd (patch)
treef05d8b44e06d6166115a3b68d30239941fd34931 /.config/nvim/lua
parentd394e7dc27de4416f3ba74da736a5251c19a36f4 (diff)
nvim: config cleanup + speedup (lazy load)
Diffstat (limited to '.config/nvim/lua')
-rw-r--r--.config/nvim/lua/mappings.lua (renamed from .config/nvim/lua/binds.lua)3
-rw-r--r--.config/nvim/lua/options.lua (renamed from .config/nvim/lua/setup.lua)29
-rw-r--r--.config/nvim/lua/plugins.lua117
-rw-r--r--.config/nvim/lua/post.lua3
-rw-r--r--.config/nvim/lua/pre.lua1
-rw-r--r--.config/nvim/lua/setup/indent-blankline.lua6
-rw-r--r--.config/nvim/lua/setup/kommentary.lua3
-rw-r--r--.config/nvim/lua/setup/lsp_signature.lua3
-rw-r--r--.config/nvim/lua/setup/lualine.lua (renamed from .config/nvim/lua/stl.lua)2
-rw-r--r--.config/nvim/lua/setup/nvim-cmp.lua (renamed from .config/nvim/lua/opts.lua)46
-rw-r--r--.config/nvim/lua/setup/nvim-lsp-installer.lua17
-rw-r--r--.config/nvim/lua/setup/nvim-treesitter.lua5
12 files changed, 162 insertions, 73 deletions
diff --git a/.config/nvim/lua/binds.lua b/.config/nvim/lua/mappings.lua
index 7b5d3fe..81f0614 100644
--- a/.config/nvim/lua/binds.lua
+++ b/.config/nvim/lua/mappings.lua
@@ -30,7 +30,6 @@ map('n', '<leader><up>', ':wincmd k<CR>', opts)
map('n', '<leader><right>', ':wincmd l<CR>', opts)
map('n', '<leader>p', '<cmd>Telescope find_files<cr>', opts)
-map('n', '<leader>P', '<cmd>Telescope file_browser hidden=true<cr>', opts)
map('n', '<leader>fg', '<cmd>Telescope live_grep<cr>', opts)
map('n', '<leader>fb', '<cmd>Telescope buffers<cr>', opts)
map('n', '<leader>fh', '<cmd>Telescope help_tags<cr>', opts)
@@ -42,8 +41,6 @@ map('n', '<leader>gi', '<cmd>Telescope lsp_implementations<cr>', opts)
map('n', 'K', '<cmd>lua vim.lsp.buf.hover()<cr>', opts)
map('n', '<C-k>', '<cmd>lua vim.lsp.buf.signature_help()<cr>', opts)
map('n', '<leader>rn', '<cmd>lua vim.lsp.buf.rename()<cr>', opts)
-map('n', '<leader>xd', '<cmd>Telescope lsp_document_diagnostics<cr>', opts)
-map('n', '<leader>xD', '<cmd>Telescope lsp_workspace_diagnostics<cr>', opts)
map('n', '<leader>xn', '<cmd>lua vim.lsp.diagnostic.goto_next()<cr>', opts)
map('n', '<leader>xN', '<cmd>lua vim.lsp.diagnostic.goto_prev()<cr>', opts)
map('n', '<leader>xx', '<cmd>Telescope lsp_code_actions<cr>', opts)
diff --git a/.config/nvim/lua/setup.lua b/.config/nvim/lua/options.lua
index 3243853..caeccc7 100644
--- a/.config/nvim/lua/setup.lua
+++ b/.config/nvim/lua/options.lua
@@ -1,8 +1,7 @@
vim.cmd('syntax enable')
vim.cmd('set undodir=$XDG_CACHE_HOME/nvim/undo')
vim.cmd('set undofile')
-vim.cmd('set shada')
-vim.cmd('colorscheme doom-one')
+require('onedark').load()
local set = vim.opt
set.mouse = "a"
@@ -36,3 +35,29 @@ set.pumblend = 0
set.splitright = true
set.splitbelow = true
set.cursorline = true
+
+-- Disable default vim plugins
+local disabled_built_ins = {
+ "netrw",
+ "netrwPlugin",
+ "netrwSettings",
+ "netrwFileHandlers",
+ "gzip",
+ "zip",
+ "zipPlugin",
+ "tar",
+ "tarPlugin",
+ "getscript",
+ "getscriptPlugin",
+ "vimball",
+ "vimballPlugin",
+ "2html_plugin",
+ "logipat",
+ "rrhelper",
+ "spellfile_plugin",
+ "matchit"
+}
+
+for _, plugin in pairs(disabled_built_ins) do
+ vim.g["loaded_" .. plugin] = 1
+end
diff --git a/.config/nvim/lua/plugins.lua b/.config/nvim/lua/plugins.lua
index c2ceed8..3164516 100644
--- a/.config/nvim/lua/plugins.lua
+++ b/.config/nvim/lua/plugins.lua
@@ -1,21 +1,97 @@
local use = require('packer').use
require('packer').startup(function()
use 'wbthomason/packer.nvim'
- use 'romgrk/doom-one.vim'
- -- use 'tpope/vim-fugitive'
+ use 'adast9/onedark.nvim'
+ use 'nathom/filetype.nvim'
+ use {
+ 'lewis6991/impatient.nvim',
+ config = function()
+ require("impatient")
+ end
+ }
+
use 'tpope/vim-surround'
- -- use 'tpope/vim-repeat'
- use 'b3nj5m1n/kommentary'
+ use {
+ 'b3nj5m1n/kommentary',
+ keys = {
+ {"n", "gcc"},
+ {"n", "gc"},
+ {"v", "gc"},
+ },
+ config = function()
+ require "setup.kommentary"
+ end
+ }
+
+ use {
+ 'williamboman/nvim-lsp-installer',
+ -- after = 'nvim-lspconfig',
+ config = function()
+ require "setup.nvim-lsp-installer"
+ end
+ }
- use 'williamboman/nvim-lsp-installer'
use 'neovim/nvim-lspconfig'
- use 'hrsh7th/cmp-nvim-lsp'
- use 'hrsh7th/nvim-cmp'
+ -- use {
+ -- 'neovim/nvim-lspconfig',
+ -- after = { 'nvim-cmp' },
+ -- event = { 'BufRead', 'BufNewFile', 'InsertEnter' },
+ -- }
- use "ray-x/lsp_signature.nvim"
- use "windwp/nvim-autopairs"
- use "lukas-reineke/indent-blankline.nvim"
- use 'kyazdani42/nvim-web-devicons'
+ use {
+ 'hrsh7th/nvim-cmp',
+ event = 'InsertEnter',
+ config = function()
+ require "setup.nvim-cmp"
+ 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",
+ 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
+ }
+
+ use {
+ "lukas-reineke/indent-blankline.nvim",
+ event = { 'BufRead' , 'BufNewFile' },
+ config = function()
+ require "setup.indent-blankline"
+ end
+ }
use {
'nvim-telescope/telescope.nvim',
@@ -28,18 +104,11 @@ require('packer').startup(function()
}
use {
- "L3MON4D3/LuaSnip",
- requires = {
- "rafamadriz/friendly-snippets",
- "saadparwaiz1/cmp_luasnip"
- }
- }
-
- use {
'lewis6991/gitsigns.nvim',
requires = {
'nvim-lua/plenary.nvim'
},
+ event = { 'BufRead' , 'BufNewFile' },
config = function()
require('gitsigns').setup()
end
@@ -47,11 +116,17 @@ require('packer').startup(function()
use {
'nvim-treesitter/nvim-treesitter',
- run = ':TSUpdate'
+ run = ':TSUpdate',
+ config = function()
+ require "setup.nvim-treesitter"
+ end
}
use {
'nvim-lualine/lualine.nvim',
- requires = {'kyazdani42/nvim-web-devicons', opt = true}
+ requires = {'kyazdani42/nvim-web-devicons', opt = true},
+ config = function()
+ require "setup.lualine"
+ end
}
end)
diff --git a/.config/nvim/lua/post.lua b/.config/nvim/lua/post.lua
new file mode 100644
index 0000000..b984880
--- /dev/null
+++ b/.config/nvim/lua/post.lua
@@ -0,0 +1,3 @@
+-- vim.diagnostic.config({virtual_text = false})
+vim.opt.shadafile = ""
+vim.cmd('highlight IndentBlanklineChar guifg=#3b414c gui=nocombine')
diff --git a/.config/nvim/lua/pre.lua b/.config/nvim/lua/pre.lua
new file mode 100644
index 0000000..5e6a458
--- /dev/null
+++ b/.config/nvim/lua/pre.lua
@@ -0,0 +1 @@
+vim.opt.shadafile = "NONE"
diff --git a/.config/nvim/lua/setup/indent-blankline.lua b/.config/nvim/lua/setup/indent-blankline.lua
new file mode 100644
index 0000000..ff81338
--- /dev/null
+++ b/.config/nvim/lua/setup/indent-blankline.lua
@@ -0,0 +1,6 @@
+require("indent_blankline").setup {
+ char = "▏",
+ show_trailing_blankline_indent = false,
+ buftype_exclude = {"startify", "help", "terminal"},
+ filetype_exclude = {"startify", "help", "terminal"},
+}
diff --git a/.config/nvim/lua/setup/kommentary.lua b/.config/nvim/lua/setup/kommentary.lua
new file mode 100644
index 0000000..3ca608d
--- /dev/null
+++ b/.config/nvim/lua/setup/kommentary.lua
@@ -0,0 +1,3 @@
+require('kommentary.config').configure_language("default", {
+ prefer_single_line_comments = true,
+})
diff --git a/.config/nvim/lua/setup/lsp_signature.lua b/.config/nvim/lua/setup/lsp_signature.lua
new file mode 100644
index 0000000..65f7070
--- /dev/null
+++ b/.config/nvim/lua/setup/lsp_signature.lua
@@ -0,0 +1,3 @@
+require'lsp_signature'.setup {
+ floating_window = false
+}
diff --git a/.config/nvim/lua/stl.lua b/.config/nvim/lua/setup/lualine.lua
index 241e0ff..0c07a4a 100644
--- a/.config/nvim/lua/stl.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'}
+ disabled_filetypes = {'startify', 'terminal', 'netrw', 'NvimTree'}
},
sections = {
lualine_a = {'mode'},
diff --git a/.config/nvim/lua/opts.lua b/.config/nvim/lua/setup/nvim-cmp.lua
index 1e5bfda..42bf348 100644
--- a/.config/nvim/lua/opts.lua
+++ b/.config/nvim/lua/setup/nvim-cmp.lua
@@ -1,4 +1,3 @@
--- CMP
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
@@ -50,48 +49,3 @@ cmp.setup {
},
}
vim.cmd('autocmd FileType markdown lua require("cmp").setup.buffer { enabled = false }')
-
--- LSPCONFIG
-
-local lsp_installer = require("nvim-lsp-installer")
-
--- Register a handler that will be called for each installed server when it's ready (i.e. when installation is finished
--- or if the server is already installed).
-lsp_installer.on_server_ready(function(server)
- local opts = {}
-
- -- (optional) Customize the options passed to the server
- -- if server.name == "tsserver" then
- -- opts.root_dir = function() ... end
- -- end
-
- -- This setup() function will take the provided server configuration and decorate it with the necessary properties
- -- before passing it onwards to lspconfig.
- -- Refer to https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md
- server:setup(opts)
-end)
-
--- Misc
-
-require('nvim-autopairs').setup{}
-
-require'lsp_signature'.setup {
- floating_window = false
-}
-
-require'nvim-treesitter.configs'.setup {
- highlight = {
- enable = true,
- },
-}
-
-require('kommentary.config').configure_language("default", {
- prefer_single_line_comments = true,
-})
-
-require("indent_blankline").setup {
- char = "¦",
- show_trailing_blankline_indent = false,
- buftype_exclude = {"startify", "help", "terminal"},
- filetype_exclude = {"startify", "help", "terminal"},
-}
diff --git a/.config/nvim/lua/setup/nvim-lsp-installer.lua b/.config/nvim/lua/setup/nvim-lsp-installer.lua
new file mode 100644
index 0000000..bd3496e
--- /dev/null
+++ b/.config/nvim/lua/setup/nvim-lsp-installer.lua
@@ -0,0 +1,17 @@
+local lsp_installer = require("nvim-lsp-installer")
+
+-- Register a handler that will be called for each installed server when it's ready (i.e. when installation is finished
+-- or if the server is already installed).
+lsp_installer.on_server_ready(function(server)
+ local opts = {}
+
+ -- (optional) Customize the options passed to the server
+ -- if server.name == "tsserver" then
+ -- opts.root_dir = function() ... end
+ -- end
+
+ -- This setup() function will take the provided server configuration and decorate it with the necessary properties
+ -- before passing it onwards to lspconfig.
+ -- Refer to https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md
+ server:setup(opts)
+end)
diff --git a/.config/nvim/lua/setup/nvim-treesitter.lua b/.config/nvim/lua/setup/nvim-treesitter.lua
new file mode 100644
index 0000000..42bfcbd
--- /dev/null
+++ b/.config/nvim/lua/setup/nvim-treesitter.lua
@@ -0,0 +1,5 @@
+require'nvim-treesitter.configs'.setup {
+ highlight = {
+ enable = true,
+ },
+}