commit 78c3f04c30c85bf311e0af114bf95d8e1de92478 Author: shey kail <1437467459@qq.com> Date: Tue Oct 4 15:04:44 2022 +0800 first commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a0e76af --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.netrwhist diff --git a/README.md b/README.md new file mode 100644 index 0000000..b527c1e --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +### my nvim config diff --git a/init.lua b/init.lua new file mode 100644 index 0000000..29bfaf7 --- /dev/null +++ b/init.lua @@ -0,0 +1,11 @@ +-- local config +require('localconf') +-- managing plugins +require('plugins') +-- managing lsp +require('lspconf') +-- keyboard mapping +require('keymaps') + +-- my custom functions and command +require("my") diff --git a/lua/keymaps.lua b/lua/keymaps.lua new file mode 100644 index 0000000..07f5414 --- /dev/null +++ b/lua/keymaps.lua @@ -0,0 +1,108 @@ +-- the function map(mode, lhs, rhs, opts) +-- {mode} Mode short-name (map command prefix: "n", "i", "v", "x", …) or "!" for |:map!|, or empty string for |:map|. +-- {lhs} Left-hand-side |{lhs}| of the mapping. +-- {rhs} Right-hand-side |{rhs}| of the mapping. +-- {opts} Optional parameters map. Accepts all |:map-arguments| as keys excluding || but including |noremap| and "desc". "desc" can be used to give a description to keymap. When called from Lua, also accepts a "callback" key that takes a Lua function to call when the mapping is executed. Values are Booleans. Unknown key is an error. +local function noremap(mode, lhs, rhs, opts) + local options = { noremap = true } + if opts then + options = vim.tbl_extend("force", options, opts) + end + vim.keymap.set(mode, lhs, rhs, options) +end + + +-- the function map(mode, lhs, rhs, opts) +-- {mode} Mode short-name (map command prefix: "n", "i", "v", "x", …) or "!" for |:map!|, or empty string for |:map|. +-- {lhs} Left-hand-side |{lhs}| of the mapping. +-- {rhs} Right-hand-side |{rhs}| of the mapping. +-- {opts} Optional parameters map. Accepts all |:map-arguments| as keys excluding || but including |noremap| and "desc". "desc" can be used to give a description to keymap. When called from Lua, also accepts a "callback" key that takes a Lua function to call when the mapping is executed. Values are Booleans. Unknown key is an error. +local function map(mode, lhs, rhs, opts) + vim.keymap.set(mode, lhs, rhs, opts) +end + + +--- simple note: +--- noremap("i","...","...","...") equals to inoremap +--- noremap("n","...","...","...") equals to nnoremap +--- etc + +-- === +-- === Remap space as leader key +-- === +vim.g.mapleader = " " +vim.g.maplocalleader = " " + + +-- === +-- === open init.vim file anytime +-- === +noremap('n', 'rc', 'tabedit ~/.config/nvim/init.lua', {}) +-- Quickly edit the configuration +noremap('n', 'fs', 'tabedit ~/.config/nvim/lua/plugins.lua', {}) + +-- === +-- === windows management +-- === +-- use + hjkl for moving the cursor around windows +noremap('n', 'w', 'w', {}) +noremap('n', 'k', 'k', {}) +noremap('n', 'h', 'h', {}) +noremap('n', 'j', 'j', {}) +noremap('n', 'l', 'l', {}) +-- resize splits with arrow keys +noremap('n', '', ':res +5', {}) +noremap('n', '', ':res -5', {}) +noremap('n', '', ':vertical resize-5', {}) +noremap('n', '', ':vertical resize+5', {}) + + +--use Ctrl+jk for repaid warching +noremap('n', '', '5j', {}) +noremap('n', '', '5k', {}) + + +--use alt+o to add a new line down +noremap('i', '', 'o', {}) +--use alt+O to add a new line up +noremap('i', '', 'O', {}) +--use to exit terminal-mode +noremap('t', '', '', {}) +-- ra to start RnvimrToggle +noremap('n', 'ra', 'RnvimrToggle', {}) + + +-- telescope keymaps +local telescope = require('telescope.builtin') +map('n', 'ff', telescope.find_files, {}) +map('n', 'fg', telescope.live_grep, {}) +map('n', 'b', telescope.buffers, {}) +map('n', 'h', telescope.help_tags, {}) + + + +--- +---lsp attach function : mapping keys +--- +local M = {} +M.attach = function(client, bufnr) -- set up buffer keymaps, etc. + + local bufopts = {silent=true, buffer=bufnr } + local gp=require('goto-preview') + noremap('n', 'gd', gp.goto_preview_definition, bufopts) + noremap('n', 'gt', gp.goto_preview_type_definition, bufopts) + noremap('n', 'gr', gp.goto_preview_references, bufopts) + noremap('n', 'gi', gp.goto_preview_implementation, bufopts) + noremap('n', 'gx', gp.close_all_win, bufopts) +--nnoremap gpi lua require('goto-preview').goto_preview_implementation() + + + noremap('n', 'K', vim.lsp.buf.hover, bufopts) + noremap('n', 'rn', vim.lsp.buf.rename, bufopts) + +end + +return M + + + diff --git a/lua/localconf.lua b/lua/localconf.lua new file mode 100644 index 0000000..fd0bc7c --- /dev/null +++ b/lua/localconf.lua @@ -0,0 +1,60 @@ +vim.o.number = true +vim.o.showmatch = true +vim.o.termguicolors = true +vim.o.cursorline = true +vim.o.wildmenu = true +vim.o.ignorecase = true +vim.o.encoding = "utf-8" -- 保存时的字符编码 +vim.o.fileencodings = "ucs-bom,utf-8,cp936" -- 字符编码 +vim.opt.signcolumn = "yes" -- 总是显示最左边的signcolumn + +vim.o.foldcolumn = '1' +vim.o.foldlevel = 99 +vim.o.foldlevelstart = 99 +vim.o.foldenable = true + +vim.o.autoindent = true --自动缩进 +vim.o.smartindent = true --智能缩进 + +--- === +--- === set 's width as 4 spaces +--- === +vim.o.tabstop = 4 +vim.o.softtabstop = 4 +vim.o.shiftwidth = 4 + +--- === +--- === set colorscheme to one-nvim +--- === +-- before setting colorscheme, setting whole background to be transparent +vim.g.one_nvim_transparent_bg = true +vim.cmd("colorscheme one-nvim") + + +--- === +--- === change color +--- === +---change popup menu's color +--vim.api.nvim_set_hl(0, 'Pmenu', { fg = '#BBBBBB', bg = '#272727' }) +--vim.api.nvim_set_hl(0, 'PmenuSel', { fg = '#BBBBBB', bg = '#004b72' }) +--vim.api.nvim_set_hl(0, 'PmenuSbar', { fg = 'NONE', bg = '#343B41' }) +--vim.api.nvim_set_hl(0, 'PmenuThumb', { fg = 'NONE', bg = '#BBBBBB' }) +-- +-----change tab line's color +--vim.api.nvim_set_hl(0, 'StatusLine', { fg = '#BBBBBB', bg = '#272727' }) +--vim.api.nvim_set_hl(0, 'StatusLineNC', { fg = '#BBBBBB', bg = '#272727' }) +-- +-----change status line's color +----setting tab line's background color +--vim.api.nvim_set_hl(0, 'TabLineFill', { fg = "NONE", bg = '#272727' }) +----setting unselected tab's color +--vim.api.nvim_set_hl(0, 'TabLine', { fg = "NONE", bg = "#272727" }) +----setting selected tab's color +--vim.api.nvim_set_hl(0, 'TabLineSel', { fg = "NONE", bg = "#777777" }) +-- +----setting WinSeparator color +--vim.api.nvim_set_hl(0, 'WinSeparator', { fg = "NONE", bg = "#272727" }) + +--setting SignColumn color +--vim.api.nvim_set_hl(0, 'SignColumn', { fg = "NONE", bg = "#000000" }) + diff --git a/lua/lspconf/handlers.lua b/lua/lspconf/handlers.lua new file mode 100644 index 0000000..f8d7971 --- /dev/null +++ b/lua/lspconf/handlers.lua @@ -0,0 +1,79 @@ + +-- Configure lsp information display style +local M = {} + +--- +---lsp diagnostic +--- +-- +--call M.OpenDiagFloat() to open a floating windows with the diagnostic message for the current line +--add M.OpenDiagFloat() to autocmd to auto-open floating diagnostic message for the current line +M.OpenDiagFloat = function () + for _, winid in pairs(vim.api.nvim_tabpage_list_wins(0)) do + if vim.api.nvim_win_get_config(winid).zindex then + return + end + end + vim.diagnostic.open_float({focusable = false}) +end + + + +M.setup = function() + -- replace the lsp info symbol + local signs = { + { name = "DiagnosticSignError", text = "" }, + { name = "DiagnosticSignWarn", text = "" }, + { name = "DiagnosticSignHint", text = "" }, + { name = "DiagnosticSignInfo", text = "" }, + } + + for _, sign in ipairs(signs) do + vim.fn.sign_define(sign.name, { texthl = sign.name, text = sign.text, numhl = "" }) + end + + -- set the style of lsp info + local config = { + -- disable virtual text + -- the message show after the current line. + virtual_text = { + prefix = '●', + }, + -- show signs + signs = { + active = signs, + }, + update_in_insert = true, + underline = true, + severity_sort = true, + float = { + focusable = false, + style = "minimal", + source = "always", + header = "", + prefix = "", + }, + } + vim.diagnostic.config(config) + + + -- set the popup window border + vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, { + border = "rounded", + }) + + vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, { + border = "rounded", + }) + + -- auto open floating diagnostic message for the current line + vim.o.updatetime = 500 + vim.api.nvim_create_autocmd("CursorHold", { callback=M.OpenDiagFloat }) + + +end + + +return M + + diff --git a/lua/lspconf/init.lua b/lua/lspconf/init.lua new file mode 100644 index 0000000..58f6d01 --- /dev/null +++ b/lua/lspconf/init.lua @@ -0,0 +1,3 @@ +-- enable + +require('lspconf.lsp') diff --git a/lua/lspconf/lsp.lua b/lua/lspconf/lsp.lua new file mode 100644 index 0000000..87bd8fb --- /dev/null +++ b/lua/lspconf/lsp.lua @@ -0,0 +1,98 @@ +--- +--- mason, mason-lspconfig and cmp_nvim_lsp config +--- +-- enable lspconfig +local lspconfig = require('lspconfig') +-- enable mason.nvim +local mason=require("mason") +mason.setup() +-- enable mason-lspconfig +local mason_lspconfig=require("mason-lspconfig") +mason_lspconfig.setup() + +local attach = function () + -- enable lsp keymaps + require('keymaps').attach() + -- enable auto-open floating diagnostics, lsp info style + require('lspconf.handlers').setup() + -- LSP signature hint as you type + require("lsp_signature").on_attach() +end + + +-- Add additional capabilities supported by nvim-cmp +local capabilities = vim.lsp.protocol.make_client_capabilities() +capabilities = require('cmp_nvim_lsp').update_capabilities(capabilities) +-- Enable all language servers installed with the additional completion capabilities offered by nvim-cmp +local servers = mason_lspconfig.get_installed_servers() +for _, lsp in ipairs(servers) do + if lsp == "r_language_server" then + lspconfig[lsp].setup { + on_attach = attach, + capabilities = capabilities, + settings = { + r = { + lsp = { + diagnostics = false, + }, + }, + }, + } + else + lspconfig[lsp].setup { + on_attach = attach, + capabilities = capabilities, + } + end + +end + + +-- luasnip setup +local luasnip = require 'luasnip' + +-- nvim-cmp setup +local cmp = require 'cmp' +cmp.setup { + snippet = { + expand = function(args) + luasnip.lsp_expand(args.body) + end, + }, + mapping = cmp.mapping.preset.insert({ + [''] = cmp.mapping.scroll_docs(-4), + [''] = cmp.mapping.scroll_docs(4), + [''] = cmp.mapping.complete(), + [''] = cmp.mapping.confirm { + behavior = cmp.ConfirmBehavior.Replace, + select = true, + }, + [''] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item() + elseif luasnip.expand_or_jumpable() then + luasnip.expand_or_jump() + else + fallback() + end + end, { 'i', 's' }), + [''] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_prev_item() + elseif luasnip.jumpable(-1) then + luasnip.jump(-1) + else + fallback() + end + end, { 'i', 's' }), + }), + sources = { + { name = 'nvim_lsp' }, + { name = 'luasnip' }, + { name = 'buffer' }, + { name = 'path'}, + { name = 'nvim_lua'}, + }, +} + + diff --git a/lua/my/header_plugin/command.lua b/lua/my/header_plugin/command.lua new file mode 100644 index 0000000..14d52e9 --- /dev/null +++ b/lua/my/header_plugin/command.lua @@ -0,0 +1,38 @@ +local fun = require("my.header_plugin.fun") +-- this command is to print the header of csv +vim.api.nvim_create_user_command("Headercsv", function (args) + fun.header("csv",args.fargs[1],args.fargs[2]) +end, { + desc = "get the header of csv file", + nargs = "*", + complete = "file", +}) + + +-- this command is to print the header of tsv +vim.api.nvim_create_user_command("Headertsv", function (args) + fun.header("tsv",args.fargs[1],args.fargs[2]) +end, { + desc = "get the header of tsv file", + nargs = "*", + complete = "file", +}) + + +-- this command is to print the header of csv.gz +vim.api.nvim_create_user_command("Headercsvgz", function (args) + fun.zheader("csv",args.fargs[1],args.fargs[2]) +end, { + desc = "get the header of csv.gz file", + nargs = "*", + complete = "file", +}) + +-- this command is to print the header of tsv.gz +vim.api.nvim_create_user_command("Headertsvgz", function (args) + fun.zheader("tsv",args.fargs[1],args.fargs[2]) +end, { + desc = "get the header of tsv.gz file", + nargs = "*", + complete = "file", +}) diff --git a/lua/my/header_plugin/fun.lua b/lua/my/header_plugin/fun.lua new file mode 100644 index 0000000..6fe7146 --- /dev/null +++ b/lua/my/header_plugin/fun.lua @@ -0,0 +1,45 @@ + +local M = {} + + +--- +--- this function is to print the header of csv or tsv +--- +M.header = function(f_type, file, range) + range = range or "" + local tbl + + if range=="" then + tbl={"r! head -1 ", file} + else + if f_type=="tsv" then + tbl={"r! head -1 ", file, " | cut -f ", range} + elseif f_type=="csv" then + tbl={"r! head -1 ", file, " | cut -d, -f ", range} + end + end + vim.cmd(table.concat(tbl)) +end + + + +--- +--- this function is to print the header of csv.gz or tsv.gz +--- +M.zheader = function(f_type, file, range) + range = range or "" + local tbl + + if range=="" then + tbl={"r! zcat ",file," | head -1 "} + else + if f_type=="tsv" then + tbl={"r! zcat ",file," | head -1 ", " | cut -f ", range} + elseif f_type=="csv" then + tbl={"r! zcat ",file," | head -1 ", " | cut -d, -f ", range} + end + end + vim.cmd(table.concat(tbl)) +end + +return M diff --git a/lua/my/header_plugin/init.lua b/lua/my/header_plugin/init.lua new file mode 100644 index 0000000..44e54cb --- /dev/null +++ b/lua/my/header_plugin/init.lua @@ -0,0 +1 @@ +require("my.header_plugin.command") diff --git a/lua/my/init.lua b/lua/my/init.lua new file mode 100644 index 0000000..d3e7dec --- /dev/null +++ b/lua/my/init.lua @@ -0,0 +1,20 @@ +--------------------- +--- header_plugin --- +--------------------- +----- +-- +-- info : provide commands to print the header of csv, tsv, csv.gz and tsv.gz files +-- +----- +-- +-- commands : +-- +-- Headercsv: print csv's header +-- Headercsvgz: print csv.gz's header +-- Headertsv: print tsv's header +-- Headertsvgz: print tsv.gz's header +-- +-- usage: Headercsv path_to_csv column_range +-- +----- +require("my.header_plugin") diff --git a/lua/plugins.lua b/lua/plugins.lua new file mode 100644 index 0000000..8bd92c4 --- /dev/null +++ b/lua/plugins.lua @@ -0,0 +1,120 @@ +-- This file can be loaded by calling `lua require('plugins')` from your init.vim + +-- Only required if you have packer configured as `opt` +vim.cmd [[packadd packer.nvim]] + +return require('packer').startup(function(use) + -- Packer can manage itself + use {'wbthomason/packer.nvim'} + + -- preview colors in files + use {'NvChad/nvim-colorizer.lua', + opt=true, + config=function() require("colorizer").setup{ + filetypes = { "*" }, + user_default_options = { + RGB = true, -- #RGB hex codes + RRGGBB = true, -- #RRGGBB hex codes + names = true, -- "Name" codes like Blue or blue + RRGGBBAA = true, -- #RRGGBBAA hex codes + AARRGGBB = false, -- 0xAARRGGBB hex codes + rgb_fn = false, -- CSS rgb() and rgba() functions + hsl_fn = false, -- CSS hsl() and hsla() functions + css = false, -- Enable all CSS features: rgb_fn, hsl_fn, names, RGB, RRGGBB + css_fn = false, -- Enable all CSS *functions*: rgb_fn, hsl_fn + -- Available modes for `mode`: foreground, background, virtualtext + mode = "background", -- Set the display mode. + -- Available methods are false / true / "normal" / "lsp" / "both" + -- True is same as normal + tailwind = false, -- Enable tailwind colors + -- parsers can contain values used in |user_default_options| + sass = { enable = false, parsers = { css }, }, -- Enable sass colors + virtualtext = "■", + }, + -- all the sub-options of filetypes apply to buftypes + buftypes = {}, + } + end} + + -- input behaviors + use { "windwp/nvim-autopairs", config = function() require("nvim-autopairs").setup{} end } + use {'mg979/vim-visual-multi'} + use { "kylechui/nvim-surround", tag = "*", config = function() require("nvim-surround").setup{} end } -- Use tag="*" for stability; omit to use `main` branch for the latest features + + + -- markdown + use {'iamcco/markdown-preview.nvim', run = 'cd app && yarn install', ft = {'markdown'} } + -- use 'dhruvasagar/vim-table-mode' + + -- insert image + --use 'ferrine/md-img-paste.vim' + + -- Lsp config + use {"williamboman/mason.nvim"} + use {"williamboman/mason-lspconfig.nvim"} + use {"neovim/nvim-lspconfig"} + use {'hrsh7th/nvim-cmp'} + use {'hrsh7th/cmp-nvim-lsp'} + use { "ray-x/lsp_signature.nvim" } -- signature hint as you type + use {'hrsh7th/cmp-buffer'} + use {'hrsh7th/cmp-path'} + use {'rmagatti/goto-preview', config = function() require('goto-preview').setup {} end } --previewing definitions using floating windows. + use {'L3MON4D3/LuaSnip'} -- Snippets plugin + use {'saadparwaiz1/cmp_luasnip'} -- Snippets source for nvim-cmp + use {'hrsh7th/cmp-nvim-lua', ft={"lua"}} -- plugin to provide vim.api.* completion + + -- dress + use {'stevearc/dressing.nvim'} + + + -- fcitx auto-convertion + use {'vim-scripts/fcitx.vim'} + --use '520Matches/fcitx5.vim' + + + -- nvim-R + use {'jalvesaq/Nvim-R',ft = {'r'},branch="stable"} + + -- debug + use {"ravenxrz/DAPInstall.nvim",opt=true} + use {"ravenxrz/nvim-dap",opt=true} + use {"theHamsta/nvim-dap-virtual-text",opt=true} + use {"rcarriga/nvim-dap-ui",opt=true} + + -- fastfold + use {'Konfekt/FastFold', ft = {'sh', 'zsh', 'bash', 'c', 'cpp', 'cmake', 'html', 'go', 'vim', 'r', 'cs','py','lua'}} + + + -- a simple tab line + use {'crispgm/nvim-tabline', + config = function() + require('tabline').setup({}) + end, + } + + -- open ranger in neovim + use {'kevinhwang91/rnvimr'} + + -- indentLine + --use {'Yggdroot/indentLine'} + use {"lukas-reineke/indent-blankline.nvim", config = function () require("indent_blankline").setup{ } end } + + --fuzzy finder + use { 'nvim-telescope/telescope.nvim', + tag = '0.1.0', + requires = { {'nvim-lua/plenary.nvim'} }, + config = function () + require("telescopeconfig") + end + } + + -- ai + use {'github/copilot.vim'} + + -- color theme + use {'shey-kail/one-nvim'} + + +end) + + diff --git a/lua/telescopeconfig/init.lua b/lua/telescopeconfig/init.lua new file mode 100644 index 0000000..5806cdb --- /dev/null +++ b/lua/telescopeconfig/init.lua @@ -0,0 +1,12 @@ +local picker = require("telescopeconfig.picker") +local preview = require("telescopeconfig.preview") + + +require("telescope").setup { + defaults = { + buffer_previewer_maker = preview.new_maker, + vimgrep_arguments = picker.vimgrep_arguments, + }, + pickers = picker.pickers + +} diff --git a/lua/telescopeconfig/picker.lua b/lua/telescopeconfig/picker.lua new file mode 100644 index 0000000..b1626ad --- /dev/null +++ b/lua/telescopeconfig/picker.lua @@ -0,0 +1,33 @@ + +local M = {} + +M.pickers = { + find_files = { + mappings = { + -- enable cd in telescope + n = { + ["cd"] = function(prompt_bufnr) + local selection = require("telescope.actions.state").get_selected_entry() + local dir = vim.fn.fnamemodify(selection.path, ":p:h") + require("telescope.actions").close(prompt_bufnr) + -- Depending on what you want put `cd`, `lcd`, `tcd` + vim.cmd(string.format("silent lcd %s", dir)) + end + }, + }, + -- enable find hidden files (exclude .git) + find_command = { "rg", "--files", "--hidden", "--glob", "!.git/*" }, + }, +} +M.vimgrep_arguments = { + "rg", + "--color=never", + "--no-heading", + "--with-filename", + "--line-number", + "--column", + "--smart-case", + "--trim" -- To trim the indentation at the beginning of presented line in the result window +} + +return M diff --git a/lua/telescopeconfig/preview.lua b/lua/telescopeconfig/preview.lua new file mode 100644 index 0000000..92cfaf0 --- /dev/null +++ b/lua/telescopeconfig/preview.lua @@ -0,0 +1,33 @@ +local previewers = require("telescope.previewers") + + + -- Disable highlighting for these file. Put all filetypes that slow you down in this array. +local _bad = { ".*%.csv", ".*%.txt", ".*%.bed", ".*%.fa", ".*%.fasta", ".*%.fastq", ".*%.fq", ".*%.sam"} +local bad_files = function(filepath) + for _, v in ipairs(_bad) do + if filepath:match(v) then + return false + end + end + return true +end + +local M = {} +M.new_maker = function(filepath, bufnr, opts) + opts = opts or {} + + filepath = vim.fn.expand(filepath) + vim.loop.fs_stat(filepath, function(_, stat) + -- if file size is larger than 100000, it will disable previewer for this file + if not stat then return end + if stat.size > 100000 then + return + -- if file size is less than 100000, previewer will work normally. if the type of these file is in the list of _bad, highlighting will disable for them. + else if opts.use_ft_detect == nil then opts.use_ft_detect = true end + opts.use_ft_detect = opts.use_ft_detect == false and false or bad_files(filepath) + previewers.buffer_previewer_maker(filepath, bufnr, opts) + end + end) +end + +return M diff --git a/plugin/packer_compiled.lua b/plugin/packer_compiled.lua new file mode 100644 index 0000000..52e8433 --- /dev/null +++ b/plugin/packer_compiled.lua @@ -0,0 +1,329 @@ +-- 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/shey/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?.lua;/home/shey/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?/init.lua;/home/shey/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?.lua;/home/shey/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?/init.lua" +local install_cpath_pattern = "/home/shey/.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 = { + ["DAPInstall.nvim"] = { + loaded = false, + needs_bufread = false, + path = "/home/shey/.local/share/nvim/site/pack/packer/opt/DAPInstall.nvim", + url = "https://github.com/ravenxrz/DAPInstall.nvim" + }, + FastFold = { + loaded = false, + needs_bufread = false, + only_cond = false, + path = "/home/shey/.local/share/nvim/site/pack/packer/opt/FastFold", + url = "https://github.com/Konfekt/FastFold" + }, + LuaSnip = { + loaded = true, + path = "/home/shey/.local/share/nvim/site/pack/packer/start/LuaSnip", + url = "https://github.com/L3MON4D3/LuaSnip" + }, + ["Nvim-R"] = { + loaded = false, + needs_bufread = true, + only_cond = false, + path = "/home/shey/.local/share/nvim/site/pack/packer/opt/Nvim-R", + url = "https://github.com/jalvesaq/Nvim-R" + }, + ["cmp-buffer"] = { + loaded = true, + path = "/home/shey/.local/share/nvim/site/pack/packer/start/cmp-buffer", + url = "https://github.com/hrsh7th/cmp-buffer" + }, + ["cmp-nvim-lsp"] = { + loaded = true, + path = "/home/shey/.local/share/nvim/site/pack/packer/start/cmp-nvim-lsp", + url = "https://github.com/hrsh7th/cmp-nvim-lsp" + }, + ["cmp-nvim-lua"] = { + after_files = { "/home/shey/.local/share/nvim/site/pack/packer/opt/cmp-nvim-lua/after/plugin/cmp_nvim_lua.lua" }, + loaded = false, + needs_bufread = false, + only_cond = false, + path = "/home/shey/.local/share/nvim/site/pack/packer/opt/cmp-nvim-lua", + url = "https://github.com/hrsh7th/cmp-nvim-lua" + }, + ["cmp-path"] = { + loaded = true, + path = "/home/shey/.local/share/nvim/site/pack/packer/start/cmp-path", + url = "https://github.com/hrsh7th/cmp-path" + }, + cmp_luasnip = { + loaded = true, + path = "/home/shey/.local/share/nvim/site/pack/packer/start/cmp_luasnip", + url = "https://github.com/saadparwaiz1/cmp_luasnip" + }, + ["copilot.vim"] = { + loaded = true, + path = "/home/shey/.local/share/nvim/site/pack/packer/start/copilot.vim", + url = "https://github.com/github/copilot.vim" + }, + ["dressing.nvim"] = { + loaded = true, + path = "/home/shey/.local/share/nvim/site/pack/packer/start/dressing.nvim", + url = "https://github.com/stevearc/dressing.nvim" + }, + ["fcitx.vim"] = { + loaded = true, + path = "/home/shey/.local/share/nvim/site/pack/packer/start/fcitx.vim", + url = "https://github.com/vim-scripts/fcitx.vim" + }, + ["goto-preview"] = { + 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\17goto-preview\frequire\0" }, + loaded = true, + path = "/home/shey/.local/share/nvim/site/pack/packer/start/goto-preview", + url = "https://github.com/rmagatti/goto-preview" + }, + ["indent-blankline.nvim"] = { + config = { "\27LJ\2\nB\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\21indent_blankline\frequire\0" }, + loaded = true, + path = "/home/shey/.local/share/nvim/site/pack/packer/start/indent-blankline.nvim", + url = "https://github.com/lukas-reineke/indent-blankline.nvim" + }, + ["lsp_signature.nvim"] = { + loaded = true, + path = "/home/shey/.local/share/nvim/site/pack/packer/start/lsp_signature.nvim", + url = "https://github.com/ray-x/lsp_signature.nvim" + }, + ["markdown-preview.nvim"] = { + loaded = false, + needs_bufread = false, + only_cond = false, + path = "/home/shey/.local/share/nvim/site/pack/packer/opt/markdown-preview.nvim", + url = "https://github.com/iamcco/markdown-preview.nvim" + }, + ["mason-lspconfig.nvim"] = { + loaded = true, + path = "/home/shey/.local/share/nvim/site/pack/packer/start/mason-lspconfig.nvim", + url = "https://github.com/williamboman/mason-lspconfig.nvim" + }, + ["mason.nvim"] = { + loaded = true, + path = "/home/shey/.local/share/nvim/site/pack/packer/start/mason.nvim", + url = "https://github.com/williamboman/mason.nvim" + }, + ["nvim-autopairs"] = { + 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\19nvim-autopairs\frequire\0" }, + loaded = true, + path = "/home/shey/.local/share/nvim/site/pack/packer/start/nvim-autopairs", + url = "https://github.com/windwp/nvim-autopairs" + }, + ["nvim-cmp"] = { + loaded = true, + path = "/home/shey/.local/share/nvim/site/pack/packer/start/nvim-cmp", + url = "https://github.com/hrsh7th/nvim-cmp" + }, + ["nvim-colorizer.lua"] = { + config = { "\27LJ\2\n\2\0\0\a\0\r\0\0196\0\0\0'\2\1\0B\0\2\0029\0\2\0005\2\4\0005\3\3\0=\3\5\0025\3\6\0005\4\a\0004\5\3\0006\6\b\0>\6\1\5=\5\t\4=\4\n\3=\3\v\0024\3\0\0=\3\f\2B\0\2\1K\0\1\0\rbuftypes\25user_default_options\tsass\fparsers\bcss\1\0\1\venable\1\1\0\f\vhsl_fn\1\vrgb_fn\1\rAARRGGBB\1\rRRGGBBAA\2\nnames\2\vRRGGBB\2\bRGB\2\tmode\15background\16virtualtext\b■\rtailwind\1\vcss_fn\1\bcss\1\14filetypes\1\0\0\1\2\0\0\6*\nsetup\14colorizer\frequire\0" }, + loaded = false, + needs_bufread = false, + path = "/home/shey/.local/share/nvim/site/pack/packer/opt/nvim-colorizer.lua", + url = "https://github.com/NvChad/nvim-colorizer.lua" + }, + ["nvim-dap"] = { + loaded = false, + needs_bufread = false, + path = "/home/shey/.local/share/nvim/site/pack/packer/opt/nvim-dap", + url = "https://github.com/ravenxrz/nvim-dap" + }, + ["nvim-dap-ui"] = { + loaded = false, + needs_bufread = false, + path = "/home/shey/.local/share/nvim/site/pack/packer/opt/nvim-dap-ui", + url = "https://github.com/rcarriga/nvim-dap-ui" + }, + ["nvim-dap-virtual-text"] = { + loaded = false, + needs_bufread = false, + path = "/home/shey/.local/share/nvim/site/pack/packer/opt/nvim-dap-virtual-text", + url = "https://github.com/theHamsta/nvim-dap-virtual-text" + }, + ["nvim-lspconfig"] = { + loaded = true, + path = "/home/shey/.local/share/nvim/site/pack/packer/start/nvim-lspconfig", + url = "https://github.com/neovim/nvim-lspconfig" + }, + ["nvim-surround"] = { + 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\18nvim-surround\frequire\0" }, + loaded = true, + path = "/home/shey/.local/share/nvim/site/pack/packer/start/nvim-surround", + url = "https://github.com/kylechui/nvim-surround" + }, + ["nvim-tabline"] = { + config = { "\27LJ\2\n9\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\ftabline\frequire\0" }, + loaded = true, + path = "/home/shey/.local/share/nvim/site/pack/packer/start/nvim-tabline", + url = "https://github.com/crispgm/nvim-tabline" + }, + ["one-nvim"] = { + loaded = true, + path = "/home/shey/.local/share/nvim/site/pack/packer/start/one-nvim", + url = "https://github.com/shey-kail/one-nvim" + }, + ["packer.nvim"] = { + loaded = true, + path = "/home/shey/.local/share/nvim/site/pack/packer/start/packer.nvim", + url = "https://github.com/wbthomason/packer.nvim" + }, + ["plenary.nvim"] = { + loaded = true, + path = "/home/shey/.local/share/nvim/site/pack/packer/start/plenary.nvim", + url = "https://github.com/nvim-lua/plenary.nvim" + }, + rnvimr = { + loaded = true, + path = "/home/shey/.local/share/nvim/site/pack/packer/start/rnvimr", + url = "https://github.com/kevinhwang91/rnvimr" + }, + ["telescope.nvim"] = { + config = { "\27LJ\2\n/\0\0\3\0\2\0\0046\0\0\0'\2\1\0B\0\2\1K\0\1\0\20telescopeconfig\frequire\0" }, + loaded = true, + path = "/home/shey/.local/share/nvim/site/pack/packer/start/telescope.nvim", + url = "https://github.com/nvim-telescope/telescope.nvim" + }, + ["vim-visual-multi"] = { + loaded = true, + path = "/home/shey/.local/share/nvim/site/pack/packer/start/vim-visual-multi", + url = "https://github.com/mg979/vim-visual-multi" + } +} + +time([[Defining packer_plugins]], false) +-- Config for: goto-preview +time([[Config for goto-preview]], 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\17goto-preview\frequire\0", "config", "goto-preview") +time([[Config for goto-preview]], false) +-- Config for: telescope.nvim +time([[Config for telescope.nvim]], true) +try_loadstring("\27LJ\2\n/\0\0\3\0\2\0\0046\0\0\0'\2\1\0B\0\2\1K\0\1\0\20telescopeconfig\frequire\0", "config", "telescope.nvim") +time([[Config for telescope.nvim]], false) +-- Config for: nvim-autopairs +time([[Config for nvim-autopairs]], 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\19nvim-autopairs\frequire\0", "config", "nvim-autopairs") +time([[Config for nvim-autopairs]], false) +-- Config for: nvim-surround +time([[Config for nvim-surround]], 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\18nvim-surround\frequire\0", "config", "nvim-surround") +time([[Config for nvim-surround]], false) +-- Config for: nvim-tabline +time([[Config for nvim-tabline]], true) +try_loadstring("\27LJ\2\n9\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\ftabline\frequire\0", "config", "nvim-tabline") +time([[Config for nvim-tabline]], false) +-- Config for: indent-blankline.nvim +time([[Config for indent-blankline.nvim]], true) +try_loadstring("\27LJ\2\nB\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\21indent_blankline\frequire\0", "config", "indent-blankline.nvim") +time([[Config for indent-blankline.nvim]], false) +vim.cmd [[augroup packer_load_aucmds]] +vim.cmd [[au!]] + -- Filetype lazy-loads +time([[Defining lazy-load filetype autocommands]], true) +vim.cmd [[au FileType markdown ++once lua require("packer.load")({'markdown-preview.nvim'}, { ft = "markdown" }, _G.packer_plugins)]] +vim.cmd [[au FileType r ++once lua require("packer.load")({'FastFold', 'Nvim-R'}, { ft = "r" }, _G.packer_plugins)]] +vim.cmd [[au FileType sh ++once lua require("packer.load")({'FastFold'}, { ft = "sh" }, _G.packer_plugins)]] +vim.cmd [[au FileType lua ++once lua require("packer.load")({'cmp-nvim-lua', 'FastFold'}, { ft = "lua" }, _G.packer_plugins)]] +vim.cmd [[au FileType vim ++once lua require("packer.load")({'FastFold'}, { ft = "vim" }, _G.packer_plugins)]] +vim.cmd [[au FileType html ++once lua require("packer.load")({'FastFold'}, { ft = "html" }, _G.packer_plugins)]] +vim.cmd [[au FileType go ++once lua require("packer.load")({'FastFold'}, { ft = "go" }, _G.packer_plugins)]] +vim.cmd [[au FileType zsh ++once lua require("packer.load")({'FastFold'}, { ft = "zsh" }, _G.packer_plugins)]] +vim.cmd [[au FileType bash ++once lua require("packer.load")({'FastFold'}, { ft = "bash" }, _G.packer_plugins)]] +vim.cmd [[au FileType cpp ++once lua require("packer.load")({'FastFold'}, { ft = "cpp" }, _G.packer_plugins)]] +vim.cmd [[au FileType cmake ++once lua require("packer.load")({'FastFold'}, { ft = "cmake" }, _G.packer_plugins)]] +vim.cmd [[au FileType c ++once lua require("packer.load")({'FastFold'}, { ft = "c" }, _G.packer_plugins)]] +vim.cmd [[au FileType cs ++once lua require("packer.load")({'FastFold'}, { ft = "cs" }, _G.packer_plugins)]] +vim.cmd [[au FileType py ++once lua require("packer.load")({'FastFold'}, { ft = "py" }, _G.packer_plugins)]] +time([[Defining lazy-load filetype autocommands]], false) +vim.cmd("augroup END") +vim.cmd [[augroup filetypedetect]] +time([[Sourcing ftdetect script at: /home/shey/.local/share/nvim/site/pack/packer/opt/Nvim-R/ftdetect/r.vim]], true) +vim.cmd [[source /home/shey/.local/share/nvim/site/pack/packer/opt/Nvim-R/ftdetect/r.vim]] +time([[Sourcing ftdetect script at: /home/shey/.local/share/nvim/site/pack/packer/opt/Nvim-R/ftdetect/r.vim]], false) +vim.cmd("augroup END") + +_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/sample_vimspector_json/Python.json b/sample_vimspector_json/Python.json new file mode 100644 index 0000000..a1121a0 --- /dev/null +++ b/sample_vimspector_json/Python.json @@ -0,0 +1,32 @@ +{ + "adapters": { + "debugpy": { + "command": [ + "python3", + "-m", + "debugpy.adapter" + ], + "name": "debugpy" + } + }, + "configurations": { + "run - debugpy": { + "adapter": "debugpy", + "configuration": { + "python": "/usr/bin/python3", + "request": "launch", + "type": "python", + "cwd": "${workspaceRoot}", + "program": "${file}", + "stopOnEntry": true, + "args": [ "*${args:--update-gadget-config}" ] + }, + "breakpoints": { + "exception": { + "raised": "N", + "uncaught": "" + } + } + } + } +} diff --git a/sample_vimspector_json/c.json b/sample_vimspector_json/c.json new file mode 100644 index 0000000..a8b6860 --- /dev/null +++ b/sample_vimspector_json/c.json @@ -0,0 +1,24 @@ +{ + "configurations": { + "cpp:launch": { + "adapter": "vscode-cpptools", + "configuration": { + "name": "cpp", + "type": "cppdbg", + "request": "launch", + "program": "${fileDirname}/a.out", + "args": ["*${ProgramArgs}"], + "cwd": "${workspaceRoot}", + "environment": [], + "externalConsole": false, + "stopAtEntry": true, + "MIMode": "gdb", + "logging": { + "engineLogging": true + } + } + } + } +} + + diff --git a/sample_vimspector_json/rust.json b/sample_vimspector_json/rust.json new file mode 100644 index 0000000..511dd42 --- /dev/null +++ b/sample_vimspector_json/rust.json @@ -0,0 +1,20 @@ +{ + "configurations": { + "cpp:launch": { + "adapter": "CodeLLDB", + "configuration": { + "name": "rust", + "type": "rustdbg", + "request": "launch", + "program": "${workspaceRoot}/target/debug/list", + "args": ["*${ProgramArgs}"], + "cwd": "${workspaceRoot}", + "environment": [], + "externalConsole": false, + "stopAtEntry": true + } + } + } +} + +