Merge branch 'master' of https://git.freiewildbahn.de/oli/nvim
This commit is contained in:
4
init.lua
4
init.lua
@ -1,7 +1,7 @@
|
|||||||
vim.g.mapleader = ','
|
vim.g.mapleader = ','
|
||||||
if not vim.g.vscode then
|
if not vim.g.vscode then
|
||||||
require('my_plugins')
|
require('config.lazy')
|
||||||
require('my_keymappings')
|
require('my_keymappings')
|
||||||
require('my_options')
|
|
||||||
require('my_autocommands')
|
require('my_autocommands')
|
||||||
|
require('config.options')
|
||||||
end
|
end
|
||||||
|
55
lazy-lock.json
Normal file
55
lazy-lock.json
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
{
|
||||||
|
"Comment.nvim": { "branch": "master", "commit": "45dc21a71ad1450606f5e98261badb28db59d74c" },
|
||||||
|
"LuaSnip": { "branch": "master", "commit": "5570fd797eae0790affb54ea669a150cad76db5d" },
|
||||||
|
"aerial.nvim": { "branch": "master", "commit": "7e2fef6ec501a3fe8bc6c4051b3a1014dc098a06" },
|
||||||
|
"clangd_extensions.nvim": { "branch": "main", "commit": "9bd6073dd1230e667f97760b5a73f81547a19528" },
|
||||||
|
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
|
||||||
|
"cmp-calc": { "branch": "main", "commit": "50792f34a628ea6eb31d2c90e8df174671e4e7a0" },
|
||||||
|
"cmp-cmdline": { "branch": "main", "commit": "23c51b2a3c00f6abc4e922dbd7c3b9aca6992063" },
|
||||||
|
"cmp-cmdline-history": { "branch": "master", "commit": "003573b72d4635ce636234a826fa8c4ba2895ffe" },
|
||||||
|
"cmp-dap": { "branch": "master", "commit": "d16f14a210cd28988b97ca8339d504533b7e09a4" },
|
||||||
|
"cmp-emoji": { "branch": "main", "commit": "19075c36d5820253d32e2478b6aaf3734aeaafa0" },
|
||||||
|
"cmp-look": { "branch": "master", "commit": "b39c50bcdf6199dddda56adc466c2bd9c951a960" },
|
||||||
|
"cmp-nvim-lsp": { "branch": "main", "commit": "59224771f91b86d1de12570b4070fe4ad7cd1eeb" },
|
||||||
|
"cmp-nvim-lsp-signature-help": { "branch": "main", "commit": "d2768cb1b83de649d57d967085fe73c5e01f8fd7" },
|
||||||
|
"cmp-nvim-lua": { "branch": "main", "commit": "d276254e7198ab7d00f117e88e223b4bd8c02d21" },
|
||||||
|
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
|
||||||
|
"cmp-spell": { "branch": "master", "commit": "60584cb75e5e8bba5a0c9e4c3ab0791e0698bffa" },
|
||||||
|
"cmp-treesitter": { "branch": "master", "commit": "b40178b780d547bcf131c684bc5fd41af17d05f2" },
|
||||||
|
"cmp_luasnip": { "branch": "master", "commit": "18095520391186d634a0045dacaa346291096566" },
|
||||||
|
"diffview.nvim": { "branch": "main", "commit": "3812e296d3977a24db62f7c18025755b40968d3a" },
|
||||||
|
"dressing.nvim": { "branch": "master", "commit": "4436d6f41e2f6b8ada57588acd1a9f8b3d21453c" },
|
||||||
|
"friendly-snippets": { "branch": "main", "commit": "1a6a02350568d6830bcfa167c72f9b6e75e454ae" },
|
||||||
|
"gitsigns.nvim": { "branch": "main", "commit": "2ab3bdf0a40bab53033048c6be75bda86316b55d" },
|
||||||
|
"gruvbox-flat.nvim": { "branch": "master", "commit": "172269867994c0da7adcf02e89a068cda85eb805" },
|
||||||
|
"indent-blankline.nvim": { "branch": "master", "commit": "c4c203c3e8a595bc333abaf168fcb10c13ed5fb7" },
|
||||||
|
"lazy.nvim": { "branch": "main", "commit": "5a5487b015743c69d6a275156a90af35c2905c47" },
|
||||||
|
"leap.nvim": { "branch": "main", "commit": "a5c9504290832e6bdbbb6265fd1ff02fc6485d20" },
|
||||||
|
"legendary.nvim": { "branch": "master", "commit": "f53ef425b1b6cb9dc907a054755138345fd2fd57" },
|
||||||
|
"lsp_signature.nvim": { "branch": "master", "commit": "1979f1118e2b38084e7c148f279eed6e9300a342" },
|
||||||
|
"lspkind-nvim": { "branch": "master", "commit": "c68b3a003483cf382428a43035079f78474cd11e" },
|
||||||
|
"lualine.nvim": { "branch": "master", "commit": "fffbcb829288c3ca366f17cdb8d46aefb5c1d6f3" },
|
||||||
|
"mason-lspconfig.nvim": { "branch": "main", "commit": "31d8ed0dd3daf6cc64e35d710a190b64080bdc86" },
|
||||||
|
"mason.nvim": { "branch": "main", "commit": "5f82a4e5618ebb0f3197141e9f14a07b56d5390f" },
|
||||||
|
"null-ls.nvim": { "branch": "main", "commit": "b26851b3e7ac1c0c85666f8a74e36aef2acb89c6" },
|
||||||
|
"nvim-autopairs": { "branch": "master", "commit": "03580d758231956d33c8dd91e2be195106a79fa4" },
|
||||||
|
"nvim-cmp": { "branch": "main", "commit": "e55033fce468c9c578b946948807f2ac48a6ee08" },
|
||||||
|
"nvim-dap": { "branch": "master", "commit": "6f2ea9e33b48a51849ec93c6c38148a5372018e4" },
|
||||||
|
"nvim-dap-python": { "branch": "master", "commit": "d4400d075c21ed8fb8e8ac6a5ff56f58f6e93531" },
|
||||||
|
"nvim-dap-ui": { "branch": "master", "commit": "54365d2eb4cb9cfab0371306c6a76c913c5a67e3" },
|
||||||
|
"nvim-dap-virtual-text": { "branch": "master", "commit": "2971ce3e89b1711cc26e27f73d3f854b559a77d4" },
|
||||||
|
"nvim-lspconfig": { "branch": "master", "commit": "42ca8ce0f2252be795da4789fadfa91f6c3f7464" },
|
||||||
|
"nvim-treesitter": { "branch": "master", "commit": "0cb637ca9f4389172933e5aba36387ab8430b6fb" },
|
||||||
|
"nvim-ts-rainbow": { "branch": "master", "commit": "064fd6c0a15fae7f876c2c6dd4524ca3fad96750" },
|
||||||
|
"nvim-web-devicons": { "branch": "master", "commit": "05e1072f63f6c194ac6e867b567e6b437d3d4622" },
|
||||||
|
"overseer.nvim": { "branch": "master", "commit": "82ed207195b58a73b9f7d013d6eb3c7d78674ac9" },
|
||||||
|
"plenary.nvim": { "branch": "master", "commit": "4b7e52044bbb84242158d977a50c4cbcd85070c7" },
|
||||||
|
"project.nvim": { "branch": "main", "commit": "685bc8e3890d2feb07ccf919522c97f7d33b94e4" },
|
||||||
|
"telescope-dap.nvim": { "branch": "master", "commit": "313d2ea12ae59a1ca51b62bf01fc941a983d9c9c" },
|
||||||
|
"telescope-fzf-native.nvim": { "branch": "main", "commit": "fab3e2212e206f4f8b3bbaa656e129443c9b802e" },
|
||||||
|
"telescope-ui-select.nvim": { "branch": "master", "commit": "62ea5e58c7bbe191297b983a9e7e89420f581369" },
|
||||||
|
"telescope.nvim": { "branch": "master", "commit": "e960efa60e97df58e089b00270f09d60f27202c8" },
|
||||||
|
"toggleterm.nvim": { "branch": "main", "commit": "b02a1674bd0010d7982b056fd3df4f717ff8a57a" },
|
||||||
|
"vim-repeat": { "branch": "master", "commit": "24afe922e6a05891756ecf331f39a1f6743d3d5a" },
|
||||||
|
"yanky.nvim": { "branch": "main", "commit": "2bb05abe20b5d7af917a48785acfacb602248e36" }
|
||||||
|
}
|
14
lua/config/lazy.lua
Normal file
14
lua/config/lazy.lua
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
local lazypath = vim.fn.stdpath('data') .. '/lazy/lazy.nvim'
|
||||||
|
if not vim.loop.fs_stat(lazypath) then
|
||||||
|
vim.fn.system({
|
||||||
|
'git',
|
||||||
|
'clone',
|
||||||
|
'--filter=blob:none',
|
||||||
|
'--single-branch',
|
||||||
|
'https://github.com/folke/lazy.nvim.git',
|
||||||
|
lazypath,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
vim.opt.runtimepath:prepend(lazypath)
|
||||||
|
|
||||||
|
require('lazy').setup('plugins', {})
|
@ -1,62 +1,63 @@
|
|||||||
vim.cmd('filetype plugin indent on')
|
|
||||||
vim.cmd('language en_US.utf-8')
|
vim.cmd('filetype plugin indent on')
|
||||||
|
vim.cmd('language en_US.utf-8')
|
||||||
local opt = vim.opt
|
|
||||||
local indent = 2
|
local opt = vim.opt
|
||||||
opt.termguicolors = true -- Enable colors in terminal
|
local indent = 2
|
||||||
opt.hlsearch = true --Set highlight on search
|
opt.termguicolors = true -- Enable colors in terminal
|
||||||
opt.number = true --Make line numbers default
|
opt.hlsearch = true --Set highlight on search
|
||||||
opt.relativenumber = false --Make relative number default
|
opt.number = true --Make line numbers default
|
||||||
opt.mouse = 'a' --Enable mouse mode
|
opt.relativenumber = false --Make relative number default
|
||||||
opt.breakindent = true --Enable break indent
|
opt.mouse = 'a' --Enable mouse mode
|
||||||
opt.undofile = true --Save undo history
|
opt.breakindent = true --Enable break indent
|
||||||
opt.ignorecase = true --Case insensitive searching unless /C or capital in search
|
opt.undofile = true --Save undo history
|
||||||
opt.smartcase = true -- Smart case
|
opt.ignorecase = true --Case insensitive searching unless /C or capital in search
|
||||||
opt.updatetime = 300 --Decrease update time
|
opt.smartcase = true -- Smart case
|
||||||
opt.signcolumn = 'yes' -- Always show sign column
|
opt.updatetime = 300 --Decrease update time
|
||||||
opt.clipboard = 'unnamed,unnamedplus' -- Access system clipboard
|
opt.signcolumn = 'yes' -- Always show sign column
|
||||||
opt.timeoutlen = 300 -- Time in milliseconds to wait for a mapped sequence to complete.
|
opt.clipboard = 'unnamed,unnamedplus' -- Access system clipboard
|
||||||
opt.ttimeoutlen = 10
|
opt.timeoutlen = 300 -- Time in milliseconds to wait for a mapped sequence to complete.
|
||||||
opt.showmode = false -- Do not need to show the mode. We use the statusline instead.
|
opt.ttimeoutlen = 10
|
||||||
opt.scrolloff = 999 -- Lines of context
|
opt.showmode = false -- Do not need to show the mode. We use the statusline instead.
|
||||||
opt.joinspaces = false -- No double spaces with join after a dot
|
opt.scrolloff = 999 -- Lines of context
|
||||||
opt.showmatch = true -- Show matching braces
|
opt.joinspaces = false -- No double spaces with join after a dot
|
||||||
opt.wrap = true -- When on, lines longer than the width of the window will wrap and displaying continues on the next line
|
opt.showmatch = true -- Show matching braces
|
||||||
opt.list = true
|
opt.wrap = true -- When on, lines longer than the width of the window will wrap and displaying continues on the next line
|
||||||
opt.hidden= true
|
opt.list = true
|
||||||
opt.scrolloff= 4
|
opt.hidden= true
|
||||||
opt.shiftround= true
|
opt.scrolloff= 4
|
||||||
opt.relativenumber= false
|
opt.shiftround= true
|
||||||
opt.splitbelow= true
|
opt.relativenumber= false
|
||||||
opt.splitright= true
|
opt.splitbelow= true
|
||||||
opt.wildmode= 'longest:full,full'
|
opt.splitright= true
|
||||||
opt.splitbelow= true
|
opt.wildmode= 'longest:full,full'
|
||||||
opt.splitright= true
|
opt.splitbelow= true
|
||||||
opt.shiftwidth = indent
|
opt.splitright= true
|
||||||
opt.tabstop = indent
|
opt.shiftwidth = indent
|
||||||
if vim.loop.os_uname().sysname == 'Linux' then
|
opt.tabstop = indent
|
||||||
opt.guifont= 'JetBrainsMono Nerd Font Mono:h7'
|
if vim.loop.os_uname().sysname == 'Linux' then
|
||||||
else
|
opt.guifont= 'JetBrainsMono Nerd Font Mono:h7'
|
||||||
opt.guifont= 'JetBrainsMonoNL NF:h9' -- https://github.com/ryanoasis/nerd-fonts/blob/master/patched-fonts/JetBrainsMono/NoLigatures/Regular/complete/JetBrains%20Mono%20NL%20Regular%20Nerd%20Font%20Complete%20Mono%20Windows%20Compatible.ttf
|
else
|
||||||
end
|
opt.guifont= 'JetBrainsMonoNL NF:h9' -- https://github.com/ryanoasis/nerd-fonts/blob/master/patched-fonts/JetBrainsMono/NoLigatures/Regular/complete/JetBrains%20Mono%20NL%20Regular%20Nerd%20Font%20Complete%20Mono%20Windows%20Compatible.ttf
|
||||||
opt.swapfile= false
|
end
|
||||||
opt.backup= false
|
opt.swapfile= false
|
||||||
opt.spelllang= 'en,de'
|
opt.backup= false
|
||||||
opt.completeopt= 'menu,menuone,noselect'
|
opt.spelllang= 'en,de'
|
||||||
opt.expandtab= true
|
opt.completeopt= 'menu,menuone,noselect'
|
||||||
opt.smartindent= true
|
opt.expandtab= true
|
||||||
opt.title = true
|
opt.smartindent= true
|
||||||
opt.titlestring = '%{getcwd()} - %t'
|
opt.title = true
|
||||||
|
opt.titlestring = '%{getcwd()} - %t'
|
||||||
-- go to previous/next line with h,l,left arrow and right arrow
|
opt.laststatus = 3 -- for lualine
|
||||||
-- when cursor reaches end/beginning of line
|
|
||||||
-- opt.whichwrap:append('<>[]hl')
|
-- go to previous/next line with h,l,left arrow and right arrow
|
||||||
|
-- when cursor reaches end/beginning of line
|
||||||
-- disable nvim intro
|
-- opt.whichwrap:append('<>[]hl')
|
||||||
opt.shortmess:append('sI')
|
|
||||||
|
-- disable nvim intro
|
||||||
-- Treesitter based folding
|
opt.shortmess:append('sI')
|
||||||
opt.foldlevel = 20
|
|
||||||
opt.foldmethod = 'expr'
|
-- Treesitter based folding
|
||||||
opt.foldexpr = 'nvim_treesitter#foldexpr()'
|
opt.foldlevel = 20
|
||||||
|
opt.foldmethod = 'expr'
|
||||||
|
opt.foldexpr = 'nvim_treesitter#foldexpr()'
|
@ -1,5 +1,4 @@
|
|||||||
local opts = { noremap = true, silent = true }
|
local opts = { noremap = true, silent = true }
|
||||||
vim.keymap.set('n', '<space>', 'nil', opts)
|
|
||||||
|
|
||||||
-- Tabs
|
-- Tabs
|
||||||
vim.keymap.set('n', '<S-Right>', ':tabnext<CR>', opts)
|
vim.keymap.set('n', '<S-Right>', ':tabnext<CR>', opts)
|
||||||
@ -26,13 +25,16 @@ vim.keymap.set('x', '<', '<gv')
|
|||||||
vim.keymap.set('x', '>', '>gv')
|
vim.keymap.set('x', '>', '>gv')
|
||||||
|
|
||||||
local function hlWord()
|
local function hlWord()
|
||||||
local current_word = vim.call('expand','<cword>')
|
local current_word = vim.call('expand', '<cword>')
|
||||||
vim.fn.setreg('/', "\\<" .. current_word .. "\\>")
|
vim.fn.setreg('/', "\\<" .. current_word .. "\\>")
|
||||||
vim.opt.hlsearch = true
|
vim.opt.hlsearch = true
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Highlight word under cursor
|
-- Highlight word under cursor
|
||||||
vim.keymap.set('n', "'", hlWord, { noremap = true, silent = true })
|
vim.keymap.set('n', "'", hlWord, { noremap = true, silent = true, desc = 'Higlight word under cursor' })
|
||||||
vim.keymap.set('x', "'", 'y/\\V<C-R>"<CR>N', { noremap = true, silent = true })
|
vim.keymap.set('x', "'", 'y/\\V<C-R>"<CR>N', { noremap = true, silent = true, desc = 'Highlight visual' })
|
||||||
|
|
||||||
-- Close Buffer
|
-- Close Buffer
|
||||||
vim.keymap.set('n', '<C-w>', ':bd<CR>')
|
vim.keymap.set('n', '<C-w>', ':bd<CR>', { desc = 'Close buffer' })
|
||||||
|
|
||||||
|
vim.keymap.set('n', '<space>x', 'za', { desc = 'Toggle fold' })
|
||||||
|
27
lua/plugins/aerial.lua
Normal file
27
lua/plugins/aerial.lua
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
return {
|
||||||
|
'stevearc/aerial.nvim',
|
||||||
|
dependencies = {
|
||||||
|
'nvim-telescope/telescope.nvim'
|
||||||
|
},
|
||||||
|
config = function()
|
||||||
|
require('aerial').setup({
|
||||||
|
backends = { 'lsp', 'treesitter', 'markdown' },
|
||||||
|
layout = {
|
||||||
|
default_direction = "prefer_left"
|
||||||
|
},
|
||||||
|
filter_kind = false,
|
||||||
|
show_guides = true,
|
||||||
|
})
|
||||||
|
require('telescope').load_extension('aerial')
|
||||||
|
end,
|
||||||
|
cmd = 'AerialToggle',
|
||||||
|
keys = {
|
||||||
|
{
|
||||||
|
'<leader>s',
|
||||||
|
function ()
|
||||||
|
require('aerial').toggle()
|
||||||
|
end,
|
||||||
|
desc = 'Symbols outline',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
171
lua/plugins/cmp.lua
Normal file
171
lua/plugins/cmp.lua
Normal file
@ -0,0 +1,171 @@
|
|||||||
|
return {
|
||||||
|
'hrsh7th/nvim-cmp',
|
||||||
|
dependencies = {
|
||||||
|
{ 'onsails/lspkind-nvim' },
|
||||||
|
{ 'hrsh7th/cmp-buffer' },
|
||||||
|
{ 'hrsh7th/cmp-nvim-lsp' },
|
||||||
|
{ 'L3MON4D3/LuaSnip' },
|
||||||
|
{ 'saadparwaiz1/cmp_luasnip' },
|
||||||
|
{ 'hrsh7th/cmp-nvim-lua' },
|
||||||
|
{ 'octaltree/cmp-look' },
|
||||||
|
{ 'hrsh7th/cmp-path' },
|
||||||
|
{ 'hrsh7th/cmp-calc' },
|
||||||
|
{ 'f3fora/cmp-spell' },
|
||||||
|
{ 'hrsh7th/cmp-emoji' },
|
||||||
|
{ 'hrsh7th/cmp-cmdline' },
|
||||||
|
{ 'dmitmel/cmp-cmdline-history' },
|
||||||
|
{ 'ray-x/cmp-treesitter' },
|
||||||
|
{ 'hrsh7th/cmp-nvim-lsp-signature-help' },
|
||||||
|
{ 'p00f/clangd_extensions.nvim' },
|
||||||
|
{
|
||||||
|
'windwp/nvim-autopairs',
|
||||||
|
config = function()
|
||||||
|
require('setup/nvim-autopairs')
|
||||||
|
end
|
||||||
|
},
|
||||||
|
},
|
||||||
|
config = function()
|
||||||
|
local cmp = require('cmp')
|
||||||
|
local luasnip = require('luasnip')
|
||||||
|
|
||||||
|
local t = function(str)
|
||||||
|
return vim.api.nvim_replace_termcodes(str, true, true, true)
|
||||||
|
end
|
||||||
|
|
||||||
|
local check_back_space = function()
|
||||||
|
local col = vim.fn.col('.') - 1
|
||||||
|
return col == 0 or vim.fn.getline('.'):sub(col, col):match('%s') ~= nil
|
||||||
|
end
|
||||||
|
|
||||||
|
cmp.setup({
|
||||||
|
formatting = {
|
||||||
|
format = require('lspkind').cmp_format({
|
||||||
|
mode = 'symbol_text', -- show only symbol annotations
|
||||||
|
maxwidth = 80, -- prevent the popup from showing more than provided characters (e.g 50 will not show more than 50 characters)
|
||||||
|
ellipsis_char = '...', -- when popup menu exceed maxwidth, the truncated part would show ellipsis_char instead (must define maxwidth first)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
mapping = {
|
||||||
|
['<Up>'] = cmp.mapping(cmp.mapping.select_prev_item(), { 'i', 'c', 's' }),
|
||||||
|
['<Down>'] = cmp.mapping(cmp.mapping.select_next_item(), { 'i', 'c', 's' }),
|
||||||
|
['<C-d>'] = cmp.mapping.scroll_docs(-4),
|
||||||
|
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
||||||
|
['<C-Space>'] = cmp.mapping(cmp.mapping.complete(), { 'i', 'c', 's' }),
|
||||||
|
['<C-e>'] = cmp.mapping(cmp.mapping.close(), { 'i', 'c', 's' }),
|
||||||
|
['<CR>'] = cmp.mapping({
|
||||||
|
i = cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Insert, select = false }),
|
||||||
|
c = cmp.mapping.confirm({ select = false }),
|
||||||
|
s = cmp.mapping.confirm({ select = false }),
|
||||||
|
}),
|
||||||
|
['<Tab>'] = cmp.mapping(function(fallback)
|
||||||
|
if luasnip.expand_or_jumpable() then
|
||||||
|
vim.api.nvim_feedkeys(t('<Plug>luasnip-expand-or-jump'), '', true)
|
||||||
|
else
|
||||||
|
fallback()
|
||||||
|
end
|
||||||
|
end, {
|
||||||
|
'i',
|
||||||
|
's',
|
||||||
|
}),
|
||||||
|
['<S-Tab>'] = cmp.mapping(function(fallback)
|
||||||
|
if luasnip.jumpable(-1) then
|
||||||
|
vim.api.nvim_feedkeys(t('<Plug>luasnip-jump-prev'), '', true)
|
||||||
|
else
|
||||||
|
fallback()
|
||||||
|
end
|
||||||
|
end, {
|
||||||
|
'i',
|
||||||
|
's',
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
snippet = {
|
||||||
|
expand = function(args)
|
||||||
|
require('luasnip').lsp_expand(args.body)
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
sources = {
|
||||||
|
{ name = 'luasnip', priority = 8 },
|
||||||
|
{ name = 'nvim_lsp', priority = 7 },
|
||||||
|
{ name = 'nvim_lsp_signature_help', priority = 7 },
|
||||||
|
{ name = 'treesitter', priority = 6 },
|
||||||
|
{ name = 'buffer', priority = 5,
|
||||||
|
option = {
|
||||||
|
get_bufnrs = function()
|
||||||
|
local bufs = {}
|
||||||
|
for _, win in ipairs(vim.api.nvim_list_wins()) do
|
||||||
|
bufs[vim.api.nvim_win_get_buf(win)] = true
|
||||||
|
end
|
||||||
|
return vim.tbl_keys(bufs)
|
||||||
|
end
|
||||||
|
}
|
||||||
|
},
|
||||||
|
-- { name = 'nvim_lua' },
|
||||||
|
-- { name = 'look' },
|
||||||
|
-- { name = 'path' },
|
||||||
|
-- { name = 'cmp_tabnine' },
|
||||||
|
-- { name = 'calc' },
|
||||||
|
-- { name = 'spell' },
|
||||||
|
-- { name = 'emoji' },
|
||||||
|
},
|
||||||
|
enabled = function()
|
||||||
|
return vim.api.nvim_buf_get_option(0, "buftype") ~= "prompt"
|
||||||
|
or vim.api.nvim_buf_get_option(0, 'filetype') == 'dap-repl'
|
||||||
|
or vim.api.nvim_buf_get_option(0, 'filetype') == 'dapui_watches'
|
||||||
|
or vim.api.nvim_buf_get_option(0, 'filetype') == 'dapui_hover'
|
||||||
|
end,
|
||||||
|
completion = { completeopt = 'menu,menuone,noinsert, noselect' },
|
||||||
|
window = {
|
||||||
|
-- completion = cmp.config.window.bordered(),
|
||||||
|
-- documentation = cmp.config.window.bordered(),
|
||||||
|
},
|
||||||
|
sorting = {
|
||||||
|
comparators = {
|
||||||
|
require('clangd_extensions.cmp_scores'),
|
||||||
|
cmp.config.compare.locality,
|
||||||
|
-- cmp.config.compare.recently_used,
|
||||||
|
-- -- cmp.config.compare.offset,
|
||||||
|
-- cmp.config.compare.exact,
|
||||||
|
-- cmp.config.compare.recently_used,
|
||||||
|
-- cmp.config.compare.kind,
|
||||||
|
-- cmp.config.compare.sort_text,
|
||||||
|
-- cmp.config.compare.length,
|
||||||
|
-- cmp.config.compare.order,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
-- experimental = { native_menu = true }
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Use buffer source for `/` (if you enabled `native_menu`, this won't work anymore).
|
||||||
|
cmp.setup.cmdline('/', {
|
||||||
|
sources = {
|
||||||
|
{ name = 'buffer' },
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
|
||||||
|
cmp.setup.cmdline(':', {
|
||||||
|
sources = {
|
||||||
|
{ name = 'cmdline' },
|
||||||
|
{ name = 'cmdline_history' },
|
||||||
|
{ name = 'path' },
|
||||||
|
{ name = 'buffer' },
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
require('cmp').setup.filetype({ 'dap-repl', 'dapui_watches', 'dapui_hover' }, {
|
||||||
|
sources = {
|
||||||
|
{ name = 'dap' },
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Autopairs
|
||||||
|
--require("nvim-autopairs.completion.cmp").setup({
|
||||||
|
-- map_cr = true,
|
||||||
|
-- map_complete = true,
|
||||||
|
-- auto_select = true
|
||||||
|
--})
|
||||||
|
local cmp_autopairs = require('nvim-autopairs.completion.cmp')
|
||||||
|
cmp.event:on('confirm_done', cmp_autopairs.on_confirm_done({ map_char = { tex = '' } }))
|
||||||
|
end,
|
||||||
|
event = { 'InsertEnter', 'CmdLineEnter' },
|
||||||
|
}
|
22
lua/plugins/comment.lua
Normal file
22
lua/plugins/comment.lua
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
return {
|
||||||
|
'numToStr/Comment.nvim',
|
||||||
|
config = function()
|
||||||
|
require('Comment').setup({
|
||||||
|
mappings = false,
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
keys = {
|
||||||
|
{
|
||||||
|
'<c-c>',
|
||||||
|
'<Plug>(comment_toggle_linewise_current)',
|
||||||
|
desc= 'Toggle comment'
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
'<c-c>',
|
||||||
|
'<Plug>(comment_toggle_linewise_visual)gv',
|
||||||
|
mode = 'v',
|
||||||
|
desc= 'Toggle comment'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
254
lua/plugins/dap.lua
Normal file
254
lua/plugins/dap.lua
Normal file
@ -0,0 +1,254 @@
|
|||||||
|
return {
|
||||||
|
'mfussenegger/nvim-dap',
|
||||||
|
dependencies = {
|
||||||
|
'mfussenegger/nvim-dap-python',
|
||||||
|
'theHamsta/nvim-dap-virtual-text',
|
||||||
|
{
|
||||||
|
'nvim-telescope/telescope-dap.nvim',
|
||||||
|
dependencies = 'telescope.nvim',
|
||||||
|
},
|
||||||
|
'rcarriga/nvim-dap-ui',
|
||||||
|
'rcarriga/cmp-dap',
|
||||||
|
},
|
||||||
|
keys = {
|
||||||
|
{
|
||||||
|
'<F5>',
|
||||||
|
function()
|
||||||
|
require('dap').continue()
|
||||||
|
end,
|
||||||
|
desc = 'DAP start or continue'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'<S-F5>',
|
||||||
|
function()
|
||||||
|
require('dap').run_last()
|
||||||
|
end,
|
||||||
|
desc = 'DAP run last'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'<F6>',
|
||||||
|
function()
|
||||||
|
loadConfigs()
|
||||||
|
end,
|
||||||
|
desc = 'DAP configs'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'<F7>',
|
||||||
|
function()
|
||||||
|
require('dap').goto_()
|
||||||
|
end,
|
||||||
|
desc = 'DAP goto'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'<F8>',
|
||||||
|
function()
|
||||||
|
require('dap.ui.widgets').hover()
|
||||||
|
end,
|
||||||
|
desc = 'DAP Hover'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'<F9>',
|
||||||
|
function()
|
||||||
|
require('dap').toggle_breakpoint()
|
||||||
|
end,
|
||||||
|
desc = 'DAP breakpoint'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'<F10>',
|
||||||
|
function()
|
||||||
|
require('dap').step_over()
|
||||||
|
end,
|
||||||
|
desc = 'DAP step_over'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'<F11>',
|
||||||
|
function()
|
||||||
|
require('dap').step_into()
|
||||||
|
end,
|
||||||
|
desc = 'DAP step_into'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'<S-F11>',
|
||||||
|
function()
|
||||||
|
require('dap').step_out()
|
||||||
|
end,
|
||||||
|
desc = 'DAP step_out'
|
||||||
|
},
|
||||||
|
},
|
||||||
|
config = function()
|
||||||
|
local dap = require('dap')
|
||||||
|
vim.fn.sign_define('DapBreakpoint', {text='🛑', texthl='', linehl='', numhl=''})
|
||||||
|
require("cmp_dap").is_dap_buffer()
|
||||||
|
|
||||||
|
|
||||||
|
-- make sure we can exit the terminal with esc
|
||||||
|
vim.api.nvim_create_autocmd({ "TermOpen" }, {
|
||||||
|
pattern = { '*dap-terminal*' },
|
||||||
|
callback = function()
|
||||||
|
local opts = { noremap = true }
|
||||||
|
vim.api.nvim_buf_set_keymap(0, 't', '<esc>', [[<C-\><C-n>]], opts)
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
|
local function getVenvSuffix()
|
||||||
|
if vim.loop.os_uname().sysname == 'Linux' then
|
||||||
|
return 'bin/python'
|
||||||
|
elseif vim.loop.os_uname().sysname == 'Windows_NT' then
|
||||||
|
return 'Scripts/python.exe'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function getPythonEnv()
|
||||||
|
local venv = os.getenv("VIRTUAL_ENV")
|
||||||
|
if venv ~= nil then
|
||||||
|
return string.format("%s/%s", venv, getVenvSuffix())
|
||||||
|
end
|
||||||
|
local conda = os.getenv("CONDA_PREFIX")
|
||||||
|
if conda ~= nil then
|
||||||
|
return string.format("%s/%s", conda, 'python.exe')
|
||||||
|
end
|
||||||
|
|
||||||
|
local cwd = vim.fn.getcwd()
|
||||||
|
if vim.fn.executable(cwd .. '/venv/' .. getVenvSuffix()) == 1 then
|
||||||
|
return cwd .. '/venv/' .. getVenvSuffix()
|
||||||
|
elseif vim.fn.executable(cwd .. '/.venv/' .. getVenvSuffix()) == 1 then
|
||||||
|
return cwd .. '/.venv/' .. getVenvSuffix()
|
||||||
|
else
|
||||||
|
if vim.loop.os_uname().sysname == 'Linux' then
|
||||||
|
return '/usr/bin/python'
|
||||||
|
elseif vim.loop.os_uname().sysname == 'Windows_NT' then
|
||||||
|
return os.getenv('SCOOP') .. '/apps/python/current/python.exe'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function loadConfigs()
|
||||||
|
require('dap.ext.vscode').load_launchjs()
|
||||||
|
-- Make sure we use the correct python env even for the configs from launch.json
|
||||||
|
for _, config in pairs(dap.configurations.python) do
|
||||||
|
config.pythonPath = getPythonEnv()
|
||||||
|
config.cwd = vim.fn.getcwd()
|
||||||
|
end
|
||||||
|
require 'telescope'.extensions.dap.configurations {}
|
||||||
|
end
|
||||||
|
|
||||||
|
local masonpath = vim.fn.stdpath('data') .. '/mason'
|
||||||
|
|
||||||
|
-- PYTHON
|
||||||
|
dap.adapters.python = {
|
||||||
|
type = 'executable';
|
||||||
|
command = masonpath .. '/packages/debugpy/venv/' .. getVenvSuffix();
|
||||||
|
args = { '-m', 'debugpy.adapter' };
|
||||||
|
options = {
|
||||||
|
detached = true;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
local dapui = require("dapui")
|
||||||
|
dapui.setup()
|
||||||
|
dap.listeners.after.event_initialized["dapui_config"] = function()
|
||||||
|
dapui.open({})
|
||||||
|
end
|
||||||
|
dap.listeners.before.event_terminated["dapui_config"] = function()
|
||||||
|
dapui.close({})
|
||||||
|
end
|
||||||
|
dap.listeners.before.event_exited["dapui_config"] = function()
|
||||||
|
dapui.close({})
|
||||||
|
end
|
||||||
|
|
||||||
|
dap.configurations.python = {
|
||||||
|
{
|
||||||
|
type = 'python';
|
||||||
|
request = 'launch';
|
||||||
|
name = "Launch file with venv";
|
||||||
|
justMyCode = false;
|
||||||
|
program = "${file}";
|
||||||
|
cwd = vim.fn.getcwd();
|
||||||
|
pythonPath = getPythonEnv
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
-- require('dap-python').setup('C:\\Users\\oli\\AppData\\Local\\nvim\\venv_debugpy\\Scripts\\python')
|
||||||
|
-- table.insert(require('dap').configurations.python, {
|
||||||
|
-- -- type = 'python',
|
||||||
|
-- -- request = 'launch',
|
||||||
|
-- -- name = 'My custom launch configuration',
|
||||||
|
-- -- program = '${file}',
|
||||||
|
-- justMyCode = false
|
||||||
|
-- -- ... more options, see https://github.com/microsoft/debugpy/wiki/Debug-configuration-settings
|
||||||
|
-- })
|
||||||
|
-- require('dap-python').setup('C:/Users/oli/AppData/Local/nvim-data/mason/packages/debugpy/venv/Scripts/python.exe')
|
||||||
|
|
||||||
|
-- CPP
|
||||||
|
dap.adapters.codelldb = {
|
||||||
|
type = 'server',
|
||||||
|
port = "${port}",
|
||||||
|
executable = {
|
||||||
|
-- CHANGE THIS to your path!
|
||||||
|
command = masonpath .. '/bin/codelldb.cmd',
|
||||||
|
args = { '--port', '${port}' },
|
||||||
|
|
||||||
|
-- On windows you may have to uncomment this:
|
||||||
|
detached = false,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dap.adapters.lldb = {
|
||||||
|
type = 'executable',
|
||||||
|
command = function()
|
||||||
|
if vim.loop.os_uname().sysname == 'Linux' then
|
||||||
|
return 'lldb-vscode'
|
||||||
|
else
|
||||||
|
return os.getenv('SCOOP') .. '/apps/llvm/current/bin/lldb-vscode.exe'
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
name = 'lldb'
|
||||||
|
}
|
||||||
|
|
||||||
|
dap.configurations.cpp = {
|
||||||
|
{
|
||||||
|
name = "Launch codelldb",
|
||||||
|
type = "codelldb",
|
||||||
|
request = "launch",
|
||||||
|
program = function()
|
||||||
|
return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/build_nvim/', 'file')
|
||||||
|
end,
|
||||||
|
cwd = '${workspaceFolder}',
|
||||||
|
stopOnEntry = true,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
dap.configurations.cpp = {
|
||||||
|
{
|
||||||
|
name = 'Launch lldb',
|
||||||
|
type = 'lldb',
|
||||||
|
request = 'launch',
|
||||||
|
program = function()
|
||||||
|
return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/build_nvim', '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,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
-- EXTENSIONS
|
||||||
|
|
||||||
|
require('nvim-dap-virtual-text').setup({})
|
||||||
|
require('telescope').load_extension('dap')
|
||||||
|
|
||||||
|
end,
|
||||||
|
}
|
8
lua/plugins/diffview.lua
Normal file
8
lua/plugins/diffview.lua
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
return {
|
||||||
|
'sindrets/diffview.nvim',
|
||||||
|
dependencies = {
|
||||||
|
'nvim-lua/plenary.nvim'
|
||||||
|
},
|
||||||
|
config = true,
|
||||||
|
cmd = 'DiffviewOpen',
|
||||||
|
}
|
12
lua/plugins/gitsigns.lua
Normal file
12
lua/plugins/gitsigns.lua
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
return {
|
||||||
|
'lewis6991/gitsigns.nvim',
|
||||||
|
config = {
|
||||||
|
current_line_blame = false,
|
||||||
|
current_line_blame_opts = {
|
||||||
|
virt_text = true,
|
||||||
|
virt_text_pos = 'eol', -- 'eol' | 'overlay' | 'right_align'
|
||||||
|
delay = 1000,
|
||||||
|
ignore_whitespace = false,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
18
lua/plugins/gruvbox_flat.lua
Normal file
18
lua/plugins/gruvbox_flat.lua
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
return {
|
||||||
|
'eddyekofo94/gruvbox-flat.nvim',
|
||||||
|
priority = 1000,
|
||||||
|
config = function()
|
||||||
|
local colors = require('gruvbox.colors')
|
||||||
|
vim.g.gruvbox_flat_style = "dark"
|
||||||
|
vim.g.gruvbox_colors = {
|
||||||
|
bg_search = 'purple',
|
||||||
|
fg_search = 'black',
|
||||||
|
}
|
||||||
|
vim.g.gruvbox_theme = {
|
||||||
|
Pmenu = { bg = 'bg_visual' },
|
||||||
|
NormalFloat = { bg = 'bg_visual' }
|
||||||
|
}
|
||||||
|
vim.g.gruvbox_dark_float = false
|
||||||
|
vim.cmd('colorscheme gruvbox-flat')
|
||||||
|
end
|
||||||
|
}
|
20
lua/plugins/indent_blankline.lua
Normal file
20
lua/plugins/indent_blankline.lua
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
return {
|
||||||
|
'lukas-reineke/indent-blankline.nvim',
|
||||||
|
dependencies = {
|
||||||
|
'nvim-treesitter/nvim-treesitter',
|
||||||
|
},
|
||||||
|
config = function()
|
||||||
|
local opt = vim.opt -- to set options
|
||||||
|
opt.listchars:append('eol:↴')
|
||||||
|
-- opt.listchars:append("space: ")
|
||||||
|
opt.listchars:append('trail: ')
|
||||||
|
opt.listchars:append('tab:→ ')
|
||||||
|
|
||||||
|
require('indent_blankline').setup({
|
||||||
|
show_end_of_line = true,
|
||||||
|
use_treesitter = true,
|
||||||
|
show_current_context = true,
|
||||||
|
context_patterns = { 'class', 'function', 'method', 'block', '^if', '^for', '^while' },
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
}
|
2
lua/plugins/init.lua
Normal file
2
lua/plugins/init.lua
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
return {
|
||||||
|
}
|
8
lua/plugins/leap.lua
Normal file
8
lua/plugins/leap.lua
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
return {
|
||||||
|
'ggandor/leap.nvim',
|
||||||
|
dependencies = { 'tpope/vim-repeat' },
|
||||||
|
config = function()
|
||||||
|
require('leap').set_default_keymaps()
|
||||||
|
end,
|
||||||
|
event = 'VeryLazy'
|
||||||
|
}
|
252
lua/plugins/lspconfig.lua
Normal file
252
lua/plugins/lspconfig.lua
Normal file
@ -0,0 +1,252 @@
|
|||||||
|
return {
|
||||||
|
'neovim/nvim-lspconfig',
|
||||||
|
dependencies = {
|
||||||
|
'williamboman/mason.nvim',
|
||||||
|
'williamboman/mason-lspconfig.nvim',
|
||||||
|
'p00f/clangd_extensions.nvim',
|
||||||
|
'jose-elias-alvarez/null-ls.nvim',
|
||||||
|
'ray-x/lsp_signature.nvim',
|
||||||
|
{
|
||||||
|
'folke/neodev.nvim',
|
||||||
|
config = true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
config = function()
|
||||||
|
require('mason').setup()
|
||||||
|
require('mason-lspconfig').setup({
|
||||||
|
automatic_installation = false,
|
||||||
|
})
|
||||||
|
|
||||||
|
local capabilities = require('cmp_nvim_lsp').default_capabilities()
|
||||||
|
|
||||||
|
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, width = 80 })
|
||||||
|
end
|
||||||
|
|
||||||
|
local on_attach = function(client, bufnr)
|
||||||
|
local function buf_set_option(...)
|
||||||
|
vim.api.nvim_buf_set_option(bufnr, ...)
|
||||||
|
end
|
||||||
|
|
||||||
|
buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc')
|
||||||
|
vim.api.nvim_buf_set_option(0, 'formatexpr', 'v:lua.vim.lsp.formatexpr()')
|
||||||
|
|
||||||
|
-- Mappings.
|
||||||
|
vim.keymap.set('n', '<space>,', vim.diagnostic.goto_prev,
|
||||||
|
{ noremap = true, silent = false, desc = 'Diag prev', buffer = bufnr })
|
||||||
|
vim.keymap.set('n', '<space>;', vim.diagnostic.goto_next,
|
||||||
|
{ noremap = true, silent = false, desc = 'Diag next', buffer = bufnr })
|
||||||
|
vim.keymap.set('n', '<space>a', vim.lsp.buf.code_action,
|
||||||
|
{ noremap = true, silent = false, desc = 'Code action', buffer = bufnr })
|
||||||
|
vim.keymap.set('n', '<space>d', vim.lsp.buf.definition,
|
||||||
|
{ noremap = true, silent = false, desc = 'Definition', buffer = bufnr })
|
||||||
|
vim.keymap.set('n', '<space>e', vim.lsp.buf.declaration,
|
||||||
|
{ noremap = true, silent = false, desc = 'Declaration', buffer = bufnr })
|
||||||
|
vim.keymap.set('n', '<space>h', vim.lsp.buf.hover,
|
||||||
|
{ noremap = true, silent = false, desc = 'Hover', buffer = bufnr })
|
||||||
|
vim.keymap.set('n', '<space>c', vim.lsp.buf.outgoing_calls,
|
||||||
|
{ noremap = true, silent = false, desc = 'Outgoing calls', buffer = bufnr })
|
||||||
|
vim.keymap.set('n', '<space>C', vim.lsp.buf.incoming_calls,
|
||||||
|
{ noremap = true, silent = false, desc = 'Incoming calls', buffer = bufnr })
|
||||||
|
vim.keymap.set('n', '<space>m', vim.lsp.buf.rename,
|
||||||
|
{ noremap = true, silent = false, desc = 'Rename', buffer = bufnr })
|
||||||
|
local tele_builtins = require('telescope.builtin')
|
||||||
|
vim.keymap.set('n', '<C-t>', tele_builtins.lsp_dynamic_workspace_symbols,
|
||||||
|
{ noremap = true, silent = false, desc = 'Workspace symbols', buffer = bufnr })
|
||||||
|
vim.keymap.set('n', '<space>D', vim.lsp.buf.type_definition,
|
||||||
|
{ noremap = true, silent = false, desc = 'Type definition', buffer = bufnr })
|
||||||
|
vim.keymap.set('n', '<C-k>', vim.lsp.buf.signature_help,
|
||||||
|
{ noremap = true, silent = false, desc = 'Signature help', buffer = bufnr })
|
||||||
|
vim.keymap.set('n', '<space>r', tele_builtins.lsp_references,
|
||||||
|
{ noremap = true, silent = false, desc = 'References', buffer = bufnr })
|
||||||
|
vim.keymap.set('n', '<space>v', function() tele_builtins.diagnostics({ bufnr = 0 }) end,
|
||||||
|
{ noremap = true, silent = false, desc = 'Diagnostics', buffer = bufnr })
|
||||||
|
vim.keymap.set('n', '<A-o>', '<cmd>ClangdSwitchSourceHeader<CR>',
|
||||||
|
{ noremap = true, silent = false, desc = 'Switch Source/Header', buffer = bufnr })
|
||||||
|
|
||||||
|
vim.cmd([[autocmd CursorHold <buffer> lua OpenDiagFloat()]])
|
||||||
|
|
||||||
|
-- Set some keybinds conditional on server capabilities
|
||||||
|
if client.server_capabilities.documentFormattingProvider then
|
||||||
|
vim.keymap.set('n', '<space>f', vim.lsp.buf.format,
|
||||||
|
{ noremap = true, silent = false, desc = 'Format file', buffer = bufnr })
|
||||||
|
end
|
||||||
|
if client.server_capabilities.documentRangeFormattingProvider then
|
||||||
|
vim.keymap.set('x', '<space>f', vim.lsp.buf.format,
|
||||||
|
{ noremap = true, silent = false, desc = 'Format visual', buffer = bufnr })
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Set autocommands conditional on server_capabilities
|
||||||
|
if client.server_capabilities.documentHighlightProvider then
|
||||||
|
vim.api.nvim_set_hl(
|
||||||
|
0,
|
||||||
|
"LspReferenceText",
|
||||||
|
{ bold = true,
|
||||||
|
ctermbg = 'red',
|
||||||
|
bg = "#5a524c" }
|
||||||
|
)
|
||||||
|
vim.api.nvim_set_hl(
|
||||||
|
0,
|
||||||
|
"LspReferenceRead",
|
||||||
|
{ bold = true,
|
||||||
|
ctermbg = 'red',
|
||||||
|
bg = 'DarkGreen' }
|
||||||
|
)
|
||||||
|
vim.api.nvim_set_hl(
|
||||||
|
0,
|
||||||
|
"LspReferenceWrite",
|
||||||
|
{ bold = true,
|
||||||
|
ctermbg = 'red',
|
||||||
|
bg = 'DarkRed' }
|
||||||
|
)
|
||||||
|
vim.api.nvim_create_augroup("lsp_document_highlight", { clear = true })
|
||||||
|
vim.api.nvim_clear_autocmds { buffer = bufnr, group = "lsp_document_highlight" }
|
||||||
|
vim.api.nvim_create_autocmd("CursorHold", {
|
||||||
|
callback = vim.lsp.buf.document_highlight,
|
||||||
|
buffer = bufnr,
|
||||||
|
group = "lsp_document_highlight",
|
||||||
|
desc = "Document Highlight",
|
||||||
|
})
|
||||||
|
vim.api.nvim_create_autocmd("CursorMoved", {
|
||||||
|
callback = vim.lsp.buf.clear_references,
|
||||||
|
buffer = bufnr,
|
||||||
|
group = "lsp_document_highlight",
|
||||||
|
desc = "Clear All the References",
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
require('lsp_signature').on_attach({
|
||||||
|
bind = true, -- This is mandatory, otherwise border config won't get registered.
|
||||||
|
handler_opts = {
|
||||||
|
border = 'single',
|
||||||
|
},
|
||||||
|
hi_parameter = 'IncSearch',
|
||||||
|
}, bufnr)
|
||||||
|
end
|
||||||
|
|
||||||
|
require('lspconfig')['pyright'].setup {
|
||||||
|
capabilities = capabilities,
|
||||||
|
on_attach = on_attach,
|
||||||
|
}
|
||||||
|
|
||||||
|
require('lspconfig')['groovyls'].setup {
|
||||||
|
capabilities = capabilities,
|
||||||
|
on_attach = on_attach,
|
||||||
|
}
|
||||||
|
|
||||||
|
require('lspconfig')['cmake'].setup {
|
||||||
|
capabilities = capabilities,
|
||||||
|
on_attach = on_attach,
|
||||||
|
}
|
||||||
|
|
||||||
|
local clangd_capabilities = capabilities
|
||||||
|
clangd_capabilities.textDocument.semanticHighlighting = true
|
||||||
|
clangd_capabilities.offsetEncoding = { "utf-16" }
|
||||||
|
require("clangd_extensions").setup {
|
||||||
|
server = {
|
||||||
|
capabilities = clangd_capabilities,
|
||||||
|
on_attach = on_attach,
|
||||||
|
cmd = { 'clangd', '--compile-commands-dir=build_nvim' },
|
||||||
|
root_dir = require('lspconfig').util.root_pattern(
|
||||||
|
'.clangd',
|
||||||
|
'.clang-tidy',
|
||||||
|
'.clang-format',
|
||||||
|
'compile_commands.json',
|
||||||
|
'compile_flags.txt',
|
||||||
|
'configure.ac',
|
||||||
|
'.git',
|
||||||
|
'build_nvim'
|
||||||
|
)
|
||||||
|
},
|
||||||
|
extensions =
|
||||||
|
{
|
||||||
|
inlay_hints = {
|
||||||
|
-- Only show inlay hints for the current line
|
||||||
|
only_current_line = true,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
-- require('clangd_extensions').setup({
|
||||||
|
-- server = {
|
||||||
|
-- on_attach = on_attach,
|
||||||
|
-- capabilities = capabilities,
|
||||||
|
-- cmd = { 'clangd', '--compile-commands-dir=build_nvim' },
|
||||||
|
-- },
|
||||||
|
-- })
|
||||||
|
|
||||||
|
require('lspconfig')['jsonls'].setup {
|
||||||
|
capabilities = capabilities,
|
||||||
|
on_attach = on_attach,
|
||||||
|
}
|
||||||
|
|
||||||
|
local lua_rtp = vim.split(package.path, ';')
|
||||||
|
table.insert(lua_rtp, 'lua/?.lua')
|
||||||
|
table.insert(lua_rtp, 'lua/?/init.lua')
|
||||||
|
require('lspconfig').sumneko_lua.setup {
|
||||||
|
capabilities = capabilities,
|
||||||
|
on_attach = on_attach,
|
||||||
|
settings = {
|
||||||
|
Lua = {
|
||||||
|
runtime = {
|
||||||
|
-- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim)
|
||||||
|
version = 'LuaJIT',
|
||||||
|
-- Setup your lua path
|
||||||
|
path = lua_rtp,
|
||||||
|
},
|
||||||
|
diagnostics = {
|
||||||
|
-- Get the language server to recognize the `vim` global
|
||||||
|
globals = { 'vim', 'use' },
|
||||||
|
},
|
||||||
|
workspace = {
|
||||||
|
-- Make the server aware of Neovim runtime files
|
||||||
|
library = vim.api.nvim_get_runtime_file('', true),
|
||||||
|
checkThirdParty = false,
|
||||||
|
},
|
||||||
|
-- Do not send telemetry data containing a randomized but unique identifier
|
||||||
|
telemetry = {
|
||||||
|
enable = false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
require('lspconfig')['dockerls'].setup {
|
||||||
|
capabilities = capabilities,
|
||||||
|
on_attach = on_attach,
|
||||||
|
}
|
||||||
|
|
||||||
|
require('lspconfig')['yamlls'].setup {
|
||||||
|
capabilities = capabilities,
|
||||||
|
on_attach = on_attach,
|
||||||
|
settings = {
|
||||||
|
yaml = {
|
||||||
|
validate = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
local null_ls = require('null-ls')
|
||||||
|
null_ls.setup({
|
||||||
|
sources = {
|
||||||
|
null_ls.builtins.code_actions.gitsigns,
|
||||||
|
null_ls.builtins.formatting.autopep8,
|
||||||
|
null_ls.builtins.formatting.prettier,
|
||||||
|
null_ls.builtins.formatting.xmlformat,
|
||||||
|
null_ls.builtins.diagnostics.flake8,
|
||||||
|
null_ls.builtins.formatting.isort,
|
||||||
|
null_ls.builtins.formatting.cmake_format,
|
||||||
|
},
|
||||||
|
on_attach = on_attach,
|
||||||
|
capabilities = capabilities,
|
||||||
|
})
|
||||||
|
|
||||||
|
vim.diagnostic.config({ virtual_text = false })
|
||||||
|
end,
|
||||||
|
event = 'VeryLazy'
|
||||||
|
}
|
32
lua/plugins/lualine.lua
Normal file
32
lua/plugins/lualine.lua
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
return {
|
||||||
|
'hoob3rt/lualine.nvim',
|
||||||
|
dependencies = { 'kyazdani42/nvim-web-devicons' },
|
||||||
|
config = {
|
||||||
|
options = {
|
||||||
|
theme = 'gruvbox-flat',
|
||||||
|
disabled_filetypes = {
|
||||||
|
statusline = {},
|
||||||
|
winbar = { 'dap-repl', 'dapui_console' },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
sections = { lualine_c = { 'getcwd', { 'filename', path = 1, file_status = true } } },
|
||||||
|
inactive_sections = { lualine_c = { 'getcwd', { 'filename', path = 1, file_status = true } } },
|
||||||
|
globalstatus = true,
|
||||||
|
winbar = {
|
||||||
|
lualine_a = {},
|
||||||
|
lualine_b = {},
|
||||||
|
lualine_c = { { 'filename', path = 1, file_status = true } },
|
||||||
|
lualine_x = {},
|
||||||
|
lualine_y = {},
|
||||||
|
lualine_z = {}
|
||||||
|
},
|
||||||
|
inactive_winbar = {
|
||||||
|
lualine_a = {},
|
||||||
|
lualine_b = {},
|
||||||
|
lualine_c = { { 'filename', path = 1, file_status = true } },
|
||||||
|
lualine_x = {},
|
||||||
|
lualine_y = {},
|
||||||
|
lualine_z = {}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
66
lua/plugins/luasnip.lua
Normal file
66
lua/plugins/luasnip.lua
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
return {
|
||||||
|
'L3MON4D3/LuaSnip',
|
||||||
|
config = function()
|
||||||
|
local ls = require('luasnip')
|
||||||
|
-- some shorthands...
|
||||||
|
local s = ls.snippet
|
||||||
|
local sn = ls.snippet_node
|
||||||
|
local isn = ls.indent_snippet_node
|
||||||
|
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 r = ls.restore_node
|
||||||
|
local l = require('luasnip.extras').lambda
|
||||||
|
local rep = require('luasnip.extras').rep
|
||||||
|
local p = require('luasnip.extras').partial
|
||||||
|
local m = require('luasnip.extras').match
|
||||||
|
local n = require('luasnip.extras').nonempty
|
||||||
|
local dl = require('luasnip.extras').dynamic_lambda
|
||||||
|
local fmt = require('luasnip.extras.fmt').fmt
|
||||||
|
local fmta = require('luasnip.extras.fmt').fmta
|
||||||
|
local types = require('luasnip.util.types')
|
||||||
|
local conds = require('luasnip.extras.expand_conditions')
|
||||||
|
|
||||||
|
local function getRegA(capitalize)
|
||||||
|
local clipboard = vim.fn.getreg('a')
|
||||||
|
clipboard = clipboard:gsub('^m_', '')
|
||||||
|
if capitalize then
|
||||||
|
clipboard = clipboard:gsub('^%l', string.upper)
|
||||||
|
end
|
||||||
|
return clipboard
|
||||||
|
end
|
||||||
|
|
||||||
|
ls.snippets = {
|
||||||
|
cpp = {
|
||||||
|
s('TEST_F_getset',
|
||||||
|
{
|
||||||
|
t('TEST_F('), i(1, 'TestClass'), t(' ,test_'), p(getRegA, false), t({ '_set_get)', '{', ' ' }),
|
||||||
|
i(2, 'm_object'), t('.set'), p(getRegA, true), t('('), i(3, '32.F'), t({ ');', ' ' }),
|
||||||
|
i(4, 'EXPECT_EQ('), rep(3), t(', '), rep(2), t('.get'), p(getRegA, true), t({ '());', '' }),
|
||||||
|
t({ '', '}', '' })
|
||||||
|
}),
|
||||||
|
s('TEST_fn_getset',
|
||||||
|
{
|
||||||
|
t('void '), p(getRegA, false), t('_'), i(1, 'get'), t('_'), i(2, 'set'), t({ '()', '{', ' ' }),
|
||||||
|
i(3, 'm_object'), t('.set'), p(getRegA, true), t('('), i(4, '32.F'), t({ ');', ' ' }),
|
||||||
|
i(5, 'EXPECT_EQ('), rep(4), t(', '), rep(3), t('.get'), p(getRegA, true), t({ '());', '' }),
|
||||||
|
t({ '', '}', '', '' }),
|
||||||
|
|
||||||
|
t('TEST_F('), i(5), t(' ,test_'), p(getRegA, false), t({ '_set_get)', '{', ' ' }),
|
||||||
|
p(getRegA, false), t('_'), rep(1), t('_'), rep(2), t({ '();' }),
|
||||||
|
t({ '', '}' }),
|
||||||
|
})
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
require('luasnip.loaders.from_vscode').lazy_load()
|
||||||
|
require('luasnip.loaders.from_vscode').lazy_load({ paths = { "./my-snippets" } })
|
||||||
|
end,
|
||||||
|
dependencies =
|
||||||
|
{
|
||||||
|
'rafamadriz/friendly-snippets'
|
||||||
|
},
|
||||||
|
cmd = 'LuaSnipListAvailable'
|
||||||
|
}
|
18
lua/plugins/neoclip.lua
Normal file
18
lua/plugins/neoclip.lua
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
return {
|
||||||
|
"AckslD/nvim-neoclip.lua",
|
||||||
|
dependencies = {
|
||||||
|
{ 'kkharji/sqlite.lua', module = 'sqlite' },
|
||||||
|
-- { 'nvim-telescope/telescope.nvim' },
|
||||||
|
},
|
||||||
|
config = true,
|
||||||
|
keys = {
|
||||||
|
{
|
||||||
|
'[',
|
||||||
|
function ()
|
||||||
|
require('telescope').extensions.neoclip.default({initial_mode='normal'})
|
||||||
|
end,
|
||||||
|
desc = 'NeoClip'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
event = 'VeryLazy'
|
||||||
|
}
|
34
lua/plugins/neogen.lua
Normal file
34
lua/plugins/neogen.lua
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
return {
|
||||||
|
'danymat/neogen',
|
||||||
|
dependencies = 'nvim-treesitter/nvim-treesitter',
|
||||||
|
config = {
|
||||||
|
enabled = true,
|
||||||
|
languages = {
|
||||||
|
cpp = {
|
||||||
|
template = {
|
||||||
|
annotation_convention = 'custom',
|
||||||
|
custom = {
|
||||||
|
{ nil, '/// file', { no_results = true, type = { 'file' } } },
|
||||||
|
{ nil, '/// $1', { no_results = true, type = { 'func', 'file' } } },
|
||||||
|
{ nil, '', { no_results = true, type = { 'file' } } },
|
||||||
|
|
||||||
|
{ nil, '/// $1', { type = { 'func' } } },
|
||||||
|
{ 'tparam', '/// \\tparam %s $1' },
|
||||||
|
{ 'parameters', '/// \\param %s $1' },
|
||||||
|
{ 'return_statement', '/// \\return $1' },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
keys = {
|
||||||
|
{
|
||||||
|
'<leader>n',
|
||||||
|
function()
|
||||||
|
require('neogen').generate({})
|
||||||
|
end,
|
||||||
|
desc = 'Add comment',
|
||||||
|
}
|
||||||
|
},
|
||||||
|
cmd = 'Neogen'
|
||||||
|
}
|
38
lua/plugins/neotest.lua
Normal file
38
lua/plugins/neotest.lua
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
return {
|
||||||
|
'nvim-neotest/neotest',
|
||||||
|
dependencies = {
|
||||||
|
'nvim-lua/plenary.nvim',
|
||||||
|
'nvim-treesitter/nvim-treesitter',
|
||||||
|
'antoinemadec/FixCursorHold.nvim',
|
||||||
|
'nvim-neotest/neotest-python'
|
||||||
|
},
|
||||||
|
config = function()
|
||||||
|
require("neotest").setup({
|
||||||
|
adapters = {
|
||||||
|
require("neotest-python")({
|
||||||
|
dap = {
|
||||||
|
justMyCode = false
|
||||||
|
},
|
||||||
|
args = { "--log-level", "DEBUG" },
|
||||||
|
runner = 'pytest',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
keys = {
|
||||||
|
{
|
||||||
|
'<F3>',
|
||||||
|
function()
|
||||||
|
require("neotest").run.run()
|
||||||
|
end,
|
||||||
|
desc = 'Run nearest test'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'<S-F3>',
|
||||||
|
function()
|
||||||
|
require("neotest").run.run({ strategy = "dap" })
|
||||||
|
end,
|
||||||
|
desc = 'Run nearest test'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
62
lua/plugins/neotree.lua
Normal file
62
lua/plugins/neotree.lua
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
return {
|
||||||
|
'nvim-neo-tree/neo-tree.nvim',
|
||||||
|
cmd = 'Neotree',
|
||||||
|
keys = {
|
||||||
|
{ '\\', '<cmd>Neotree reveal<cr>', desc = 'NeoTree' },
|
||||||
|
},
|
||||||
|
dependencies = {
|
||||||
|
'nvim-lua/plenary.nvim',
|
||||||
|
-- 'nvim-tree/nvim-web-devicons', -- not strictly required, but recommended
|
||||||
|
'kyazdani42/nvim-web-devicons',
|
||||||
|
'MunifTanjim/nui.nvim',
|
||||||
|
},
|
||||||
|
config = {
|
||||||
|
window = { -- see https://github.com/MunifTanjim/nui.nvim/tree/main/lua/nui/popup for
|
||||||
|
-- possible options. These can also be functions that return these options.
|
||||||
|
position = 'float', -- left, right, float, current
|
||||||
|
width = 40, -- applies to left and right positions
|
||||||
|
popup = { -- settings that apply to float position only
|
||||||
|
size = {
|
||||||
|
height = '80%',
|
||||||
|
width = '50%',
|
||||||
|
},
|
||||||
|
position = '50%', -- 50% means center it
|
||||||
|
-- you can also specify border here, if you want a different setting from
|
||||||
|
-- the global popup_border_style.
|
||||||
|
},
|
||||||
|
enable_git_status = false,
|
||||||
|
-- Mappings for tree window. See `:h nep-tree-mappings` for a list of built-in commands.
|
||||||
|
-- You can also create your own commands by providing a function instead of a string.
|
||||||
|
mappings = {
|
||||||
|
['<space>'] = 'toggle_node',
|
||||||
|
['<2-LeftMouse>'] = 'open',
|
||||||
|
['<cr>'] = 'open',
|
||||||
|
['s'] = 'open_split',
|
||||||
|
['v'] = 'open_vsplit',
|
||||||
|
['C'] = 'close_node',
|
||||||
|
['z'] = 'close_all_nodes',
|
||||||
|
['R'] = 'refresh',
|
||||||
|
['a'] = 'add',
|
||||||
|
['A'] = 'add_directory',
|
||||||
|
['d'] = 'delete',
|
||||||
|
['r'] = 'rename',
|
||||||
|
['y'] = 'copy_to_clipboard',
|
||||||
|
['x'] = 'cut_to_clipboard',
|
||||||
|
['p'] = 'paste_from_clipboard',
|
||||||
|
['c'] = 'copy', -- takes text input for destination
|
||||||
|
['m'] = 'move', -- takes text input for destination
|
||||||
|
['q'] = 'close_window',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
filesystem = {
|
||||||
|
filtered_items = {
|
||||||
|
hide_dotfiles = false,
|
||||||
|
hide_gitignored = false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
source_selector = {
|
||||||
|
winbar = true,
|
||||||
|
statusline = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
5
lua/plugins/nvim-ts-rainbow.lua
Normal file
5
lua/plugins/nvim-ts-rainbow.lua
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
return {
|
||||||
|
'p00f/nvim-ts-rainbow',
|
||||||
|
dependencies = 'nvim-treesitter/nvim-treesitter',
|
||||||
|
event = 'VeryLazy'
|
||||||
|
}
|
19
lua/plugins/overseer.lua
Normal file
19
lua/plugins/overseer.lua
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
return {
|
||||||
|
'stevearc/overseer.nvim',
|
||||||
|
config = function()
|
||||||
|
require('overseer').setup({
|
||||||
|
templates = { "builtin", "user.cmake.cmake" },
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
keys = {
|
||||||
|
{
|
||||||
|
'<f4>',
|
||||||
|
function()
|
||||||
|
require('overseer').open()
|
||||||
|
require('overseer').run_template()
|
||||||
|
end,
|
||||||
|
mode = { 'n', 'x' },
|
||||||
|
desc = 'Start task (overseer)',
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
12
lua/plugins/project.lua
Normal file
12
lua/plugins/project.lua
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
return {
|
||||||
|
'ahmedkhalf/project.nvim',
|
||||||
|
config = function()
|
||||||
|
require("project_nvim").setup(
|
||||||
|
{
|
||||||
|
silent_chdir = true,
|
||||||
|
ignore_lsp = { 'null-ls', 'cmake' },
|
||||||
|
patterns = { ".git", "_darcs", ".hg", ".bzr", ".svn", "Makefile", "package.json", "build_nvim", "real_path.txt" },
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
-- event = 'BufReadPre'
|
||||||
|
}
|
167
lua/plugins/telescope.lua
Normal file
167
lua/plugins/telescope.lua
Normal file
@ -0,0 +1,167 @@
|
|||||||
|
return {
|
||||||
|
'nvim-telescope/telescope.nvim',
|
||||||
|
dependencies = {
|
||||||
|
'nvim-lua/plenary.nvim',
|
||||||
|
'kyazdani42/nvim-web-devicons',
|
||||||
|
{
|
||||||
|
'nvim-telescope/telescope-fzf-native.nvim',
|
||||||
|
build = {
|
||||||
|
'cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release -G Ninja', -- On windows add -DCMAKE_C_FLAGS="-target x86_64-w64-mingw32"
|
||||||
|
'cmake --build build --config Release',
|
||||||
|
'cmake --install build --prefix build'
|
||||||
|
},
|
||||||
|
},
|
||||||
|
'nvim-telescope/telescope-ui-select.nvim',
|
||||||
|
'ahmedkhalf/project.nvim',
|
||||||
|
},
|
||||||
|
cmd = { "Telescope" },
|
||||||
|
keys = {
|
||||||
|
{
|
||||||
|
'<leader>f',
|
||||||
|
function()
|
||||||
|
require("telescope.builtin").find_files({ no_ignore = true })
|
||||||
|
end,
|
||||||
|
desc = 'Find file',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'<leader>g',
|
||||||
|
function()
|
||||||
|
Project_files()
|
||||||
|
end,
|
||||||
|
desc = 'Find git files',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'<leader>o',
|
||||||
|
function()
|
||||||
|
require("telescope.builtin").oldfiles()
|
||||||
|
end,
|
||||||
|
desc = 'Find old files',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'<leader>h',
|
||||||
|
function()
|
||||||
|
require("telescope.builtin").command_history()
|
||||||
|
end,
|
||||||
|
desc = 'Open command history',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'<leader>b',
|
||||||
|
function()
|
||||||
|
require("telescope.builtin").buffers()
|
||||||
|
end,
|
||||||
|
desc = 'Select buffer',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'<leader>q',
|
||||||
|
function()
|
||||||
|
require("telescope.builtin").quickfix()
|
||||||
|
end,
|
||||||
|
desc = 'Quickfix list with telescope',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'<leader>l',
|
||||||
|
function()
|
||||||
|
require("telescope.builtin").live_grep()
|
||||||
|
end,
|
||||||
|
desc = 'Search in project',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'<leader>j',
|
||||||
|
function()
|
||||||
|
require("telescope.builtin").jumplist()
|
||||||
|
end,
|
||||||
|
desc = 'Open jumplist',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'<c-f>',
|
||||||
|
function()
|
||||||
|
require("telescope.builtin").current_buffer_fuzzy_find()
|
||||||
|
end,
|
||||||
|
desc = 'Find in buffer',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'<leader>d',
|
||||||
|
function()
|
||||||
|
require("telescope.builtin").grep_string()
|
||||||
|
end,
|
||||||
|
desc = 'Find in workspace',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'<space>p',
|
||||||
|
function()
|
||||||
|
require('telescope').extensions.projects.projects()
|
||||||
|
end,
|
||||||
|
desc = 'Select project',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
config = function()
|
||||||
|
local actions = require('telescope.actions')
|
||||||
|
|
||||||
|
local mappingTab = {
|
||||||
|
i = {
|
||||||
|
['<cr>'] = actions.select_tab,
|
||||||
|
['<C-b>'] = actions.select_default,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
Project_files = function()
|
||||||
|
local opts = {} -- define here if you want to define something
|
||||||
|
local ok = pcall(require "telescope.builtin".git_files, opts)
|
||||||
|
if not ok then require "telescope.builtin".find_files(opts) end
|
||||||
|
end
|
||||||
|
|
||||||
|
require('telescope').setup({
|
||||||
|
defaults = {
|
||||||
|
mappings = {
|
||||||
|
i = {
|
||||||
|
['<cr>'] = actions.select_default + actions.center,
|
||||||
|
['<C-l>'] = actions.send_selected_to_loclist,
|
||||||
|
['<C-q>'] = actions.smart_send_to_qflist,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
pickers = {
|
||||||
|
-- Your special builtin config goes in here
|
||||||
|
buffers = {
|
||||||
|
sort_lastused = true,
|
||||||
|
theme = 'ivy',
|
||||||
|
mappings = {
|
||||||
|
i = {
|
||||||
|
['<c-w>'] = actions.delete_buffer,
|
||||||
|
['<cr>'] = actions.select_default,
|
||||||
|
},
|
||||||
|
n = {
|
||||||
|
['<c-w>'] = actions.delete_buffer,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
find_files = {
|
||||||
|
theme = 'ivy',
|
||||||
|
previewer = false,
|
||||||
|
},
|
||||||
|
oldfiles = {
|
||||||
|
theme = 'ivy',
|
||||||
|
},
|
||||||
|
git_files = {
|
||||||
|
theme = 'ivy',
|
||||||
|
previewer = false,
|
||||||
|
},
|
||||||
|
lsp_references = {
|
||||||
|
show_line = false;
|
||||||
|
include_declaration = false,
|
||||||
|
},
|
||||||
|
lsp_dynamic_workspace_symbols = {},
|
||||||
|
},
|
||||||
|
extensions = {
|
||||||
|
["ui-select"] = {
|
||||||
|
require("telescope.themes").get_dropdown {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
require("telescope").load_extension("ui-select")
|
||||||
|
require('telescope').load_extension('fzf')
|
||||||
|
-- require('telescope').load_extension('projects')
|
||||||
|
end
|
||||||
|
}
|
47
lua/plugins/toggleterm.lua
Normal file
47
lua/plugins/toggleterm.lua
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
return {
|
||||||
|
'akinsho/toggleterm.nvim',
|
||||||
|
config = function()
|
||||||
|
function _G.set_terminal_keymaps(term)
|
||||||
|
local opts = { noremap = true }
|
||||||
|
if (term.cmd ~= 'lazygit') then
|
||||||
|
vim.api.nvim_buf_set_keymap(term.bufnr, 't', '<esc>', [[<C-\><C-n>]], opts)
|
||||||
|
end
|
||||||
|
vim.api.nvim_buf_set_keymap(term.bufnr, 't', 'jk', [[<C-\><C-n>]], opts)
|
||||||
|
vim.api.nvim_buf_set_keymap(term.bufnr, 't', '<C-h>', [[<C-\><C-n><C-W>h]], opts)
|
||||||
|
vim.api.nvim_buf_set_keymap(term.bufnr, 't', '<C-j>', [[<C-\><C-n><C-W>j]], opts)
|
||||||
|
vim.api.nvim_buf_set_keymap(term.bufnr, 't', '<C-k>', [[<C-\><C-n><C-W>k]], opts)
|
||||||
|
vim.api.nvim_buf_set_keymap(term.bufnr, 't', '<C-l>', [[<C-\><C-n><C-W>l]], opts)
|
||||||
|
end
|
||||||
|
|
||||||
|
require('toggleterm').setup({
|
||||||
|
on_open = set_terminal_keymaps
|
||||||
|
})
|
||||||
|
|
||||||
|
local Terminal = require('toggleterm.terminal').Terminal
|
||||||
|
|
||||||
|
local lazygit = Terminal:new({
|
||||||
|
cmd = 'lazygit',
|
||||||
|
-- dir = vim.fn.getcwd(),
|
||||||
|
hidden = true,
|
||||||
|
direction = 'float',
|
||||||
|
on_open = function(term)
|
||||||
|
vim.api.nvim_buf_set_keymap(term.bufnr, "n", "q", "<cmd>close<CR>", { noremap = true, silent = true })
|
||||||
|
-- vim.api.nvim_buf_set_keymap(term.bufnr, 't', '<esc>', '<esc>', {noremap = true, silent = true})
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
function _lazygit_toggle()
|
||||||
|
lazygit:toggle()
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
cmd = 'ToggleTerm',
|
||||||
|
keys = {
|
||||||
|
{
|
||||||
|
'<Space>g',
|
||||||
|
function()
|
||||||
|
_lazygit_toggle()
|
||||||
|
end,
|
||||||
|
desc= 'Open lazygit',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
50
lua/plugins/treesitter.lua
Normal file
50
lua/plugins/treesitter.lua
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
return {
|
||||||
|
'nvim-treesitter/nvim-treesitter',
|
||||||
|
build = ':TSUpdate',
|
||||||
|
config = function()
|
||||||
|
require('nvim-treesitter.configs').setup({
|
||||||
|
ensure_installed = 'all',
|
||||||
|
highlight = {
|
||||||
|
enable = true
|
||||||
|
},
|
||||||
|
rainbow = {
|
||||||
|
enable = true,
|
||||||
|
extended_mode = true, -- Also highlight non-bracket delimiters like html tags, boolean or table: lang -> boolean
|
||||||
|
max_file_lines = nil, -- Do not enable for files with more than n lines, int
|
||||||
|
-- colors = {}, -- table of hex strings
|
||||||
|
-- termcolors = {} -- table of colour name strings
|
||||||
|
},
|
||||||
|
indent = {
|
||||||
|
enable = false -- maybe buggy
|
||||||
|
},
|
||||||
|
textobjects = {
|
||||||
|
select = {
|
||||||
|
enable = true,
|
||||||
|
|
||||||
|
-- Automatically jump forward to textobj, similar to targets.vim
|
||||||
|
lookahead = true,
|
||||||
|
|
||||||
|
keymaps = {
|
||||||
|
-- You can use the capture groups defined in textobjects.scm
|
||||||
|
["af"] = "@function.outer",
|
||||||
|
["if"] = "@function.inner",
|
||||||
|
["ac"] = "@class.outer",
|
||||||
|
["ic"] = "@class.inner",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
lsp_interop = {
|
||||||
|
enable = true,
|
||||||
|
border = 'none',
|
||||||
|
peek_definition_code = {
|
||||||
|
["<leader>df"] = "@function.outer",
|
||||||
|
["<leader>dF"] = "@class.outer",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
local parser = require('nvim-treesitter.parsers').filetype_to_parsername
|
||||||
|
parser.groovy = 'java' -- the someft filetype will use the python parser and queries.
|
||||||
|
require("nvim-treesitter.install").prefer_git = true
|
||||||
|
end
|
||||||
|
}
|
||||||
|
|
12
lua/plugins/which-key.lua
Normal file
12
lua/plugins/which-key.lua
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
return {
|
||||||
|
'folke/which-key.nvim',
|
||||||
|
config = {
|
||||||
|
plugins = {
|
||||||
|
marks = false,
|
||||||
|
registers = false,
|
||||||
|
presets = {
|
||||||
|
operators = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,13 +0,0 @@
|
|||||||
require('Comment').setup({
|
|
||||||
mappings = false,
|
|
||||||
})
|
|
||||||
require('legendary').keymap(
|
|
||||||
{
|
|
||||||
'<c-c>',
|
|
||||||
{
|
|
||||||
n = '<Plug>(comment_toggle_linewise_current)',
|
|
||||||
v = '<Plug>(comment_toggle_linewise_visual)gv'
|
|
||||||
},
|
|
||||||
description = 'Toggle comment'
|
|
||||||
}
|
|
||||||
)
|
|
@ -1,9 +0,0 @@
|
|||||||
require('gitsigns').setup({
|
|
||||||
current_line_blame = false,
|
|
||||||
current_line_blame_opts = {
|
|
||||||
virt_text = true,
|
|
||||||
virt_text_pos = 'eol', -- 'eol' | 'overlay' | 'right_align'
|
|
||||||
delay = 1000,
|
|
||||||
ignore_whitespace = false,
|
|
||||||
},
|
|
||||||
})
|
|
@ -1,12 +0,0 @@
|
|||||||
local opt = vim.opt -- to set options
|
|
||||||
opt.listchars:append('eol:↴')
|
|
||||||
-- opt.listchars:append("space: ")
|
|
||||||
opt.listchars:append('trail: ')
|
|
||||||
opt.listchars:append('tab:→ ')
|
|
||||||
|
|
||||||
require('indent_blankline').setup({
|
|
||||||
show_end_of_line = true,
|
|
||||||
use_treesitter = true,
|
|
||||||
show_current_context = true,
|
|
||||||
context_patterns = { 'class', 'function', 'method', 'block', '^if', '^for', '^while' },
|
|
||||||
})
|
|
@ -1,29 +0,0 @@
|
|||||||
vim.opt.laststatus = 3
|
|
||||||
require('lualine').setup({
|
|
||||||
options = {
|
|
||||||
theme = 'gruvbox-flat',
|
|
||||||
disabled_filetypes = {
|
|
||||||
statusline = {},
|
|
||||||
winbar = { 'dap-repl', 'dapui_console' },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
sections = { lualine_c = { 'getcwd', { 'filename', path = 1, file_status = true } } },
|
|
||||||
inactive_sections = { lualine_c = { 'getcwd', { 'filename', path = 1, file_status = true } } },
|
|
||||||
globalstatus = true,
|
|
||||||
winbar = {
|
|
||||||
lualine_a = {},
|
|
||||||
lualine_b = {},
|
|
||||||
lualine_c = { { 'filename', path = 1, file_status = true } },
|
|
||||||
lualine_x = {},
|
|
||||||
lualine_y = {},
|
|
||||||
lualine_z = {}
|
|
||||||
},
|
|
||||||
inactive_winbar = {
|
|
||||||
lualine_a = {},
|
|
||||||
lualine_b = {},
|
|
||||||
lualine_c = { { 'filename', path = 1, file_status = true } },
|
|
||||||
lualine_x = {},
|
|
||||||
lualine_y = {},
|
|
||||||
lualine_z = {}
|
|
||||||
},
|
|
||||||
})
|
|
@ -1,67 +0,0 @@
|
|||||||
local ls = require('luasnip')
|
|
||||||
-- some shorthands...
|
|
||||||
local s = ls.snippet
|
|
||||||
local sn = ls.snippet_node
|
|
||||||
local isn = ls.indent_snippet_node
|
|
||||||
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 r = ls.restore_node
|
|
||||||
local l = require('luasnip.extras').lambda
|
|
||||||
local rep = require('luasnip.extras').rep
|
|
||||||
local p = require('luasnip.extras').partial
|
|
||||||
local m = require('luasnip.extras').match
|
|
||||||
local n = require('luasnip.extras').nonempty
|
|
||||||
local dl = require('luasnip.extras').dynamic_lambda
|
|
||||||
local fmt = require('luasnip.extras.fmt').fmt
|
|
||||||
local fmta = require('luasnip.extras.fmt').fmta
|
|
||||||
local types = require('luasnip.util.types')
|
|
||||||
local conds = require('luasnip.extras.expand_conditions')
|
|
||||||
|
|
||||||
local function getRegA(capitalize)
|
|
||||||
local clipboard = vim.fn.getreg('a')
|
|
||||||
clipboard = clipboard:gsub('^m_', '')
|
|
||||||
if capitalize then
|
|
||||||
clipboard = clipboard:gsub('^%l', string.upper)
|
|
||||||
end
|
|
||||||
return clipboard
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
ls.snippets = {
|
|
||||||
cpp = {
|
|
||||||
s('TEST_F_getset',
|
|
||||||
{
|
|
||||||
t('TEST_F('), i(1, 'TestClass'), t(' ,test_'), p(getRegA, false), t({'_set_get)', '{', ' '}),
|
|
||||||
i(2, 'm_object'), t('.set'), p(getRegA, true), t('('), i(3, '32.F'), t({');', ' '}),
|
|
||||||
i(4, 'EXPECT_EQ('), rep(3), t(', '), rep(2), t('.get'), p(getRegA, true), t({'());', ''}),
|
|
||||||
t({'','}', ''})
|
|
||||||
}),
|
|
||||||
s('TEST_fn_getset',
|
|
||||||
{
|
|
||||||
t('void '), p(getRegA, false), t('_'), i(1, 'get'), t('_'), i(2, 'set'), t({'()', '{', ' '}),
|
|
||||||
i(3, 'm_object'), t('.set'), p(getRegA, true), t('('), i(4, '32.F'), t({');', ' '}),
|
|
||||||
i(5, 'EXPECT_EQ('), rep(4), t(', '), rep(3), t('.get'), p(getRegA, true), t({'());', ''}),
|
|
||||||
t({'','}', '', ''}),
|
|
||||||
|
|
||||||
t('TEST_F('), i(5), t(' ,test_'), p(getRegA, false), t({'_set_get)', '{', ' '}),
|
|
||||||
p(getRegA, false), t('_'), rep(1), t('_'), rep(2), t({'();'}),
|
|
||||||
t({'','}'}),
|
|
||||||
})
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
require('luasnip.loaders.from_vscode').lazy_load()
|
|
||||||
require('luasnip.loaders.from_vscode').lazy_load({ paths = { "./my-snippets" } })
|
|
||||||
|
|
||||||
|
|
||||||
require('legendary').commands(
|
|
||||||
{
|
|
||||||
{
|
|
||||||
':LuaSnipListAvailable<CR>',
|
|
||||||
description = 'List snippets',
|
|
||||||
}
|
|
||||||
}
|
|
||||||
)
|
|
@ -1,141 +0,0 @@
|
|||||||
local cmp = require('cmp')
|
|
||||||
local luasnip = require('luasnip')
|
|
||||||
|
|
||||||
local t = function(str)
|
|
||||||
return vim.api.nvim_replace_termcodes(str, true, true, true)
|
|
||||||
end
|
|
||||||
|
|
||||||
local check_back_space = function()
|
|
||||||
local col = vim.fn.col('.') - 1
|
|
||||||
return col == 0 or vim.fn.getline('.'):sub(col, col):match('%s') ~= nil
|
|
||||||
end
|
|
||||||
|
|
||||||
cmp.setup({
|
|
||||||
formatting = {
|
|
||||||
format = require('lspkind').cmp_format({
|
|
||||||
mode = 'symbol_text', -- show only symbol annotations
|
|
||||||
maxwidth = 80, -- prevent the popup from showing more than provided characters (e.g 50 will not show more than 50 characters)
|
|
||||||
ellipsis_char = '...', -- when popup menu exceed maxwidth, the truncated part would show ellipsis_char instead (must define maxwidth first)
|
|
||||||
})
|
|
||||||
},
|
|
||||||
mapping = {
|
|
||||||
['<Up>'] = cmp.mapping(cmp.mapping.select_prev_item(), { 'i', 'c', 's' }),
|
|
||||||
['<Down>'] = cmp.mapping(cmp.mapping.select_next_item(), { 'i', 'c', 's' }),
|
|
||||||
['<C-d>'] = cmp.mapping.scroll_docs(-4),
|
|
||||||
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
|
||||||
['<C-Space>'] = cmp.mapping(cmp.mapping.complete(), { 'i', 'c', 's' }),
|
|
||||||
['<C-e>'] = cmp.mapping(cmp.mapping.close(), { 'i', 'c', 's' }),
|
|
||||||
['<CR>'] = cmp.mapping({
|
|
||||||
i = cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Insert, select = false }),
|
|
||||||
c = cmp.mapping.confirm({ select = false }),
|
|
||||||
s = cmp.mapping.confirm({ select = false }),
|
|
||||||
}),
|
|
||||||
['<Tab>'] = cmp.mapping(function(fallback)
|
|
||||||
if luasnip.expand_or_jumpable() then
|
|
||||||
vim.api.nvim_feedkeys(t('<Plug>luasnip-expand-or-jump'), '', true)
|
|
||||||
else
|
|
||||||
fallback()
|
|
||||||
end
|
|
||||||
end, {
|
|
||||||
'i',
|
|
||||||
's',
|
|
||||||
}),
|
|
||||||
['<S-Tab>'] = cmp.mapping(function(fallback)
|
|
||||||
if luasnip.jumpable(-1) then
|
|
||||||
vim.api.nvim_feedkeys(t('<Plug>luasnip-jump-prev'), '', true)
|
|
||||||
else
|
|
||||||
fallback()
|
|
||||||
end
|
|
||||||
end, {
|
|
||||||
'i',
|
|
||||||
's',
|
|
||||||
}),
|
|
||||||
},
|
|
||||||
snippet = {
|
|
||||||
expand = function(args)
|
|
||||||
require('luasnip').lsp_expand(args.body)
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
sources = {
|
|
||||||
{ name = 'luasnip', priority = 8 },
|
|
||||||
{ name = 'nvim_lsp', priority = 7 },
|
|
||||||
{ name = 'nvim_lsp_signature_help', priority = 7 },
|
|
||||||
{ name = 'treesitter', priority = 6 },
|
|
||||||
{ name = 'buffer', priority = 5,
|
|
||||||
option = {
|
|
||||||
get_bufnrs = function()
|
|
||||||
local bufs = {}
|
|
||||||
for _, win in ipairs(vim.api.nvim_list_wins()) do
|
|
||||||
bufs[vim.api.nvim_win_get_buf(win)] = true
|
|
||||||
end
|
|
||||||
return vim.tbl_keys(bufs)
|
|
||||||
end
|
|
||||||
}
|
|
||||||
},
|
|
||||||
-- { name = 'nvim_lua' },
|
|
||||||
-- { name = 'look' },
|
|
||||||
-- { name = 'path' },
|
|
||||||
-- { name = 'cmp_tabnine' },
|
|
||||||
-- { name = 'calc' },
|
|
||||||
-- { name = 'spell' },
|
|
||||||
-- { name = 'emoji' },
|
|
||||||
},
|
|
||||||
enabled = function()
|
|
||||||
return vim.api.nvim_buf_get_option(0, "buftype") ~= "prompt"
|
|
||||||
or vim.api.nvim_buf_get_option(0, 'filetype') == 'dap-repl'
|
|
||||||
or vim.api.nvim_buf_get_option(0, 'filetype') == 'dapui_watches'
|
|
||||||
or vim.api.nvim_buf_get_option(0, 'filetype') == 'dapui_hover'
|
|
||||||
end,
|
|
||||||
completion = { completeopt = 'menu,menuone,noinsert, noselect' },
|
|
||||||
window = {
|
|
||||||
-- completion = cmp.config.window.bordered(),
|
|
||||||
-- documentation = cmp.config.window.bordered(),
|
|
||||||
},
|
|
||||||
sorting = {
|
|
||||||
comparators = {
|
|
||||||
require('clangd_extensions.cmp_scores'),
|
|
||||||
cmp.config.compare.locality,
|
|
||||||
-- cmp.config.compare.recently_used,
|
|
||||||
-- -- cmp.config.compare.offset,
|
|
||||||
-- cmp.config.compare.exact,
|
|
||||||
-- cmp.config.compare.recently_used,
|
|
||||||
-- cmp.config.compare.kind,
|
|
||||||
-- cmp.config.compare.sort_text,
|
|
||||||
-- cmp.config.compare.length,
|
|
||||||
-- cmp.config.compare.order,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
-- experimental = { native_menu = true }
|
|
||||||
})
|
|
||||||
|
|
||||||
-- Use buffer source for `/` (if you enabled `native_menu`, this won't work anymore).
|
|
||||||
cmp.setup.cmdline('/', {
|
|
||||||
sources = {
|
|
||||||
{ name = 'buffer' },
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
|
|
||||||
cmp.setup.cmdline(':', {
|
|
||||||
sources = {
|
|
||||||
{ name = 'cmdline' },
|
|
||||||
{ name = 'cmdline_history' },
|
|
||||||
{ name = 'path' },
|
|
||||||
{ name = 'buffer' },
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
require('cmp').setup.filetype({ 'dap-repl', 'dapui_watches', 'dapui_hover' }, {
|
|
||||||
sources = {
|
|
||||||
{ name = 'dap' },
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
-- Autopairs
|
|
||||||
--require("nvim-autopairs.completion.cmp").setup({
|
|
||||||
-- map_cr = true,
|
|
||||||
-- map_complete = true,
|
|
||||||
-- auto_select = true
|
|
||||||
--})
|
|
||||||
local cmp_autopairs = require('nvim-autopairs.completion.cmp')
|
|
||||||
cmp.event:on('confirm_done', cmp_autopairs.on_confirm_done({ map_char = { tex = '' } }))
|
|
@ -1,185 +0,0 @@
|
|||||||
dap = require('dap')
|
|
||||||
|
|
||||||
require("cmp_dap").is_dap_buffer()
|
|
||||||
|
|
||||||
|
|
||||||
-- make sure we can exit the terminal with esc
|
|
||||||
vim.api.nvim_create_autocmd({ "TermOpen" }, {
|
|
||||||
pattern = { '*dap-terminal*' },
|
|
||||||
callback = function()
|
|
||||||
local opts = { noremap = true }
|
|
||||||
vim.api.nvim_buf_set_keymap(0, 't', '<esc>', [[<C-\><C-n>]], opts)
|
|
||||||
end
|
|
||||||
})
|
|
||||||
|
|
||||||
local function getVenvSuffix()
|
|
||||||
if vim.loop.os_uname().sysname == 'Linux' then
|
|
||||||
return 'bin/python'
|
|
||||||
elseif vim.loop.os_uname().sysname == 'Windows_NT' then
|
|
||||||
return 'Scripts/python.exe'
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
local function getPythonEnv()
|
|
||||||
local venv = os.getenv("VIRTUAL_ENV")
|
|
||||||
if venv ~= nil then
|
|
||||||
return string.format("%s/%s", venv, getVenvSuffix())
|
|
||||||
end
|
|
||||||
local conda = os.getenv("CONDA_PREFIX")
|
|
||||||
if conda ~= nil then
|
|
||||||
return string.format("%s/%s", conda, 'python.exe')
|
|
||||||
end
|
|
||||||
|
|
||||||
local cwd = vim.fn.getcwd()
|
|
||||||
if vim.fn.executable(cwd .. '/venv/' .. getVenvSuffix()) == 1 then
|
|
||||||
return cwd .. '/venv/' .. getVenvSuffix()
|
|
||||||
elseif vim.fn.executable(cwd .. '/.venv/' .. getVenvSuffix()) == 1 then
|
|
||||||
return cwd .. '/.venv/' .. getVenvSuffix()
|
|
||||||
else
|
|
||||||
if vim.loop.os_uname().sysname == 'Linux' then
|
|
||||||
return '/usr/bin/python'
|
|
||||||
elseif vim.loop.os_uname().sysname == 'Windows_NT' then
|
|
||||||
return os.getenv('SCOOP') .. '/apps/python/current/python.exe'
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
local function loadConfigs ()
|
|
||||||
require('dap.ext.vscode').load_launchjs()
|
|
||||||
-- Make sure we use the correct python env even for the configs from launch.json
|
|
||||||
for nr,config in pairs(dap.configurations.python) do
|
|
||||||
config.pythonPath = getPythonEnv()
|
|
||||||
config.cwd = vim.fn.getcwd()
|
|
||||||
end
|
|
||||||
require'telescope'.extensions.dap.configurations{}
|
|
||||||
end
|
|
||||||
local opts = { noremap = true, silent = false }
|
|
||||||
vim.keymap.set('n', '<F5>', dap.continue, opts)
|
|
||||||
vim.keymap.set('n', '<F6>', loadConfigs, opts)
|
|
||||||
vim.keymap.set('n', '<F7>', dap.goto_, opts)
|
|
||||||
vim.keymap.set('n', '<F8>', require('dap.ui.widgets').hover, opts)
|
|
||||||
vim.keymap.set('n', '<F9>', dap.toggle_breakpoint, opts)
|
|
||||||
vim.keymap.set('n', '<F10>', dap.step_over, opts)
|
|
||||||
vim.keymap.set('n', '<F11>', dap.step_into, opts)
|
|
||||||
vim.keymap.set('n', '<S-F11>', dap.step_out, opts)
|
|
||||||
|
|
||||||
local initDir = vim.api.nvim_list_runtime_paths()[1]
|
|
||||||
local masonpath = vim.fn.stdpath('data') .. '/mason'
|
|
||||||
|
|
||||||
-- PYTHON
|
|
||||||
dap.adapters.python = {
|
|
||||||
type = 'executable';
|
|
||||||
command = masonpath .. '/packages/debugpy/venv/' .. getVenvSuffix();
|
|
||||||
args = { '-m', 'debugpy.adapter' };
|
|
||||||
options = {
|
|
||||||
detached = true;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
local dap= require("dap")
|
|
||||||
local dapui = require("dapui")
|
|
||||||
dapui.setup()
|
|
||||||
dap.listeners.after.event_initialized["dapui_config"] = function()
|
|
||||||
dapui.open()
|
|
||||||
end
|
|
||||||
dap.listeners.before.event_terminated["dapui_config"] = function()
|
|
||||||
dapui.close()
|
|
||||||
end
|
|
||||||
dap.listeners.before.event_exited["dapui_config"] = function()
|
|
||||||
dapui.close()
|
|
||||||
end
|
|
||||||
|
|
||||||
dap.configurations.python = {
|
|
||||||
{
|
|
||||||
type = 'python';
|
|
||||||
request = 'launch';
|
|
||||||
name = "Launch file with venv";
|
|
||||||
justMyCode = false;
|
|
||||||
program = "${file}";
|
|
||||||
cwd = vim.fn.getcwd();
|
|
||||||
pythonPath = getPythonEnv
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
-- require('dap-python').setup('C:\\Users\\oli\\AppData\\Local\\nvim\\venv_debugpy\\Scripts\\python')
|
|
||||||
-- table.insert(require('dap').configurations.python, {
|
|
||||||
-- -- type = 'python',
|
|
||||||
-- -- request = 'launch',
|
|
||||||
-- -- name = 'My custom launch configuration',
|
|
||||||
-- -- program = '${file}',
|
|
||||||
-- justMyCode = false
|
|
||||||
-- -- ... more options, see https://github.com/microsoft/debugpy/wiki/Debug-configuration-settings
|
|
||||||
-- })
|
|
||||||
-- require('dap-python').setup('C:/Users/oli/AppData/Local/nvim-data/mason/packages/debugpy/venv/Scripts/python.exe')
|
|
||||||
|
|
||||||
-- CPP
|
|
||||||
dap.adapters.codelldb = {
|
|
||||||
type = 'server',
|
|
||||||
port = "${port}",
|
|
||||||
executable = {
|
|
||||||
-- CHANGE THIS to your path!
|
|
||||||
command = masonpath .. '/bin/codelldb.cmd',
|
|
||||||
args = { '--port', '${port}' },
|
|
||||||
|
|
||||||
-- On windows you may have to uncomment this:
|
|
||||||
detached = false,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
dap.adapters.lldb = {
|
|
||||||
type = 'executable',
|
|
||||||
command = function()
|
|
||||||
if vim.loop.os_uname().sysname == 'Linux' then
|
|
||||||
return 'lldb-vscode'
|
|
||||||
else
|
|
||||||
return os.getenv('SCOOP') .. '/apps/llvm/current/bin/lldb-vscode.exe'
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
name = 'lldb'
|
|
||||||
}
|
|
||||||
|
|
||||||
dap.configurations.cpp = {
|
|
||||||
{
|
|
||||||
name = "Launch codelldb",
|
|
||||||
type = "codelldb",
|
|
||||||
request = "launch",
|
|
||||||
program = function()
|
|
||||||
return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/build_nvim/', 'file')
|
|
||||||
end,
|
|
||||||
cwd = '${workspaceFolder}',
|
|
||||||
stopOnEntry = true,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
dap.configurations.cpp = {
|
|
||||||
{
|
|
||||||
name = 'Launch lldb',
|
|
||||||
type = 'lldb',
|
|
||||||
request = 'launch',
|
|
||||||
program = function()
|
|
||||||
return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/build_nvim', '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,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
-- EXTENSIONS
|
|
||||||
|
|
||||||
require('nvim-dap-virtual-text').setup()
|
|
||||||
require('telescope').load_extension('dap')
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
|||||||
local actions = require("diffview.actions")
|
|
||||||
|
|
||||||
require("diffview").setup({})
|
|
@ -1,12 +0,0 @@
|
|||||||
local colors = require('gruvbox.colors')
|
|
||||||
vim.g.gruvbox_flat_style = "dark"
|
|
||||||
vim.g.gruvbox_colors = {
|
|
||||||
bg_search = 'purple',
|
|
||||||
fg_search = 'black',
|
|
||||||
}
|
|
||||||
vim.g.gruvbox_theme = {
|
|
||||||
Pmenu = { bg = 'bg_visual'},
|
|
||||||
NormalFloat = { bg = 'bg_visual'}
|
|
||||||
}
|
|
||||||
vim.g.gruvbox_dark_float = false
|
|
||||||
vim.cmd('colorscheme gruvbox-flat')
|
|
@ -1 +0,0 @@
|
|||||||
require('leap').set_default_keymaps()
|
|
@ -1,9 +0,0 @@
|
|||||||
local overseer = require('overseer')
|
|
||||||
overseer.setup({
|
|
||||||
templates = { "builtin", "user.cmake.cmake" },
|
|
||||||
})
|
|
||||||
|
|
||||||
vim.keymap.set({ 'n', 'x' }, '<F4>', function()
|
|
||||||
overseer.open()
|
|
||||||
overseer.run_template()
|
|
||||||
end, opts)
|
|
@ -1,56 +0,0 @@
|
|||||||
-- If you want icons for diagnostic errors, you'll need to define them somewhere:
|
|
||||||
vim.fn.sign_define('DiagnosticSignError', { text = ' ', texthl = 'DiagnosticSignError' })
|
|
||||||
vim.fn.sign_define('DiagnosticSignWarn', { text = ' ', texthl = 'DiagnosticSignWarn' })
|
|
||||||
vim.fn.sign_define('DiagnosticSignInfo', { text = ' ', texthl = 'DiagnosticSignInfo' })
|
|
||||||
vim.fn.sign_define('DiagnosticSignHint', { text = '', texthl = 'DiagnosticSignHint' })
|
|
||||||
|
|
||||||
require('neo-tree').setup({
|
|
||||||
window = { -- see https://github.com/MunifTanjim/nui.nvim/tree/main/lua/nui/popup for
|
|
||||||
-- possible options. These can also be functions that return these options.
|
|
||||||
position = 'float', -- left, right, float, current
|
|
||||||
width = 40, -- applies to left and right positions
|
|
||||||
popup = { -- settings that apply to float position only
|
|
||||||
size = {
|
|
||||||
height = '80%',
|
|
||||||
width = '50%',
|
|
||||||
},
|
|
||||||
position = '50%', -- 50% means center it
|
|
||||||
-- you can also specify border here, if you want a different setting from
|
|
||||||
-- the global popup_border_style.
|
|
||||||
},
|
|
||||||
enable_git_status = false,
|
|
||||||
-- Mappings for tree window. See `:h nep-tree-mappings` for a list of built-in commands.
|
|
||||||
-- You can also create your own commands by providing a function instead of a string.
|
|
||||||
mappings = {
|
|
||||||
['<space>'] = 'toggle_node',
|
|
||||||
['<2-LeftMouse>'] = 'open',
|
|
||||||
['<cr>'] = 'open',
|
|
||||||
['s'] = 'open_split',
|
|
||||||
['v'] = 'open_vsplit',
|
|
||||||
['C'] = 'close_node',
|
|
||||||
['z'] = 'close_all_nodes',
|
|
||||||
['R'] = 'refresh',
|
|
||||||
['a'] = 'add',
|
|
||||||
['A'] = 'add_directory',
|
|
||||||
['d'] = 'delete',
|
|
||||||
['r'] = 'rename',
|
|
||||||
['y'] = 'copy_to_clipboard',
|
|
||||||
['x'] = 'cut_to_clipboard',
|
|
||||||
['p'] = 'paste_from_clipboard',
|
|
||||||
['c'] = 'copy', -- takes text input for destination
|
|
||||||
['m'] = 'move', -- takes text input for destination
|
|
||||||
['q'] = 'close_window',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
filesystem = {
|
|
||||||
filtered_items = {
|
|
||||||
hide_dotfiles = false,
|
|
||||||
hide_gitignored = false,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
source_selector = {
|
|
||||||
winbar = true,
|
|
||||||
statusline = false
|
|
||||||
}
|
|
||||||
})
|
|
||||||
vim.keymap.set('n', '\\', '<cmd>Neotree reveal<cr>')
|
|
@ -1,29 +0,0 @@
|
|||||||
require('neogen').setup({
|
|
||||||
enabled = true,
|
|
||||||
languages = {
|
|
||||||
cpp = {
|
|
||||||
template = {
|
|
||||||
annotation_convention = 'custom',
|
|
||||||
custom = {
|
|
||||||
{ nil, '/// file', { no_results = true, type = { 'file' } } },
|
|
||||||
{ nil, '/// $1', { no_results = true, type = { 'func', 'file' } } },
|
|
||||||
{ nil, '', { no_results = true, type = { 'file' } } },
|
|
||||||
|
|
||||||
{ nil, '/// $1', { type = { 'func' } } },
|
|
||||||
{ 'tparam', '/// \\tparam %s $1' },
|
|
||||||
{ 'parameters', '/// \\param %s $1' },
|
|
||||||
{ 'return_statement', '/// \\return $1' },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
require('legendary').keymaps(
|
|
||||||
{
|
|
||||||
{
|
|
||||||
'<leader>n',
|
|
||||||
':Neogen<CR>',
|
|
||||||
description = 'Add comment',
|
|
||||||
}
|
|
||||||
}
|
|
||||||
)
|
|
@ -1,6 +0,0 @@
|
|||||||
require('project_nvim').setup({
|
|
||||||
silent_chdir = true,
|
|
||||||
ignore_lsp = { 'null-ls', 'cmake' },
|
|
||||||
patterns = { ".git", "_darcs", ".hg", ".bzr", ".svn", "Makefile", "package.json", "build_nvim", "real_path.txt" },
|
|
||||||
})
|
|
||||||
require('telescope').load_extension('projects')
|
|
@ -1,42 +0,0 @@
|
|||||||
function _G.set_terminal_keymaps(term)
|
|
||||||
local opts = { noremap = true }
|
|
||||||
if (term.cmd ~= 'lazygit') then
|
|
||||||
vim.api.nvim_buf_set_keymap(term.bufnr, 't', '<esc>', [[<C-\><C-n>]], opts)
|
|
||||||
end
|
|
||||||
vim.api.nvim_buf_set_keymap(term.bufnr, 't', 'jk', [[<C-\><C-n>]], opts)
|
|
||||||
vim.api.nvim_buf_set_keymap(term.bufnr, 't', '<C-h>', [[<C-\><C-n><C-W>h]], opts)
|
|
||||||
vim.api.nvim_buf_set_keymap(term.bufnr, 't', '<C-j>', [[<C-\><C-n><C-W>j]], opts)
|
|
||||||
vim.api.nvim_buf_set_keymap(term.bufnr, 't', '<C-k>', [[<C-\><C-n><C-W>k]], opts)
|
|
||||||
vim.api.nvim_buf_set_keymap(term.bufnr, 't', '<C-l>', [[<C-\><C-n><C-W>l]], opts)
|
|
||||||
end
|
|
||||||
|
|
||||||
require('toggleterm').setup({
|
|
||||||
on_open = set_terminal_keymaps
|
|
||||||
})
|
|
||||||
|
|
||||||
local Terminal = require('toggleterm.terminal').Terminal
|
|
||||||
|
|
||||||
local lazygit = Terminal:new({
|
|
||||||
cmd = 'lazygit',
|
|
||||||
-- dir = vim.fn.getcwd(),
|
|
||||||
hidden = true,
|
|
||||||
direction = 'float',
|
|
||||||
on_open = function(term)
|
|
||||||
vim.api.nvim_buf_set_keymap(term.bufnr, "n", "q", "<cmd>close<CR>", { noremap = true, silent = true })
|
|
||||||
-- vim.api.nvim_buf_set_keymap(term.bufnr, 't', '<esc>', '<esc>', {noremap = true, silent = true})
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|
||||||
function _lazygit_toggle()
|
|
||||||
lazygit:toggle()
|
|
||||||
end
|
|
||||||
|
|
||||||
require('legendary').keymaps(
|
|
||||||
{
|
|
||||||
{
|
|
||||||
'<Space>g',
|
|
||||||
':lua _lazygit_toggle()<CR>',
|
|
||||||
description = 'Open lazygit',
|
|
||||||
}
|
|
||||||
}
|
|
||||||
)
|
|
@ -1,48 +0,0 @@
|
|||||||
local parser = require('nvim-treesitter.parsers').filetype_to_parsername
|
|
||||||
parser.groovy = 'java' -- the someft filetype will use the python parser and queries.
|
|
||||||
|
|
||||||
require('nvim-treesitter.configs').setup({
|
|
||||||
ensure_installed = all,
|
|
||||||
highlight = {
|
|
||||||
enable = true
|
|
||||||
},
|
|
||||||
rainbow = {
|
|
||||||
enable = true,
|
|
||||||
extended_mode = true, -- Also highlight non-bracket delimiters like html tags, boolean or table: lang -> boolean
|
|
||||||
max_file_lines = nil, -- Do not enable for files with more than n lines, int
|
|
||||||
-- colors = {}, -- table of hex strings
|
|
||||||
-- termcolors = {} -- table of colour name strings
|
|
||||||
},
|
|
||||||
indent = {
|
|
||||||
enable = false -- maybe buggy
|
|
||||||
},
|
|
||||||
textobjects = {
|
|
||||||
select = {
|
|
||||||
enable = true,
|
|
||||||
|
|
||||||
-- Automatically jump forward to textobj, similar to targets.vim
|
|
||||||
lookahead = true,
|
|
||||||
|
|
||||||
keymaps = {
|
|
||||||
-- You can use the capture groups defined in textobjects.scm
|
|
||||||
["af"] = "@function.outer",
|
|
||||||
["if"] = "@function.inner",
|
|
||||||
["ac"] = "@class.outer",
|
|
||||||
["ic"] = "@class.inner",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
lsp_interop = {
|
|
||||||
enable = true,
|
|
||||||
border = 'none',
|
|
||||||
peek_definition_code = {
|
|
||||||
["<leader>df"] = "@function.outer",
|
|
||||||
["<leader>dF"] = "@class.outer",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
require("nvim-treesitter.install").prefer_git = true
|
|
||||||
|
|
||||||
-- local groovy_parser = require('nvim-treesitter.parsers').groovy
|
|
||||||
-- groovy_parser.groovy = 'java' -- the someft filetype will use the python parser and queries.
|
|
@ -1,27 +0,0 @@
|
|||||||
require('yanky').setup()
|
|
||||||
vim.api.nvim_set_keymap('n', 'p', '<Plug>(YankyPutAfter)', {})
|
|
||||||
vim.api.nvim_set_keymap('n', 'P', '<Plug>(YankyPutBefore)', {})
|
|
||||||
vim.api.nvim_set_keymap('x', 'p', '<Plug>(YankyPutAfter)', {})
|
|
||||||
vim.api.nvim_set_keymap('x', 'P', '<Plug>(YankyPutBefore)', {})
|
|
||||||
vim.api.nvim_set_keymap('n', 'gp', '<Plug>(YankyGPutAfter)', {})
|
|
||||||
vim.api.nvim_set_keymap('n', 'gP', '<Plug>(YankyGPutBefore)', {})
|
|
||||||
vim.api.nvim_set_keymap('x', 'gp', '<Plug>(YankyGPutAfter)', {})
|
|
||||||
vim.api.nvim_set_keymap('x', 'gP', '<Plug>(YankyGPutBefore)', {})
|
|
||||||
vim.keymap.set("n", "<c-n>", "<Plug>(YankyCycleForward)", {})
|
|
||||||
vim.keymap.set("n", "<c-p>", "<Plug>(YankyCycleBackward)", {})
|
|
||||||
|
|
||||||
require("telescope").load_extension('yank_history')
|
|
||||||
require('legendary').keymaps(
|
|
||||||
{
|
|
||||||
{
|
|
||||||
'<c-n>',
|
|
||||||
'<Plug>(YankyCycleForward)',
|
|
||||||
description = 'Yanky cycle forward',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'<c-p>',
|
|
||||||
'<Plug>(YankyCycleBackward)',
|
|
||||||
description = 'Yanky cycle backward',
|
|
||||||
},
|
|
||||||
}
|
|
||||||
)
|
|
Reference in New Issue
Block a user