diff options
| author | Robert Günzler <r@gnzler.io> | 2021-05-31 16:55:12 +0200 |
|---|---|---|
| committer | Robert Günzler <r@gnzler.io> | 2021-05-31 16:56:02 +0200 |
| commit | 48c6c952a9fccc1cc46f6cb8d817d5a4266a7c10 (patch) | |
| tree | 13496c7968f33f83ff2a48b06b725f8119a0dae4 /.vim | |
| parent | 84c501be462e03b55401ca962e03ff56e1bb1ae5 (diff) | |
vim: misc stuff
Diffstat (limited to '.vim')
| -rw-r--r-- | .vim/lua/plugins.lua | 10 | ||||
| -rw-r--r-- | .vim/lua/plugins/_completion.lua | 2 | ||||
| -rw-r--r-- | .vim/lua/plugins/_goyo.lua | 15 | ||||
| -rw-r--r-- | .vim/lua/plugins/_lsp.lua | 2 | ||||
| -rw-r--r-- | .vim/plugin/packer_compiled.vim | 116 |
5 files changed, 115 insertions, 30 deletions
diff --git a/.vim/lua/plugins.lua b/.vim/lua/plugins.lua index ead7e23..a0fac91 100644 --- a/.vim/lua/plugins.lua +++ b/.vim/lua/plugins.lua @@ -1,8 +1,13 @@ -- load by calling `lua require('plugins')` from your init.vim -local cmd = vim.cmd local g = vim.g local u = require('utils') +-- local install_path = fn.stdpath('data') .. '/site/pack/packer/opt/packer.nvim' +-- if vim.fn.empty(vim.fn.glob(install_path)) > 0 then +-- vim.fn.system({ 'git', 'clone', 'https://github.com/wbthomason/packer.nvim', install_path }) +-- vim.api.nvim_command 'packadd packer.nvim' +-- end + function disable_distribution_plugins() g.loaded_gzip = 1 g.loaded_tar = 1 @@ -147,8 +152,9 @@ return require'packer'.startup(function() -- multi-language support with lazy loading -- NOTE: put language specific plugs before this to avoid conflicsts + g.polyglot_disabled = { 'autoindent' } use {'sheerun/vim-polyglot'} - + -- minimal ux use {'junegunn/goyo.vim', cmd = 'Goyo', diff --git a/.vim/lua/plugins/_completion.lua b/.vim/lua/plugins/_completion.lua index 504ab00..59773a2 100644 --- a/.vim/lua/plugins/_completion.lua +++ b/.vim/lua/plugins/_completion.lua @@ -16,7 +16,7 @@ g.completion_sorting = 'length' -- or: alphabet, none g.completion_auto_change_source = true g.completion_chain_complete_list = { - {complete_items = {'lsp', 'snippet', 'buffers', 'path', 'ts'}}, + {complete_items = {'lsp', 'snippet', 'path', 'buffers', 'ts'}}, -- {mode = '<c-p>'}, -- {mode = '<c-n>'}, {mode = 'file'}, diff --git a/.vim/lua/plugins/_goyo.lua b/.vim/lua/plugins/_goyo.lua index e18d2ba..538712d 100644 --- a/.vim/lua/plugins/_goyo.lua +++ b/.vim/lua/plugins/_goyo.lua @@ -1,9 +1,12 @@ vim.g.goyo_width = 120 vim.g.goyo_height = 90 vim.g.goyo_linenr = false -require('utils').augroup('goyo_hooks', { - {'User', 'GoyoEnter', 'set laststatus=0 scrolloff=999'}, - {'User', 'GoyoEnter', 'Limelight'}, - {'User', 'GoyoLeave', 'set laststatus=2 scrolloff=5'}, - {'User', 'GoyoLeave', 'Limelight!'}, -}) + +require('utils').augroup2 { + goyo_hooks = { + {'User', 'GoyoEnter', 'set laststatus=0 scrolloff=999'}, + {'User', 'GoyoEnter', 'Limelight'}, + {'User', 'GoyoLeave', 'set laststatus=2 scrolloff=5'}, + {'User', 'GoyoLeave', 'Limelight!'}, + } +} diff --git a/.vim/lua/plugins/_lsp.lua b/.vim/lua/plugins/_lsp.lua index e8ca981..bf1cc6d 100644 --- a/.vim/lua/plugins/_lsp.lua +++ b/.vim/lua/plugins/_lsp.lua @@ -22,7 +22,7 @@ local my_attach = function(client) nnoremap { '<leader>f', function() vim.lsp.buf.formatting() end } -- nnoremap { 'g0', function() vim.lsp.buf.document_symbol() end } - -- nnoremap { 'gr', function() vim.lsp.buf.references() end } + nnoremap { 'gR', function() vim.lsp.buf.references() end } nnoremap { 'gW', function() vim.lsp.buf.workspace_symbol() end } nnoremap { 'gD', function() vim.lsp.buf.declaration() end } nnoremap { 'gT', function() vim.lsp.buf.type_definition() end } diff --git a/.vim/plugin/packer_compiled.vim b/.vim/plugin/packer_compiled.vim index 6e796b8..19c1df9 100644 --- a/.vim/plugin/packer_compiled.vim +++ b/.vim/plugin/packer_compiled.vim @@ -12,6 +12,41 @@ packadd packer.nvim try lua << END + local time + local profile_info + local should_profile = false + if should_profile then + local hrtime = vim.loop.hrtime + profile_info = {} + time = function(chunk, start) + if start then + profile_info[chunk] = hrtime() + else + profile_info[chunk] = (hrtime() - profile_info[chunk]) / 1e6 + end + end + else + time = function(chunk, start) end + end + +local function save_profiles(threshold) + local sorted_times = {} + for chunk_name, time_taken in pairs(profile_info) do + sorted_times[#sorted_times + 1] = {chunk_name, time_taken} + end + table.sort(sorted_times, function(a, b) return a[2] > b[2] end) + local results = {} + for i, elem in ipairs(sorted_times) do + if not threshold or threshold and elem[2] > threshold then + results[i] = elem[1] .. ' took ' .. elem[2] .. 'ms' + end + end + + _G._packer = _G._packer or {} + _G._packer.profile_output = results +end + +time("Luarocks path setup", true) local package_path_str = "/tmp/robert/.cache/nvim/packer_hererocks/2.0.5/share/lua/5.1/?.lua;/tmp/robert/.cache/nvim/packer_hererocks/2.0.5/share/lua/5.1/?/init.lua;/tmp/robert/.cache/nvim/packer_hererocks/2.0.5/lib/luarocks/rocks-5.1/?.lua;/tmp/robert/.cache/nvim/packer_hererocks/2.0.5/lib/luarocks/rocks-5.1/?/init.lua" local install_cpath_pattern = "/tmp/robert/.cache/nvim/packer_hererocks/2.0.5/lib/lua/5.1/?.so" if not string.find(package.path, package_path_str, 1, true) then @@ -22,6 +57,8 @@ if not string.find(package.cpath, install_cpath_pattern, 1, true) then package.cpath = package.cpath .. ';' .. install_cpath_pattern end +time("Luarocks path setup", false) +time("try_loadstring definition", true) local function try_loadstring(s, component, name) local success, result = pcall(loadstring(s)) if not success then @@ -31,6 +68,8 @@ local function try_loadstring(s, component, name) return result end +time("try_loadstring definition", false) +time("Defining packer_plugins", true) _G.packer_plugins = { ["astronauta.nvim"] = { loaded = true, @@ -49,6 +88,11 @@ _G.packer_plugins = { loaded = true, path = "/home/robert/.local/share/nvim/site/pack/packer/start/completion-treesitter" }, + ["editorconfig-vim"] = { + config = { "require('plugins._editorconfig')" }, + loaded = true, + path = "/home/robert/.local/share/nvim/site/pack/packer/start/editorconfig-vim" + }, ["gentoo-syntax"] = { loaded = true, path = "/home/robert/.local/share/nvim/site/pack/packer/start/gentoo-syntax" @@ -85,10 +129,8 @@ _G.packer_plugins = { path = "/home/robert/.local/share/nvim/site/pack/packer/start/neoformat" }, neogit = { - commands = { "Neogit" }, - loaded = false, - needs_bufread = true, - path = "/home/robert/.local/share/nvim/site/pack/packer/opt/neogit" + loaded = true, + path = "/home/robert/.local/share/nvim/site/pack/packer/start/neogit" }, ["neuron.nvim"] = { config = { "require('.plugins._neuron')" }, @@ -162,10 +204,6 @@ _G.packer_plugins = { loaded = true, path = "/home/robert/.local/share/nvim/site/pack/packer/start/vim-easy-align" }, - ["vim-editorconfig"] = { - loaded = true, - path = "/home/robert/.local/share/nvim/site/pack/packer/start/vim-editorconfig" - }, ["vim-github-link"] = { loaded = true, path = "/home/robert/.local/share/nvim/site/pack/packer/start/vim-github-link" @@ -219,47 +257,85 @@ _G.packer_plugins = { } } +time("Defining packer_plugins", false) -- Config for: nvim-lightbulb +time("Config for nvim-lightbulb", true) require('plugins._lightbulb') +time("Config for nvim-lightbulb", false) +-- Config for: editorconfig-vim +time("Config for editorconfig-vim", true) +require('plugins._editorconfig') +time("Config for editorconfig-vim", false) +-- Config for: neuron.nvim +time("Config for neuron.nvim", true) +require('.plugins._neuron') +time("Config for neuron.nvim", false) +-- Config for: vim-sneak +time("Config for vim-sneak", true) +vim.g['sneak#label'] = true +time("Config for vim-sneak", false) -- Config for: completion-nvim +time("Config for completion-nvim", true) require('plugins._completion') +time("Config for completion-nvim", false) -- Config for: nvim-colorizer.lua +time("Config for nvim-colorizer.lua", true) require('plugins._colorizer') --- Config for: vim-sneak -vim.g['sneak#label'] = true --- Config for: nvim-treesitter -require('plugins._treesitter') --- Config for: nvim-lspconfig -require('plugins._lsp') +time("Config for nvim-colorizer.lua", false) +-- Config for: telescope.nvim +time("Config for telescope.nvim", true) +require('plugins._telescope') +time("Config for telescope.nvim", false) -- Config for: vim-signify +time("Config for vim-signify", true) require('plugins._signify') +time("Config for vim-signify", false) -- Config for: git-messenger.vim +time("Config for git-messenger.vim", true) require('plugins._git-messenger') --- Config for: telescope.nvim -require('plugins._telescope') +time("Config for git-messenger.vim", false) +-- Config for: nvim-treesitter +time("Config for nvim-treesitter", true) +require('plugins._treesitter') +time("Config for nvim-treesitter", false) -- Config for: ultisnips +time("Config for ultisnips", true) require('plugins._ultisnips') --- Config for: neuron.nvim -require('.plugins._neuron') +time("Config for ultisnips", false) +-- Config for: nvim-lspconfig +time("Config for nvim-lspconfig", true) +require('plugins._lsp') +time("Config for nvim-lspconfig", false) -- Command lazy-loads +time("Defining lazy-load commands", true) vim.cmd [[command! -nargs=* -range -bang -complete=file Goyo lua require("packer.load")({'goyo.vim'}, { cmd = "Goyo", l1 = <line1>, l2 = <line2>, bang = <q-bang>, args = <q-args> }, _G.packer_plugins)]] vim.cmd [[command! -nargs=* -range -bang -complete=file Limelight lua require("packer.load")({'limelight.vim'}, { cmd = "Limelight", l1 = <line1>, l2 = <line2>, bang = <q-bang>, args = <q-args> }, _G.packer_plugins)]] -vim.cmd [[command! -nargs=* -range -bang -complete=file Neogit lua require("packer.load")({'neogit'}, { cmd = "Neogit", l1 = <line1>, l2 = <line2>, bang = <q-bang>, args = <q-args> }, _G.packer_plugins)]] +time("Defining lazy-load commands", false) vim.cmd [[augroup packer_load_aucmds]] vim.cmd [[au!]] -- Filetype lazy-loads -vim.cmd [[au FileType markdown ++once lua require("packer.load")({'vim-markdown', 'vim-markdown-folding'}, { ft = "markdown" }, _G.packer_plugins)]] +time("Defining lazy-load filetype autocommands", true) +vim.cmd [[au FileType markdown ++once lua require("packer.load")({'vim-markdown-folding', 'vim-markdown'}, { ft = "markdown" }, _G.packer_plugins)]] vim.cmd [[au FileType cue ++once lua require("packer.load")({'vim-cue'}, { ft = "cue" }, _G.packer_plugins)]] vim.cmd [[au FileType latex ++once lua require("packer.load")({'vimtex'}, { ft = "latex" }, _G.packer_plugins)]] vim.cmd [[au FileType tex ++once lua require("packer.load")({'vimtex'}, { ft = "tex" }, _G.packer_plugins)]] +time("Defining lazy-load filetype autocommands", false) vim.cmd("augroup END") vim.cmd [[augroup filetypedetect]] +time("Sourcing ftdetect script at: /home/robert/.local/share/nvim/site/pack/packer/opt/vimtex/ftdetect/tex.vim", true) vim.cmd [[source /home/robert/.local/share/nvim/site/pack/packer/opt/vimtex/ftdetect/tex.vim]] +time("Sourcing ftdetect script at: /home/robert/.local/share/nvim/site/pack/packer/opt/vimtex/ftdetect/tex.vim", false) +time("Sourcing ftdetect script at: /home/robert/.local/share/nvim/site/pack/packer/opt/vim-markdown/ftdetect/markdown.vim", true) vim.cmd [[source /home/robert/.local/share/nvim/site/pack/packer/opt/vim-markdown/ftdetect/markdown.vim]] +time("Sourcing ftdetect script at: /home/robert/.local/share/nvim/site/pack/packer/opt/vim-markdown/ftdetect/markdown.vim", false) +time("Sourcing ftdetect script at: /home/robert/.local/share/nvim/site/pack/packer/opt/vim-cue/ftdetect/cue.vim", true) vim.cmd [[source /home/robert/.local/share/nvim/site/pack/packer/opt/vim-cue/ftdetect/cue.vim]] +time("Sourcing ftdetect script at: /home/robert/.local/share/nvim/site/pack/packer/opt/vim-cue/ftdetect/cue.vim", false) vim.cmd("augroup END") +if should_profile then save_profiles() end + END catch |