summaryrefslogtreecommitdiff
path: root/.config
diff options
context:
space:
mode:
authorAdam <56338480+adastx@users.noreply.github.com>2022-03-12 17:38:32 +0100
committerAdam <56338480+adastx@users.noreply.github.com>2022-03-13 17:58:45 +0100
commita429e351263d07e9d032cd9d5e820c675b790d9b (patch)
tree68da1ae8a7dcd74cfad254f8b8c7fcc33f1de855 /.config
parent5a908c6cbcdba880f7f267c9a238c492d021ac0c (diff)
nvim: better lazy loading
Diffstat (limited to '.config')
-rw-r--r--.config/nvim/init.lua8
-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)28
-rw-r--r--.config/nvim/lua/plugins.lua216
-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)50
-rw-r--r--.config/nvim/lua/setup/nvim-lsp-installer.lua17
-rw-r--r--.config/nvim/lua/setup/nvim-treesitter.lua5
-rw-r--r--.config/zsh/.zshrc2
14 files changed, 236 insertions, 111 deletions
diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua
index 3bc3238..9d125a7 100644
--- a/.config/nvim/init.lua
+++ b/.config/nvim/init.lua
@@ -1,5 +1,5 @@
+require('pre')
require('plugins')
-require('opts')
-require('setup')
-require('binds')
-require('stl')
+require('options')
+require('mappings')
+require('post')
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..68d6705 100644
--- a/.config/nvim/lua/setup.lua
+++ b/.config/nvim/lua/options.lua
@@ -1,8 +1,6 @@
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')
local set = vim.opt
set.mouse = "a"
@@ -36,3 +34,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 4ca29bb..ec7545b 100644
--- a/.config/nvim/lua/plugins.lua
+++ b/.config/nvim/lua/plugins.lua
@@ -1,58 +1,170 @@
-local use = require('packer').use
-require('packer').startup(function()
- use 'wbthomason/packer.nvim'
- use 'romgrk/doom-one.vim'
- -- use 'tpope/vim-fugitive'
- use 'tpope/vim-surround'
- -- use 'tpope/vim-repeat'
- use 'b3nj5m1n/kommentary'
-
- use 'williamboman/nvim-lsp-installer'
- use 'neovim/nvim-lspconfig'
- use 'hrsh7th/cmp-nvim-lsp'
- use 'hrsh7th/nvim-cmp'
-
- use "ray-x/lsp_signature.nvim"
- use "windwp/nvim-autopairs"
- use "lukas-reineke/indent-blankline.nvim"
- use 'kyazdani42/nvim-web-devicons'
- use 'norcalli/nvim-colorizer.lua'
-
- use {
- 'nvim-telescope/telescope.nvim',
- requires = {
- 'nvim-lua/popup.nvim',
- 'nvim-lua/plenary.nvim',
- 'nvim-telescope/telescope-fzy-native.nvim',
- 'BurntSushi/ripgrep'
- }
- }
-
- use {
- "L3MON4D3/LuaSnip",
- requires = {
- "rafamadriz/friendly-snippets",
- "saadparwaiz1/cmp_luasnip"
- }
- }
-
- use {
- 'lewis6991/gitsigns.nvim',
- requires = {
- 'nvim-lua/plenary.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('onedark').load()
+ end,
+ },
+
+ {
+ "kyazdani42/nvim-web-devicons",
+ after = "onedark.nvim"
+ },
+
+ {
+ "nvim-lualine/lualine.nvim",
+ after = "nvim-web-devicons",
+ config = function()
+ require "setup.lualine"
+ end,
+ },
+
+ {
+ "lukas-reineke/indent-blankline.nvim",
+ event = { "BufRead" , "BufNewFile" },
+ config = function()
+ require "setup.indent-blankline"
+ end,
+ },
+
+ {
+ "nvim-treesitter/nvim-treesitter",
+ event = { "BufRead" , "BufNewFile" },
+ config = function()
+ require "setup.nvim-treesitter"
+ end,
+ run = ':TSUpdate',
+ },
+
+ {
+ "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,
+ },
+
+ {
+ "ray-x/lsp_signature.nvim",
+ after = "nvim-lspconfig",
+ event = 'InsertEnter',
+ config = function()
+ require "setup.lsp_signature"
end
- }
+ },
+
+ -- load luasnips + cmp related in insert mode only
+
+ {
+ "L3MON4D3/LuaSnip",
+ wants = "friendly-snippets",
+ event = "InsertEnter",
+ config = function()
+ require("luasnip/loaders/from_vscode").lazy_load()
+ end,
+ },
+
+ {
+ "rafamadriz/friendly-snippets",
+ module = "cmp_nvim_lsp",
+ },
+
+ {
+ "hrsh7th/nvim-cmp",
+ after = "LuaSnip",
+ config = function()
+ require "setup.nvim-cmp"
+ end,
+ },
+
+
+ {
+ "saadparwaiz1/cmp_luasnip",
+ after = "LuaSnip",
+ },
+
+ {
+ "hrsh7th/cmp-nvim-lsp",
+ after = "cmp_luasnip",
+ },
+
+ {
+ "windwp/nvim-autopairs",
+ after = "nvim-cmp",
+ config = function()
+ require('nvim-autopairs').setup{}
+ end,
+ },
+
+ {
+ "tpope/vim-surround",
+ event = { "BufRead" , "BufNewFile" },
+ },
+
+ {
+ "b3nj5m1n/kommentary",
+ -- event = { "BufRead" , "BufNewFile" },
+ keys = { "gcc", "gc" },
+ config = function()
+ require "setup.kommentary"
+ end,
+ },
+
+ {
+ "BurntSushi/ripgrep",
+ opt = true,
+ },
+
+ {
+ "nvim-telescope/telescope-fzf-native.nvim",
+ opt = true,
+ },
- use {
- 'nvim-treesitter/nvim-treesitter',
- run = ':TSUpdate'
- }
+ {
+ "nvim-telescope/telescope.nvim",
+ module = "telescope",
+ cmd = "Telescope",
+ wants = { "ripgrep", "telescope-fzf-native.nvim", "plenary.nvim" },
+ },
+}
- use {
- 'nvim-lualine/lualine.nvim',
- requires = {'kyazdani42/nvim-web-devicons', opt = true}
- }
+return packer.startup(function(use)
+ for _, v in pairs(plugins) do
+ use(v)
+ 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..17dcdab
--- /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', 'packer'},
+ filetype_exclude = {'startify', 'help', 'terminal', 'packer'},
+}
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..1182fce 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', 'packer'}
},
sections = {
lualine_a = {'mode'},
diff --git a/.config/nvim/lua/opts.lua b/.config/nvim/lua/setup/nvim-cmp.lua
index 1e5bfda..584da73 100644
--- a/.config/nvim/lua/opts.lua
+++ b/.config/nvim/lua/setup/nvim-cmp.lua
@@ -1,7 +1,6 @@
--- 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
+ 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")
@@ -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,
+ },
+}
diff --git a/.config/zsh/.zshrc b/.config/zsh/.zshrc
index d1d0da6..d5c79cf 100644
--- a/.config/zsh/.zshrc
+++ b/.config/zsh/.zshrc
@@ -39,7 +39,7 @@ alias clg="config log --graph --abbrev-commit --decorate --format=format:'%C(bol
alias zshrc='vim $XDG_CONFIG_HOME/zsh/.zshrc'
alias vimrc='vim ~/.vim/vimrc'
-alias nvimrc='cd $XDG_CONFIG_HOME/nvim;nvim .'
+alias nvimrc='cd $XDG_CONFIG_HOME/nvim;nvim'
alias i3config='vim $XDG_CONFIG_HOME/i3/config'
alias startup='vim $XDG_CONFIG_HOME/i3/init'