refactor config
This commit is contained in:
parent
3c9ec7eff0
commit
b5629cf22f
6
.stylua.toml
Normal file
6
.stylua.toml
Normal file
@ -0,0 +1,6 @@
|
||||
column_width = 160
|
||||
line_endings = "Unix"
|
||||
indent_type = "Spaces"
|
||||
indent_width = 2
|
||||
quote_style = "AutoPreferSingle"
|
||||
call_parentheses = "None"
|
@ -1,5 +0,0 @@
|
||||
set noexpandtab
|
||||
set smartindent
|
||||
set shiftwidth=2
|
||||
set tabstop=2
|
||||
set softtabstop=2
|
@ -1,8 +0,0 @@
|
||||
if vim.g.colors_name == "srcery" then
|
||||
local hard_black = vim.api.nvim_get_hl_by_name("SrceryHardBlack", true).foreground
|
||||
local bright_white = vim.api.nvim_get_hl_by_name("SrceryBrightWhite", true).foreground
|
||||
|
||||
vim.api.nvim_set_hl(0, "FloatBorder", {bg=hard_black, fg=bright_white})
|
||||
vim.api.nvim_set_hl(0, "FloatNormal", {bg=hard_black, fg=bright_white})
|
||||
vim.api.nvim_set_hl(0, "Pmenu", {bg=hard_black, fg=bright_white})
|
||||
end
|
@ -1,9 +1,8 @@
|
||||
if vim.g.colors_name == "srcery" then
|
||||
local bright_white = vim.api.nvim_get_hl_by_name("SrceryBrightWhite", true).foreground
|
||||
local hard_black = vim.api.nvim_get_hl_by_name("SrceryHardBlack", true).foreground
|
||||
local red = vim.api.nvim_get_hl_by_name("SrceryRed", true).foreground
|
||||
local yellow = vim.api.nvim_get_hl_by_name("SrceryYellow", true).foreground
|
||||
local gray1 = vim.api.nvim_get_hl_by_name("SrceryXgray1", true).foreground
|
||||
local bright_white = vim.api.nvim_get_hl(0, { name = 'SrceryBrightWhite' }).fg
|
||||
local hard_black = vim.api.nvim_get_hl(0, { name = 'SrceryHardBlack' }).fg
|
||||
local red = vim.api.nvim_get_hl(0, { name = 'SrceryRed' }).fg
|
||||
local yellow = vim.api.nvim_get_hl(0, { name = 'SrceryYellow' }).fg
|
||||
local gray1 = vim.api.nvim_get_hl(0, { name = 'SrceryXgray1' }).fg
|
||||
|
||||
local TelescopePrompt = {
|
||||
TelescopeBorder = { bg = hard_black, fg = hard_black },
|
||||
@ -19,4 +18,3 @@ if vim.g.colors_name == "srcery" then
|
||||
for hl, col in pairs(TelescopePrompt) do
|
||||
vim.api.nvim_set_hl(0, hl, col)
|
||||
end
|
||||
end
|
||||
|
@ -1,67 +1,50 @@
|
||||
{
|
||||
"Comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" },
|
||||
"DoxygenToolkit.vim": { "branch": "master", "commit": "afd8663d36d2ec19d26befdb10e89e912d26bbd3" },
|
||||
"LuaSnip": { "branch": "master", "commit": "e808bee352d1a6fcf902ca1a71cee76e60e24071" },
|
||||
"based.nvim": { "branch": "main", "commit": "886e63bab99714bada17d2a0e300841250d2daa6" },
|
||||
"cmp-cmdline": { "branch": "main", "commit": "d250c63aa13ead745e3a40f61fdd3470efde3923" },
|
||||
"cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" },
|
||||
"LuaSnip": { "branch": "master", "commit": "33b06d72d220aa56a7ce80a0dd6f06c70cd82b9d" },
|
||||
"cmp-nvim-lsp": { "branch": "main", "commit": "99290b3ec1322070bcfb9e846450a46f6efa50f0" },
|
||||
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
|
||||
"cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" },
|
||||
"compiler-explorer.nvim": { "branch": "master", "commit": "ee8e7a2808bdad67cd2acb61b5c9ffa7735c7ec9" },
|
||||
"diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" },
|
||||
"dressing.nvim": { "branch": "master", "commit": "1b7921eecc65af1baf8ac1dc06f0794934cbcfb2" },
|
||||
"editorconfig-vim": { "branch": "master", "commit": "8b7da79e9daee7a3f3a8d4fe29886b9756305aff" },
|
||||
"escape.nvim": { "branch": "main", "commit": "ab474f9322a215d552f56e98be4f932be0f4169f" },
|
||||
"fidget.nvim": { "branch": "main", "commit": "0ba1e16d07627532b6cae915cc992ecac249fb97" },
|
||||
"friendly-snippets": { "branch": "main", "commit": "00ba9dd3df89509f95437b8d595553707c46d5ea" },
|
||||
"git-blame.nvim": { "branch": "master", "commit": "2883a7460f611c2705b23f12d58d398d5ce6ec00" },
|
||||
"gitsigns.nvim": { "branch": "main", "commit": "863903631e676b33e8be2acb17512fdc1b80b4fb" },
|
||||
"cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" },
|
||||
"conform.nvim": { "branch": "master", "commit": "f4e8837878fc5712d053ba3091a73d27d96a09e2" },
|
||||
"dressing.nvim": { "branch": "master", "commit": "fc78a3ca96f4db9f8893bb7e2fd9823e0780451b" },
|
||||
"editorconfig-vim": { "branch": "master", "commit": "3c2813f2566d9392ff3614248c5db43c3fda9d5f" },
|
||||
"fidget.nvim": { "branch": "main", "commit": "9238947645ce17d96f30842e61ba81147185b657" },
|
||||
"gitsigns.nvim": { "branch": "main", "commit": "5f808b5e4fef30bd8aca1b803b4e555da07fc412" },
|
||||
"global-note.nvim": { "branch": "main", "commit": "1e0d4bba425d971ed3ce40d182c574a25507115c" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "1159bdccd8910a0fd0914b24d6c3d186689023d9" },
|
||||
"lazygit.nvim": { "branch": "main", "commit": "56760339a81cd1540d5a72fd9d93010a2677b55d" },
|
||||
"lsp_signature.nvim": { "branch": "master", "commit": "fc38521ea4d9ec8dbd4c2819ba8126cea743943b" },
|
||||
"lspkind-nvim": { "branch": "master", "commit": "59c3f419af48a2ffb2320cea85e44e5a95f71664" },
|
||||
"lualine.nvim": { "branch": "master", "commit": "b431d228b7bbcdaea818bdc3e25b8cdbe861f056" },
|
||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "25c11854aa25558ee6c03432edfa0df0217324be" },
|
||||
"indent-blankline.nvim": { "branch": "master", "commit": "259357fa4097e232730341fa60988087d189193a" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "7e6c863bc7563efbdd757a310d17ebc95166cef3" },
|
||||
"lazydev.nvim": { "branch": "main", "commit": "f59bd14a852ca43db38e3662395354cb2a9b13e0" },
|
||||
"lazygit.nvim": { "branch": "main", "commit": "77a0d42943d8265271e6e6beaed72da54eeb17e7" },
|
||||
"luvit-meta": { "branch": "main", "commit": "57d464c4acb5c2e66bd4145060f5dc9e96a7bbb7" },
|
||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "8e46de9241d3997927af12196bd8faa0ed08c29a" },
|
||||
"mason-nvim-dap.nvim": { "branch": "main", "commit": "8b9363d83b5d779813cdd2819b8308651cec2a09" },
|
||||
"mason-tool-installer.nvim": { "branch": "main", "commit": "c5e07b8ff54187716334d585db34282e46fa2932" },
|
||||
"mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" },
|
||||
"mini.nvim": { "branch": "main", "commit": "7ebfab26d77a4b9b05aaae565907e7fa4b2ee154" },
|
||||
"move.nvim": { "branch": "main", "commit": "cccbd4ea9049ca5f99f025ffaddb7392359c7d6a" },
|
||||
"neo-tree.nvim": { "branch": "v3.x", "commit": "a77af2e764c5ed4038d27d1c463fa49cd4794e07" },
|
||||
"neodev.nvim": { "branch": "main", "commit": "46aa467dca16cf3dfe27098042402066d2ae242d" },
|
||||
"nui.nvim": { "branch": "main", "commit": "b58e2bfda5cea347c9d58b7f11cf3012c7b3953f" },
|
||||
"nvim-bqf": { "branch": "main", "commit": "1b24dc6050c34e8cd377b6b4cd6abe40509e0187" },
|
||||
"nvim-cmp": { "branch": "main", "commit": "ae644feb7b67bf1ce4260c231d1d4300b19c6f30" },
|
||||
"nvim-cmp": { "branch": "main", "commit": "98e8b9d593a5547c126a39212d6f5e954a2d85dd" },
|
||||
"nvim-colorizer.lua": { "branch": "master", "commit": "a065833f35a3a7cc3ef137ac88b5381da2ba302e" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "dcf511d53fae9675c6fde4241d94b2daaa5e0cd5" },
|
||||
"nvim-luapad": { "branch": "master", "commit": "176686eb616a5ada5dfc748f2b5109194bbe8a71" },
|
||||
"nvim-navbuddy": { "branch": "master", "commit": "f22bac988f2dd073601d75ba39ea5636ab6e38cb" },
|
||||
"nvim-navic": { "branch": "master", "commit": "8649f694d3e76ee10c19255dece6411c29206a54" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "4f04fb7027ce786ac4adfd1c629ca40aea96ffec" },
|
||||
"nvim-treesitter-textobjects": { "branch": "master", "commit": "b91c98afa6c42819aea6cbc1ba38272f5456a5cf" },
|
||||
"nvim-web-devicons": { "branch": "master", "commit": "56f17def81478e406e3a8ec4aa727558e79786f3" },
|
||||
"nvim-dap": { "branch": "master", "commit": "7e48a80551e0b8fd7e34436d74243de7ae1ec397" },
|
||||
"nvim-dap-go": { "branch": "main", "commit": "6aa88167ea1224bcef578e8c7160fe8afbb44848" },
|
||||
"nvim-dap-ui": { "branch": "master", "commit": "ffa89839f97bad360e78428d5c740fdad9a0ff02" },
|
||||
"nvim-lint": { "branch": "master", "commit": "1fea92f1d9908eaa5eb8bafe08b4293d7aadaa55" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "040001d85e9190a904d0e35ef5774633e14d8475" },
|
||||
"nvim-nio": { "branch": "master", "commit": "a428f309119086dc78dd4b19306d2d67be884eee" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "fa915a30c5cdf1d18129e9ef6ac2ee0fa799904f" },
|
||||
"nvim-web-devicons": { "branch": "master", "commit": "0eb18da56e2ba6ba24de7130a12bcc4e31ad11cb" },
|
||||
"oil.nvim": { "branch": "master", "commit": "dba037598843973b8c54bc5ce0318db4a0da439d" },
|
||||
"playground": { "branch": "master", "commit": "ba48c6a62a280eefb7c85725b0915e021a1a0749" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "2d9b06177a975543726ce5c73fca176cedbffe9d" },
|
||||
"quick-scope": { "branch": "master", "commit": "4d35d3b2bc6794666353dcc241b2680bd560416f" },
|
||||
"srcery-vim": { "branch": "master", "commit": "fa2242a3dd81804468241c0a8ebb32266c33fa60" },
|
||||
"tabular": { "branch": "master", "commit": "12437cd1b53488e24936ec4b091c9324cafee311" },
|
||||
"targets.vim": { "branch": "master", "commit": "6325416da8f89992b005db3e4517aaef0242602e" },
|
||||
"telescope-fzf-native.nvim": { "branch": "main", "commit": "cf48d4dfce44e0b9a2e19a008d6ec6ea6f01a83b" },
|
||||
"telescope-fzf-native.nvim": { "branch": "main", "commit": "dae2eac9d91464448b584c7949a31df8faefec56" },
|
||||
"telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" },
|
||||
"telescope.nvim": { "branch": "master", "commit": "d90956833d7c27e73c621a61f20b29fdb7122709" },
|
||||
"tidy.nvim": { "branch": "main", "commit": "58fcc63de53840fa78946e4161e8883e67213f92" },
|
||||
"telescope.nvim": { "branch": "0.1.x", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" },
|
||||
"todo-comments.nvim": { "branch": "main", "commit": "ae0a2afb47cf7395dc400e5dc4e05274bf4fb9e0" },
|
||||
"toggleterm.nvim": { "branch": "main", "commit": "137d06fb103952a0fb567882bb8527e2f92d327d" },
|
||||
"vim-autosource": { "branch": "main", "commit": "569440e157d6eb37fb098dfe95252533553a56f5" },
|
||||
"vim-blade": { "branch": "master", "commit": "9534101808cc320eef003129a40cab04b026a20c" },
|
||||
"vim-eunuch": { "branch": "master", "commit": "8fb3904be27b6b60d086f87c2570085902414069" },
|
||||
"vim-glsl": { "branch": "master", "commit": "40dd0b143ef93f3930a8a409f60c1bb85e28b727" },
|
||||
"vim-indent-object": { "branch": "master", "commit": "8ab36d5ec2a3a60468437a95e142ce994df598c6" },
|
||||
"vim-repeat": { "branch": "master", "commit": "65846025c15494983dafe5e3b46c8f88ab2e9635" },
|
||||
"vim-sleuth": { "branch": "master", "commit": "be69bff86754b1aa5adcbb527d7fcd1635a84080" },
|
||||
"vim-smoothie": { "branch": "master", "commit": "df1e324e9f3395c630c1c523d0555a01d2eb1b7e" },
|
||||
"vim-surround": { "branch": "master", "commit": "3d188ed2113431cf8dac77be61b842acb64433d9" },
|
||||
"vim-tmux-navigator": { "branch": "master", "commit": "a9b52e7d36114d40350099f254b5f299a35df978" },
|
||||
"vim-unimpaired": { "branch": "master", "commit": "6d44a6dc2ec34607c41ec78acf81657248580bf1" },
|
||||
"window-picker": { "branch": "main", "commit": "41cfaa428577c53552200a404ae9b3a0b5719706" },
|
||||
"zen-mode.nvim": { "branch": "main", "commit": "29b292bdc58b76a6c8f294c961a8bf92c5a6ebd6" },
|
||||
"zig-tools.nvim": { "branch": "master", "commit": "78a85278fe5d480da2f01df4db898757d7e953b5" }
|
||||
"which-key.nvim": { "branch": "main", "commit": "8ab96b38a2530eacba5be717f52e04601eb59326" },
|
||||
"zen-mode.nvim": { "branch": "main", "commit": "863f150ca321b3dd8aa1a2b69b5f411a220e144f" }
|
||||
}
|
||||
|
52
lua/kickstart/health.lua
Normal file
52
lua/kickstart/health.lua
Normal file
@ -0,0 +1,52 @@
|
||||
--[[
|
||||
--
|
||||
-- This file is not required for your own configuration,
|
||||
-- but helps people determine if their system is setup correctly.
|
||||
--
|
||||
--]]
|
||||
|
||||
local check_version = function()
|
||||
local verstr = tostring(vim.version())
|
||||
if not vim.version.ge then
|
||||
vim.health.error(string.format("Neovim out of date: '%s'. Upgrade to latest stable or nightly", verstr))
|
||||
return
|
||||
end
|
||||
|
||||
if vim.version.ge(vim.version(), '0.10-dev') then
|
||||
vim.health.ok(string.format("Neovim version is: '%s'", verstr))
|
||||
else
|
||||
vim.health.error(string.format("Neovim out of date: '%s'. Upgrade to latest stable or nightly", verstr))
|
||||
end
|
||||
end
|
||||
|
||||
local check_external_reqs = function()
|
||||
-- Basic utils: `git`, `make`, `unzip`
|
||||
for _, exe in ipairs { 'git', 'make', 'unzip', 'rg' } do
|
||||
local is_executable = vim.fn.executable(exe) == 1
|
||||
if is_executable then
|
||||
vim.health.ok(string.format("Found executable: '%s'", exe))
|
||||
else
|
||||
vim.health.warn(string.format("Could not find executable: '%s'", exe))
|
||||
end
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
return {
|
||||
check = function()
|
||||
vim.health.start 'kickstart.nvim'
|
||||
|
||||
vim.health.info [[NOTE: Not every warning is a 'must-fix' in `:checkhealth`
|
||||
|
||||
Fix only warnings for plugins and languages you intend to use.
|
||||
Mason will give warnings for languages that are not installed.
|
||||
You do not need to install, unless you want to use those languages!]]
|
||||
|
||||
local uv = vim.uv or vim.loop
|
||||
vim.health.info('System Information: ' .. vim.inspect(uv.os_uname()))
|
||||
|
||||
check_version()
|
||||
check_external_reqs()
|
||||
end,
|
||||
}
|
16
lua/kickstart/plugins/autopairs.lua
Normal file
16
lua/kickstart/plugins/autopairs.lua
Normal file
@ -0,0 +1,16 @@
|
||||
-- autopairs
|
||||
-- https://github.com/windwp/nvim-autopairs
|
||||
|
||||
return {
|
||||
'windwp/nvim-autopairs',
|
||||
event = 'InsertEnter',
|
||||
-- Optional dependency
|
||||
dependencies = { 'hrsh7th/nvim-cmp' },
|
||||
config = function()
|
||||
require('nvim-autopairs').setup {}
|
||||
-- If you want to automatically add `(` after selecting a function or method
|
||||
local cmp_autopairs = require 'nvim-autopairs.completion.cmp'
|
||||
local cmp = require 'cmp'
|
||||
cmp.event:on('confirm_done', cmp_autopairs.on_confirm_done())
|
||||
end,
|
||||
}
|
148
lua/kickstart/plugins/debug.lua
Normal file
148
lua/kickstart/plugins/debug.lua
Normal file
@ -0,0 +1,148 @@
|
||||
-- debug.lua
|
||||
--
|
||||
-- Shows how to use the DAP plugin to debug your code.
|
||||
--
|
||||
-- Primarily focused on configuring the debugger for Go, but can
|
||||
-- be extended to other languages as well. That's why it's called
|
||||
-- kickstart.nvim and not kitchen-sink.nvim ;)
|
||||
|
||||
return {
|
||||
-- NOTE: Yes, you can install new plugins here!
|
||||
'mfussenegger/nvim-dap',
|
||||
-- NOTE: And you can specify dependencies as well
|
||||
dependencies = {
|
||||
-- Creates a beautiful debugger UI
|
||||
'rcarriga/nvim-dap-ui',
|
||||
|
||||
-- Required dependency for nvim-dap-ui
|
||||
'nvim-neotest/nvim-nio',
|
||||
|
||||
-- Installs the debug adapters for you
|
||||
'williamboman/mason.nvim',
|
||||
'jay-babu/mason-nvim-dap.nvim',
|
||||
|
||||
-- Add your own debuggers here
|
||||
'leoluz/nvim-dap-go',
|
||||
},
|
||||
keys = {
|
||||
-- Basic debugging keymaps, feel free to change to your liking!
|
||||
{
|
||||
'<F5>',
|
||||
function()
|
||||
require('dap').continue()
|
||||
end,
|
||||
desc = 'Debug: Start/Continue',
|
||||
},
|
||||
{
|
||||
'<F1>',
|
||||
function()
|
||||
require('dap').step_into()
|
||||
end,
|
||||
desc = 'Debug: Step Into',
|
||||
},
|
||||
{
|
||||
'<F2>',
|
||||
function()
|
||||
require('dap').step_over()
|
||||
end,
|
||||
desc = 'Debug: Step Over',
|
||||
},
|
||||
{
|
||||
'<F3>',
|
||||
function()
|
||||
require('dap').step_out()
|
||||
end,
|
||||
desc = 'Debug: Step Out',
|
||||
},
|
||||
{
|
||||
'<leader>b',
|
||||
function()
|
||||
require('dap').toggle_breakpoint()
|
||||
end,
|
||||
desc = 'Debug: Toggle Breakpoint',
|
||||
},
|
||||
{
|
||||
'<leader>B',
|
||||
function()
|
||||
require('dap').set_breakpoint(vim.fn.input 'Breakpoint condition: ')
|
||||
end,
|
||||
desc = 'Debug: Set Breakpoint',
|
||||
},
|
||||
-- Toggle to see last session result. Without this, you can't see session output in case of unhandled exception.
|
||||
{
|
||||
'<F7>',
|
||||
function()
|
||||
require('dapui').toggle()
|
||||
end,
|
||||
desc = 'Debug: See last session result.',
|
||||
},
|
||||
},
|
||||
config = function()
|
||||
local dap = require 'dap'
|
||||
local dapui = require 'dapui'
|
||||
|
||||
require('mason-nvim-dap').setup {
|
||||
-- Makes a best effort to setup the various debuggers with
|
||||
-- reasonable debug configurations
|
||||
automatic_installation = true,
|
||||
|
||||
-- You can provide additional configuration to the handlers,
|
||||
-- see mason-nvim-dap README for more information
|
||||
handlers = {},
|
||||
|
||||
-- You'll need to check that you have the required things installed
|
||||
-- online, please don't ask me how to install them :)
|
||||
ensure_installed = {
|
||||
-- Update this to ensure that you have the debuggers for the langs you want
|
||||
'delve',
|
||||
},
|
||||
}
|
||||
|
||||
-- Dap UI setup
|
||||
-- For more information, see |:help nvim-dap-ui|
|
||||
dapui.setup {
|
||||
-- Set icons to characters that are more likely to work in every terminal.
|
||||
-- Feel free to remove or use ones that you like more! :)
|
||||
-- Don't feel like these are good choices.
|
||||
icons = { expanded = '▾', collapsed = '▸', current_frame = '*' },
|
||||
controls = {
|
||||
icons = {
|
||||
pause = '⏸',
|
||||
play = '▶',
|
||||
step_into = '⏎',
|
||||
step_over = '⏭',
|
||||
step_out = '⏮',
|
||||
step_back = 'b',
|
||||
run_last = '▶▶',
|
||||
terminate = '⏹',
|
||||
disconnect = '⏏',
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
-- Change breakpoint icons
|
||||
-- vim.api.nvim_set_hl(0, 'DapBreak', { fg = '#e51400' })
|
||||
-- vim.api.nvim_set_hl(0, 'DapStop', { fg = '#ffcc00' })
|
||||
-- local breakpoint_icons = vim.g.have_nerd_font
|
||||
-- and { Breakpoint = '', BreakpointCondition = '', BreakpointRejected = '', LogPoint = '', Stopped = '' }
|
||||
-- or { Breakpoint = '●', BreakpointCondition = '⊜', BreakpointRejected = '⊘', LogPoint = '◆', Stopped = '⭔' }
|
||||
-- for type, icon in pairs(breakpoint_icons) do
|
||||
-- local tp = 'Dap' .. type
|
||||
-- local hl = (type == 'Stopped') and 'DapStop' or 'DapBreak'
|
||||
-- vim.fn.sign_define(tp, { text = icon, texthl = hl, numhl = hl })
|
||||
-- end
|
||||
|
||||
dap.listeners.after.event_initialized['dapui_config'] = dapui.open
|
||||
dap.listeners.before.event_terminated['dapui_config'] = dapui.close
|
||||
dap.listeners.before.event_exited['dapui_config'] = dapui.close
|
||||
|
||||
-- Install golang specific config
|
||||
require('dap-go').setup {
|
||||
delve = {
|
||||
-- On Windows delve must be run attached or it crashes.
|
||||
-- See https://github.com/leoluz/nvim-dap-go/blob/main/README.md#configuring
|
||||
detached = vim.fn.has 'win32' == 0,
|
||||
},
|
||||
}
|
||||
end,
|
||||
}
|
59
lua/kickstart/plugins/gitsigns.lua
Normal file
59
lua/kickstart/plugins/gitsigns.lua
Normal file
@ -0,0 +1,59 @@
|
||||
-- Adds git related signs to the gutter, as well as utilities for managing changes
|
||||
|
||||
return {
|
||||
{
|
||||
'lewis6991/gitsigns.nvim',
|
||||
opts = {
|
||||
on_attach = function(bufnr)
|
||||
local gitsigns = require 'gitsigns'
|
||||
|
||||
local function map(mode, l, r, opts)
|
||||
opts = opts or {}
|
||||
opts.buffer = bufnr
|
||||
vim.keymap.set(mode, l, r, opts)
|
||||
end
|
||||
|
||||
-- Navigation
|
||||
map('n', ']c', function()
|
||||
if vim.wo.diff then
|
||||
vim.cmd.normal { ']c', bang = true }
|
||||
else
|
||||
gitsigns.nav_hunk 'next'
|
||||
end
|
||||
end, { desc = 'Jump to next git [c]hange' })
|
||||
|
||||
map('n', '[c', function()
|
||||
if vim.wo.diff then
|
||||
vim.cmd.normal { '[c', bang = true }
|
||||
else
|
||||
gitsigns.nav_hunk 'prev'
|
||||
end
|
||||
end, { desc = 'Jump to previous git [c]hange' })
|
||||
|
||||
-- Actions
|
||||
-- visual mode
|
||||
map('v', '<leader>hs', function()
|
||||
gitsigns.stage_hunk { vim.fn.line '.', vim.fn.line 'v' }
|
||||
end, { desc = 'git [s]tage hunk' })
|
||||
map('v', '<leader>hr', function()
|
||||
gitsigns.reset_hunk { vim.fn.line '.', vim.fn.line 'v' }
|
||||
end, { desc = 'git [r]eset hunk' })
|
||||
-- normal mode
|
||||
map('n', '<leader>hs', gitsigns.stage_hunk, { desc = 'git [s]tage hunk' })
|
||||
map('n', '<leader>hr', gitsigns.reset_hunk, { desc = 'git [r]eset hunk' })
|
||||
map('n', '<leader>hS', gitsigns.stage_buffer, { desc = 'git [S]tage buffer' })
|
||||
map('n', '<leader>hu', gitsigns.undo_stage_hunk, { desc = 'git [u]ndo stage hunk' })
|
||||
map('n', '<leader>hR', gitsigns.reset_buffer, { desc = 'git [R]eset buffer' })
|
||||
map('n', '<leader>hp', gitsigns.preview_hunk, { desc = 'git [p]review hunk' })
|
||||
map('n', '<leader>hb', gitsigns.blame_line, { desc = 'git [b]lame line' })
|
||||
map('n', '<leader>hd', gitsigns.diffthis, { desc = 'git [d]iff against index' })
|
||||
map('n', '<leader>hD', function()
|
||||
gitsigns.diffthis '@'
|
||||
end, { desc = 'git [D]iff against last commit' })
|
||||
-- Toggles
|
||||
map('n', '<leader>tb', gitsigns.toggle_current_line_blame, { desc = '[T]oggle git show [b]lame line' })
|
||||
map('n', '<leader>tD', gitsigns.toggle_deleted, { desc = '[T]oggle git show [D]eleted' })
|
||||
end,
|
||||
},
|
||||
},
|
||||
}
|
9
lua/kickstart/plugins/indent_line.lua
Normal file
9
lua/kickstart/plugins/indent_line.lua
Normal file
@ -0,0 +1,9 @@
|
||||
return {
|
||||
{ -- Add indentation guides even on blank lines
|
||||
'lukas-reineke/indent-blankline.nvim',
|
||||
-- Enable `lukas-reineke/indent-blankline.nvim`
|
||||
-- See `:help ibl`
|
||||
main = 'ibl',
|
||||
opts = {},
|
||||
},
|
||||
}
|
60
lua/kickstart/plugins/lint.lua
Normal file
60
lua/kickstart/plugins/lint.lua
Normal file
@ -0,0 +1,60 @@
|
||||
return {
|
||||
|
||||
{ -- Linting
|
||||
'mfussenegger/nvim-lint',
|
||||
event = { 'BufReadPre', 'BufNewFile' },
|
||||
config = function()
|
||||
local lint = require 'lint'
|
||||
lint.linters_by_ft = {
|
||||
markdown = { 'markdownlint' },
|
||||
}
|
||||
|
||||
-- To allow other plugins to add linters to require('lint').linters_by_ft,
|
||||
-- instead set linters_by_ft like this:
|
||||
-- lint.linters_by_ft = lint.linters_by_ft or {}
|
||||
-- lint.linters_by_ft['markdown'] = { 'markdownlint' }
|
||||
--
|
||||
-- However, note that this will enable a set of default linters,
|
||||
-- which will cause errors unless these tools are available:
|
||||
-- {
|
||||
-- clojure = { "clj-kondo" },
|
||||
-- dockerfile = { "hadolint" },
|
||||
-- inko = { "inko" },
|
||||
-- janet = { "janet" },
|
||||
-- json = { "jsonlint" },
|
||||
-- markdown = { "vale" },
|
||||
-- rst = { "vale" },
|
||||
-- ruby = { "ruby" },
|
||||
-- terraform = { "tflint" },
|
||||
-- text = { "vale" }
|
||||
-- }
|
||||
--
|
||||
-- You can disable the default linters by setting their filetypes to nil:
|
||||
-- lint.linters_by_ft['clojure'] = nil
|
||||
-- lint.linters_by_ft['dockerfile'] = nil
|
||||
-- lint.linters_by_ft['inko'] = nil
|
||||
-- lint.linters_by_ft['janet'] = nil
|
||||
-- lint.linters_by_ft['json'] = nil
|
||||
-- lint.linters_by_ft['markdown'] = nil
|
||||
-- lint.linters_by_ft['rst'] = nil
|
||||
-- lint.linters_by_ft['ruby'] = nil
|
||||
-- lint.linters_by_ft['terraform'] = nil
|
||||
-- lint.linters_by_ft['text'] = nil
|
||||
|
||||
-- Create autocommand which carries out the actual linting
|
||||
-- on the specified events.
|
||||
local lint_augroup = vim.api.nvim_create_augroup('lint', { clear = true })
|
||||
vim.api.nvim_create_autocmd({ 'BufEnter', 'BufWritePost', 'InsertLeave' }, {
|
||||
group = lint_augroup,
|
||||
callback = function()
|
||||
-- Only run the linter in buffers that you can modify in order to
|
||||
-- avoid superfluous noise, notably within the handy LSP pop-ups that
|
||||
-- describe the hovered symbol using Markdown.
|
||||
if vim.opt_local.modifiable:get() then
|
||||
lint.try_lint()
|
||||
end
|
||||
end,
|
||||
})
|
||||
end,
|
||||
},
|
||||
}
|
25
lua/kickstart/plugins/neo-tree.lua
Normal file
25
lua/kickstart/plugins/neo-tree.lua
Normal file
@ -0,0 +1,25 @@
|
||||
-- Neo-tree is a Neovim plugin to browse the file system
|
||||
-- https://github.com/nvim-neo-tree/neo-tree.nvim
|
||||
|
||||
return {
|
||||
'nvim-neo-tree/neo-tree.nvim',
|
||||
version = '*',
|
||||
dependencies = {
|
||||
'nvim-lua/plenary.nvim',
|
||||
'nvim-tree/nvim-web-devicons', -- not strictly required, but recommended
|
||||
'MunifTanjim/nui.nvim',
|
||||
},
|
||||
cmd = 'Neotree',
|
||||
keys = {
|
||||
{ '\\', ':Neotree reveal<CR>', desc = 'NeoTree reveal', silent = true },
|
||||
},
|
||||
opts = {
|
||||
filesystem = {
|
||||
window = {
|
||||
mappings = {
|
||||
['\\'] = 'close_window',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
@ -1,36 +0,0 @@
|
||||
local dap = require('dap')
|
||||
dap.adapters.lldb = {
|
||||
type = 'executable',
|
||||
command = '/usr/bin/lldb-vscode',
|
||||
name = 'lldb'
|
||||
}
|
||||
|
||||
dap.configurations.cpp = {
|
||||
{
|
||||
name = 'Launch',
|
||||
type = 'lldb',
|
||||
request = 'launch',
|
||||
program = function()
|
||||
return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file')
|
||||
end,
|
||||
cwd = '${workspaceFolder}',
|
||||
stopOnEntry = false,
|
||||
args = {},
|
||||
|
||||
-- 💀
|
||||
-- if you change `runInTerminal` to true, you might need to change the yama/ptrace_scope setting:
|
||||
--
|
||||
-- echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope
|
||||
--
|
||||
-- Otherwise you might get the following error:
|
||||
--
|
||||
-- Error on launch: Failed to attach to the target process
|
||||
--
|
||||
-- But you should be aware of the implications:
|
||||
-- https://www.kernel.org/doc/html/latest/admin-guide/LSM/Yama.html
|
||||
-- runInTerminal = false,
|
||||
},
|
||||
}
|
||||
|
||||
dap.configurations.c = dap.configurations.cpp
|
||||
dap.configurations.rust = dap.configurations.cpp
|
@ -3,18 +3,18 @@ local M = {}
|
||||
function M.load()
|
||||
-- TODO: Make it work with buffer which don't have a filename yet
|
||||
|
||||
vim.api.nvim_create_user_command("AddIncludeGuard", function(data)
|
||||
vim.api.nvim_create_user_command('AddIncludeGuard', function(data)
|
||||
local bufnr = vim.api.nvim_get_current_buf()
|
||||
local name_pattern = data.fargs[1] or "%s_"
|
||||
local name_pattern = data.fargs[1] or '%s_'
|
||||
|
||||
local function formatName(filename)
|
||||
local parts = vim.split(filename, "[/\\]", {trimempty=true})
|
||||
local parts = vim.split(filename, '[/\\]', { trimempty = true })
|
||||
local last_part = parts[#parts]
|
||||
local ext = last_part:match("%.([^%.]+)$")
|
||||
local name = last_part:gsub("%.[^%.]+$", "")
|
||||
local ext = last_part:match '%.([^%.]+)$'
|
||||
local name = last_part:gsub('%.[^%.]+$', '')
|
||||
|
||||
if ext == "h" or ext == "hpp" then
|
||||
name = name.."_H"
|
||||
if ext == 'h' or ext == 'hpp' then
|
||||
name = name .. '_H'
|
||||
end
|
||||
|
||||
return name_pattern:format(name:upper())
|
||||
@ -24,16 +24,16 @@ function M.load()
|
||||
local guard_name = formatName(buf_filename)
|
||||
|
||||
vim.api.nvim_buf_set_lines(bufnr, 0, 0, false, {
|
||||
"#ifndef "..guard_name,
|
||||
"#define "..guard_name,
|
||||
""
|
||||
'#ifndef ' .. guard_name,
|
||||
'#define ' .. guard_name,
|
||||
'',
|
||||
})
|
||||
|
||||
vim.api.nvim_buf_set_lines(bufnr, -1, -1, false, {
|
||||
"",
|
||||
"#endif //"..guard_name
|
||||
'',
|
||||
'#endif //' .. guard_name,
|
||||
})
|
||||
end, { nargs="?" })
|
||||
end, { nargs = '?' })
|
||||
end
|
||||
|
||||
return M
|
@ -1,111 +0,0 @@
|
||||
local M = {}
|
||||
|
||||
local ts = vim.treesitter
|
||||
|
||||
local function get_ast_root(bufnr)
|
||||
local tree = ts.get_parser(bufnr, "c"):parse()
|
||||
return tree[1]:root()
|
||||
end
|
||||
|
||||
|
||||
local function do_lines_match(lines1, lines2)
|
||||
if #lines1 ~= lines2 then
|
||||
return false
|
||||
end
|
||||
for i, line1 in ipairs(lines1) do
|
||||
if line1 ~= lines2[i] then
|
||||
return false
|
||||
end
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
local function format_macros()
|
||||
local query = ts.query.parse("c", [[
|
||||
(preproc_function_def value: (preproc_arg) @macro_def)
|
||||
(preproc_def value: (preproc_arg) @macro_def)
|
||||
]])
|
||||
|
||||
local capture_lookup = {}
|
||||
for id, name in ipairs(query.captures) do
|
||||
capture_lookup[name] = id
|
||||
end
|
||||
|
||||
local bufnr = vim.api.nvim_get_current_buf()
|
||||
local winnr = vim.api.nvim_get_current_win()
|
||||
|
||||
for _, match in query:iter_matches(get_ast_root(bufnr), bufnr, 0, -1) do
|
||||
local macro_def_node = match[capture_lookup.macro_def]
|
||||
-- local class_name = ts.get_node_text(class_node, bufnr)
|
||||
local start_line = macro_def_node:start()
|
||||
local end_line = macro_def_node:end_()
|
||||
|
||||
local lines = vim.api.nvim_buf_get_lines(bufnr, start_line, end_line+1, false)
|
||||
local tabstop = tonumber(vim.bo[bufnr].tabstop) or 8
|
||||
|
||||
local new_lines = {}
|
||||
for i, line in ipairs(lines) do
|
||||
lines[i] = line:match("^(.-)%s*[\\]?$")
|
||||
new_lines[i] = lines[i]
|
||||
end
|
||||
|
||||
while true do
|
||||
local last_line = new_lines[#lines]
|
||||
if not last_line then break end
|
||||
if last_line:match("^%s*//") or last_line:match("^%s*/%*") or last_line:match("^%s*$") then
|
||||
table.remove(lines, #lines)
|
||||
end_line = end_line - 1
|
||||
else
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
if #new_lines > 2 then
|
||||
local line_length = 0
|
||||
do
|
||||
local textwidth = vim.bo[bufnr].textwidth
|
||||
if textwidth and textwidth ~= "" then
|
||||
line_length = tonumber(textwidth)
|
||||
end
|
||||
|
||||
if line_length <= 0 then
|
||||
local colorcolum = vim.wo[winnr].colorcolumn
|
||||
if colorcolum and colorcolum ~= "" then
|
||||
line_length = tonumber(colorcolum)
|
||||
end
|
||||
end
|
||||
|
||||
if line_length <= 0 then
|
||||
for _, line in ipairs(new_lines) do
|
||||
line_length = math.max(line_length, #line+2)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
for i = 1, #new_lines-1 do
|
||||
local line = new_lines[i]
|
||||
local length = #(line:gsub("\t", (" "):rep(tabstop)))
|
||||
lines[i] = line .. (" "):rep(line_length - length-2) .. " \\"
|
||||
end
|
||||
|
||||
if not do_lines_match(lines, new_lines) then
|
||||
vim.api.nvim_buf_set_lines(bufnr, start_line, end_line+1, false, lines)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function M.load()
|
||||
local group = vim.api.nvim_create_augroup("UpdateCMacro", { clear = true })
|
||||
for _, cmd in ipairs{"InsertLeavePre", "BufWritePre"} do
|
||||
vim.api.nvim_create_autocmd(cmd, {
|
||||
group = group,
|
||||
pattern = {"*.c", "*.h", "*.cpp", "*.hpp", "*.cc"},
|
||||
callback = function (data)
|
||||
format_macros()
|
||||
end
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
@ -1,17 +0,0 @@
|
||||
local M = {}
|
||||
|
||||
function M.load()
|
||||
local disabled_built_ins = {
|
||||
'matchit',
|
||||
'netrw',
|
||||
'netrwPlugin',
|
||||
'netrwSettings',
|
||||
'netrwFileHandlers',
|
||||
}
|
||||
|
||||
for _, name in ipairs(disabled_built_ins) do
|
||||
vim.g['loaded_' .. name] = 1
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
@ -1,11 +0,0 @@
|
||||
local M = {}
|
||||
|
||||
function M.load()
|
||||
vim.keymap.set("n", "<leader><leader>x", ":w<cr>:source %<cr>", { silent = true })
|
||||
|
||||
function _G.P(...)
|
||||
print(vim.inspect(...))
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
@ -2,16 +2,16 @@ local M = {}
|
||||
|
||||
function M.load()
|
||||
-- Setup tree sitter
|
||||
local parser_config = require("nvim-treesitter.parsers").get_parser_configs()
|
||||
local parser_config = require('nvim-treesitter.parsers').get_parser_configs()
|
||||
parser_config.uci = {
|
||||
install_info = {
|
||||
url = "git@rpuzonas.com:rpuzonas/tree-sitter-uci.git",
|
||||
files = {"src/parser.c"},
|
||||
branch = "main",
|
||||
url = 'git@rpuzonas.com:rpuzonas/tree-sitter-uci.git',
|
||||
files = { 'src/parser.c' },
|
||||
branch = 'main',
|
||||
generate_requires_npm = false,
|
||||
requires_generate_from_grammar = false,
|
||||
},
|
||||
filetype = "uci",
|
||||
filetype = 'uci',
|
||||
}
|
||||
|
||||
-- Determine UCI filetype by contents of file.
|
||||
@ -33,7 +33,8 @@ function M.load()
|
||||
}
|
||||
}
|
||||
})
|
||||
]]--
|
||||
]]
|
||||
--
|
||||
end
|
||||
|
||||
return M
|
@ -1,168 +0,0 @@
|
||||
|
||||
local empty = require('lualine.component'):extend()
|
||||
function empty:draw(default_highlight)
|
||||
self.status = ''
|
||||
self.applied_separator = ''
|
||||
self:apply_highlights(default_highlight)
|
||||
self:apply_section_separators()
|
||||
return self.status
|
||||
end
|
||||
|
||||
-- Put proper separators and gaps between components in sections
|
||||
local function process_sections(sections)
|
||||
local bg = vim.g.srcery_xgray1
|
||||
|
||||
for name, section in pairs(sections) do
|
||||
local left = name:sub(9, 10) < 'x'
|
||||
for pos = 1, name ~= 'lualine_z' and #section or #section - 1 do
|
||||
table.insert(section, pos * 2, { empty, color = { fg = bg, bg = bg } })
|
||||
end
|
||||
for id, comp in ipairs(section) do
|
||||
if type(comp) ~= 'table' then
|
||||
comp = { comp }
|
||||
section[id] = comp
|
||||
end
|
||||
comp.separator = left and { right = '' } or { left = '' }
|
||||
end
|
||||
end
|
||||
return sections
|
||||
end
|
||||
|
||||
local function search_result()
|
||||
local last_search = vim.fn.getreg('/')
|
||||
if not last_search or last_search == '' then
|
||||
return ''
|
||||
end
|
||||
local searchcount = vim.fn.searchcount { maxcount = 9999 }
|
||||
if searchcount.total == 0 then
|
||||
return ''
|
||||
end
|
||||
return last_search .. '(' .. searchcount.current .. '/' .. searchcount.total .. ')'
|
||||
end
|
||||
|
||||
local function recording_macro()
|
||||
local reg = vim.api.nvim_call_function("reg_recording", {})
|
||||
if reg ~= "" then
|
||||
return "@" .. reg
|
||||
else
|
||||
return ""
|
||||
end
|
||||
end
|
||||
|
||||
local function modified()
|
||||
if vim.bo.modified then
|
||||
return '+'
|
||||
elseif vim.bo.modifiable == false or vim.bo.readonly == true then
|
||||
return '-'
|
||||
end
|
||||
return ''
|
||||
end
|
||||
|
||||
|
||||
return {
|
||||
"nvim-lualine/lualine.nvim",
|
||||
dependencies = {"nvim-tree/nvim-web-devicons"},
|
||||
config = function()
|
||||
local bg = vim.g.srcery_xgray1
|
||||
|
||||
local colors = {
|
||||
red = vim.g.srcery_red,
|
||||
grey = vim.g.srcery_black,
|
||||
black = vim.g.srcery_hard_black,
|
||||
white = vim.g.srcery_bright_white,
|
||||
light_green = vim.g.srcery_bright_green,
|
||||
orange = vim.g.srcery_orange,
|
||||
green = vim.g.srcery_green,
|
||||
}
|
||||
|
||||
local theme = {
|
||||
normal = {
|
||||
a = { fg = colors.white, bg = colors.black },
|
||||
b = { fg = colors.white, bg = colors.grey },
|
||||
c = { fg = colors.black, bg = bg },
|
||||
z = { fg = colors.white, bg = colors.black },
|
||||
},
|
||||
insert = { a = { fg = colors.black, bg = colors.light_green } },
|
||||
visual = { a = { fg = colors.black, bg = colors.orange } },
|
||||
replace = { a = { fg = colors.black, bg = colors.green } },
|
||||
}
|
||||
|
||||
local extensions = {"man", "quickfix"}
|
||||
if pcall(require, "neo-tree") then
|
||||
table.insert(extensions, "neo-tree")
|
||||
end
|
||||
if pcall(require, "luapad.statusline") then
|
||||
table.insert(extensions, {
|
||||
sections = process_sections {
|
||||
lualine_a = {"mode"},
|
||||
lualine_b = {
|
||||
{
|
||||
"diagnostics",
|
||||
source = { "nvim" },
|
||||
sections = { "error" },
|
||||
diagnostics_color = { error = { bg = colors.red, fg = colors.white } },
|
||||
},
|
||||
{
|
||||
"diagnostics",
|
||||
source = { "nvim" },
|
||||
sections = { "warn" },
|
||||
diagnostics_color = { warn = { bg = colors.orange, fg = colors.white } },
|
||||
},
|
||||
{ recording_macro, color = { bg = colors.orange } }
|
||||
},
|
||||
lualine_y = { search_result, "filetype" },
|
||||
lualine_z = { "%l:%c", "%p%%/%L" },
|
||||
},
|
||||
filetypes = {"lua.luapad"}
|
||||
})
|
||||
end
|
||||
|
||||
require("lualine").setup {
|
||||
options = {
|
||||
icons_enabled = true,
|
||||
theme = theme,
|
||||
component_separators = "",
|
||||
section_separators = { left = "", right = "" },
|
||||
globalstatus = true
|
||||
},
|
||||
sections = process_sections {
|
||||
lualine_a = { "mode" },
|
||||
lualine_b = {
|
||||
"branch",
|
||||
"diff",
|
||||
{
|
||||
"diagnostics",
|
||||
source = { "nvim" },
|
||||
sections = { "error" },
|
||||
diagnostics_color = { error = { bg = colors.red, fg = colors.white } },
|
||||
},
|
||||
{
|
||||
"diagnostics",
|
||||
source = { "nvim" },
|
||||
sections = { "warn" },
|
||||
diagnostics_color = { warn = { bg = colors.orange, fg = colors.white } },
|
||||
},
|
||||
{ "filename", file_status = false, path = 1 },
|
||||
{ modified, color = { bg = colors.red } },
|
||||
{ "%w", cond = function() return vim.wo.previewwindow end },
|
||||
{ "%r", cond = function() return vim.bo.readonly end },
|
||||
{ "%q", cond = function() return vim.bo.buftype == "quickfix" end },
|
||||
{ recording_macro, color = { bg = colors.orange } }
|
||||
},
|
||||
lualine_c = {},
|
||||
lualine_x = {},
|
||||
lualine_y = { search_result, "filetype" },
|
||||
lualine_z = { "%l:%c", "%p%%/%L" },
|
||||
},
|
||||
inactive_sections = {
|
||||
lualine_a = {},
|
||||
lualine_b = {},
|
||||
lualine_c = {},
|
||||
lualine_x = {},
|
||||
lualine_y = {},
|
||||
lualine_z = {},
|
||||
},
|
||||
extensions = extensions
|
||||
}
|
||||
end
|
||||
}
|
@ -1,89 +0,0 @@
|
||||
local function capture(cmd, raw)
|
||||
local f = assert(io.popen(cmd, 'r'))
|
||||
local s = assert(f:read('*a'))
|
||||
f:close()
|
||||
if raw then return s end
|
||||
s = string.gsub(s, '^%s+', '')
|
||||
s = string.gsub(s, '%s+$', '')
|
||||
s = string.gsub(s, '[\n\r]+', ' ')
|
||||
return s
|
||||
end
|
||||
|
||||
return {
|
||||
"L3MON4D3/LuaSnip",
|
||||
config = function()
|
||||
local ls = require("luasnip")
|
||||
local s = ls.snippet
|
||||
local sn = ls.snippet_node
|
||||
local fmt = require("luasnip.extras.fmt").fmt
|
||||
local t = ls.text_node
|
||||
local i = ls.insert_node
|
||||
local f = ls.function_node
|
||||
local c = ls.choice_node
|
||||
local d = ls.dynamic_node
|
||||
|
||||
local function getCurrentYear()
|
||||
return os.date("%Y")
|
||||
end
|
||||
|
||||
local function getGitUsername()
|
||||
local stdout = capture("git config user.name")
|
||||
if stdout == "" then return nil end
|
||||
return stdout
|
||||
end
|
||||
|
||||
-- ls.config.set_config {
|
||||
-- history = true,
|
||||
-- updateevents = "TextChanged,TextChangedI",
|
||||
-- enable_autosnippets = true
|
||||
-- }
|
||||
|
||||
-- vim.keymap.set({"i", "s"}, "<c-k>", function()
|
||||
-- if ls.expand_or_jumpable() then
|
||||
-- ls.expand_or_jump()
|
||||
-- end
|
||||
-- end, { silent = true })
|
||||
|
||||
-- vim.keymap.set({ "i", "s" }, "<c-j>", function()
|
||||
-- if ls.jumpable(-1) then ls.jump(-1) end
|
||||
-- end, { silent = -1 })
|
||||
|
||||
-- vim.keymap.set({"i"}, "<c-l>", function()
|
||||
-- if ls.choice_active() then ls.change_choice(1) end
|
||||
-- end)
|
||||
|
||||
ls.add_snippets("all", {
|
||||
s("MIT", {
|
||||
t({"The MIT License (MIT)", "Copyright © "}),
|
||||
f(getCurrentYear, {}),
|
||||
t(" "),
|
||||
d(1, function()
|
||||
return sn(nil, {
|
||||
i(1, getGitUsername() or "<copyright holders>")
|
||||
})
|
||||
end, {}),
|
||||
t{
|
||||
"",
|
||||
"",
|
||||
"Permission is hereby granted, free of charge, to any person obtaining a copy of",
|
||||
"this software and associated documentation files (the “Software”), to deal in",
|
||||
"the Software without restriction, including without limitation the rights to",
|
||||
"use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies",
|
||||
"of the Software, and to permit persons to whom the Software is furnished to do",
|
||||
"so, subject to the following conditions:",
|
||||
"",
|
||||
"The above copyright notice and this permission notice shall be included in all",
|
||||
"copies or substantial portions of the Software.",
|
||||
"",
|
||||
"THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR",
|
||||
"IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,",
|
||||
"FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE",
|
||||
"AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER",
|
||||
"LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,",
|
||||
"OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE",
|
||||
"SOFTWARE.",
|
||||
}
|
||||
})
|
||||
})
|
||||
end
|
||||
}
|
@ -1,154 +0,0 @@
|
||||
local telescope = require('telescope')
|
||||
local actions = require('telescope.actions')
|
||||
local builtin = require('telescope.builtin')
|
||||
|
||||
-- [[ Configure Telescope ]]
|
||||
-- See `:help telescope` and `:help telescope.setup()`
|
||||
-- require('telescope').setup {
|
||||
-- defaults = {
|
||||
-- mappings = {
|
||||
-- i = {
|
||||
-- ['<C-u>'] = false,
|
||||
-- ['<C-d>'] = false,
|
||||
-- },
|
||||
-- },
|
||||
-- },
|
||||
-- }
|
||||
|
||||
-- Enable telescope fzf native, if installed
|
||||
-- pcall(require('telescope').load_extension, 'fzf')
|
||||
|
||||
-- See `:help telescope.builtin`
|
||||
-- vim.keymap.set('n', '<leader>?', require('telescope.builtin').oldfiles, { desc = '[?] Find recently opened files' })
|
||||
-- vim.keymap.set('n', '<leader><space>', require('telescope.builtin').buffers, { desc = '[ ] Find existing buffers' })
|
||||
-- vim.keymap.set('n', '<leader>/', function()
|
||||
-- -- You can pass additional configuration to telescope to change theme, layout, etc.
|
||||
-- require('telescope.builtin').current_buffer_fuzzy_find(require('telescope.themes').get_dropdown {
|
||||
-- winblend = 10,
|
||||
-- previewer = false,
|
||||
-- })
|
||||
-- end, { desc = '[/] Fuzzily search in current buffer' })
|
||||
|
||||
-- vim.keymap.set('n', '<leader>gf', require('telescope.builtin').git_files, { desc = 'Search [G]it [F]iles' })
|
||||
-- vim.keymap.set('n', '<leader>sf', require('telescope.builtin').find_files, { desc = '[S]earch [F]iles' })
|
||||
-- vim.keymap.set('n', '<leader>sh', require('telescope.builtin').help_tags, { desc = '[S]earch [H]elp' })
|
||||
-- vim.keymap.set('n', '<leader>sw', require('telescope.builtin').grep_string, { desc = '[S]earch current [W]ord' })
|
||||
-- vim.keymap.set('n', '<leader>sg', require('telescope.builtin').live_grep, { desc = '[S]earch by [G]rep' })
|
||||
-- vim.keymap.set('n', '<leader>sd', require('telescope.builtin').diagnostics, { desc = '[S]earch [D]iagnostics' })
|
||||
-- vim.keymap.set('n', '<leader>sr', require('telescope.builtin').resume, { desc = '[S]earch [R]esume' })
|
||||
|
||||
-- Falling back to find_files if git_files can't find a .git directory
|
||||
local function project_files(opts)
|
||||
opts = opts or {}
|
||||
if not opts.prompt_title then
|
||||
opts.prompt_title = "Project files"
|
||||
end
|
||||
local ok = pcall(builtin.git_files, opts)
|
||||
if not ok then builtin.find_files(opts) end
|
||||
end
|
||||
|
||||
local function get_vtext()
|
||||
local prev_regv = vim.fn.getreg('v')
|
||||
vim.cmd('noau normal! "vy"')
|
||||
local text = vim.fn.getreg('v')
|
||||
vim.fn.setreg("v", prev_regv)
|
||||
|
||||
text = string.gsub(text, "\n", "")
|
||||
if #text > 0 then
|
||||
return text
|
||||
else
|
||||
return ""
|
||||
end
|
||||
end
|
||||
|
||||
local function escape_sed_symbols(text)
|
||||
return text:gsub("[.()%[%]]", "\\%1")
|
||||
end
|
||||
|
||||
return {
|
||||
"nvim-telescope/telescope.nvim",
|
||||
tag = "0.1.5",
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
"nvim-tree/nvim-web-devicons",
|
||||
"nvim-telescope/telescope-ui-select.nvim",
|
||||
{
|
||||
"nvim-telescope/telescope-fzf-native.nvim",
|
||||
build = "make",
|
||||
cond = function() return vim.fn.executable('make') == 1 end,
|
||||
}
|
||||
},
|
||||
config = function()
|
||||
telescope.setup{
|
||||
defaults = {
|
||||
vimgrep_arguments = {
|
||||
"rg",
|
||||
"-L",
|
||||
"--color=never",
|
||||
"--no-heading",
|
||||
"--with-filename",
|
||||
"--line-number",
|
||||
"--column",
|
||||
"--smart-case",
|
||||
},
|
||||
prompt_prefix = " ",
|
||||
selection_caret = " ",
|
||||
entry_prefix = " ",
|
||||
initial_mode = "insert",
|
||||
selection_strategy = "reset",
|
||||
sorting_strategy = "ascending",
|
||||
layout_strategy = "horizontal",
|
||||
layout_config = {
|
||||
horizontal = {
|
||||
prompt_position = "top",
|
||||
preview_width = 0.55,
|
||||
results_width = 0.8,
|
||||
},
|
||||
vertical = { mirror = false },
|
||||
width = 0.87,
|
||||
height = 0.80,
|
||||
preview_cutoff = 120,
|
||||
},
|
||||
file_sorter = require("telescope.sorters").get_fuzzy_file,
|
||||
file_ignore_patterns = {
|
||||
"node_modules",
|
||||
"package%-lock%.json",
|
||||
"composer%.lock",
|
||||
"vendor"
|
||||
},
|
||||
generic_sorter = require("telescope.sorters").get_generic_fuzzy_sorter,
|
||||
path_display = { "truncate" },
|
||||
color_devicons = true,
|
||||
winblend = 0,
|
||||
border = {},
|
||||
borderchars = { "─", "│", "─", "│", "╭", "╮", "╯", "╰" },
|
||||
set_env = { ["COLORTERM"] = "truecolor" }, -- default = nil,
|
||||
file_previewer = require("telescope.previewers").vim_buffer_cat.new,
|
||||
grep_previewer = require("telescope.previewers").vim_buffer_vimgrep.new,
|
||||
qflist_previewer = require("telescope.previewers").vim_buffer_qflist.new,
|
||||
buffer_previewer_maker = require("telescope.previewers").buffer_previewer_maker,
|
||||
mappings = {
|
||||
i = { ["<esc>"] = actions.close }
|
||||
},
|
||||
},
|
||||
pickers = {
|
||||
live_grep = { disable_coordinates = true },
|
||||
colorscheme = { enable_preview = true }
|
||||
},
|
||||
extensions = {
|
||||
["ui-select"] = { require("telescope.themes").get_dropdown {} }
|
||||
}
|
||||
}
|
||||
|
||||
telescope.load_extension("ui-select")
|
||||
pcall(telescope.load_extension, 'fzf') -- Enable telescope fzf native, if installed
|
||||
|
||||
local keymap = vim.keymap.set
|
||||
keymap("n", "<C-p>", project_files, { desc = "Find [P]roject files" })
|
||||
keymap("n", "<leader>p", function() builtin.find_files() end, { desc = "[P] Find files" })
|
||||
keymap("n", "<leader>fw", function() builtin.live_grep() end, { desc = "[F]ind [W]ords" })
|
||||
keymap("v", "<leader>fw", function() builtin.live_grep{ default_text = escape_sed_symbols(get_vtext()) } end, { desc = "[F]ind [W]ords" })
|
||||
keymap("n", "<leader>fh", function() builtin.help_tags() end, { desc = "Find help tags" })
|
||||
end
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
{
|
||||
"adapters": {
|
||||
"lldb-vscode": {
|
||||
"attach": {
|
||||
"pidProperty": "pid",
|
||||
"pidSelect": "none"
|
||||
},
|
||||
"command": [
|
||||
"lldb-vscode"
|
||||
],
|
||||
"env": {
|
||||
"LLDB_LAUNCH_FLAG_LAUNCH_IN_TTY": "YES"
|
||||
},
|
||||
"name": "lldb"
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user