Misc: LSP, Coc, vgit

This commit is contained in:
sfigato 2022-10-02 00:47:43 +02:00
parent d35e92f090
commit ab4cc3e016
Signed by: blallo
GPG Key ID: 0CBE577C9B72DC3F
6 changed files with 468 additions and 91 deletions

View File

@ -96,6 +96,12 @@ require('config.lspconfig')
-- Custom -- Custom
Custom = require('config.custom') Custom = require('config.custom')
cmd([[
au BufRead,BufNewFile *.ha set filetype=hare
au BufRead,BufNewFile *.conf set filetype=config
]])
g["do_filetype_lua"] = 1
-- Keybinds -- Keybinds
@ -105,26 +111,37 @@ local map = Mapper.map
-- - Telescope-related -- - Telescope-related
local opts = { noremap = true, silent = true } local opts = { noremap = true, silent = true }
map('n', '<Leader>ff', '<cmd>Telescope find_files<cr>', opts, "Telescope", "find_files", "Find files from current position") map('n', '<Leader>ff', '<cmd>Telescope find_files<cr>', opts, "Telescope", "find_files",
"Find files from current position")
map('n', '<Leader>fg', '<cmd>Telescope git_files<cr>', opts, "Telescope", "git_files", "Find git-tracked files") map('n', '<Leader>fg', '<cmd>Telescope git_files<cr>', opts, "Telescope", "git_files", "Find git-tracked files")
map('n', '<Leader>fb', '<cmd>Telescope buffers<cr>', opts, "Telescope", "buffers", "Search in current opened buffers") map('n', '<Leader>fb', '<cmd>Telescope buffers<cr>', opts, "Telescope", "buffers", "Search in current opened buffers")
map('n', '<Leader>fc', '<cmd>Telescope grep_string<cr>', opts, "Telescope", "grep_string", "Search string from current position") map('n', '<Leader>fc', '<cmd>Telescope grep_string<cr>', opts, "Telescope", "grep_string",
"Search string from current position")
map('n', '<Leader>fr', '<cmd>Telescope live_grep<cr>', opts, "Telescope", "live_grep", "Search string in real time") map('n', '<Leader>fr', '<cmd>Telescope live_grep<cr>', opts, "Telescope", "live_grep", "Search string in real time")
map('n', '<Leader>fR', '<cmd>Telescope live_grep grep_open_files=true<cr>', opts, "Telescope", "live_grep_open_buffers", "Search string in real time (only on the open buffers)") map('n', '<Leader>fR', '<cmd>Telescope live_grep grep_open_files=true<cr>', opts, "Telescope", "live_grep_open_buffers",
"Search string in real time (only on the open buffers)")
map('n', '<Leader>ft', '<cmd>Telescope treesitter<cr>', opts, "Telescope", "treesitter", "Explore treesitter") map('n', '<Leader>ft', '<cmd>Telescope treesitter<cr>', opts, "Telescope", "treesitter", "Explore treesitter")
map('n', '<Leader>fC', '<cmd>Telescope git_bcommits<cr>', opts, "Telescope", "git_bcommits", "Show diff of current buffer") map('n', '<Leader>fC', '<cmd>Telescope git_bcommits<cr>', opts, "Telescope", "git_bcommits",
"Show diff of current buffer")
map('n', '<Leader>fh', '<cmd>Telescope builtin<cr>', opts, "Telescope", "builtin", "Show Telescope builtins") map('n', '<Leader>fh', '<cmd>Telescope builtin<cr>', opts, "Telescope", "builtin", "Show Telescope builtins")
map('n', '<Leader>lr', '<cmd>Telescope lsp_references<cr>', opts, "Telescope", "lsp_references", "Show references using LSP") map('n', '<Leader>lr', '<cmd>Telescope lsp_references<cr>', opts, "Telescope", "lsp_references",
map('n', '<Leader>li', '<cmd>Telescope lsp_implementations<cr>', opts, "Telescope", "lsp_implementations", "Show implementations using LSP") "Show references using LSP")
map('n', '<Leader>ld', '<cmd>Telescope lsp_definitions<cr>', opts, "Telescope", "lsp_definitions", "Show definitions using LSP") map('n', '<Leader>li', '<cmd>Telescope lsp_implementations<cr>', opts, "Telescope", "lsp_implementations",
map('n', '<Leader>ls', '<cmd>Telescope lsp_document_symbols<cr>', opts, "Telescope", "lsp_document_symbols", "Show symbols in document using LSP") "Show implementations using LSP")
map('n', '<Leader>ld', '<cmd>Telescope lsp_definitions<cr>', opts, "Telescope", "lsp_definitions",
"Show definitions using LSP")
map('n', '<Leader>ls', '<cmd>Telescope lsp_document_symbols<cr>', opts, "Telescope", "lsp_document_symbols",
"Show symbols in document using LSP")
-- Undo tree -- Undo tree
map('n', '<Leader>u', '<cmd>UndotreeToggle<cr><cmd>UndotreeFocus<cr>', { noremap = true }, "UndoTree", "undo_tree_toggle", "Toggle UndoTree browser") map('n', '<Leader>u', '<cmd>UndotreeToggle<cr><cmd>UndotreeFocus<cr>', { noremap = true }, "UndoTree", "undo_tree_toggle"
, "Toggle UndoTree browser")
-- Split maximizer -- Split maximizer
map('n', '<Leader>mm', '<cmd>MaximizerToggle<cr>', opts, "MaximizerToggle", "maximizer_toggle_n", "Toggle maximal view of current split") map('n', '<Leader>mm', '<cmd>MaximizerToggle<cr>', opts, "MaximizerToggle", "maximizer_toggle_n",
map('v', '<Leader>mm', '<cmd>MaximizerToggle<cr>', opts, "MaximizerToggle", "maximizer_toggle_v", "Toggle maximal view of current split") "Toggle maximal view of current split")
map('v', '<Leader>mm', '<cmd>MaximizerToggle<cr>', opts, "MaximizerToggle", "maximizer_toggle_v",
"Toggle maximal view of current split")
-- Split movement and management -- Split movement and management
map('n', '<C-l>', '<C-w>l', opts, "Movement", "move_right_n", "Move to the split to the right") map('n', '<C-l>', '<C-w>l', opts, "Movement", "move_right_n", "Move to the split to the right")
@ -150,6 +167,11 @@ map('i', '<C-d>', '<cmd>bd<cr>', opts, "Management", "full_close_i", "Close curr
map('n', '<Leader><Tab>', '<cmd>bnext<cr>', {}, "Movement", "go_to_next_buf", "Switch to the next buffer") map('n', '<Leader><Tab>', '<cmd>bnext<cr>', {}, "Movement", "go_to_next_buf", "Switch to the next buffer")
map('n', '<Leader>\\', '<cmd>bprev<cr>', {}, "Movement", "go_to_prev_buf", "Switch to the previous buffer") map('n', '<Leader>\\', '<cmd>bprev<cr>', {}, "Movement", "go_to_prev_buf", "Switch to the previous buffer")
-- Search niceties
map('v', '<Leader>/', '<esc>:\\%V', {}, "Search", "search_in_visual_selection",
"Search only in the current visual selection")
-- Move selection around -- Move selection around
cmd([[ cmd([[
nnoremap <silent> <C-Down> :m .+1<CR>== nnoremap <silent> <C-Down> :m .+1<CR>==
@ -167,7 +189,19 @@ vnoremap <silent> <C-Up> :m '<-2<CR>gv=gv
-- map('v', '<C-Up>', "<cmd>m '<-2<CR>gv=gv", opst, "MoveText", "move_text_down_v", "") -- map('v', '<C-Up>', "<cmd>m '<-2<CR>gv=gv", opst, "MoveText", "move_text_down_v", "")
-- Clean highlight -- Clean highlight
map('n', '<leader><esc>', '<cmd>nohls<CR><cmd>call clearmatches()<cr>', opts, "CleanHighlights", "clear_all", "Clear all highlights and matches") map('n', '<leader><esc>', '<cmd>nohls<CR><cmd>call clearmatches()<cr>', opts, "CleanHighlights", "clear_all",
"Clear all highlights and matches")
-- Open links with reader -- Open links with reader
map('n', 'gx', '<cmd>lua Custom.open_with_reader()<cr>', {}, "OpenWithReader", "open_with_reader", "Open the link under the cursor with `reader` in a floating tab") map('n', 'gx', '<cmd>lua Custom.open_with_reader()<cr>', {}, "OpenWithReader", "open_with_reader",
"Open the link under the cursor with `reader` in a floating tab")
-- cder
map('n', '<leader>cd', '<cmd>Telescope cder<cr>', {}, "Cder", "cder", "Change base directory interactively")
-- vgit
require('config.vgit')
-- coc
require('config.coc')

35
lua/config/coc.lua Normal file
View File

@ -0,0 +1,35 @@
-- Some servers have issues with backup files, see #649.
vim.opt.backup = false
vim.opt.writebackup = false
-- Having longer updatetime (default is 4000 ms = 4 s) leads to noticeable
-- delays and poor user experience.
vim.opt.updatetime = 300
-- Always show the signcolumn, otherwise it would shift the text each time
-- diagnostics appear/become resolved.
vim.opt.signcolumn = "yes"
-- Auto complete
function _G.check_back_space()
local col = vim.fn.col('.') - 1
return col == 0 or vim.fn.getline('.'):sub(col, col):match('%s')
end
local opts = { silent = true, noremap = true, expr = true }
-- Use tab for trigger completion with characters ahead and navigate.
-- NOTE: There's always complete item selected by default, you may want to enable
-- no select by `"suggest.noselect": true` in your configuration file.
-- NOTE: Use command ':verbose imap <tab>' to make sure tab is not mapped by
-- other plugin before putting this into your config.
-- vim.api.nvim_set_keymap("i", "<TAB>",
-- 'coc#pum#visible() ? coc#pum#next(1) : v:lua.check_back_space() ? "<TAB>" : coc#refresh()', opts)
-- vim.api.nvim_set_keymap("i", "<S-TAB>",
-- [[coc#pum#visible() ? coc#pum#prev(1) : "\<C-h>"]], opts)
-- Make <CR> to accept selected completion item or notify coc.nvim to format
-- <C-g>u breaks current undo, please make your own choice.
vim.api.nvim_set_keymap("i", "<cr>",
[[coc#pum#visible() ? coc#pum#confirm() : "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"]], opts)

View File

@ -18,33 +18,45 @@ end
-- nvim_lsp.harepls.setup {} -- nvim_lsp.harepls.setup {}
-- keybindings
local on_attach = function(client, bufrn) local on_attach = function(client, bufrn)
Mapper = require("nvim-mapper") Mapper = require("nvim-mapper")
local function buf_set_keymap(...) Mapper.map_buf(bufrn, ...) end local function buf_set_keymap(...) Mapper.map_buf(bufrn, ...) end
local function buf_set_option(...) vim.api.nvim_buf_set_option(bufrn, ...) end local function buf_set_option(...) vim.api.nvim_buf_set_option(bufrn, ...) end
buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc') buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc')
-- Mappings -- Mappings
local opts = { noremap=true, silent=true } local opts = { noremap = true, silent = true }
-- See `:help vim.lsp.*` for documentation on any of the below functions -- See `:help vim.lsp.*` for documentation on any of the below functions
buf_set_keymap('n', 'gD', '<cmd>lua vim.lsp.buf.declaration()<CR>', opts, "LSP", "declaration", "Go to declaration") buf_set_keymap('n', 'gD', '<cmd>lua vim.lsp.buf.declaration()<CR>', opts, "LSP", "declaration", "Go to declaration")
buf_set_keymap('n', 'gd', '<cmd>lua vim.lsp.buf.definition()<CR>', opts, "LSP", "definition", "Go to definition") buf_set_keymap('n', 'gd', '<cmd>lua vim.lsp.buf.definition()<CR>', opts, "LSP", "definition", "Go to definition")
buf_set_keymap('n', 'K', '<cmd>lua vim.lsp.buf.hover()<CR>', opts, "LSP", "hover", "Hover") buf_set_keymap('n', 'K', '<cmd>lua vim.lsp.buf.hover()<CR>', opts, "LSP", "hover", "Hover")
buf_set_keymap('n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<CR>', opts, "LSP", "implementation", "Go to implementation") buf_set_keymap('n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<CR>', opts, "LSP", "implementation",
buf_set_keymap('n', '<C-k>', '<cmd>lua vim.lsp.buf.signature_help()<CR>', opts, "LSP", "signature_help", "Show signature help") "Go to implementation")
buf_set_keymap('n', '<space>wa', '<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>', opts, "LSP", "add_workspace_folder", "Add workspace folder") buf_set_keymap('n', '<C-k>', '<cmd>lua vim.lsp.buf.signature_help()<CR>', opts, "LSP", "signature_help",
buf_set_keymap('n', '<space>wr', '<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>', opts, "LSP", "remove_workspace_folder", "Remove workspace folder") "Show signature help")
buf_set_keymap('n', '<space>wl', '<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>', opts, "LSP", "list_workspace_folders", "List workspace folder") buf_set_keymap('n', '<space>wa', '<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>', opts, "LSP",
buf_set_keymap('n', '<space>D', '<cmd>lua vim.lsp.buf.type_definition()<CR>', opts, "LSP", "type_definition", "Show type definition") "add_workspace_folder", "Add workspace folder")
buf_set_keymap('n', '<space>wr', '<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>', opts, "LSP",
"remove_workspace_folder", "Remove workspace folder")
buf_set_keymap('n', '<space>wl', '<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>', opts, "LSP"
, "list_workspace_folders", "List workspace folder")
buf_set_keymap('n', '<space>D', '<cmd>lua vim.lsp.buf.type_definition()<CR>', opts, "LSP", "type_definition",
"Show type definition")
buf_set_keymap('n', '<space>rn', '<cmd>lua vim.lsp.buf.rename()<CR>', opts, "LSP", "rename", "Rename") buf_set_keymap('n', '<space>rn', '<cmd>lua vim.lsp.buf.rename()<CR>', opts, "LSP", "rename", "Rename")
buf_set_keymap('n', '<space>ca', '<cmd>lua vim.lsp.buf.code_action()<CR>', opts, "LSP", "code_action", "Show code actions") buf_set_keymap('n', '<space>ca', '<cmd>lua vim.lsp.buf.code_action()<CR>', opts, "LSP", "code_action",
"Show code actions")
buf_set_keymap('n', 'gr', '<cmd>lua vim.lsp.buf.references()<CR>', opts, "LSP", "references", "Show references") buf_set_keymap('n', 'gr', '<cmd>lua vim.lsp.buf.references()<CR>', opts, "LSP", "references", "Show references")
buf_set_keymap('n', '<space>e', '<cmd>lua vim.lsp.diagnostic.show_line_diagnostics()<CR>', opts, "LSP", "show_line_diagnostics", "Show line diagnostic") buf_set_keymap('n', '<space>e', '<cmd>lua vim.lsp.diagnostic.show_line_diagnostics()<CR>', opts, "LSP",
"show_line_diagnostics", "Show line diagnostic")
buf_set_keymap('n', '[d', '<cmd>lua vim.lsp.diagnostic.goto_prev()<CR>', opts, "LSP", "goto_prev", "Go to previous") buf_set_keymap('n', '[d', '<cmd>lua vim.lsp.diagnostic.goto_prev()<CR>', opts, "LSP", "goto_prev", "Go to previous")
buf_set_keymap('n', ']d', '<cmd>lua vim.lsp.diagnostic.goto_next()<CR>', opts, "LSP", "goto_next", "Go to next") buf_set_keymap('n', ']d', '<cmd>lua vim.lsp.diagnostic.goto_next()<CR>', opts, "LSP", "goto_next", "Go to next")
buf_set_keymap('n', '<space>q', '<cmd>lua vim.lsp.diagnostic.set_loclist()<CR>', opts, "LSP", "set_loclist", "Set loclist") buf_set_keymap('n', '<space>q', '<cmd>lua vim.lsp.diagnostic.set_loclist()<CR>', opts, "LSP", "set_loclist",
"Set loclist")
buf_set_keymap('n', '<space>f', '<cmd>lua vim.lsp.buf.formatting()<CR>', opts, "LSP", "formatting", "Format") buf_set_keymap('n', '<space>f', '<cmd>lua vim.lsp.buf.formatting()<CR>', opts, "LSP", "formatting", "Format")
end end
@ -74,13 +86,13 @@ end
local capabilities = vim.lsp.protocol.make_client_capabilities() local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities.textDocument.completion.completionItem.snippetSupport = true capabilities.textDocument.completion.completionItem.snippetSupport = true
require'lspconfig'.jsonls.setup { require 'lspconfig'.jsonls.setup {
cmd = { "vscode-json-languageserver", "--stdio" }, cmd = { "vscode-json-languageserver", "--stdio" },
capabilities = capabilities, capabilities = capabilities,
commands = { commands = {
Format = { Format = {
function() function()
vim.lsp.buf.range_formatting({},{0,0},{vim.fn.line("$"),0}) vim.lsp.buf.range_formatting({}, { 0, 0 }, { vim.fn.line("$"), 0 })
end end
}, },
}, },
@ -90,7 +102,7 @@ local runtime_path = vim.split(package.path, ';')
table.insert(runtime_path, "lua/?.lua") table.insert(runtime_path, "lua/?.lua")
table.insert(runtime_path, "lua/?/init.lua") table.insert(runtime_path, "lua/?/init.lua")
require'lspconfig'.sumneko_lua.setup { require 'lspconfig'.sumneko_lua.setup {
settings = { settings = {
Lua = { Lua = {
runtime = { runtime = {
@ -101,7 +113,7 @@ require'lspconfig'.sumneko_lua.setup {
}, },
diagnostics = { diagnostics = {
-- Get the language server to recognize the `vim` global -- Get the language server to recognize the `vim` global
globals = {'vim'}, globals = { 'vim' },
}, },
workspace = { workspace = {
-- Make the server aware of Neovim runtime files -- Make the server aware of Neovim runtime files
@ -115,5 +127,20 @@ require'lspconfig'.sumneko_lua.setup {
}, },
} }
-- lsp_lines
require('lsp_lines').setup()
vim.diagnostic.config({
virtual_text = false,
})
vim.keymap.set(
"",
"<space>l",
require("lsp_lines").toggle,
{ desc = "Toggle lsp_lines" }
)
-- Format on save -- Format on save
vim.cmd [[autocmd BufWritePre <buffer> lua vim.lsp.buf.formatting_sync()]] vim.cmd [[autocmd BufWritePre <buffer> lua vim.lsp.buf.formatting_sync()]]

216
lua/config/vgit.lua Normal file
View File

@ -0,0 +1,216 @@
vim.o.updatetime = 300
vim.o.incsearch = false
vim.wo.signcolumn = 'yes'
require('vgit').setup({
keymaps = {
['n <leader>gk'] = 'hunk_up',
['n <leader>gj'] = 'hunk_down',
['n <leader>gs'] = 'buffer_hunk_stage',
['n <leader>gr'] = 'buffer_hunk_reset',
['n <leader>gp'] = 'buffer_hunk_preview',
['n <leader>gb'] = 'buffer_blame_preview',
['n <leader>gf'] = 'buffer_diff_preview',
['n <leader>gh'] = 'buffer_history_preview',
['n <leader>gu'] = 'buffer_reset',
['n <leader>gg'] = 'buffer_gutter_blame_preview',
['n <leader>glu'] = 'project_hunks_preview',
['n <leader>gls'] = 'project_hunks_staged_preview',
['n <leader>gd'] = 'project_diff_preview',
['n <leader>gq'] = 'project_hunks_qf',
['n <leader>gx'] = 'toggle_diff_preference',
},
settings = {
-- git = {
-- cmd = 'git', -- optional setting, not really required
-- fallback_cwd = vim.fn.expand("$HOME"),
-- fallback_args = {
-- "--git-dir",
-- vim.fn.expand("$HOME/dots/yadm-repo"),
-- "--work-tree",
-- vim.fn.expand("$HOME"),
-- },
-- },
hls = {
GitBackground = 'Normal',
GitHeader = 'NormalFloat',
GitFooter = 'NormalFloat',
GitBorder = 'LineNr',
GitLineNr = 'LineNr',
GitComment = 'Comment',
GitSignsAdd = {
gui = nil,
fg = '#d7ffaf',
bg = nil,
sp = nil,
override = false,
},
GitSignsChange = {
gui = nil,
fg = '#7AA6DA',
bg = nil,
sp = nil,
override = false,
},
GitSignsDelete = {
gui = nil,
fg = '#e95678',
bg = nil,
sp = nil,
override = false,
},
GitSignsAddLn = 'DiffAdd',
GitSignsDeleteLn = 'DiffDelete',
GitWordAdd = {
gui = nil,
fg = nil,
bg = '#5d7a22',
sp = nil,
override = false,
},
GitWordDelete = {
gui = nil,
fg = nil,
bg = '#960f3d',
sp = nil,
override = false,
},
},
live_blame = {
enabled = true,
format = function(blame, git_config)
local config_author = git_config['user.name']
local author = blame.author
if config_author == author then
author = 'You'
end
local time = os.difftime(os.time(), blame.author_time)
/ (60 * 60 * 24 * 30 * 12)
local time_divisions = {
{ 1, 'years' },
{ 12, 'months' },
{ 30, 'days' },
{ 24, 'hours' },
{ 60, 'minutes' },
{ 60, 'seconds' },
}
local counter = 1
local time_division = time_divisions[counter]
local time_boundary = time_division[1]
local time_postfix = time_division[2]
while time < 1 and counter ~= #time_divisions do
time_division = time_divisions[counter]
time_boundary = time_division[1]
time_postfix = time_division[2]
time = time * time_boundary
counter = counter + 1
end
local commit_message = blame.commit_message
if not blame.committed then
author = 'You'
commit_message = 'Uncommitted changes'
return string.format(' %s • %s', author, commit_message)
end
local max_commit_message_length = 255
if #commit_message > max_commit_message_length then
commit_message = commit_message:sub(1, max_commit_message_length) .. '...'
end
return string.format(
' %s, %s • %s',
author,
string.format(
'%s %s ago',
time >= 0 and math.floor(time + 0.5) or math.ceil(time - 0.5),
time_postfix
),
commit_message
)
end,
},
live_gutter = {
enabled = true,
edge_navigation = true, -- This allows users to navigate within a hunk
},
authorship_code_lens = {
enabled = true,
},
scene = {
diff_preference = 'unified',
},
diff_preview = {
keymaps = {
buffer_stage = 'S',
buffer_unstage = 'U',
buffer_hunk_stage = 's',
buffer_hunk_unstage = 'u',
toggle_view = 't',
},
},
project_diff_preview = {
keymaps = {
buffer_stage = 's',
buffer_unstage = 'u',
buffer_hunk_stage = 'gs',
buffer_hunk_unstage = 'gu',
buffer_reset = 'r',
stage_all = 'S',
unstage_all = 'U',
reset_all = 'R',
},
},
signs = {
priority = 10,
definitions = {
GitSignsAddLn = {
linehl = 'GitSignsAddLn',
texthl = nil,
numhl = nil,
icon = nil,
text = '',
},
GitSignsDeleteLn = {
linehl = 'GitSignsDeleteLn',
texthl = nil,
numhl = nil,
icon = nil,
text = '',
},
GitSignsAdd = {
texthl = 'GitSignsAdd',
numhl = nil,
icon = nil,
linehl = nil,
text = '',
},
GitSignsDelete = {
texthl = 'GitSignsDelete',
numhl = nil,
icon = nil,
linehl = nil,
text = '',
},
GitSignsChange = {
texthl = 'GitSignsChange',
numhl = nil,
icon = nil,
linehl = nil,
text = '',
},
},
usage = {
screen = {
add = 'GitSignsAddLn',
remove = 'GitSignsDeleteLn',
},
main = {
add = 'GitSignsAdd',
remove = 'GitSignsDelete',
change = 'GitSignsChange',
},
},
},
symbols = {
void = '',
},
}
})

View File

@ -24,7 +24,10 @@ local function init()
use { use {
'nvim-telescope/telescope.nvim', 'nvim-telescope/telescope.nvim',
requires = { { 'nvim-lua/popup.nvim' }, { 'nvim-lua/plenary.nvim' } }, requires = { { 'nvim-lua/popup.nvim' }, { 'nvim-lua/plenary.nvim' } },
config = function() require("telescope").load_extension("mapper") end config = function()
require("telescope").load_extension("mapper");
require("telescope").load_extension('cder');
end
} }
-- Highlight -- Highlight
@ -67,6 +70,11 @@ local function init()
-- LSP stuff -- LSP stuff
use 'neovim/nvim-lspconfig' use 'neovim/nvim-lspconfig'
use 'https://git.sr.ht/~whynothugo/lsp_lines.nvim'
-- -- Coq
use {'ms-jpq/coq_nvim', branch = 'coq'}
use {'ms-jpq/coq.artifacts', branch = 'artifacts'}
use {'ms-jpq/coq.thirdparty', branch = '3p'}
-- Split maximizer -- Split maximizer
use 'szw/vim-maximizer' use 'szw/vim-maximizer'
@ -85,6 +93,20 @@ local function init()
-- Autotag completer -- Autotag completer
use 'windwp/nvim-ts-autotag' use 'windwp/nvim-ts-autotag'
-- cder.nvim
use 'zane-/cder.nvim'
-- dressing.nvim
use 'stevearc/dressing.nvim'
-- vgit
use {
'tanvirtin/vgit.nvim',
requires = {
'nvim-lua/plenary.nvim'
}
}
end end
local plugins = setmetatable({}, { local plugins = setmetatable({}, {

View File

@ -9,10 +9,13 @@ vim.api.nvim_command('packadd packer.nvim')
local no_errors, error_msg = pcall(function() local no_errors, error_msg = pcall(function()
local time _G._packer = _G._packer or {}
local profile_info _G._packer.inside_compile = true
local should_profile = false
if should_profile then local time
local profile_info
local should_profile = false
if should_profile then
local hrtime = vim.loop.hrtime local hrtime = vim.loop.hrtime
profile_info = {} profile_info = {}
time = function(chunk, start) time = function(chunk, start)
@ -22,9 +25,9 @@ local no_errors, error_msg = pcall(function()
profile_info[chunk] = (hrtime() - profile_info[chunk]) / 1e6 profile_info[chunk] = (hrtime() - profile_info[chunk]) / 1e6
end end
end end
else else
time = function(chunk, start) end time = function(chunk, start) end
end end
local function save_profiles(threshold) local function save_profiles(threshold)
local sorted_times = {} local sorted_times = {}
@ -38,8 +41,10 @@ local function save_profiles(threshold)
results[i] = elem[1] .. ' took ' .. elem[2] .. 'ms' results[i] = elem[1] .. ' took ' .. elem[2] .. 'ms'
end end
end end
if threshold then
table.insert(results, '(Only showing plugins that took longer than ' .. threshold .. ' ms ' .. 'to load)')
end
_G._packer = _G._packer or {}
_G._packer.profile_output = results _G._packer.profile_output = results
end end
@ -79,11 +84,36 @@ _G.packer_plugins = {
path = "/home/leo/.local/share/nvim/site/pack/packer/start/black", path = "/home/leo/.local/share/nvim/site/pack/packer/start/black",
url = "https://github.com/psf/black" url = "https://github.com/psf/black"
}, },
["cder.nvim"] = {
loaded = true,
path = "/home/leo/.local/share/nvim/site/pack/packer/start/cder.nvim",
url = "https://github.com/zane-/cder.nvim"
},
["coc.nvim"] = { ["coc.nvim"] = {
loaded = true, loaded = true,
path = "/home/leo/.local/share/nvim/site/pack/packer/start/coc.nvim", path = "/home/leo/.local/share/nvim/site/pack/packer/start/coc.nvim",
url = "https://github.com/neoclide/coc.nvim" url = "https://github.com/neoclide/coc.nvim"
}, },
["coq.artifacts"] = {
loaded = true,
path = "/home/leo/.local/share/nvim/site/pack/packer/start/coq.artifacts",
url = "https://github.com/ms-jpq/coq.artifacts"
},
coq_nvim = {
loaded = true,
path = "/home/leo/.local/share/nvim/site/pack/packer/start/coq_nvim",
url = "https://github.com/ms-jpq/coq_nvim"
},
["dressing.nvim"] = {
loaded = true,
path = "/home/leo/.local/share/nvim/site/pack/packer/start/dressing.nvim",
url = "https://github.com/stevearc/dressing.nvim"
},
["lsp_lines.nvim"] = {
loaded = true,
path = "/home/leo/.local/share/nvim/site/pack/packer/start/lsp_lines.nvim",
url = "https://git.sr.ht/~whynothugo/lsp_lines.nvim"
},
["lualine.nvim"] = { ["lualine.nvim"] = {
loaded = true, loaded = true,
path = "/home/leo/.local/share/nvim/site/pack/packer/start/lualine.nvim", path = "/home/leo/.local/share/nvim/site/pack/packer/start/lualine.nvim",
@ -131,8 +161,9 @@ _G.packer_plugins = {
url = "https://github.com/windwp/nvim-ts-autotag" url = "https://github.com/windwp/nvim-ts-autotag"
}, },
["nvim-web-devicons"] = { ["nvim-web-devicons"] = {
loaded = true, loaded = false,
path = "/home/leo/.local/share/nvim/site/pack/packer/start/nvim-web-devicons", needs_bufread = false,
path = "/home/leo/.local/share/nvim/site/pack/packer/opt/nvim-web-devicons",
url = "https://github.com/kyazdani42/nvim-web-devicons" url = "https://github.com/kyazdani42/nvim-web-devicons"
}, },
["packer.nvim"] = { ["packer.nvim"] = {
@ -151,7 +182,7 @@ _G.packer_plugins = {
url = "https://github.com/nvim-lua/popup.nvim" url = "https://github.com/nvim-lua/popup.nvim"
}, },
["telescope.nvim"] = { ["telescope.nvim"] = {
config = { "\27LJ\2\nK\0\0\3\0\4\0\a6\0\0\0'\2\1\0B\0\2\0029\0\2\0'\2\3\0B\0\2\1K\0\1\0\vmapper\19load_extension\14telescope\frequire\0" }, config = { "\27LJ\2\nh\0\0\3\0\5\0\r6\0\0\0'\2\1\0B\0\2\0029\0\2\0'\2\3\0B\0\2\0016\0\0\0'\2\1\0B\0\2\0029\0\2\0'\2\4\0B\0\2\1K\0\1\0\tcder\vmapper\19load_extension\14telescope\frequire\0" },
loaded = true, loaded = true,
path = "/home/leo/.local/share/nvim/site/pack/packer/start/telescope.nvim", path = "/home/leo/.local/share/nvim/site/pack/packer/start/telescope.nvim",
url = "https://github.com/nvim-telescope/telescope.nvim" url = "https://github.com/nvim-telescope/telescope.nvim"
@ -161,6 +192,11 @@ _G.packer_plugins = {
path = "/home/leo/.local/share/nvim/site/pack/packer/start/undotree", path = "/home/leo/.local/share/nvim/site/pack/packer/start/undotree",
url = "https://github.com/mbbill/undotree" url = "https://github.com/mbbill/undotree"
}, },
["vgit.nvim"] = {
loaded = true,
path = "/home/leo/.local/share/nvim/site/pack/packer/start/vgit.nvim",
url = "https://github.com/tanvirtin/vgit.nvim"
},
["vim-matchup"] = { ["vim-matchup"] = {
loaded = true, loaded = true,
path = "/home/leo/.local/share/nvim/site/pack/packer/start/vim-matchup", path = "/home/leo/.local/share/nvim/site/pack/packer/start/vim-matchup",
@ -181,12 +217,19 @@ _G.packer_plugins = {
time([[Defining packer_plugins]], false) time([[Defining packer_plugins]], false)
-- Config for: telescope.nvim -- Config for: telescope.nvim
time([[Config for telescope.nvim]], true) time([[Config for telescope.nvim]], true)
try_loadstring("\27LJ\2\nK\0\0\3\0\4\0\a6\0\0\0'\2\1\0B\0\2\0029\0\2\0'\2\3\0B\0\2\1K\0\1\0\vmapper\19load_extension\14telescope\frequire\0", "config", "telescope.nvim") try_loadstring("\27LJ\2\nh\0\0\3\0\5\0\r6\0\0\0'\2\1\0B\0\2\0029\0\2\0'\2\3\0B\0\2\0016\0\0\0'\2\1\0B\0\2\0029\0\2\0'\2\4\0B\0\2\1K\0\1\0\tcder\vmapper\19load_extension\14telescope\frequire\0", "config", "telescope.nvim")
time([[Config for telescope.nvim]], false) time([[Config for telescope.nvim]], false)
-- Config for: nvim-mapper -- Config for: nvim-mapper
time([[Config for nvim-mapper]], true) time([[Config for nvim-mapper]], true)
try_loadstring("\27LJ\2\n=\0\0\3\0\3\0\a6\0\0\0'\2\1\0B\0\2\0029\0\2\0004\2\0\0B\0\2\1K\0\1\0\nsetup\16nvim-mapper\frequire\0", "config", "nvim-mapper") try_loadstring("\27LJ\2\n=\0\0\3\0\3\0\a6\0\0\0'\2\1\0B\0\2\0029\0\2\0004\2\0\0B\0\2\1K\0\1\0\nsetup\16nvim-mapper\frequire\0", "config", "nvim-mapper")
time([[Config for nvim-mapper]], false) time([[Config for nvim-mapper]], false)
_G._packer.inside_compile = false
if _G._packer.needs_bufread == true then
vim.cmd("doautocmd BufRead")
end
_G._packer.needs_bufread = false
if should_profile then save_profiles() end if should_profile then save_profiles() end
end) end)