From 57e115339d00a2a8afe09dba6f83009cc5a02e99 Mon Sep 17 00:00:00 2001 From: "Anna (navi) Figueiredo Gomes" Date: Mon, 10 Apr 2023 16:38:26 -0300 Subject: nvim update, semi-refactor --- .config/nvim/.luarc.json | 4 - .config/nvim/colors/test.lua | 1 - .config/nvim/init.lua | 0 .config/nvim/lua/.luarc.json | 4 + .config/nvim/lua/autocmds.lua | 20 ++-- .config/nvim/lua/keymaps.lua | 82 +++++--------- .config/nvim/lua/lilies.lua | 0 .config/nvim/lua/options.lua | 10 +- .config/nvim/lua/plugins.lua | 131 +++++++++++++--------- .config/nvim/lua/statusline.lua | 178 +++++++++--------------------- .config/nvim/lua/ui.lua | 0 .config/nvim/lua/util.lua | 34 ------ .config/nvim/lua/utils.lua | 23 ++++ .config/nvim/plugin/packer_compiled.lua | 189 -------------------------------- .config/nvim/snippets/c.json | 19 ++++ .config/nvim/snippets/package.json | 13 +++ 16 files changed, 231 insertions(+), 477 deletions(-) delete mode 100644 .config/nvim/.luarc.json delete mode 100755 .config/nvim/colors/test.lua mode change 100755 => 100644 .config/nvim/init.lua create mode 100644 .config/nvim/lua/.luarc.json mode change 100755 => 100644 .config/nvim/lua/autocmds.lua mode change 100755 => 100644 .config/nvim/lua/keymaps.lua mode change 100755 => 100644 .config/nvim/lua/lilies.lua mode change 100755 => 100644 .config/nvim/lua/options.lua mode change 100755 => 100644 .config/nvim/lua/plugins.lua mode change 100755 => 100644 .config/nvim/lua/ui.lua delete mode 100755 .config/nvim/lua/util.lua create mode 100644 .config/nvim/lua/utils.lua delete mode 100644 .config/nvim/plugin/packer_compiled.lua create mode 100644 .config/nvim/snippets/c.json create mode 100644 .config/nvim/snippets/package.json (limited to '.config') diff --git a/.config/nvim/.luarc.json b/.config/nvim/.luarc.json deleted file mode 100644 index e1b9d70..0000000 --- a/.config/nvim/.luarc.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "$schema": "https://raw.githubusercontent.com/sumneko/vscode-lua/master/setting/schema.json", - "Lua.workspace.checkThirdParty": false -} \ No newline at end of file diff --git a/.config/nvim/colors/test.lua b/.config/nvim/colors/test.lua deleted file mode 100755 index c46a1b7..0000000 --- a/.config/nvim/colors/test.lua +++ /dev/null @@ -1 +0,0 @@ -print('test dot lua') diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua old mode 100755 new mode 100644 diff --git a/.config/nvim/lua/.luarc.json b/.config/nvim/lua/.luarc.json new file mode 100644 index 0000000..e1b9d70 --- /dev/null +++ b/.config/nvim/lua/.luarc.json @@ -0,0 +1,4 @@ +{ + "$schema": "https://raw.githubusercontent.com/sumneko/vscode-lua/master/setting/schema.json", + "Lua.workspace.checkThirdParty": false +} \ No newline at end of file diff --git a/.config/nvim/lua/autocmds.lua b/.config/nvim/lua/autocmds.lua old mode 100755 new mode 100644 index 5fcb496..d7d1294 --- a/.config/nvim/lua/autocmds.lua +++ b/.config/nvim/lua/autocmds.lua @@ -1,28 +1,30 @@ +local custom_au = vim.api.nvim_create_augroup('custom', {}) + vim.api.nvim_create_autocmd('BufWritePost', { - pattern = "config", + group = custom_au, + pattern = require('utils').config_home() .. "/i3/config", command = '!i3-msg -q reload', }) vim.api.nvim_create_autocmd('BufWritePost', { + group = custom_au, pattern = "*.tex", command = 'silent !pdflatex %', }) vim.api.nvim_create_autocmd('BufWritePre', { + group = custom_au, pattern = 'todo.txt', command = 'sort', }) ---vim.api.nvim_create_autocmd('VimEnter', { - --once = true, - --callback = function() - --if vim.fn.filereadable('Session.vim') then - --vim.cmd('source Session.vim') - --end - --end ---}) +vim.api.nvim_create_autocmd('VimResized', { + group = custom_au, + command = 'wincmd =', +}) vim.api.nvim_create_autocmd('TextYankPost', { + group = custom_au, callback = function () vim.highlight.on_yank({ higroup = 'IncSearch', timeout = 200}) end, diff --git a/.config/nvim/lua/keymaps.lua b/.config/nvim/lua/keymaps.lua old mode 100755 new mode 100644 index 16de10f..4c09fd2 --- a/.config/nvim/lua/keymaps.lua +++ b/.config/nvim/lua/keymaps.lua @@ -1,68 +1,38 @@ vim.g.mapleader = " " -local function keymap(mode, lhs, rhs, opts) - opts = opts or { noremap = true, silent = true } - vim.keymap.set(mode, lhs, rhs, opts) -end -keymap('n', '', - function() require('luasnip').jump(1) end, - {noremap = true, silent = true}) +local opts = { noremap = true, silent = true } -- Map leader + s and v/h to open split -keymap('n', 'sp', ':sp') -keymap('n', 'sv', ':vsp') +vim.keymap.set('n', 'sp', ':sp', opts) +vim.keymap.set('n', 'sv', ':vsp', opts) -keymap('n', 'q', ':q') +vim.keymap.set('n', 'q', ':q', opts) -keymap('n', '', ':mksession!nvim-session:wqa') -keymap('n', '', ':wa:mksession!nvim-session') -keymap('n', '', ':sourcenvim-session') +vim.keymap.set('n', 'y', '"+y', opts) +vim.keymap.set('n', 'd', '"+d', opts) +vim.keymap.set('n', 'p', '"+p', opts) +vim.keymap.set('n', 'Y', '"+Y', opts) +vim.keymap.set('n', 'D', '"+D', opts) +vim.keymap.set('n', 'P', '"+P', opts) -keymap('n', 'y', '"+y') -keymap('n', 'd', '"+d') -keymap('n', 'p', '"+p') -keymap('n', 'Y', '"+Y') -keymap('n', 'D', '"+D') -keymap('n', 'P', '"+P') +vim.keymap.set('v', 'y', '"+y', opts) +vim.keymap.set('v', 'd', '"+d', opts) +vim.keymap.set('v', 'p', '"+p', opts) +vim.keymap.set('v', 'Y', '"+Y', opts) +vim.keymap.set('v', 'D', '"+D', opts) +vim.keymap.set('v', 'P', '"+P', opts) -keymap('v', 'y', '"+y') -keymap('v', 'd', '"+d') -keymap('v', 'p', '"+p') -keymap('v', 'Y', '"+Y') -keymap('v', 'D', '"+D') -keymap('v', 'P', '"+P') +vim.keymap.set('n', '', 'h', opts) +vim.keymap.set('n', '', 'k', opts) +vim.keymap.set('n', '', 'j', opts) +vim.keymap.set('n', '', 'l', opts) -keymap('n', '', 'h') -keymap('n', '', 'k') -keymap('n', '', 'j') -keymap('n', '', 'l') +vim.keymap.set('n', '', ':cn', opts) +vim.keymap.set('n', '', ':cp', opts) -keymap('v', '<', '', '>gv') +vim.keymap.set('v', '<', '', '>gv', opts) -keymap('i', '', '') +vim.keymap.set('i', '', '', opts) -vim.api.nvim_create_autocmd('User', { - pattern = 'LspAttached', - desc = 'LSP Keymaps', - callback = function() - local function bufmap(mode, lhs, rhs) - keymap(mode, lhs, rhs, { silent = true, noremap = true, buffer = true }) - end - - bufmap('n', 'gD', vim.lsp.buf.declaration) - bufmap('n', 'gd', vim.lsp.buf.definition) - bufmap('n', 'K', vim.lsp.buf.hover) - bufmap('n', 'gi', vim.lsp.buf.implementation) - bufmap('n', '', vim.lsp.buf.signature_help) - bufmap('n', 'wa', vim.lsp.buf.add_workspace_folder) - bufmap('n', 'wr', vim.lsp.buf.remove_workspace_folder) - bufmap('n', 'wl', function() print(vim.inspect(vim.lsp.buf.list_workspace_folders())) end) - bufmap('n', 'D', vim.lsp.buf.type_definition) - bufmap('n', 'rn', vim.lsp.buf.rename) - bufmap('n', 'ca', vim.lsp.buf.code_action) - bufmap('n', 'gr', vim.lsp.buf.references) - bufmap('n', 'f', vim.lsp.buf.formatting) - bufmap('n', 'e', vim.diagnostic.open_float) - end -}) +vim.keymap.set('n', 'gp', require('utils').lsp_peek, opts) diff --git a/.config/nvim/lua/lilies.lua b/.config/nvim/lua/lilies.lua old mode 100755 new mode 100644 diff --git a/.config/nvim/lua/options.lua b/.config/nvim/lua/options.lua old mode 100755 new mode 100644 index a32fe58..8be12cf --- a/.config/nvim/lua/options.lua +++ b/.config/nvim/lua/options.lua @@ -1,4 +1,4 @@ ---vim.opt.termguicolors = true +vim.opt.termguicolors = true vim.opt.showmode = false vim.opt.path = '.,,**' @@ -23,6 +23,10 @@ vim.opt.scrolloff = 15 vim.opt.synmaxcol = 300 -vim.opt.cmdheight = 0 +vim.opt.wildoptions = 'tagfile' + +vim.g.lsp_langs = { 'c', 'cpp', 'rust', 'php', 'lua', 'sh' } +vim.g.ts_langs = { 'c', 'cpp', 'rust', 'php', 'lua' } + +vim.g.editorconfig = true ---vim.g.editorconfig = true diff --git a/.config/nvim/lua/plugins.lua b/.config/nvim/lua/plugins.lua old mode 100755 new mode 100644 index 9655992..e956ae4 --- a/.config/nvim/lua/plugins.lua +++ b/.config/nvim/lua/plugins.lua @@ -1,17 +1,28 @@ local ensure_packer = function() local fn = vim.fn - local install_path = fn.stdpath('data')..'/site/pack/packer/start/packer.nvim' + local install_path = fn.stdpath('data') .. '/site/pack/packer/start/packer.nvim' if fn.empty(fn.glob(install_path)) > 0 then - fn.system({'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path}) + fn.system({ 'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path }) vim.cmd [[packadd packer.nvim]] return true end return false end +vim.api.nvim_create_autocmd('BufWritePost', { + pattern = require('utils').config_home() .. '/nvim/lua/plugins.lua', + group = vim.api.nvim_create_augroup('packer', {}), + command = 'source | PackerCompile' +}) + local packer_bootstrap = ensure_packer() +require('packer').init({ + compile_path = vim.fn.stdpath('data') .. '/site/pack/loader/start/packer/plugin/packer.lua', +}) + return require('packer').startup(function(use) + use 'wbthomason/packer.nvim' use { @@ -24,36 +35,53 @@ return require('packer').startup(function(use) use { "SmiteshP/nvim-navic", - requires = "neovim/nvim-lspconfig" + requires = "neovim/nvim-lspconfig", } use { - "folke/which-key.nvim", + "ibhagwan/fzf-lua", config = function() - require("which-key").setup { - -- your configuration comes here - -- or leave it empty to use the default settings - -- refer to the configuration section below - } + local opts = {noremap = true, silent = true} + vim.keymap.set('n', 'f', require('fzf-lua').files, opts) + vim.keymap.set('n', 'b', require('fzf-lua').buffers, opts) + vim.keymap.set('n', 'Q', require('fzf-lua').quick_fix, opts) + vim.keymap.set('n', 't', require('fzf-lua').tabs, opts) end } use { 'neovim/nvim-lspconfig', + --ft = vim.g.lsp_langs, config = function() local lspconfig = require('lspconfig') - local capabilities = require('cmp_nvim_lsp').default_capabilities(vim.lsp.protocol.make_client_capabilities()) + local capabilities = require('cmp_nvim_lsp').default_capabilities() local cache = os.getenv("XDG_RUNTIME_DIR") or "/tmp/" local on_attach = function(client, bufnr) - vim.api.nvim_exec_autocmds('User', {pattern = 'LspAttached'}) + local bind_opts = { silent = true, noremap = true, buffer = true } require('nvim-navic').attach(client, bufnr) + vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, bind_opts) + vim.keymap.set('n', 'gd', vim.lsp.buf.definition, bind_opts) + vim.keymap.set('n', 'K', vim.lsp.buf.hover, bind_opts) + vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, bind_opts) + vim.keymap.set('n', 'k', vim.lsp.buf.signature_help, bind_opts) + vim.keymap.set('n', 'wa', vim.lsp.buf.add_workspace_folder, bind_opts) + vim.keymap.set('n', 'wr', vim.lsp.buf.remove_workspace_folder, bind_opts) + vim.keymap.set('n', 'wl', function() + print(vim.inspect(vim.lsp.buf.list_workspace_folders())) + end, bind_opts) + vim.keymap.set('n', 'D', vim.lsp.buf.type_definition, bind_opts) + vim.keymap.set('n', 'rn', vim.lsp.buf.rename, bind_opts) + vim.keymap.set('n', 'ca', vim.lsp.buf.code_action, bind_opts) + vim.keymap.set('n', 'gr', vim.lsp.buf.references, bind_opts) + --vim.keymap.set('n', 'f', vim.lsp.buf.formatting, bind_opts) + vim.keymap.set('n', 'e', vim.diagnostic.open_float, bind_opts) + vim.keymap.set('n', 'E', vim.diagnostic.setqflist, bind_opts) end lspconfig.ccls.setup { on_attach = on_attach, capabilities = capabilities, - single_file_support = true, init_options = { cache = { directory = cache .. "/ccls" @@ -86,7 +114,7 @@ return require('packer').startup(function(use) }, diagnostics = { - globals = {'vim'}, + globals = { 'vim', 'packer_plugins' }, }, workspace = { @@ -105,9 +133,10 @@ return require('packer').startup(function(use) use { 'nvim-treesitter/nvim-treesitter', run = ':TSUpdate', + after = 'nvim-lspconfig', config = function() - require'nvim-treesitter.configs'.setup { - ensure_installed = { "c", "cpp", "php", "lua" }, + require 'nvim-treesitter.configs'.setup { + ensure_installed = vim.g.ts_langs, sync_install = false, auto_install = true, highlight = { @@ -118,75 +147,73 @@ return require('packer').startup(function(use) end } + use { + 'L3MON4D3/LuaSnip', + config = function() + require('luasnip.loaders.from_vscode').lazy_load({ paths = "~/.config/nvim/snippets" }) + end + } + use { 'hrsh7th/nvim-cmp', requires = { 'hrsh7th/cmp-nvim-lsp', - 'hrsh7th/cmp-vsnip', - 'hrsh7th/vim-vsnip', + 'L3MON4D3/LuaSnip', + 'saadparwaiz1/cmp_luasnip', 'hrsh7th/cmp-nvim-lsp-signature-help', 'hrsh7th/cmp-nvim-lsp-document-symbol', }, + --ft = vim.g.lsp_langs, config = function() - -- Setup nvim-cmp. - local cmp = require'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 - end - - local feedkey = function(key, mode) - vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes(key, true, true, true), mode, true) - end - + local cmp = require('cmp') + local luasnip = require('luasnip') cmp.setup({ snippet = { - -- REQUIRED - you must specify a snippet engine expand = function(args) - vim.fn["vsnip#anonymous"](args.body) -- For `vsnip` users. - -- require('luasnip').lsp_expand(args.body) -- For `luasnip` users. - -- require('snippy').expand_snippet(args.body) -- For `snippy` users. - -- vim.fn["UltiSnips#Anon"](args.body) -- For `ultisnips` users. + require('luasnip').lsp_expand(args.body) end, }, - window = { - completion = cmp.config.window.bordered(), - documentation = cmp.config.window.bordered(), - }, mapping = cmp.mapping.preset.insert({ [''] = cmp.mapping.scroll_docs(-4), [''] = cmp.mapping.scroll_docs(4), [''] = cmp.mapping.complete(), [''] = cmp.mapping.abort(), - [''] = cmp.mapping.confirm({ select = false }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. + [''] = cmp.mapping.confirm({ select = false }), [''] = cmp.mapping(function(fallback) if cmp.visible() then cmp.select_next_item() - elseif vim.fn["vsnip#available"](1) == 1 then - feedkey("(vsnip-expand-or-jump)", "") - elseif has_words_before() then - cmp.complete() + elseif luasnip.expand_or_jumpable() then + luasnip.expand_or_jump() else - fallback() -- The fallback function sends a already mapped key. In this case, it's probably ``. + fallback() end end, { "i", "s" }), - [''] = cmp.mapping(function() + [''] = cmp.mapping(function(fallback) if cmp.visible() then cmp.select_prev_item() - elseif vim.fn["vsnip#jumpable"](-1) == 1 then - feedkey("(vsnip-jump-prev)", "") + elseif luasnip.jumpable(-1) then + luasnip.jump(-1) + else + fallback() end end, { "i", "s" }), + [''] = cmp.mapping(function(fallback) + if luasnip.choice_active() then + luasnip.change_choice(1) + else + fallback() + end + end), }), sources = cmp.config.sources({ { name = 'nvim_lsp' }, - { name = 'vsnip' }, -- For vsnip users. - -- { name = 'luasnip' }, -- For luasnip users. - -- { name = 'ultisnips' }, -- For ultisnips users. - -- { name = 'snippy' }, -- For snippy users. + { name = 'luasnip' }, { name = 'nvim_lsp_signature_help' } - }, { - { name = 'buffer' }, + }), + }) + cmp.setup.cmdline({ '/', '?' }, { + sources = cmp.config.sources({ + { name = 'nvim_lsp_document_symbol' } }) }) end diff --git a/.config/nvim/lua/statusline.lua b/.config/nvim/lua/statusline.lua index b7b6ed9..e91ac49 100644 --- a/.config/nvim/lua/statusline.lua +++ b/.config/nvim/lua/statusline.lua @@ -1,14 +1,8 @@ -local fn = vim.fn local api = vim.api --- possible values are 'arrow' | 'rounded' | 'blank' -local active_sep = 'blank' - --- change them if you want to different separator -local separators = { - arrow = { '', '' }, - rounded = { '', '' }, - blank = { '', '' }, +Statusline = { + active = '', + inactive = '', } -- highlight groups @@ -25,74 +19,7 @@ local colors = { line_col_alt = '%#LineColAlt#', } -local trunc_width = setmetatable({ - mode = 80, - git_status = 90, - filename = 140, - line_col = 60, -}, { - __index = function() - return 80 - end -}) - -local is_truncated = function(_, width) - local current_width = api.nvim_win_get_width(0) - return current_width < width -end - ---local modes = setmetatable({ - --['n'] = {'Normal', 'N'}; - --['no'] = {'N·Pending', 'N·P'} ; - --['v'] = {'Visual', 'V' }; - --['V'] = {'V·Line', 'V·L' }; - --[''] = {'V·Block', 'V·B'}; -- this is not ^V, but it's , they're different - --['s'] = {'Select', 'S'}; - --['S'] = {'S·Line', 'S·L'}; - --[''] = {'S·Block', 'S·B'}; -- same with this one, it's not ^S but it's  - --['i'] = {'Insert', 'I'}; - --['ic'] = {'Insert', 'I'}; - --['R'] = {'Replace', 'R'}; - --['Rv'] = {'V·Replace', 'V·R'}; - --['c'] = {'Command', 'C'}; - --['cv'] = {'Vim·Ex ', 'V·E'}; - --['ce'] = {'Ex ', 'E'}; - --['r'] = {'Prompt ', 'P'}; - --['rm'] = {'More ', 'M'}; - --['r?'] = {'Confirm ', 'C'}; - --['!'] = {'Shell ', 'S'}; - --['t'] = {'Terminal ', 'T'}; ---}, { - --__index = function() - --return {'Unknown', 'U'} -- handle edge cases - --end ---}) - -local get_current_mode = function() - return string.format('[%s]', api.nvim_get_mode().mode ) -end - -local get_git_status = function() - -- use fallback because it doesn't set this variable on the initial `BufEnter` - local signs = vim.b.gitsigns_status_dict or {head = '', added = 0, changed = 0, removed = 0} - local is_head_empty = signs.head ~= '' - - if is_truncated(trunc_width.git_status) then - return is_head_empty and string.format('  %s ', signs.head or '') or '' - end - - return is_head_empty and string.format( - ' +%s ~%s -%s |  %s ', - signs.added, signs.changed, signs.removed, signs.head - ) or '' -end - -local get_filename = function() - --if is_truncated(trunc_width.filename) then return "%<%f" end - return "%<%F" -end - -local get_filetype = function() +Statusline.get_filetype = function() local filetype = vim.bo.filetype if filetype == '' then return '' @@ -100,72 +27,50 @@ local get_filetype = function() return string.format('%s', filetype):lower() end -local get_line_col = function() - return '%l:%c' +local add_active = function(text) + Statusline.active = Statusline.active .. text end -Statusline = {} - -Statusline.active = function() - local navic = require('nvim-navic') - - --local mode = colors.mode .. self:get_current_mode() - --local mode_alt = colors.mode_alt .. self.separators[active_sep][1] - --local git = colors.git .. self:get_git_status() - --local git_alt = colors.git_alt .. self.separators[active_sep][1] - --local filename = colors.inactive .. self:get_filename() .. colors.git_alt - --local location = "" - --if navic.is_available() then - --location = navic.get_location() - --end - --local filetype_alt = colors.filetype_alt .. self.separators[active_sep][2] - --local filetype = colors.filetype .. self:get_filetype() - --local line_col = colors.line_col .. self:get_line_col() - --local line_col_alt = colors.line_col_alt .. self.separators[active_sep][2] - - local mode = get_current_mode() - --local git = get_git_status() - local filename = get_filename() .. colors.git_alt - local location = "" - if navic.is_available() then - location = navic.get_location() - end - local filetype = get_filetype() - local line_col = get_line_col() - - return table.concat({ - mode, " ", filename, " ", "%m%r%q", " ", filetype, - "%=", - location, " ", line_col, " " - }) +local add_inactive = function(text) + Statusline.inactive = Statusline.inactive .. text end -Statusline.inactive = function() - return colors.inactive .. '%F' +local addl_active = function(func) + Statusline.active = Statusline.active .. '%{v:lua.' .. func .. '}' end -Statusline.set_explorer = function() - local title = colors.mode .. '  ' - local title_alt = colors.mode_alt .. Statusline.separators[active_sep][2] - - return table.concat({ colors.active, title, title_alt }) +local addl_inactive = function(func) + Statusline.inactive = Statusline.inactive .. '%{v:lua.' .. func .. '}' end ---Statusline = setmetatable(M, { - --__call = function(statusline, mode) - --if mode == "active" then return statusline:set_active() end - --if mode == "inactive" then return statusline:set_inactive() end - --if mode == "explorer" then return statusline:set_explorer() end - --end ---}) +add_active('[') +addl_active('vim.api.nvim_get_mode().mode') +add_active(']') +add_active(' ') +add_active('%<%f') +add_active(' ') +add_active('%m%r%q') +add_active(' ') +addl_active('Statusline.get_filetype()') +add_active('%=') +addl_active('require("nvim-navic").get_location()') +add_active(' ') +add_active('%l:%c') +add_active(' ') + +add_inactive(colors.inactive .. '%F') local augroup = api.nvim_create_augroup('Statusline', { clear = true}) api.nvim_create_autocmd({"WinEnter", "BufEnter"}, { - command = "setlocal statusline=%!v:lua.Statusline.active()", + callback = function() + vim.wo.statusline = Statusline.active + end, group = augroup }) api.nvim_create_autocmd({"WinLeave", "BufLeave"}, { - command = "setlocal statusline=%!v:lua.Statusline.inactive()", + callback = function() + vim.wo.statusline = Statusline.inactive + end, group = augroup }) @@ -200,3 +105,18 @@ api.nvim_create_autocmd({"WinLeave", "BufLeave"}, { -- ) -- end -- end +-- +--local get_git_status = function() + ---- use fallback because it doesn't set this variable on the initial `BufEnter` + --local signs = vim.b.gitsigns_status_dict or {head = '', added = 0, changed = 0, removed = 0} + --local is_head_empty = signs.head ~= '' +-- + --if is_truncated(trunc_width.git_status) then + --return is_head_empty and string.format('  %s ', signs.head or '') or '' + --end +-- + --return is_head_empty and string.format( + --' +%s ~%s -%s |  %s ', + --signs.added, signs.changed, signs.removed, signs.head + --) or '' +--end diff --git a/.config/nvim/lua/ui.lua b/.config/nvim/lua/ui.lua old mode 100755 new mode 100644 diff --git a/.config/nvim/lua/util.lua b/.config/nvim/lua/util.lua deleted file mode 100755 index 8b57d32..0000000 --- a/.config/nvim/lua/util.lua +++ /dev/null @@ -1,34 +0,0 @@ -return { - { - 'windwp/nvim-autopairs', - after = 'nvim-lspconfig', - config = function() - require('nvim-autopairs').setup{} - end - }, - { - 'nvim-lua/plenary.nvim' - }, - { - 'tversteeg/registers.nvim' - }, - { - 'nvim-telescope/telescope.nvim', - -- requires = { 'nvim-lua/plenary.nvim' }, - config = function() - local keymap = vim.api.nvim_set_keymap - local opts = { noremap = true, silent = true } - - keymap('n', 'ff', 'Telescope find_files', opts) - keymap('n', 'fb', 'Telescope buffers', opts) - keymap('n', 'fh', 'Telescope help_tags', opts) - keymap('n', 'fg', 'Telescope live_grep', opts) - end - }, - { - 'xiyaowong/which-key.nvim', - config = function() - require("which-key").setup() - end - } -} diff --git a/.config/nvim/lua/utils.lua b/.config/nvim/lua/utils.lua new file mode 100644 index 0000000..08ff22d --- /dev/null +++ b/.config/nvim/lua/utils.lua @@ -0,0 +1,23 @@ +local M = {} + +function M.lsp_peek() + local params = vim.lsp.util.make_position_params() + return vim.lsp.buf_request(0, 'textDocument/definition', params, + function(_, result, module, _) + if result == nil or vim.tbl_isempty(result) then + vim.lsp.log.info(module, 'No location found') + return nil + end + if vim.tbl_islist(result) then + vim.lsp.util.preview_location(result[1]) + else + vim.lsp.util.preview_location(result) + end + end) +end + +function M.config_home() + return os.getenv('XDG_CONFIG_HOME') or (vim.fn.expand('~') .. '/.config') +end + +return M diff --git a/.config/nvim/plugin/packer_compiled.lua b/.config/nvim/plugin/packer_compiled.lua deleted file mode 100644 index 41ea80b..0000000 --- a/.config/nvim/plugin/packer_compiled.lua +++ /dev/null @@ -1,189 +0,0 @@ --- Automatically generated packer.nvim plugin loader code - -if vim.api.nvim_call_function('has', {'nvim-0.5'}) ~= 1 then - vim.api.nvim_command('echohl WarningMsg | echom "Invalid Neovim version for packer.nvim! | echohl None"') - return -end - -vim.api.nvim_command('packadd packer.nvim') - -local no_errors, error_msg = pcall(function() - -_G._packer = _G._packer or {} -_G._packer.inside_compile = true - -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 - if threshold then - table.insert(results, '(Only showing plugins that took longer than ' .. threshold .. ' ms ' .. 'to load)') - end - - _G._packer.profile_output = results -end - -time([[Luarocks path setup]], true) -local package_path_str = "/home/anna/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?.lua;/home/anna/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?/init.lua;/home/anna/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?.lua;/home/anna/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?/init.lua" -local install_cpath_pattern = "/home/anna/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/lua/5.1/?.so" -if not string.find(package.path, package_path_str, 1, true) then - package.path = package.path .. ';' .. package_path_str -end - -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), name, _G.packer_plugins[name]) - if not success then - vim.schedule(function() - vim.api.nvim_notify('packer.nvim: Error running ' .. component .. ' for ' .. name .. ': ' .. result, vim.log.levels.ERROR, {}) - end) - end - return result -end - -time([[try_loadstring definition]], false) -time([[Defining packer_plugins]], true) -_G.packer_plugins = { - ["cmp-nvim-lsp"] = { - loaded = true, - path = "/home/anna/.local/share/nvim/site/pack/packer/start/cmp-nvim-lsp", - url = "https://github.com/hrsh7th/cmp-nvim-lsp" - }, - ["cmp-nvim-lsp-document-symbol"] = { - loaded = true, - path = "/home/anna/.local/share/nvim/site/pack/packer/start/cmp-nvim-lsp-document-symbol", - url = "https://github.com/hrsh7th/cmp-nvim-lsp-document-symbol" - }, - ["cmp-nvim-lsp-signature-help"] = { - loaded = true, - path = "/home/anna/.local/share/nvim/site/pack/packer/start/cmp-nvim-lsp-signature-help", - url = "https://github.com/hrsh7th/cmp-nvim-lsp-signature-help" - }, - ["cmp-vsnip"] = { - loaded = true, - path = "/home/anna/.local/share/nvim/site/pack/packer/start/cmp-vsnip", - url = "https://github.com/hrsh7th/cmp-vsnip" - }, - ["nvim-cmp"] = { - config = { "\27LJ\2\n\1\0\0\b\0\b\2!6\0\0\0006\2\1\0009\2\2\0029\2\3\2)\4\0\0B\2\2\0A\0\0\3\b\1\0\0X\2\206\2\1\0009\2\2\0029\2\4\2)\4\0\0\23\5\1\0\18\6\0\0+\a\2\0B\2\5\2:\2\1\2\18\4\2\0009\2\5\2\18\5\1\0\18\6\1\0B\2\4\2\18\4\2\0009\2\6\2'\5\a\0B\2\3\2\n\2\0\0X\2\2+\2\1\0X\3\1+\2\2\0L\2\2\0\a%s\nmatch\bsub\23nvim_buf_get_lines\24nvim_win_get_cursor\bapi\bvim\vunpack\0\2p\0\2\n\0\4\0\0156\2\0\0009\2\1\0029\2\2\0026\4\0\0009\4\1\0049\4\3\4\18\6\0\0+\a\2\0+\b\2\0+\t\2\0B\4\5\2\18\5\1\0+\6\2\0B\2\4\1K\0\1\0\27nvim_replace_termcodes\18nvim_feedkeys\bapi\bvim;\0\1\4\0\4\0\0066\1\0\0009\1\1\0019\1\2\0019\3\3\0B\1\2\1K\0\1\0\tbody\20vsnip#anonymous\afn\bvim\1\0\1\5\3\b\1 -\1\0\0009\1\0\1B\1\1\2\15\0\1\0X\2\4-\1\0\0009\1\1\1B\1\1\1X\1\226\1\2\0009\1\3\0019\1\4\1)\3\1\0B\1\2\2\t\1\0\0X\1\5-\1\1\0'\3\5\0'\4\6\0B\1\3\1X\1\n-\1\2\0B\1\1\2\15\0\1\0X\2\4-\1\0\0009\1\a\1B\1\1\1X\1\2\18\1\0\0B\1\1\1K\0\1\0\0\2\1\rcomplete\5!(vsnip-expand-or-jump)\20vsnip#available\afn\bvim\21select_next_item\fvisible\2\1\0\0\4\2\a\1\21-\0\0\0009\0\0\0B\0\1\2\15\0\0\0X\1\4-\0\0\0009\0\1\0B\0\1\1X\0\v6\0\2\0009\0\3\0009\0\4\0)\2B\0\2\2\t\0\0\0X\0\4-\0\1\0'\2\5\0'\3\6\0B\0\3\1K\0\1\0\0\2\5\28(vsnip-jump-prev)\19vsnip#jumpable\afn\bvim\21select_prev_item\fvisible\2\4\1\0\r\0)\0O6\0\0\0'\2\1\0B\0\2\0023\1\2\0003\2\3\0009\3\4\0005\5\b\0005\6\6\0003\a\5\0=\a\a\6=\6\t\0055\6\r\0009\a\n\0009\a\v\a9\a\f\aB\a\1\2=\a\14\0069\a\n\0009\a\v\a9\a\f\aB\a\1\2=\a\15\6=\6\v\0059\6\16\0009\6\17\0069\6\18\0065\b\20\0009\t\16\0009\t\19\t)\vB\t\2\2=\t\21\b9\t\16\0009\t\19\t)\v\4\0B\t\2\2=\t\22\b9\t\16\0009\t\23\tB\t\1\2=\t\24\b9\t\16\0009\t\25\tB\t\1\2=\t\26\b9\t\16\0009\t\27\t5\v\28\0B\t\2\2=\t\29\b9\t\16\0003\v\30\0005\f\31\0B\t\3\2=\t \b9\t\16\0003\v!\0005\f\"\0B\t\3\2=\t#\bB\6\2\2=\6\16\0059\6\n\0009\6$\0064\b\4\0005\t%\0>\t\1\b5\t&\0>\t\2\b5\t'\0>\t\3\b4\t\3\0005\n(\0>\n\1\tB\6\3\2=\6$\5B\3\2\0012\0\0K\0\1\0\1\0\1\tname\vbuffer\1\0\1\tname\28nvim_lsp_signature_help\1\0\1\tname\nvsnip\1\0\1\tname\rnvim_lsp\fsources\f\1\3\0\0\6i\6s\0\n\1\3\0\0\6i\6s\0\t\1\0\1\vselect\1\fconfirm\n\nabort\14\rcomplete\n\n\1\0\0\16scroll_docs\vinsert\vpreset\fmapping\18documentation\15completion\1\0\0\rbordered\vwindow\vconfig\fsnippet\1\0\0\vexpand\1\0\0\0\nsetup\0\0\bcmp\frequire\0" }, - loaded = true, - path = "/home/anna/.local/share/nvim/site/pack/packer/start/nvim-cmp", - url = "https://github.com/hrsh7th/nvim-cmp" - }, - ["nvim-lspconfig"] = { - config = { "\27LJ\2\nw\0\2\6\1\6\0\f6\2\0\0009\2\1\0029\2\2\2'\4\3\0005\5\4\0B\2\3\1-\2\0\0009\2\5\2\18\4\0\0\18\5\1\0B\2\3\1K\0\1\0\3\vattach\1\0\1\fpattern\16LspAttached\tUser\23nvim_exec_autocmds\bapi\bvim\6\1\0\15\0003\0U6\0\0\0'\2\1\0B\0\2\0026\1\0\0'\3\2\0B\1\2\0029\1\3\0016\3\4\0009\3\5\0039\3\6\0039\3\a\3B\3\1\0A\1\0\0026\2\b\0009\2\t\2'\4\n\0B\2\2\2\14\0\2\0X\3\1'\2\v\0006\3\0\0'\5\f\0B\3\2\0023\4\r\0009\5\14\0009\5\15\0055\a\16\0=\4\17\a=\1\18\a5\b\22\0005\t\20\0\18\n\2\0'\v\19\0&\n\v\n=\n\21\t=\t\23\b=\b\24\aB\5\2\0019\5\25\0009\5\15\0055\a\26\0=\4\17\a=\1\18\aB\5\2\0019\5\27\0009\5\15\0055\a\28\0=\4\17\a=\1\18\aB\5\2\0019\5\29\0009\5\15\0055\a\30\0=\4\17\a=\1\18\aB\5\2\0019\5\31\0009\5\15\0055\a \0=\4\17\a=\1\18\a5\b0\0005\t\"\0005\n!\0=\n#\t5\n%\0005\v$\0=\v&\n=\n'\t5\n+\0006\v\4\0009\v(\v9\v)\v'\r*\0+\14\2\0B\v\3\2=\v,\n=\n-\t5\n.\0=\n/\t=\t1\b=\b2\aB\5\2\0012\0\0K\0\1\0\rsettings\bLua\1\0\0\14telemetry\1\0\1\venable\1\14workspace\flibrary\1\0\0\5\26nvim_get_runtime_file\bapi\16diagnostics\fglobals\1\0\0\1\2\0\0\bvim\fruntime\1\0\0\1\0\1\fversion\vLuaJIT\1\0\0\vlua_ls\1\0\0\18rust_analyzer\1\0\0\vbashls\1\0\0\rphpactor\17init_options\ncache\1\0\0\14directory\1\0\0\n/ccls\17capabilities\14on_attach\1\0\1\24single_file_support\2\nsetup\tccls\0\15nvim-navic\n/tmp/\20XDG_RUNTIME_DIR\vgetenv\aos\29make_client_capabilities\rprotocol\blsp\bvim\25default_capabilities\17cmp_nvim_lsp\14lspconfig\frequire\0" }, - loaded = true, - path = "/home/anna/.local/share/nvim/site/pack/packer/start/nvim-lspconfig", - url = "https://github.com/neovim/nvim-lspconfig" - }, - ["nvim-navic"] = { - loaded = true, - path = "/home/anna/.local/share/nvim/site/pack/packer/start/nvim-navic", - url = "https://github.com/SmiteshP/nvim-navic" - }, - ["nvim-treesitter"] = { - config = { "\27LJ\2\n\1\0\0\4\0\b\0\v6\0\0\0'\2\1\0B\0\2\0029\0\2\0005\2\4\0005\3\3\0=\3\5\0025\3\6\0=\3\a\2B\0\2\1K\0\1\0\14highlight\1\0\2\venable\2&additional_vim_regex_highlighting\1\21ensure_installed\1\0\2\17auto_install\2\17sync_install\1\1\5\0\0\6c\bcpp\bphp\blua\nsetup\28nvim-treesitter.configs\frequire\0" }, - loaded = true, - path = "/home/anna/.local/share/nvim/site/pack/packer/start/nvim-treesitter", - url = "https://github.com/nvim-treesitter/nvim-treesitter" - }, - ["packer.nvim"] = { - loaded = true, - path = "/home/anna/.local/share/nvim/site/pack/packer/start/packer.nvim", - url = "https://github.com/wbthomason/packer.nvim" - }, - ["rose-pine"] = { - config = { "\27LJ\2\n9\0\0\3\0\3\0\0056\0\0\0009\0\1\0'\2\2\0B\0\2\1K\0\1\0\26colorscheme rose-pine\bcmd\bvim\0" }, - loaded = true, - path = "/home/anna/.local/share/nvim/site/pack/packer/start/rose-pine", - url = "https://github.com/rose-pine/neovim" - }, - ["rust-tools.nvim"] = { - config = { "\27LJ\2\nZ\0\2\6\0\5\0\a6\2\0\0009\2\1\0029\2\2\2'\4\3\0005\5\4\0B\2\3\1K\0\1\0\1\0\1\fpattern\16LspAttached\tUser\23nvim_exec_autocmds\bapi\bvim\1\1\0\a\0\15\0\0226\0\0\0'\2\1\0B\0\2\0026\1\0\0'\3\2\0B\1\2\0029\1\3\0016\3\4\0009\3\5\0039\3\6\0039\3\a\3B\3\1\0A\1\0\0023\2\b\0009\3\t\0005\5\r\0005\6\n\0=\2\v\6=\1\f\6=\6\14\5B\3\2\1K\0\1\0\vserver\1\0\0\17capabilities\14on_attach\1\0\0\nsetup\0\29make_client_capabilities\rprotocol\blsp\bvim\25default_capabilities\17cmp_nvim_lsp\15rust-tools\frequire\0" }, - loaded = true, - path = "/home/anna/.local/share/nvim/site/pack/packer/start/rust-tools.nvim", - url = "https://github.com/simrat39/rust-tools.nvim" - }, - ["vim-vsnip"] = { - loaded = true, - path = "/home/anna/.local/share/nvim/site/pack/packer/start/vim-vsnip", - url = "https://github.com/hrsh7th/vim-vsnip" - }, - ["which-key.nvim"] = { - config = { "\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\14which-key\frequire\0" }, - loaded = true, - path = "/home/anna/.local/share/nvim/site/pack/packer/start/which-key.nvim", - url = "https://github.com/folke/which-key.nvim" - } -} - -time([[Defining packer_plugins]], false) --- Config for: nvim-cmp -time([[Config for nvim-cmp]], true) -try_loadstring("\27LJ\2\n\1\0\0\b\0\b\2!6\0\0\0006\2\1\0009\2\2\0029\2\3\2)\4\0\0B\2\2\0A\0\0\3\b\1\0\0X\2\206\2\1\0009\2\2\0029\2\4\2)\4\0\0\23\5\1\0\18\6\0\0+\a\2\0B\2\5\2:\2\1\2\18\4\2\0009\2\5\2\18\5\1\0\18\6\1\0B\2\4\2\18\4\2\0009\2\6\2'\5\a\0B\2\3\2\n\2\0\0X\2\2+\2\1\0X\3\1+\2\2\0L\2\2\0\a%s\nmatch\bsub\23nvim_buf_get_lines\24nvim_win_get_cursor\bapi\bvim\vunpack\0\2p\0\2\n\0\4\0\0156\2\0\0009\2\1\0029\2\2\0026\4\0\0009\4\1\0049\4\3\4\18\6\0\0+\a\2\0+\b\2\0+\t\2\0B\4\5\2\18\5\1\0+\6\2\0B\2\4\1K\0\1\0\27nvim_replace_termcodes\18nvim_feedkeys\bapi\bvim;\0\1\4\0\4\0\0066\1\0\0009\1\1\0019\1\2\0019\3\3\0B\1\2\1K\0\1\0\tbody\20vsnip#anonymous\afn\bvim\1\0\1\5\3\b\1 -\1\0\0009\1\0\1B\1\1\2\15\0\1\0X\2\4-\1\0\0009\1\1\1B\1\1\1X\1\226\1\2\0009\1\3\0019\1\4\1)\3\1\0B\1\2\2\t\1\0\0X\1\5-\1\1\0'\3\5\0'\4\6\0B\1\3\1X\1\n-\1\2\0B\1\1\2\15\0\1\0X\2\4-\1\0\0009\1\a\1B\1\1\1X\1\2\18\1\0\0B\1\1\1K\0\1\0\0\2\1\rcomplete\5!(vsnip-expand-or-jump)\20vsnip#available\afn\bvim\21select_next_item\fvisible\2\1\0\0\4\2\a\1\21-\0\0\0009\0\0\0B\0\1\2\15\0\0\0X\1\4-\0\0\0009\0\1\0B\0\1\1X\0\v6\0\2\0009\0\3\0009\0\4\0)\2B\0\2\2\t\0\0\0X\0\4-\0\1\0'\2\5\0'\3\6\0B\0\3\1K\0\1\0\0\2\5\28(vsnip-jump-prev)\19vsnip#jumpable\afn\bvim\21select_prev_item\fvisible\2\4\1\0\r\0)\0O6\0\0\0'\2\1\0B\0\2\0023\1\2\0003\2\3\0009\3\4\0005\5\b\0005\6\6\0003\a\5\0=\a\a\6=\6\t\0055\6\r\0009\a\n\0009\a\v\a9\a\f\aB\a\1\2=\a\14\0069\a\n\0009\a\v\a9\a\f\aB\a\1\2=\a\15\6=\6\v\0059\6\16\0009\6\17\0069\6\18\0065\b\20\0009\t\16\0009\t\19\t)\vB\t\2\2=\t\21\b9\t\16\0009\t\19\t)\v\4\0B\t\2\2=\t\22\b9\t\16\0009\t\23\tB\t\1\2=\t\24\b9\t\16\0009\t\25\tB\t\1\2=\t\26\b9\t\16\0009\t\27\t5\v\28\0B\t\2\2=\t\29\b9\t\16\0003\v\30\0005\f\31\0B\t\3\2=\t \b9\t\16\0003\v!\0005\f\"\0B\t\3\2=\t#\bB\6\2\2=\6\16\0059\6\n\0009\6$\0064\b\4\0005\t%\0>\t\1\b5\t&\0>\t\2\b5\t'\0>\t\3\b4\t\3\0005\n(\0>\n\1\tB\6\3\2=\6$\5B\3\2\0012\0\0K\0\1\0\1\0\1\tname\vbuffer\1\0\1\tname\28nvim_lsp_signature_help\1\0\1\tname\nvsnip\1\0\1\tname\rnvim_lsp\fsources\f\1\3\0\0\6i\6s\0\n\1\3\0\0\6i\6s\0\t\1\0\1\vselect\1\fconfirm\n\nabort\14\rcomplete\n\n\1\0\0\16scroll_docs\vinsert\vpreset\fmapping\18documentation\15completion\1\0\0\rbordered\vwindow\vconfig\fsnippet\1\0\0\vexpand\1\0\0\0\nsetup\0\0\bcmp\frequire\0", "config", "nvim-cmp") -time([[Config for nvim-cmp]], false) --- Config for: which-key.nvim -time([[Config for which-key.nvim]], 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\14which-key\frequire\0", "config", "which-key.nvim") -time([[Config for which-key.nvim]], false) --- Config for: rose-pine -time([[Config for rose-pine]], true) -try_loadstring("\27LJ\2\n9\0\0\3\0\3\0\0056\0\0\0009\0\1\0'\2\2\0B\0\2\1K\0\1\0\26colorscheme rose-pine\bcmd\bvim\0", "config", "rose-pine") -time([[Config for rose-pine]], false) --- Config for: nvim-treesitter -time([[Config for nvim-treesitter]], true) -try_loadstring("\27LJ\2\n\1\0\0\4\0\b\0\v6\0\0\0'\2\1\0B\0\2\0029\0\2\0005\2\4\0005\3\3\0=\3\5\0025\3\6\0=\3\a\2B\0\2\1K\0\1\0\14highlight\1\0\2\venable\2&additional_vim_regex_highlighting\1\21ensure_installed\1\0\2\17auto_install\2\17sync_install\1\1\5\0\0\6c\bcpp\bphp\blua\nsetup\28nvim-treesitter.configs\frequire\0", "config", "nvim-treesitter") -time([[Config for nvim-treesitter]], false) --- Config for: nvim-lspconfig -time([[Config for nvim-lspconfig]], true) -try_loadstring("\27LJ\2\nw\0\2\6\1\6\0\f6\2\0\0009\2\1\0029\2\2\2'\4\3\0005\5\4\0B\2\3\1-\2\0\0009\2\5\2\18\4\0\0\18\5\1\0B\2\3\1K\0\1\0\3\vattach\1\0\1\fpattern\16LspAttached\tUser\23nvim_exec_autocmds\bapi\bvim\6\1\0\15\0003\0U6\0\0\0'\2\1\0B\0\2\0026\1\0\0'\3\2\0B\1\2\0029\1\3\0016\3\4\0009\3\5\0039\3\6\0039\3\a\3B\3\1\0A\1\0\0026\2\b\0009\2\t\2'\4\n\0B\2\2\2\14\0\2\0X\3\1'\2\v\0006\3\0\0'\5\f\0B\3\2\0023\4\r\0009\5\14\0009\5\15\0055\a\16\0=\4\17\a=\1\18\a5\b\22\0005\t\20\0\18\n\2\0'\v\19\0&\n\v\n=\n\21\t=\t\23\b=\b\24\aB\5\2\0019\5\25\0009\5\15\0055\a\26\0=\4\17\a=\1\18\aB\5\2\0019\5\27\0009\5\15\0055\a\28\0=\4\17\a=\1\18\aB\5\2\0019\5\29\0009\5\15\0055\a\30\0=\4\17\a=\1\18\aB\5\2\0019\5\31\0009\5\15\0055\a \0=\4\17\a=\1\18\a5\b0\0005\t\"\0005\n!\0=\n#\t5\n%\0005\v$\0=\v&\n=\n'\t5\n+\0006\v\4\0009\v(\v9\v)\v'\r*\0+\14\2\0B\v\3\2=\v,\n=\n-\t5\n.\0=\n/\t=\t1\b=\b2\aB\5\2\0012\0\0K\0\1\0\rsettings\bLua\1\0\0\14telemetry\1\0\1\venable\1\14workspace\flibrary\1\0\0\5\26nvim_get_runtime_file\bapi\16diagnostics\fglobals\1\0\0\1\2\0\0\bvim\fruntime\1\0\0\1\0\1\fversion\vLuaJIT\1\0\0\vlua_ls\1\0\0\18rust_analyzer\1\0\0\vbashls\1\0\0\rphpactor\17init_options\ncache\1\0\0\14directory\1\0\0\n/ccls\17capabilities\14on_attach\1\0\1\24single_file_support\2\nsetup\tccls\0\15nvim-navic\n/tmp/\20XDG_RUNTIME_DIR\vgetenv\aos\29make_client_capabilities\rprotocol\blsp\bvim\25default_capabilities\17cmp_nvim_lsp\14lspconfig\frequire\0", "config", "nvim-lspconfig") -time([[Config for nvim-lspconfig]], false) --- Config for: rust-tools.nvim -time([[Config for rust-tools.nvim]], true) -try_loadstring("\27LJ\2\nZ\0\2\6\0\5\0\a6\2\0\0009\2\1\0029\2\2\2'\4\3\0005\5\4\0B\2\3\1K\0\1\0\1\0\1\fpattern\16LspAttached\tUser\23nvim_exec_autocmds\bapi\bvim\1\1\0\a\0\15\0\0226\0\0\0'\2\1\0B\0\2\0026\1\0\0'\3\2\0B\1\2\0029\1\3\0016\3\4\0009\3\5\0039\3\6\0039\3\a\3B\3\1\0A\1\0\0023\2\b\0009\3\t\0005\5\r\0005\6\n\0=\2\v\6=\1\f\6=\6\14\5B\3\2\1K\0\1\0\vserver\1\0\0\17capabilities\14on_attach\1\0\0\nsetup\0\29make_client_capabilities\rprotocol\blsp\bvim\25default_capabilities\17cmp_nvim_lsp\15rust-tools\frequire\0", "config", "rust-tools.nvim") -time([[Config for rust-tools.nvim]], 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 - -end) - -if not no_errors then - error_msg = error_msg:gsub('"', '\\"') - vim.api.nvim_command('echohl ErrorMsg | echom "Error in packer_compiled: '..error_msg..'" | echom "Please check your config for correctness" | echohl None') -end diff --git a/.config/nvim/snippets/c.json b/.config/nvim/snippets/c.json new file mode 100644 index 0000000..abed0f2 --- /dev/null +++ b/.config/nvim/snippets/c.json @@ -0,0 +1,19 @@ +{ + "header_guard": { + "prefix": "header_guard", + "body": [ + "#ifndef _$1_H_", + "#define _$1_H_", + "$0", + "#endif" + ] + }, + "function": { + "prefix": "function", + "body": [ + "$1 $2($3) {", + " $0", + "}" + ], + } +} diff --git a/.config/nvim/snippets/package.json b/.config/nvim/snippets/package.json new file mode 100644 index 0000000..7bb8a12 --- /dev/null +++ b/.config/nvim/snippets/package.json @@ -0,0 +1,13 @@ +{ + "name": "my snippets", + "contributes": { + "snippets": [ + { + "language": [ + "c", "cpp" + ], + "path": "./c.json" + } + ] + } +} -- cgit v1.2.3