Compare commits
191 Commits
Author | SHA1 | Date | |
---|---|---|---|
4c9b016540 | |||
e32ff73562 | |||
774fdda969 | |||
612ec0cbe6 | |||
c19072c4cd | |||
e72eaa724e | |||
e6d1091430 | |||
59d9b95eb9 | |||
ebd55ecc55 | |||
41ce8f2063 | |||
652a1c2aa7 | |||
988db59976 | |||
54e6d1b844 | |||
bf80f95a9a | |||
99e1139337 | |||
382871be03 | |||
1ba7731c16 | |||
4a21802429 | |||
087e0faad2 | |||
14fd19bde6 | |||
8030c44a93 | |||
49f8494072 | |||
69b5cace69 | |||
5a22a03eba | |||
c9c630ce61 | |||
c792c0839b | |||
80cff42519 | |||
d019626efb | |||
8953d89f3c | |||
860b97c24c | |||
deb6dea93b | |||
b396169fca | |||
6a8c84250f | |||
894dba3337 | |||
8ebf953ec7 | |||
3aea401281 | |||
98a9f00bd6 | |||
03c102be95 | |||
3b3bc5b937 | |||
5d4cf9bfdc | |||
219a8c3e81 | |||
d7b2cc3156 | |||
f9888e9c2a | |||
8b79b38ca0 | |||
d6f71c8ab2 | |||
23a3a8f7c6 | |||
d525388f3f | |||
4bd385dd55 | |||
f9d9bbd258 | |||
c607af6115 | |||
b12a673ba1 | |||
3c9ecc9d53 | |||
be42757e5e | |||
8020639f31 | |||
ec56132c85 | |||
3392ebe270 | |||
ad480c4d35 | |||
49bb25aec6 | |||
c27b582b89 | |||
9e2890aed9 | |||
0a31d71c0c | |||
7b776c7e9f | |||
1f60a85098 | |||
688493d39d | |||
b099ba7efd | |||
0c66846e4e | |||
d609883ff7 | |||
5ad1c4be90 | |||
5f357b0db5 | |||
0a60ff63bd | |||
a1bff62966 | |||
3a0e386252 | |||
37b7a68c45 | |||
607245c47d | |||
2c277ee846 | |||
37d7e60eef | |||
2951e86e06 | |||
228171561f | |||
b1754cf7db | |||
1f8ef76f81 | |||
9b4fcca0ce | |||
d9f90a1f4b | |||
5b4878f76d | |||
c6d9e5b891 | |||
b31bd343fa | |||
c6bdb676aa | |||
2bdc01b56f | |||
6eba3c6f3a | |||
3b66cc0b3c | |||
db6d89471c | |||
892ac617ee | |||
c54a515556 | |||
20cb51e2b5 | |||
d6930cbb2f | |||
76a7aad423 | |||
c921ae0f4f | |||
8db95a1880 | |||
4a6de72626 | |||
6c8531b67a | |||
e34744b677 | |||
8cafa90c01 | |||
2da1322e7f | |||
c65f2c543b | |||
7bd0f10847 | |||
2c4617f462 | |||
5dde3be206 | |||
4fbe1c4174 | |||
d7b49c4c4b | |||
8a000f811c | |||
7f99415c02 | |||
257d2fffcf | |||
3dc493ff7e | |||
651d1d0d2f | |||
579cdff054 | |||
96e1f3f6ed | |||
99e257dbc1 | |||
f0f1c35740 | |||
2425d5f29d | |||
ab1de6c1de | |||
595a4d287b | |||
641d2e0c9e | |||
1c10794866 | |||
204f38c947 | |||
ee3b97648a | |||
4462d4af5c | |||
f307fb2124 | |||
d23279a4a4 | |||
8220799933 | |||
752814db02 | |||
d57067ea70 | |||
198141f63f | |||
018c25d0d7 | |||
04d69955d7 | |||
434611abf4 | |||
f9d0bf5366 | |||
479c8686eb | |||
aa7bc38af6 | |||
e3a6774b76 | |||
d219e43cc7 | |||
cb2b0e521f | |||
c3deaa45c6 | |||
4c543d7f44 | |||
8860d92ed1 | |||
a3d76bbd15 | |||
a1d6d33b34 | |||
fbdad999cd | |||
cf9b76d0e0 | |||
c0aa5e03d0 | |||
86b8b65c99 | |||
61a052b960 | |||
7e1182a11b | |||
d1b14f05c1 | |||
961ec74fbd | |||
f8ff3b647f | |||
79486cd892 | |||
da4f4674a5 | |||
4a076eacd9 | |||
7e40d7732f | |||
b259a2ae23 | |||
c643e834e0 | |||
ff41531888 | |||
3a700044c4 | |||
3209e01c99 | |||
9bf991c537 | |||
b8bca37446 | |||
86b5aeb691 | |||
464644246c | |||
6689c9b523 | |||
4c5aa10996 | |||
29b32edada | |||
667e42fe57 | |||
4dd3918382 | |||
bec752c6b7 | |||
ab444ed7d9 | |||
bd3af2a9a4 | |||
e72fa7324b | |||
577a3cd1a7 | |||
0d93bc8fa5 | |||
9325519929 | |||
71321b1d16 | |||
faeea7fb5f | |||
5c4e7a4000 | |||
cfff367b83 | |||
25a5283cd6 | |||
3f9a7f38fb | |||
0e13e43fc3 | |||
0e92584aaf | |||
b7020671d7 | |||
31ca3a6d00 | |||
8fabdb2d07 | |||
6db33686b5 |
71
.clangd
Normal file
71
.clangd
Normal file
@ -0,0 +1,71 @@
|
||||
Diagnostics:
|
||||
UnusedIncludes: Strict
|
||||
ClangTidy:
|
||||
Add:
|
||||
- cppcoreguidelines-*
|
||||
- clang-analyzer-core.*
|
||||
- bugprone-assert-side-effect
|
||||
- bugprone-branch-clone
|
||||
- bugprone-copy-constructor-init
|
||||
- bugprone-exception-escape
|
||||
- bugprone-forward-declaration-namespace
|
||||
- bugprone-incorrect-roundings
|
||||
- bugprone-infinite-loop
|
||||
- bugprone-integer-division
|
||||
- bugprone-macro-parentheses
|
||||
- bugprone-multiple-statement-macro
|
||||
- bugprone-parent-virtual-call
|
||||
- bugprone-redundant-branch-condition
|
||||
- bugprone-reserved-identifier
|
||||
- bugprone-sizeof-container
|
||||
- bugprone-sizeof-expression
|
||||
- bugprone-string-constructor
|
||||
- bugprone-string-integer-assignment
|
||||
- bugprone-suspicious-enum-usage
|
||||
- bugprone-suspicious-include
|
||||
- bugprone-suspicious-missing-comma
|
||||
- bugprone-suspicious-semicolon
|
||||
- bugprone-swapped-arguments
|
||||
- bugprone-terminating-continue
|
||||
- bugprone-too-small-loop-variable
|
||||
- llvm-namespace-comment
|
||||
- misc-definitions-in-headers
|
||||
- misc-redundant-expression
|
||||
- misc-unused-parameters
|
||||
- hicpp-signed-bitwise
|
||||
- readability-identifier-naming
|
||||
- readability-duplicate-include
|
||||
- readability-braces-around-statements
|
||||
- readability-implicit-bool-conversion
|
||||
- readability-inconsistent-declaration-parameter-name
|
||||
- readability-make-member-function-const
|
||||
- readability-misleading-indentation
|
||||
- readability-redundant-declaration
|
||||
- readability-redundant-preprocessor
|
||||
- readability-redundant-member-init
|
||||
- readability-simplify-boolean-expr
|
||||
- readability-static-accessed-through-instance
|
||||
- readability-uppercase-literal-suffix
|
||||
Remove:
|
||||
- readability-avoid-const-params-in-decls
|
||||
- readability-function-cognitive-complexity
|
||||
- readability-magic-numbers
|
||||
- readability-identifier-length
|
||||
- cppcoreguidelines-explicit-virtual-functions
|
||||
- cppcoreguidelines-init-variables
|
||||
- cppcoreguidelines-non-private-member-variables-in-classes
|
||||
- cppcoreguidelines-avoid-magic-numbers
|
||||
- cppcoreguidelines-owning-memory
|
||||
- cppcoreguidelines-pro-bounds-constant-array-index
|
||||
- cppcoreguidelines-special-member-functions
|
||||
- cppcoreguidelines-avoid-c-arrays
|
||||
- cppcoreguidelines-pro-type-reinterpret-cast
|
||||
CheckOptions:
|
||||
readability-identifier-naming.FunctionCase: camelBack
|
||||
readability-identifier-naming.NamespaceCase: lower_case
|
||||
readability-identifier-naming.ClassCase: CamelCase
|
||||
readability-identifier-naming.PrivateMemberPrefix: m_
|
||||
readability-identifier-naming.StructCase: CamelCase
|
||||
readability-identifier-naming.VariableCase: camelBack
|
||||
readability-identifier-naming.GlobalConstantCase: UPPER_CASE
|
||||
readability-identifier-naming.EnumConstant: UPPER_CASE
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -5,3 +5,4 @@ vim.bundle
|
||||
plugged
|
||||
rplugin.vim
|
||||
plugin/packer_compiled.lua
|
||||
venv_debugpy
|
||||
|
133
init.lua
133
init.lua
@ -1,135 +1,4 @@
|
||||
local cmd = vim.cmd -- to execute Vim commands e.g. cmd('pwd')
|
||||
local fn = vim.fn -- to call Vim functions e.g. fn.bufnr()
|
||||
local g = vim.g -- a table to access global variables
|
||||
local opt = vim.opt -- to set options
|
||||
local utils = require('utils')
|
||||
|
||||
-------------------- PACKER --------------------------------
|
||||
-- Auto install packer.nvim if not exists
|
||||
local install_path = fn.stdpath('data')..'/site/pack/packer/start/packer.nvim'
|
||||
if fn.empty(fn.glob(install_path)) > 0 then
|
||||
fn.system({'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path})
|
||||
vim.cmd 'packadd packer.nvim'
|
||||
end
|
||||
vim.cmd [[packadd packer.nvim]]
|
||||
-------------------- EXTERNAL ------------------------------
|
||||
require('my_plugins')
|
||||
require('my_keymappings')
|
||||
require('my_options')
|
||||
require("my_autocommands")
|
||||
|
||||
-- plugins
|
||||
require('my_telescope')
|
||||
require('my_lspinstall')
|
||||
require('my_cmp')
|
||||
-------------------- TREE-SITTER ---------------------------
|
||||
require('nvim-treesitter.configs').setup({
|
||||
ensure_installed = 'maintained',
|
||||
highlight = {
|
||||
enable = true
|
||||
}
|
||||
})
|
||||
-------------------- GITSIGNS ------------------------------
|
||||
require('gitsigns').setup()
|
||||
-------------------- NVIM-TREE -----------------------------
|
||||
require('nvim-tree').setup({
|
||||
auto_close = true,
|
||||
update_cwd = true,
|
||||
update_to_buf_dir = {
|
||||
-- enable the feature
|
||||
enable = true,
|
||||
-- allow to open the tree if it was previously closed
|
||||
auto_open = false,
|
||||
},
|
||||
update_focused_file = {
|
||||
enable = true,
|
||||
update_cwd = false,
|
||||
ignore_list = {}
|
||||
},
|
||||
diagnostics = {
|
||||
enable = true,
|
||||
icons = {
|
||||
hint = "",
|
||||
info = "",
|
||||
warning = "",
|
||||
error = "",
|
||||
}
|
||||
},
|
||||
})
|
||||
utils.map('n', '<leader>tt', '<cmd>NvimTreeToggle<CR>')
|
||||
g.nvim_tree_highlight_opened_files = 1
|
||||
g.nvim_tree_respect_buf_cwd = 1
|
||||
-------------------- COMMENTED -----------------------------
|
||||
require('Comment').setup({
|
||||
toggler = {
|
||||
---line-comment toggle
|
||||
line = '<leader>cc',
|
||||
},
|
||||
opleader = {
|
||||
---line-comment opfunc mapping
|
||||
line = '<leader>c',
|
||||
},
|
||||
})
|
||||
-------------------- CMAKE ---------------------------------
|
||||
require('telescope').load_extension('cmake')
|
||||
require('cmake').setup({
|
||||
parameters_file = 'neovim.json', -- JSON file to store information about selected target, run arguments and build type.
|
||||
build_dir = '{cwd}/build_nvim', -- Build directory. The expressions `{cwd}`, `{os}` and `{build_type}` will be expanded with the corresponding text values.
|
||||
})
|
||||
utils.map('n', '<F5>', ':CMake build<CR>:copen<CR>')
|
||||
|
||||
-- msbuild errorformat
|
||||
opt.errorformat:append("\\ %#%f(%l\\\\\\,%c):\\ %m")
|
||||
-- cl.exe errorformat
|
||||
-- o.errorformat:append('\ %#%f(%l) : %#%t%[A-z]%# %m')
|
||||
|
||||
-------------------- NEOCLIP -------------------------------
|
||||
require('neoclip').setup({
|
||||
default_register = '+',
|
||||
})
|
||||
require('telescope').load_extension('neoclip')
|
||||
-------------------- LUALINE -------------------------------
|
||||
require('lualine').setup {
|
||||
options = {theme = 'gruvbox'},
|
||||
sections = {lualine_c = {'getcwd', 'filename', 'nvim_treesitter#statusline'},
|
||||
}
|
||||
}
|
||||
-------------------- PROJECT -------------------------------
|
||||
require("project_nvim").setup {
|
||||
silent_chdir = true,
|
||||
}
|
||||
require('telescope').load_extension('projects')
|
||||
utils.map('n', '<space>p', '<cmd>Telescope projects<cr>')
|
||||
-------------------- TS-RAINBOW ----------------------------
|
||||
require'nvim-treesitter.configs'.setup {
|
||||
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
|
||||
}
|
||||
}
|
||||
-------------------- LUASNIP -------------------------------
|
||||
require("luasnip.loaders.from_vscode").load()
|
||||
-------------------- AUTOPAIRS -----------------------------
|
||||
require('nvim-autopairs').setup{}
|
||||
-------------------- FZF NATIVE ----------------------------
|
||||
require('telescope').load_extension('fzf')
|
||||
-------------------- TERMINAL ------------------------------
|
||||
require('nvim-terminal').setup({
|
||||
toggle_keymap = '<leader>z',
|
||||
})
|
||||
-------------------- INDENT-BLANKLINE ----------------------
|
||||
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'},
|
||||
}
|
||||
|
||||
require('my_autocommands')
|
||||
|
@ -1,45 +1,86 @@
|
||||
function nvim_create_augroups(definitions)
|
||||
for group_name, definition in pairs(definitions) do
|
||||
vim.cmd('augroup ' .. group_name)
|
||||
vim.cmd('autocmd!')
|
||||
for _, def in ipairs(definition) do
|
||||
local command = table.concat(vim.tbl_flatten{'autocmd', def}, ' ')
|
||||
vim.cmd(command)
|
||||
end
|
||||
vim.cmd('augroup END')
|
||||
end
|
||||
end
|
||||
local api = vim.api
|
||||
|
||||
local autocmds = {
|
||||
packer = {
|
||||
{ 'BufWritePost', 'plugins.lua', 'PackerCompile' };
|
||||
};
|
||||
restore_cursor = {
|
||||
{ 'BufRead', '*', [[call setpos(".", getpos("'\""))]] };
|
||||
};
|
||||
save_shada = {
|
||||
{'FocusGained,FocusLost', '*', 'rshada|wshada'};
|
||||
};
|
||||
resize_windows_proportionally = {
|
||||
{ 'VimResized', '*', ':wincmd =' };
|
||||
};
|
||||
lua_highlight = {
|
||||
{ 'TextYankPost', '*', [[silent! lua vim.highlight.on_yank() {higroup='IncSearch', timeout=400}]] };
|
||||
};
|
||||
file_type = {
|
||||
{'BufRead,BufNewFile', '*.simvis', 'set filetype=xml'};
|
||||
{'BufRead,BufNewFile', '*.simcfg,*.simcon,*.simudex', 'set filetype=cfg'};
|
||||
{'BufRead,BufNewFile', 'Jenkinsfile*', 'set filetype=groovy'};
|
||||
{'BufRead,BufNewFile', '*.manifest', 'set filetype=xml'};
|
||||
{'BufRead,BufNewFile', 'SConstruct,SConscript', 'set filetype=python'};
|
||||
};
|
||||
file_changed = {
|
||||
{'BufEnter,FocusGained', '*', 'checktime'};
|
||||
};
|
||||
no_auto_comment = {
|
||||
{'BufEnter', '*', 'set fo-=c fo-=r fo-=o'}
|
||||
}
|
||||
}
|
||||
-- Highlight on yank
|
||||
local yankGrp = api.nvim_create_augroup('YankHighlight', { clear = true })
|
||||
api.nvim_create_autocmd('TextYankPost', {
|
||||
command = 'silent! lua vim.highlight.on_yank()',
|
||||
group = yankGrp,
|
||||
})
|
||||
|
||||
nvim_create_augroups(autocmds)
|
||||
-- Filetypes
|
||||
local fileGrp = api.nvim_create_augroup('file_type', { clear = true })
|
||||
api.nvim_create_autocmd({ 'BufRead', 'BufNewFile' }, {
|
||||
pattern = { '*.simvis', '*.manifest' },
|
||||
callback = function()
|
||||
vim.bo.filetype = 'xml'
|
||||
end,
|
||||
group = fileGrp,
|
||||
})
|
||||
api.nvim_create_autocmd({ 'BufRead', 'BufNewFile' }, {
|
||||
pattern = { '*.simcfg', '*.simcon', '*.simudex' },
|
||||
callback = function()
|
||||
vim.bo.filetype = 'xml'
|
||||
end,
|
||||
group = fileGrp,
|
||||
})
|
||||
api.nvim_create_autocmd({ 'BufRead', 'BufNewFile' }, {
|
||||
pattern = { 'JenkinsFile*' },
|
||||
callback = function()
|
||||
vim.bo.filetype = 'groovy'
|
||||
end,
|
||||
group = fileGrp,
|
||||
})
|
||||
api.nvim_create_autocmd({ 'BufRead', 'BufNewFile' }, {
|
||||
pattern = { 'SConstruct', 'SConscript' },
|
||||
callback = function()
|
||||
vim.bo.filetype = 'python'
|
||||
end,
|
||||
group = fileGrp,
|
||||
})
|
||||
api.nvim_create_autocmd({ 'BufRead', 'BufNewFile' }, {
|
||||
pattern = { 'doskey'},
|
||||
callback = function()
|
||||
vim.bo.filetype = 'dosini'
|
||||
end,
|
||||
group = fileGrp,
|
||||
})
|
||||
api.nvim_create_autocmd({ 'BufRead', 'BufNewFile' }, {
|
||||
pattern = { '.clangd', '.clang-tidy'},
|
||||
callback = function()
|
||||
vim.bo.filetype = 'yaml'
|
||||
end,
|
||||
group = fileGrp,
|
||||
})
|
||||
|
||||
-- Read and write shada file
|
||||
api.nvim_create_autocmd({ 'FocusLost' }, { command = [[wshada]] })
|
||||
api.nvim_create_autocmd({ 'FocusGained' }, { command = [[rshada]] })
|
||||
|
||||
-- go to last loc when opening a buffer
|
||||
-- api.nvim_create_autocmd(
|
||||
-- 'BufReadPost',
|
||||
-- { command = [[if line("'\"") > 1 && line("'\"") <= line("$") | execute "normal! g`\"" | endif]] }
|
||||
-- )
|
||||
|
||||
-- Check if we need to reload the file when it changed
|
||||
api.nvim_create_autocmd({ 'FocusGained', 'BufEnter' }, { command = [[if !bufexists("[Command Line]") | checktime | endif]] })
|
||||
|
||||
-- windows to close with "q"
|
||||
api.nvim_create_autocmd(
|
||||
'FileType',
|
||||
{ pattern = { 'help', 'startuptime', 'qf', 'lspinfo' }, command = [[nnoremap <buffer><silent> q :close<CR>]] }
|
||||
)
|
||||
api.nvim_create_autocmd('FileType', { pattern = 'man', command = [[nnoremap <buffer><silent> q :quit<CR>]] })
|
||||
|
||||
-- show cursor line only in active window
|
||||
local cursorGrp = api.nvim_create_augroup('CursorLine', { clear = true })
|
||||
api.nvim_create_autocmd({ 'InsertLeave', 'WinEnter' }, { pattern = '*', command = 'set cursorline', group = cursorGrp })
|
||||
api.nvim_create_autocmd(
|
||||
{ 'InsertEnter', 'WinLeave' },
|
||||
{ pattern = '*', command = 'set nocursorline', group = cursorGrp }
|
||||
)
|
||||
-- don't auto comment new line
|
||||
api.nvim_create_autocmd('BufEnter', { command = [[set formatoptions-=cro]] })
|
||||
|
||||
-- Keep window ratio when resize
|
||||
api.nvim_create_autocmd('VimResized', {command = [[wincmd =]]})
|
||||
|
118
lua/my_cmp.lua
118
lua/my_cmp.lua
@ -1,118 +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 = function(entry, vim_item)
|
||||
-- fancy icons and a name of kind
|
||||
vim_item.kind = require("lspkind").presets.default[vim_item.kind] ..
|
||||
" " .. vim_item.kind
|
||||
-- set a name for each source
|
||||
vim_item.menu = ({
|
||||
buffer = "[Buffer]",
|
||||
nvim_lsp = "[LSP]",
|
||||
ultisnips = "[UltiSnips]",
|
||||
nvim_lua = "[Lua]",
|
||||
cmp_tabnine = "[TabNine]",
|
||||
look = "[Look]",
|
||||
path = "[Path]",
|
||||
spell = "[Spell]",
|
||||
calc = "[Calc]",
|
||||
emoji = "[Emoji]"
|
||||
})[entry.source.name]
|
||||
return vim_item
|
||||
end
|
||||
},
|
||||
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 = true }),
|
||||
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 = 'nvim_lsp'}, {name = 'buffer'}, {name = "luasnip"},
|
||||
{name = "nvim_lua"}, {name = "look"}, {name = "path"},
|
||||
{name = 'cmp_tabnine'}, {name = "calc"}, {name = "spell"},
|
||||
{name = "emoji"}
|
||||
},
|
||||
completion = {completeopt = 'menu,menuone,noinsert, noselect'},
|
||||
-- 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 = cmp.config.sources({
|
||||
{ name = 'path' }
|
||||
}, {
|
||||
{ name = 'cmdline' }
|
||||
}, {
|
||||
{ name = 'buffer' }
|
||||
}),
|
||||
})
|
||||
|
||||
-- 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 = '' } }))
|
||||
|
||||
-- TabNine
|
||||
--local tabnine = require('cmp_tabnine.config')
|
||||
--tabnine:setup({max_lines = 1000, max_num_results = 20, sort = true})
|
||||
|
||||
-- Database completion
|
||||
vim.api.nvim_exec([[
|
||||
autocmd FileType sql,mysql,plsql lua require('cmp').setup.buffer({ sources = {{ name = 'vim-dadbod-completion' }} })
|
||||
]], false)
|
@ -1,90 +1,35 @@
|
||||
local utils = require('utils')
|
||||
vim.g.mapleader = ','
|
||||
-- Paste from clipboard
|
||||
utils.map('n', '<leader>p', '"+p')
|
||||
utils.map('n', '<leader>P', '"+P')
|
||||
utils.map('v', '<leader>p', '"+p')
|
||||
utils.map('v', '<leader>P', '"+P')
|
||||
|
||||
-- Yank to clipboard
|
||||
utils.map('v', '<leader>y', '"+y')
|
||||
utils.map('n', '<leader>Y', '"+yg_')
|
||||
utils.map('n', '<leader>y', '"+y')
|
||||
utils.map('n', '<leader>yy', '"+yy')
|
||||
local opts = { noremap = true, silent = true }
|
||||
vim.keymap.set('n', '<space>', 'nil', opts)
|
||||
|
||||
-- Tabs
|
||||
utils.map('n', '<F2>', ':tabnew .<CR>', { noremap = true, silent = true })
|
||||
utils.map('i', '<F2>', '<Esc>:tabnew .<CR>', { noremap = true, silent = true })
|
||||
-- utils.map('n', '<S-Right>', ':BufferLineCycleNext<CR>')
|
||||
-- utils.map('n', '<S-Left>', ':BufferLineCyclePrev<CR>')
|
||||
utils.map('n', '<S-Right>', ':tabnext<CR>', { noremap = true, silent = true })
|
||||
utils.map('n', '<S-Left>', ':tabprevious<CR>', { noremap = true, silent = true })
|
||||
vim.keymap.set('n', '<S-Right>', ':tabnext<CR>', opts)
|
||||
vim.keymap.set('n', '<S-Left>', ':tabprevious<CR>', opts)
|
||||
-- Split movement
|
||||
utils.map('n', '<A-Up>', ':wincmd k<CR>', { noremap = true, silent = true })
|
||||
utils.map('n', '<A-Down>', ':wincmd j<CR>', { noremap = true, silent = true })
|
||||
utils.map('n', '<A-Left>', ':wincmd h<CR>', { noremap = true, silent = true })
|
||||
utils.map('n', '<A-Right>', ':wincmd l<CR>', { noremap = true, silent = true })
|
||||
-- Open a new vertical split window with Ctrl - F2
|
||||
utils.map('n', '<C-F2>', ':vsplit .<CR>', { noremap = true, silent = true })
|
||||
utils.map('i', '<C-F2>', '<Esc>:vsplit .<CR>', { noremap = true, silent = true })
|
||||
-- Open a new horizontal split window with Shift - F2
|
||||
utils.map('n', '<S-F2>', ':split .<CR>', { noremap = true, silent = true })
|
||||
utils.map('i', '<S-F2>', '<Esc>:split .<CR>', { noremap = true, silent = true })
|
||||
vim.keymap.set('n', '<A-Up>', ':wincmd k<CR>', opts)
|
||||
vim.keymap.set('n', '<A-Down>', ':wincmd j<CR>', opts)
|
||||
vim.keymap.set('n', '<A-Left>', ':wincmd h<CR>', opts)
|
||||
vim.keymap.set('n', '<A-Right>', ':wincmd l<CR>', opts)
|
||||
|
||||
utils.map('n', '<C-S>', ':wa<CR>')
|
||||
vim.keymap.set('n', '<C-S>', ':wa | wshada<CR>')
|
||||
|
||||
-- Linewrap and jumping
|
||||
utils.map('n', 'k', 'gk')
|
||||
utils.map('n', 'j', 'gj')
|
||||
utils.map('n', '0', 'g0')
|
||||
utils.map('n', '$', 'g$')
|
||||
utils.map('n', '<Up>', 'gk')
|
||||
utils.map('n', '<Down>', 'gj')
|
||||
utils.map('n', '<Home>', 'g<Home>')
|
||||
utils.map('n', '<End>', 'g<End>')
|
||||
utils.map('v', 'k', 'gk')
|
||||
utils.map('v', 'j', 'gj')
|
||||
utils.map('v', '0', 'g0')
|
||||
utils.map('v', '$', 'g$')
|
||||
utils.map('v', '<Up>', 'gk')
|
||||
utils.map('v', '<Down>', 'gj')
|
||||
utils.map('v', '<Home>', 'g<Home>')
|
||||
utils.map('v', '<End>', 'g<End>')
|
||||
vim.keymap.set({ 'n', 'x' }, 'k', 'gk', opts)
|
||||
vim.keymap.set({ 'n', 'x' }, 'j', 'gj', opts)
|
||||
vim.keymap.set({ 'n', 'x' }, '0', 'g0', opts)
|
||||
vim.keymap.set({ 'n', 'x' }, '$', 'g$', opts)
|
||||
vim.keymap.set({ 'n', 'x' }, '<Up>', 'gk', opts)
|
||||
vim.keymap.set({ 'n', 'x' }, '<Down>', 'gj', opts)
|
||||
vim.keymap.set({ 'n', 'x' }, '<Home>', 'g<Home>', opts)
|
||||
vim.keymap.set({ 'n', 'x' }, '<End>', 'g<End>', opts)
|
||||
|
||||
utils.map('v', '<', '<gv')
|
||||
utils.map('v', '>', '>gv')
|
||||
vim.keymap.set('x', '<', '<gv')
|
||||
vim.keymap.set('x', '>', '>gv')
|
||||
|
||||
-- Highlight word under cursor
|
||||
utils.map('n', 'ü', ":let @/='\\<<C-R>=expand(\"<cword>\")<CR>\\>'<CR>:set hls<CR>", { noremap = true, silent = true })
|
||||
utils.map('v', 'ü', "y:let @/='<C-R>=escape(@\",'/\\')<CR>'<CR>:set hls<CR>") utils.map('v', 'ü', "y:let @/='<C-R>=escape(@\",'/\\')<CR>'<CR>:set hls<CR>", { noremap = true, silent = true })
|
||||
|
||||
-- Close Buffer
|
||||
utils.map('n', '<C-w>', ':bd<CR>')
|
||||
|
||||
-- <Tab> to navigate the completion menu
|
||||
utils.map('i', '<S-Tab>', 'pumvisible() ? "\\<C-p>" : "\\<Tab>"', {expr = true})
|
||||
utils.map('i', '<Tab>', 'pumvisible() ? "\\<C-n>" : "\\<Tab>"', {expr = true})
|
||||
|
||||
-- Telescope
|
||||
utils.map('n', '<leader>f', '<cmd>Telescope find_files<cr>')
|
||||
utils.map('n', '<C-p>', '<cmd>Telescope find_files<cr>')
|
||||
utils.map('n', '<leader>g', '<cmd>Telescope git_files<cr>')
|
||||
utils.map('n', '<leader>o', '<cmd>Telescope oldfiles<cr>')
|
||||
utils.map('n', '<leader>h', '<cmd>Telescope command_history<cr>')
|
||||
utils.map('v', '<leader>h', '<cmd>Telescope command_history<cr>')
|
||||
utils.map('n', '<C-S-p>', '<cmd>Telescope commands<cr>')
|
||||
utils.map('n', '<leader>b', '<cmd>Telescope buffers<cr>')
|
||||
utils.map('n', '<leader>q', '<cmd>Telescope quickfix<cr>')
|
||||
utils.map('n', '<leader>l', '<cmd>Telescope live_grep<cr>')
|
||||
utils.map('n', '<space>r', '<cmd>Telescope lsp_references<cr>')
|
||||
utils.map('n', '<C-S-o>', '<cmd>Telescope lsp_document_symbols<cr>')
|
||||
utils.map('n', '<A-m>', '<cmd>Telescope lsp_document_symbols<cr>')
|
||||
utils.map('n', '<space>v', '<cmd>Telescope diagnostics bufnr=0<cr>')
|
||||
utils.map('n', '<C-y>', '<cmd>Telescope neoclip<cr>')
|
||||
utils.map('n', '<leader>j', '<cmd>Telescope jumplist<cr>')
|
||||
|
||||
-- wildmode
|
||||
|
||||
-- Symbols Outline
|
||||
utils.map('n', '<leader>s', '<cmd>SymbolsOutline<cr>')
|
||||
vim.keymap.set('n', "'", ':let @/=\'\\<<C-R>=expand("<cword>")<CR>\\>\'<CR>:set hls<CR>', { noremap = true, silent = true })
|
||||
-- vim.keymap.set('v', "'", "y:let @/='<C-R>=escape(@\",'/\\')<CR>'<CR>:set hls<CR>")
|
||||
vim.keymap.set('x', "'", "y:let @/='<C-R>=escape(@\",'/\\')<CR>'<CR>:set hls<CR>", { noremap = true, silent = true })
|
||||
|
||||
-- Close Buffer
|
||||
vim.keymap.set('n', '<C-w>', ':bd<CR>')
|
||||
|
@ -1,108 +0,0 @@
|
||||
local utils = require('utils')
|
||||
|
||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||
capabilities.textDocument.completion.completionItem.documentationFormat = { 'markdown', 'plaintext' }
|
||||
capabilities.textDocument.completion.completionItem.snippetSupport = true
|
||||
capabilities.textDocument.completion.completionItem.preselectSupport = true
|
||||
capabilities.textDocument.completion.completionItem.insertReplaceSupport = true
|
||||
capabilities.textDocument.completion.completionItem.labelDetailsSupport = true
|
||||
capabilities.textDocument.completion.completionItem.deprecatedSupport = true
|
||||
capabilities.textDocument.completion.completionItem.commitCharactersSupport = true
|
||||
capabilities.textDocument.completion.completionItem.tagSupport = { valueSet = { 1 } }
|
||||
capabilities.textDocument.completion.completionItem.resolveSupport = {
|
||||
properties = {
|
||||
'documentation',
|
||||
'detail',
|
||||
'additionalTextEdits',
|
||||
},
|
||||
}
|
||||
|
||||
local on_attach = function(client, bufnr)
|
||||
local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end
|
||||
local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end
|
||||
|
||||
buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc')
|
||||
|
||||
-- Mappings.
|
||||
local opts = { noremap=true, silent=true }
|
||||
utils.map('n', '<space>,', '<cmd>lua vim.lsp.diagnostic.goto_prev()<CR>', opts)
|
||||
utils.map('n', '<space>;', '<cmd>lua vim.lsp.diagnostic.goto_next()<CR>', opts)
|
||||
utils.map('n', '<space>a', '<cmd>Telescope lsp_code_actions<CR>', opts)
|
||||
utils.map('n', '<space>d', '<cmd>lua vim.lsp.buf.definition()<CR>', opts)
|
||||
utils.map('n', '<space>e', '<cmd>lua vim.lsp.buf.declaration()<CR>', opts)
|
||||
utils.map('n', '<space>h', '<cmd>lua vim.lsp.buf.hover()<CR>', opts)
|
||||
utils.map('n', '<space>c', '<cmd>lua vim.lsp.buf.outgoing_calls()<CR>', opts)
|
||||
utils.map('n', '<space>C', '<cmd>lua vim.lsp.buf.incoming_calls()<CR>', opts)
|
||||
utils.map('n', '<space>m', '<cmd>lua vim.lsp.buf.rename()<CR>', opts)
|
||||
-- utils.map('n', '<space>r', '<cmd>lua vim.lsp.buf.references()<CR, opts>')
|
||||
utils.map('n', '<space>s', '<cmd>lua vim.lsp.buf.document_symbol()<CR>', opts)
|
||||
utils.map('n', '<C-t>', '<cmd>Telescope lsp_dynamic_workspace_symbols<CR>', opts)
|
||||
utils.map('n', '<space>D', '<cmd>lua vim.lsp.buf.type_definition()<CR>', opts)
|
||||
utils.map('n', '<C-k>', '<cmd>lua vim.lsp.buf.signature_help()<CR>', opts)
|
||||
utils.map('n', '<space>r', '<cmd>Telescope lsp_references<cr>')
|
||||
utils.map('n', '<C-S-o>', '<cmd>Telescope lsp_document_symbols<cr>')
|
||||
utils.map('n', '<A-m>', '<cmd>Telescope lsp_document_symbols<cr>')
|
||||
utils.map('n', '<space>v', '<cmd>Telescope diagnostics bufnr=0<cr>')
|
||||
utils.map('n', '<A-o>', ':ClangdSwitchSourceHeader<CR>', opts)
|
||||
|
||||
-- Set some keybinds conditional on server capabilities
|
||||
if client.resolved_capabilities.document_formatting then
|
||||
utils.map('n', '<space>f', '<cmd>lua vim.lsp.buf.formatting()<CR>', opts)
|
||||
end
|
||||
if client.resolved_capabilities.document_range_formatting then
|
||||
utils.map('v', '<space>f', '<esc><cmd>lua vim.lsp.buf.range_formatting()<CR>', opts)
|
||||
end
|
||||
|
||||
-- Set autocommands conditional on server_capabilities
|
||||
if client.resolved_capabilities.document_highlight then
|
||||
vim.api.nvim_exec([[
|
||||
hi LspReferenceRead cterm=bold ctermbg=red guibg=DarkGreen
|
||||
hi LspReferenceText cterm=bold ctermbg=Black guibg=DarkYellow guifg=Black
|
||||
hi LspReferenceWrite cterm=bold ctermbg=red guibg=DarkRed
|
||||
augroup lsp_document_highlight
|
||||
autocmd! * <buffer>
|
||||
autocmd CursorHold <buffer> lua vim.lsp.buf.document_highlight()
|
||||
autocmd CursorHoldI <buffer> lua vim.lsp.buf.document_highlight()
|
||||
autocmd CursorMoved <buffer> lua vim.lsp.buf.clear_references()
|
||||
augroup END
|
||||
]], false)
|
||||
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
|
||||
|
||||
local lsp_installer = require("nvim-lsp-installer")
|
||||
lsp_installer.on_server_ready(function(server)
|
||||
local opts = {
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
}
|
||||
|
||||
-- (optional) Customize the options passed to the server
|
||||
-- if server.name == "tsserver" then
|
||||
-- opts.root_dir = function() ... end
|
||||
-- end
|
||||
|
||||
-- This setup() function is exactly the same as lspconfig's setup function (:help lspconfig-quickstart)
|
||||
server:setup(opts)
|
||||
vim.cmd [[ do User LspAttachBuffers ]]
|
||||
end)
|
||||
|
||||
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.stylua,
|
||||
null_ls.builtins.diagnostics.flake8,
|
||||
null_ls.builtins.formatting.isort
|
||||
},
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities
|
||||
}
|
@ -1,35 +1,62 @@
|
||||
local utils = require('utils')
|
||||
vim.cmd 'colorscheme gruvbox-material' -- Put your favorite colorscheme here
|
||||
vim.cmd 'syntax enable'
|
||||
vim.cmd 'filetype plugin indent on'
|
||||
vim.cmd 'language en_US.utf-8'
|
||||
utils.opt('o', 'hlsearch', true)
|
||||
utils.opt('o', 'guifont', 'Hack NF:h9')
|
||||
utils.opt('o', 'swapfile', false)
|
||||
utils.opt('o', 'backup', false)
|
||||
utils.opt('o', 'spelllang', 'en,de')
|
||||
vim.cmd('filetype plugin indent on')
|
||||
vim.cmd('language en_US.utf-8')
|
||||
|
||||
local opt = vim.opt
|
||||
local indent = 2
|
||||
utils.opt('b', 'expandtab', true)
|
||||
utils.opt('b', 'shiftwidth', indent)
|
||||
utils.opt('b', 'smartindent', true)
|
||||
utils.opt('b', 'tabstop', indent)
|
||||
utils.opt('o', 'hidden', true)
|
||||
utils.opt('o', 'ignorecase', true)
|
||||
utils.opt('o', 'scrolloff', 4 )
|
||||
utils.opt('o', 'shiftround', true)
|
||||
utils.opt('o', 'relativenumber', false)
|
||||
utils.opt('o', 'smartcase', true)
|
||||
utils.opt('o', 'splitbelow', true)
|
||||
utils.opt('o', 'splitright', true)
|
||||
utils.opt('o', 'wildmode', 'longest:full,full')
|
||||
utils.opt('w', 'number', true)
|
||||
utils.opt('o', 'clipboard', 'unnamed,unnamedplus')
|
||||
utils.opt('o', 'mouse', 'a')
|
||||
utils.opt('o', 'wrap', false)
|
||||
utils.opt('o', 'termguicolors', true)
|
||||
utils.opt('o', 'splitbelow', true)
|
||||
utils.opt('o', 'splitright', true)
|
||||
utils.opt('o', 'list', true)
|
||||
utils.opt('o', 'updatetime', 300)
|
||||
utils.opt('o', 'wrap', true)
|
||||
utils.opt('o', 'showmatch', true)
|
||||
opt.termguicolors = true -- Enable colors in terminal
|
||||
opt.hlsearch = true --Set highlight on search
|
||||
opt.number = true --Make line numbers default
|
||||
opt.relativenumber = false --Make relative number default
|
||||
opt.mouse = 'a' --Enable mouse mode
|
||||
opt.breakindent = true --Enable break indent
|
||||
opt.undofile = true --Save undo history
|
||||
opt.ignorecase = true --Case insensitive searching unless /C or capital in search
|
||||
opt.smartcase = true -- Smart case
|
||||
opt.updatetime = 300 --Decrease update time
|
||||
opt.signcolumn = 'yes' -- Always show sign column
|
||||
opt.clipboard = 'unnamed,unnamedplus' -- Access system clipboard
|
||||
opt.timeoutlen = 300 -- Time in milliseconds to wait for a mapped sequence to complete.
|
||||
opt.ttimeoutlen = 10
|
||||
opt.showmode = false -- Do not need to show the mode. We use the statusline instead.
|
||||
opt.scrolloff = 999 -- Lines of context
|
||||
opt.joinspaces = false -- No double spaces with join after a dot
|
||||
opt.showmatch = true -- Show matching braces
|
||||
opt.wrap = true -- When on, lines longer than the width of the window will wrap and displaying continues on the next line
|
||||
opt.list = true
|
||||
opt.hidden= true
|
||||
opt.scrolloff= 4
|
||||
opt.shiftround= true
|
||||
opt.relativenumber= false
|
||||
opt.splitbelow= true
|
||||
opt.splitright= true
|
||||
opt.wildmode= 'longest:full,full'
|
||||
opt.splitbelow= true
|
||||
opt.splitright= true
|
||||
opt.shiftwidth = indent
|
||||
opt.tabstop = indent
|
||||
if vim.loop.os_uname().sysname == 'Linux' then
|
||||
opt.guifont= 'JetBrainsMono Nerd Font Mono:h7'
|
||||
else
|
||||
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
|
||||
end
|
||||
opt.swapfile= false
|
||||
opt.backup= false
|
||||
opt.spelllang= 'en,de'
|
||||
opt.completeopt= 'menu,menuone,noselect'
|
||||
opt.expandtab= true
|
||||
opt.smartindent= true
|
||||
opt.title = true
|
||||
opt.titlestring = '%{getcwd()} - %t'
|
||||
|
||||
-- go to previous/next line with h,l,left arrow and right arrow
|
||||
-- when cursor reaches end/beginning of line
|
||||
-- opt.whichwrap:append('<>[]hl')
|
||||
|
||||
-- disable nvim intro
|
||||
opt.shortmess:append('sI')
|
||||
|
||||
-- Treesitter based folding
|
||||
opt.foldlevel = 20
|
||||
opt.foldmethod = 'expr'
|
||||
opt.foldexpr = 'nvim_treesitter#foldexpr()'
|
||||
|
||||
|
@ -1,55 +1,231 @@
|
||||
return require('packer').startup(function()
|
||||
vim.cmd([[
|
||||
augroup packer_user_config
|
||||
autocmd!
|
||||
autocmd BufWritePost my_plugins.lua source <afile> | PackerCompile
|
||||
augroup end
|
||||
]])
|
||||
|
||||
local fn = vim.fn
|
||||
local install_path = fn.stdpath('data') .. '/site/pack/packer/start/packer.nvim'
|
||||
if fn.empty(fn.glob(install_path)) > 0 then
|
||||
packer_bootstrap = fn.system({
|
||||
'git',
|
||||
'clone',
|
||||
'--depth',
|
||||
'1',
|
||||
'https://github.com/wbthomason/packer.nvim',
|
||||
install_path,
|
||||
})
|
||||
end
|
||||
vim.api.nvim_command('packadd packer.nvim')
|
||||
|
||||
local function get_setup(name)
|
||||
return string.format('require("setup/%s")', name)
|
||||
end
|
||||
|
||||
local packerUtil = require('packer.util')
|
||||
require('packer').init({
|
||||
snapshot_path = packerUtil.join_paths(vim.fn.stdpath('config'), 'snapshots'),
|
||||
display = {
|
||||
open_fn = require('packer.util').float,
|
||||
},
|
||||
})
|
||||
|
||||
return require('packer').startup(function()
|
||||
-- Packer can manage itself as an optional plugin
|
||||
use {'wbthomason/packer.nvim'}
|
||||
use {'neovim/nvim-lspconfig'}
|
||||
use {'nvim-treesitter/nvim-treesitter'}
|
||||
use {
|
||||
'nvim-telescope/telescope.nvim',
|
||||
requires = {{'nvim-lua/popup.nvim'}, {'nvim-lua/plenary.nvim'}, {'kyazdani42/nvim-web-devicons'}}
|
||||
}
|
||||
use {'sainnhe/gruvbox-material'}
|
||||
use {'lukas-reineke/indent-blankline.nvim'}
|
||||
use {'nvim-lua/plenary.nvim'}
|
||||
use {'lewis6991/gitsigns.nvim'}
|
||||
use {
|
||||
'kyazdani42/nvim-tree.lua',
|
||||
requires = 'kyazdani42/nvim-web-devicons'
|
||||
}
|
||||
use{'numToStr/Comment.nvim'}
|
||||
use {
|
||||
use({ 'wbthomason/packer.nvim' })
|
||||
use({
|
||||
'nvim-treesitter/nvim-treesitter',
|
||||
run = ':TSUpdate',
|
||||
config = get_setup('treesitter'),
|
||||
})
|
||||
use({
|
||||
'nvim-telescope/telescope.nvim',
|
||||
requires = {
|
||||
{ 'nvim-lua/popup.nvim' },
|
||||
{ 'nvim-lua/plenary.nvim' },
|
||||
{ 'kyazdani42/nvim-web-devicons' },
|
||||
{ 'nvim-telescope/telescope-fzf-native.nvim',
|
||||
run = 'cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release -G Ninja && cmake --build build --config Release && cmake --install build --prefix build' },
|
||||
},
|
||||
config = get_setup('telescope'),
|
||||
})
|
||||
use({
|
||||
'sainnhe/gruvbox-material',
|
||||
disable = true,
|
||||
config = get_setup('my_gruvbox-material')
|
||||
})
|
||||
use({
|
||||
'ellisonleao/gruvbox.nvim',
|
||||
disable = true,
|
||||
config = get_setup('gruvbox'),
|
||||
})
|
||||
use({
|
||||
'luisiacc/gruvbox-baby',
|
||||
disable = false,
|
||||
config = get_setup('my_gruvbox-baby')
|
||||
})
|
||||
use({
|
||||
'lukas-reineke/indent-blankline.nvim',
|
||||
requires = {
|
||||
'nvim-treesitter/nvim-treesitter',
|
||||
},
|
||||
config = get_setup('indent_blankline'),
|
||||
})
|
||||
use({ 'nvim-lua/plenary.nvim' })
|
||||
use({
|
||||
'lewis6991/gitsigns.nvim',
|
||||
config = get_setup('gitsigns'),
|
||||
})
|
||||
use({
|
||||
'kyazdani42/nvim-tree.lua',
|
||||
requires = 'kyazdani42/nvim-web-devicons',
|
||||
config = get_setup('nvim-tree'),
|
||||
disable = true,
|
||||
})
|
||||
use({
|
||||
'numToStr/Comment.nvim',
|
||||
config = get_setup('comment'),
|
||||
})
|
||||
use({
|
||||
'hrsh7th/nvim-cmp',
|
||||
requires = {
|
||||
'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'
|
||||
}
|
||||
}
|
||||
use {'rafamadriz/friendly-snippets'}
|
||||
use {'onsails/lspkind-nvim'}
|
||||
use {'Shatur/neovim-cmake',
|
||||
requires = {'mfussenegger/nvim-dap'}
|
||||
}
|
||||
use {'AckslD/nvim-neoclip.lua'}
|
||||
use {
|
||||
{ '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' },
|
||||
{ 'ray-x/cmp-treesitter' },
|
||||
{ 'hrsh7th/cmp-nvim-lsp-signature-help' },
|
||||
{ 'p00f/clangd_extensions.nvim' },
|
||||
},
|
||||
config = get_setup('cmp'),
|
||||
})
|
||||
use({ 'L3MON4D3/LuaSnip', config = get_setup('luasnip') })
|
||||
use({ 'rafamadriz/friendly-snippets' })
|
||||
use({ 'onsails/lspkind-nvim' })
|
||||
use({ 'Shatur/neovim-cmake', requires = { 'mfussenegger/nvim-dap' }, config = get_setup('cmake') })
|
||||
use({
|
||||
'hoob3rt/lualine.nvim',
|
||||
requires = {'kyazdani42/nvim-web-devicons', opt = true}
|
||||
}
|
||||
use {'ahmedkhalf/project.nvim'}
|
||||
use {'p00f/nvim-ts-rainbow'}
|
||||
use {'simrat39/symbols-outline.nvim'}
|
||||
use {'f-person/git-blame.nvim'}
|
||||
use {'windwp/nvim-autopairs'}
|
||||
use {'nvim-telescope/telescope-fzf-native.nvim', run = 'make'}
|
||||
use {'ray-x/lsp_signature.nvim'}
|
||||
use {'s1n7ax/nvim-terminal'}
|
||||
use {
|
||||
requires = { 'kyazdani42/nvim-web-devicons', opt = true },
|
||||
config = get_setup('lualine'),
|
||||
})
|
||||
use({
|
||||
'ahmedkhalf/project.nvim',
|
||||
config = get_setup('project'),
|
||||
})
|
||||
use({ 'p00f/nvim-ts-rainbow',
|
||||
requires = 'nvim-treesitter/nvim-treesitter',
|
||||
})
|
||||
use({
|
||||
'windwp/nvim-autopairs',
|
||||
config = get_setup('nvim-autopairs'),
|
||||
})
|
||||
use({ 'ray-x/lsp_signature.nvim' })
|
||||
use({
|
||||
's1n7ax/nvim-terminal',
|
||||
config = get_setup('terminal'),
|
||||
})
|
||||
use({
|
||||
'williamboman/nvim-lsp-installer',
|
||||
requires = {'neovim/nvim-lspconfig'}
|
||||
requires = {
|
||||
'neovim/nvim-lspconfig',
|
||||
'p00f/clangd_extensions.nvim',
|
||||
},
|
||||
config = get_setup('lspinstall'),
|
||||
disable = true,
|
||||
})
|
||||
use({
|
||||
'neovim/nvim-lspconfig',
|
||||
requires = {
|
||||
'williamboman/mason.nvim',
|
||||
'williamboman/mason-lspconfig.nvim',
|
||||
'p00f/clangd_extensions.nvim',
|
||||
},
|
||||
config = get_setup('my_lspconfig'),
|
||||
})
|
||||
use({
|
||||
'jose-elias-alvarez/null-ls.nvim',
|
||||
requires = { 'nvim-lua/plenary.nvim' },
|
||||
})
|
||||
use({
|
||||
'danymat/neogen',
|
||||
requires = 'nvim-treesitter/nvim-treesitter',
|
||||
config = get_setup('neogen'),
|
||||
})
|
||||
use({ 'stevearc/dressing.nvim' })
|
||||
use({
|
||||
'nvim-treesitter/nvim-treesitter-textobjects',
|
||||
requires = 'nvim-treesitter/nvim-treesitter',
|
||||
})
|
||||
use({
|
||||
'nvim-neo-tree/neo-tree.nvim',
|
||||
requires = {
|
||||
'nvim-lua/plenary.nvim',
|
||||
'kyazdani42/nvim-web-devicons',
|
||||
'MunifTanjim/nui.nvim',
|
||||
},
|
||||
config = get_setup('neo-tree'),
|
||||
})
|
||||
use({
|
||||
'akinsho/toggleterm.nvim',
|
||||
config = get_setup('toggleterm'),
|
||||
})
|
||||
use({
|
||||
'gfeiyou/command-center.nvim',
|
||||
requires = { 'nvim-telescope/telescope.nvim' },
|
||||
config = get_setup('my_command_center'),
|
||||
})
|
||||
use({
|
||||
'gbprod/yanky.nvim',
|
||||
config = get_setup('yanky')
|
||||
})
|
||||
use {
|
||||
'ldelossa/litee.nvim',
|
||||
requires = {
|
||||
'ldelossa/litee-calltree.nvim',
|
||||
'ldelossa/litee-symboltree.nvim',
|
||||
'ldelossa/gh.nvim'
|
||||
},
|
||||
config = get_setup('my_litee')
|
||||
}
|
||||
use {
|
||||
'jose-elias-alvarez/null-ls.nvim',
|
||||
requires = {'nvim-lua/plenary.nvim'}
|
||||
'stevearc/aerial.nvim',
|
||||
config = get_setup('aerial')
|
||||
}
|
||||
use {
|
||||
'm-demare/hlargs.nvim',
|
||||
requires = { 'nvim-treesitter/nvim-treesitter' },
|
||||
config = get_setup('my_hlargs')
|
||||
}
|
||||
use {
|
||||
'ggandor/leap.nvim',
|
||||
requires = { 'tpope/vim-repeat' },
|
||||
config = get_setup('my_leap')
|
||||
}
|
||||
use {
|
||||
'mfussenegger/nvim-dap',
|
||||
requires = {
|
||||
'mfussenegger/nvim-dap-python',
|
||||
'theHamsta/nvim-dap-virtual-text',
|
||||
'nvim-telescope/telescope-dap.nvim',
|
||||
'rcarriga/cmp-dap',
|
||||
'rcarriga/nvim-dap-ui'
|
||||
},
|
||||
config = get_setup('my_dap')
|
||||
}
|
||||
use {
|
||||
'sindrets/diffview.nvim',
|
||||
requires = 'nvim-lua/plenary.nvim',
|
||||
config = get_setup('my_diffview')
|
||||
}
|
||||
if packer_bootstrap then
|
||||
require('packer').sync()
|
||||
end
|
||||
end)
|
||||
|
6
lua/setup/aerial.lua
Normal file
6
lua/setup/aerial.lua
Normal file
@ -0,0 +1,6 @@
|
||||
require('aerial').setup({
|
||||
backends = { 'lsp', 'treesitter','markdown' },
|
||||
default_direction = "prefer_left",
|
||||
filter_kind = false,
|
||||
show_guides = true,
|
||||
})
|
10
lua/setup/cmake.lua
Normal file
10
lua/setup/cmake.lua
Normal file
@ -0,0 +1,10 @@
|
||||
local opt = vim.opt -- to set options
|
||||
-- require('telescope').load_extension('cmake')
|
||||
require('cmake').setup({
|
||||
parameters_file = 'neovim.json', -- JSON file to store information about selected target, run arguments and build type.
|
||||
build_dir = '{cwd}/build_nvim', -- Build directory. The expressions `{cwd}`, `{os}` and `{build_type}` will be expanded with the corresponding text values.
|
||||
})
|
||||
-- msbuild errorformat
|
||||
opt.errorformat:append('\\ %#%f(%l\\\\\\,%c):\\ %m')
|
||||
-- cl.exe errorformat
|
||||
-- o.errorformat:append('\ %#%f(%l) : %#%t%[A-z]%# %m')
|
139
lua/setup/cmp.lua
Normal file
139
lua/setup/cmp.lua
Normal file
@ -0,0 +1,139 @@
|
||||
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 = function(entry, vim_item)
|
||||
-- fancy icons and a name of kind
|
||||
vim_item.kind = require('lspkind').presets.default[vim_item.kind] .. ' ' .. vim_item.kind
|
||||
-- set a name for each source
|
||||
vim_item.menu = ({
|
||||
buffer = '[Buffer]',
|
||||
nvim_lsp = '[LSP]',
|
||||
ultisnips = '[UltiSnips]',
|
||||
nvim_lua = '[Lua]',
|
||||
cmp_tabnine = '[TabNine]',
|
||||
look = '[Look]',
|
||||
path = '[Path]',
|
||||
spell = '[Spell]',
|
||||
calc = '[Calc]',
|
||||
emoji = '[Emoji]',
|
||||
})[entry.source.name]
|
||||
return vim_item
|
||||
end,
|
||||
},
|
||||
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 = true }),
|
||||
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' },
|
||||
{ name = 'nvim_lsp' },
|
||||
{ name = 'nvim_lsp_signature_help' },
|
||||
{ name = 'treesitter' },
|
||||
{ name = 'buffer' },
|
||||
-- { name = 'nvim_lua' },
|
||||
-- { name = 'look' },
|
||||
-- { name = 'path' },
|
||||
-- { name = 'cmp_tabnine' },
|
||||
-- { name = 'calc' },
|
||||
-- { name = 'spell' },
|
||||
-- { name = 'emoji' },
|
||||
},
|
||||
completion = { completeopt = 'menu,menuone,noinsert, noselect' },
|
||||
sorting = {
|
||||
comparators = {
|
||||
cmp.config.compare.offset,
|
||||
cmp.config.compare.exact,
|
||||
require('clangd_extensions.cmp_scores'),
|
||||
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 = cmp.config.sources({
|
||||
{ name = 'path' },
|
||||
}, {
|
||||
{ name = 'cmdline' },
|
||||
}, {
|
||||
{ name = 'buffer' },
|
||||
}),
|
||||
})
|
||||
|
||||
-- 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 = '' } }))
|
||||
|
||||
-- TabNine
|
||||
--local tabnine = require('cmp_tabnine.config')
|
||||
--tabnine:setup({max_lines = 1000, max_num_results = 20, sort = true})
|
||||
|
||||
-- Database completion
|
||||
vim.api.nvim_exec(
|
||||
[[
|
||||
autocmd FileType sql,mysql,plsql lua require('cmp').setup.buffer({ sources = {{ name = 'vim-dadbod-completion' }} })
|
||||
]],
|
||||
false
|
||||
)
|
3
lua/setup/comment.lua
Normal file
3
lua/setup/comment.lua
Normal file
@ -0,0 +1,3 @@
|
||||
require('Comment').setup({
|
||||
mappings = false,
|
||||
})
|
9
lua/setup/gitsigns.lua
Normal file
9
lua/setup/gitsigns.lua
Normal file
@ -0,0 +1,9 @@
|
||||
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,
|
||||
},
|
||||
})
|
14
lua/setup/gruvbox.lua
Normal file
14
lua/setup/gruvbox.lua
Normal file
@ -0,0 +1,14 @@
|
||||
require('gruvbox').setup({
|
||||
undercurl = true,
|
||||
underline = true,
|
||||
bold = false,
|
||||
italic = false, -- will make italic comments and special strings
|
||||
inverse = true, -- invert background for search, diffs, statuslines and errors
|
||||
invert_selection = false,
|
||||
invert_signs = false,
|
||||
invert_tabline = false,
|
||||
invert_intend_guides = false,
|
||||
contrast = "hard", -- can be "hard" or "soft"
|
||||
overrides = {},
|
||||
})
|
||||
vim.cmd('colorscheme gruvbox')
|
12
lua/setup/indent_blankline.lua
Normal file
12
lua/setup/indent_blankline.lua
Normal file
@ -0,0 +1,12 @@
|
||||
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' },
|
||||
})
|
192
lua/setup/lspinstall.lua
Normal file
192
lua/setup/lspinstall.lua
Normal file
@ -0,0 +1,192 @@
|
||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||
capabilities.textDocument.completion.completionItem.documentationFormat = { 'markdown', 'plaintext' }
|
||||
capabilities.textDocument.completion.completionItem.snippetSupport = true
|
||||
capabilities.textDocument.completion.completionItem.preselectSupport = true
|
||||
capabilities.textDocument.completion.completionItem.insertReplaceSupport = true
|
||||
capabilities.textDocument.completion.completionItem.labelDetailsSupport = true
|
||||
capabilities.textDocument.completion.completionItem.deprecatedSupport = true
|
||||
capabilities.textDocument.completion.completionItem.commitCharactersSupport = true
|
||||
capabilities.textDocument.completion.completionItem.tagSupport = { valueSet = { 1 } }
|
||||
capabilities.offsetEncoding = { 'utf-16' }
|
||||
capabilities.textDocument.completion.completionItem.resolveSupport = {
|
||||
properties = {
|
||||
'documentation',
|
||||
'detail',
|
||||
'additionalTextEdits',
|
||||
},
|
||||
}
|
||||
|
||||
OpenDiagFloat = function()
|
||||
for _, winid in pairs(vim.api.nvim_tabpage_list_wins(0)) do
|
||||
if vim.api.nvim_win_get_config(winid).zindex then
|
||||
return
|
||||
end
|
||||
end
|
||||
vim.diagnostic.open_float({ focusable = false })
|
||||
end
|
||||
|
||||
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.
|
||||
local opts = { noremap = true, silent = false, buffer = true }
|
||||
vim.keymap.set('n', '<space>,', vim.lsp.diagnostic.goto_prev, opts)
|
||||
vim.keymap.set('n', '<space>;', vim.lsp.diagnostic.goto_next, opts)
|
||||
vim.keymap.set('n', '<space>a', vim.lsp.buf.code_action, opts)
|
||||
vim.keymap.set('n', '<space>d', vim.lsp.buf.definition, opts)
|
||||
vim.keymap.set('n', '<space>e', vim.lsp.buf.declaration, opts)
|
||||
vim.keymap.set('n', '<space>h', vim.lsp.buf.hover, opts)
|
||||
vim.keymap.set('n', '<space>c', vim.lsp.buf.outgoing_calls, opts)
|
||||
vim.keymap.set('n', '<space>C', vim.lsp.buf.incoming_calls, opts)
|
||||
vim.keymap.set('n', '<space>m', vim.lsp.buf.rename, opts)
|
||||
local tele_builtins = require('telescope.builtin')
|
||||
vim.keymap.set('n', '<C-t>', tele_builtins.lsp_dynamic_workspace_symbols, opts)
|
||||
vim.keymap.set('n', '<space>D', vim.lsp.buf.type_definition, opts)
|
||||
vim.keymap.set('n', '<C-k>', vim.lsp.buf.signature_help, opts)
|
||||
vim.keymap.set('n', '<space>r', tele_builtins.lsp_references, opts)
|
||||
vim.keymap.set('n', '<A-m>', '<cmd>Telescope aerial<cr>', opts)
|
||||
vim.keymap.set('n', '<space>v', function() tele_builtins.diagnostics({ bufnr = 0 }) end, opts)
|
||||
vim.keymap.set('n', '<A-o>', '<cmd>ClangdSwitchSourceHeader<CR>', opts)
|
||||
|
||||
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, opts)
|
||||
end
|
||||
if client.server_capabilities.documentRangeFormattingProvider then
|
||||
vim.keymap.set('v', '<space>f', vim.lsp.buf.range_formatting, opts)
|
||||
end
|
||||
|
||||
-- Set autocommands conditional on server_capabilities
|
||||
if client.server_capabilities.documentHighlightProvider then
|
||||
vim.api.nvim_exec(
|
||||
[[
|
||||
hi LspReferenceRead cterm=bold ctermbg=red guibg=DarkGreen
|
||||
hi LspReferenceWrite cterm=bold ctermbg=red guibg=DarkRed
|
||||
]], false)
|
||||
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)
|
||||
require("aerial").on_attach(client, bufnr)
|
||||
end
|
||||
|
||||
local lsp_installer = require('nvim-lsp-installer')
|
||||
|
||||
local servers = {
|
||||
'pyright',
|
||||
'cmake',
|
||||
'clangd',
|
||||
'jsonls',
|
||||
'sumneko_lua',
|
||||
'dockerls',
|
||||
}
|
||||
|
||||
for _, name in pairs(servers) do
|
||||
local server_is_found, server = lsp_installer.get_server(name)
|
||||
if server_is_found then
|
||||
if not server:is_installed() then
|
||||
print('Installing ' .. name)
|
||||
server:install()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
lsp_installer.on_server_ready(function(server)
|
||||
local opts = {
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
}
|
||||
|
||||
-- (optional) Customize the options passed to the server
|
||||
if server.name == 'clangd' then
|
||||
return
|
||||
end
|
||||
|
||||
if server.name == 'sumneko_lua' then
|
||||
local lua_rtp = vim.split(package.path, ';')
|
||||
table.insert(lua_rtp, 'lua/?.lua')
|
||||
table.insert(lua_rtp, 'lua/?/init.lua')
|
||||
opts.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),
|
||||
},
|
||||
-- Do not send telemetry data containing a randomized but unique identifier
|
||||
telemetry = {
|
||||
enable = false,
|
||||
},
|
||||
},
|
||||
}
|
||||
end
|
||||
if server.name == 'yamlls' then
|
||||
opts.settings = {
|
||||
yaml = {
|
||||
validate = false
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
-- This setup() function is exactly the same as lspconfig's setup function (:help lspconfig-quickstart)
|
||||
server:setup(opts)
|
||||
vim.cmd([[ do User LspAttachBuffers ]])
|
||||
end)
|
||||
|
||||
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.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 })
|
||||
|
||||
require('clangd_extensions').setup({
|
||||
server = {
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
cmd = { 'clangd', '--compile-commands-dir=build_nvim' },
|
||||
},
|
||||
})
|
34
lua/setup/lualine.lua
Normal file
34
lua/setup/lualine.lua
Normal file
@ -0,0 +1,34 @@
|
||||
if vim.version().minor >= 8 then
|
||||
local function status_line()
|
||||
local file_name = "%-.32t"
|
||||
local modified = " %-m"
|
||||
local right_align = "%="
|
||||
local line_no = "%10([%l/%L%)]"
|
||||
local pct_thru_file = "%5p%%"
|
||||
|
||||
return string.format(
|
||||
"%s%s%s%s%s",
|
||||
file_name,
|
||||
modified,
|
||||
right_align,
|
||||
line_no,
|
||||
pct_thru_file
|
||||
)
|
||||
end
|
||||
|
||||
vim.opt.laststatus = 3
|
||||
vim.opt.winbar = status_line()
|
||||
require('lualine').setup({
|
||||
options = { theme = 'gruvbox-baby' },
|
||||
sections = { lualine_c = { 'getcwd' } },
|
||||
inactive_sections = { lualine_c = { 'getcwd', { 'filename', path = 1, file_status = true } } },
|
||||
globalstatus = true,
|
||||
})
|
||||
else
|
||||
require('lualine').setup({
|
||||
options = { theme = 'gruvbox-baby' },
|
||||
sections = { lualine_c = { 'filename' } },
|
||||
globalstatus = false,
|
||||
-- inactive_sections = { lualine_c = { 'filename' } },
|
||||
})
|
||||
end
|
57
lua/setup/luasnip.lua
Normal file
57
lua/setup/luasnip.lua
Normal file
@ -0,0 +1,57 @@
|
||||
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" } })
|
249
lua/setup/my_command_center.lua
Normal file
249
lua/setup/my_command_center.lua
Normal file
@ -0,0 +1,249 @@
|
||||
require('telescope').load_extension('command_center')
|
||||
|
||||
local command_center = require('command_center')
|
||||
local noremap = { noremap = true }
|
||||
local silent_noremap = { noremap = true, silent = true }
|
||||
|
||||
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
|
||||
|
||||
command_center.add({
|
||||
{
|
||||
description = 'Open command_center',
|
||||
cmd = '<CMD>Telescope command_center<CR>',
|
||||
keybindings = {
|
||||
{ 'n', '<Leader>p', noremap },
|
||||
{ 'x', '<Leader>p', noremap },
|
||||
},
|
||||
},
|
||||
{
|
||||
description = 'Open a new tab',
|
||||
cmd = '<CMD>tabnew .<CR>',
|
||||
keybindings = {
|
||||
{ 'n', 'F2', silent_noremap },
|
||||
},
|
||||
},
|
||||
{
|
||||
description = 'Open a new vertical split',
|
||||
cmd = '<CMD>vsplit .<CR>',
|
||||
keybindings = {
|
||||
{ 'n', '<C-F2>', silent_noremap },
|
||||
},
|
||||
},
|
||||
{
|
||||
description = 'Open a new horizontal split',
|
||||
cmd = '<CMD>split .<CR>',
|
||||
keybindings = {
|
||||
{ 'n', '<S-F2>', silent_noremap },
|
||||
},
|
||||
},
|
||||
{
|
||||
description = 'CMake build all',
|
||||
cmd = '<CMD>CMake build_all<CR>',
|
||||
},
|
||||
{
|
||||
description = 'CMake build selected target',
|
||||
cmd = '<CMD>CMake build<CR>',
|
||||
keybindings = {
|
||||
{ 'n', '<F4>', silent_noremap },
|
||||
},
|
||||
},
|
||||
{
|
||||
description = 'CMake configure',
|
||||
cmd = '<CMD>CMake configure<CR>',
|
||||
},
|
||||
{
|
||||
description = 'CMake select target',
|
||||
cmd = '<CMD>CMake select_target<CR>',
|
||||
},
|
||||
{
|
||||
description = 'CMake clear cache',
|
||||
cmd = '<CMD>CMake clear_cache<CR>',
|
||||
},
|
||||
{
|
||||
description = 'List snippets',
|
||||
cmd = '<CMD>LuaSnipListAvailable<CR>',
|
||||
},
|
||||
{
|
||||
description = 'Add comment',
|
||||
cmd = '<CMD>Neogen<CR>',
|
||||
keybindings = {
|
||||
{ 'n', '<leader>n', silent_noremap },
|
||||
},
|
||||
},
|
||||
{
|
||||
description = 'Select project',
|
||||
cmd = '<CMD>Telescope projects<CR>',
|
||||
keybindings = {
|
||||
{ 'n', '<space>p', silent_noremap },
|
||||
},
|
||||
},
|
||||
{
|
||||
description = 'Find file',
|
||||
cmd = '<CMD>lua require("telescope.builtin").find_files({no_ignore=true})<CR>',
|
||||
keybindings = {
|
||||
{ 'n', '<leader>f', silent_noremap },
|
||||
},
|
||||
},
|
||||
{
|
||||
description = 'Find git files',
|
||||
cmd = '<CMD>lua project_files()<CR>',
|
||||
keybindings = {
|
||||
{ 'n', '<leader>g', silent_noremap },
|
||||
},
|
||||
},
|
||||
{
|
||||
description = 'Find old files',
|
||||
cmd = '<CMD>Telescope oldfiles<CR>',
|
||||
keybindings = {
|
||||
{ 'n', '<leader>o', silent_noremap },
|
||||
},
|
||||
},
|
||||
{
|
||||
description = 'Open command history',
|
||||
cmd = '<CMD>Telescope command_history<CR>',
|
||||
keybindings = {
|
||||
{ 'n', '<leader>h', silent_noremap },
|
||||
},
|
||||
},
|
||||
{
|
||||
description = 'Select buffer',
|
||||
cmd = '<CMD>Telescope buffers<CR>',
|
||||
keybindings = {
|
||||
{ 'n', '<leader>b', silent_noremap },
|
||||
},
|
||||
},
|
||||
{
|
||||
description = 'Quickfix list with telescope',
|
||||
cmd = '<CMD>Telescope quickfix<CR>',
|
||||
keybindings = {
|
||||
{ 'n', '<leader>q', silent_noremap },
|
||||
},
|
||||
},
|
||||
{
|
||||
description = 'Search in project',
|
||||
cmd = '<CMD>Telescope live_grep<CR>',
|
||||
keybindings = {
|
||||
{ 'n', '<leader>l', silent_noremap },
|
||||
{ 'n', '<c-s-f>', silent_noremap },
|
||||
},
|
||||
},
|
||||
{
|
||||
description = 'Search in open files',
|
||||
cmd = "<CMD>lua require('telescope.builtin').live_grep({ prompt_title = 'find string in open buffers...', grep_open_files = true })<CR>",
|
||||
},
|
||||
{
|
||||
description = 'Open clipboard history',
|
||||
cmd = '<CMD>Telescope neoclip<CR>',
|
||||
keybindings = {
|
||||
{ 'n', '<C-y>', silent_noremap },
|
||||
},
|
||||
},
|
||||
{
|
||||
description = 'Open jumplist',
|
||||
cmd = '<CMD>Telescope jumplist<CR>',
|
||||
keybindings = {
|
||||
{ 'n', '<leader>j', silent_noremap },
|
||||
},
|
||||
},
|
||||
{
|
||||
description = 'Find in buffer',
|
||||
cmd = '<CMD>Telescope current_buffer_fuzzy_find<CR>',
|
||||
keybindings = {
|
||||
{ 'n', '<c-f>', silent_noremap },
|
||||
},
|
||||
},
|
||||
{
|
||||
description = 'Find in workspace',
|
||||
cmd = '<CMD>Telescope grep_string<CR>',
|
||||
keybindings = {
|
||||
{ 'n', '<leader>d', silent_noremap },
|
||||
},
|
||||
},
|
||||
{
|
||||
description = 'Open lazygit',
|
||||
cmd = '<CMD>lua _lazygit_toggle()<CR>',
|
||||
keybindings = {
|
||||
{ 'n', '<Space>g', silent_noremap },
|
||||
},
|
||||
},
|
||||
{
|
||||
description = 'Word under cursor into register a',
|
||||
cmd = '"ayiw',
|
||||
keybindings = {
|
||||
{ 'n', '<leader>a', silent_noremap },
|
||||
},
|
||||
},
|
||||
{
|
||||
description = 'Toggle fold',
|
||||
cmd = 'za',
|
||||
keybindings = {
|
||||
{ 'n', '<space>x', silent_noremap },
|
||||
},
|
||||
},
|
||||
{
|
||||
description = 'Yanky cycle forward',
|
||||
cmd = '<Plug>(YankyCycleForward)',
|
||||
keybindings = {
|
||||
{ 'n', '<c-n>', silent_noremap },
|
||||
},
|
||||
},
|
||||
{
|
||||
description = 'Yanky cycle backward',
|
||||
cmd = '<Plug>(YankyCycleBackward)',
|
||||
keybindings = {
|
||||
{ 'n', '<c-p>', silent_noremap },
|
||||
},
|
||||
},
|
||||
{
|
||||
description = 'Github list PRs',
|
||||
cmd = '<CMD>Octo pr list<CR>',
|
||||
},
|
||||
{
|
||||
description = 'Github checkout PR',
|
||||
cmd = '<CMD>Octo pr checkout<CR>',
|
||||
},
|
||||
{
|
||||
description = 'Github open PR in browser',
|
||||
cmd = '<CMD>Octo pr browser<CR>',
|
||||
},
|
||||
{
|
||||
description = 'Comment line',
|
||||
cmd = '<Plug>(comment_toggle_current_linewise)',
|
||||
keybindings = {
|
||||
{ 'n', '<c-_>', silent_noremap },
|
||||
{ 'n', '<c-c>', silent_noremap },
|
||||
},
|
||||
},
|
||||
{
|
||||
description = 'Comment line',
|
||||
cmd = '<Plug>(comment_toggle_linewise_visual)gv',
|
||||
keybindings = {
|
||||
{ 'x', '<c-_>', silent_noremap },
|
||||
{ 'x', '<c-c>', silent_noremap },
|
||||
},
|
||||
},
|
||||
{
|
||||
description = 'Symbols outline',
|
||||
cmd = '<CMD>AerialToggle<CR>',
|
||||
keybindings = {
|
||||
{ 'n', '<leader>s', silent_noremap },
|
||||
{ 'n', '<Space>s', silent_noremap },
|
||||
},
|
||||
},
|
||||
{
|
||||
description = 'Big font size',
|
||||
cmd = '<CMD>set guifont=JetBrainsMonoNL\\ NF:h12<CR>',
|
||||
},
|
||||
{
|
||||
description = 'Reset font size',
|
||||
cmd = '<CMD>set guifont=JetBrainsMonoNL\\ NF:h9<CR>',
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
153
lua/setup/my_dap.lua
Normal file
153
lua/setup/my_dap.lua
Normal file
@ -0,0 +1,153 @@
|
||||
dap = require('dap')
|
||||
local opts = { noremap = true, silent = false }
|
||||
-- vim.keymap.set('n', '<F5>', dap.continue(), opts)
|
||||
vim.keymap.set('n', '<F5>', ":lua require('dap').continue()<CR>", opts)
|
||||
vim.keymap.set('n', '<F9>', ":lua require('dap').toggle_breakpoint()<CR>", opts)
|
||||
vim.keymap.set('n', '<F10>', ":lua require('dap').step_over()<CR>", opts)
|
||||
vim.keymap.set('n', '<F11>', ":lua require('dap').step_into()<CR>", opts)
|
||||
vim.keymap.set('n', '<S-F11>', ":lua require('dap').step_out()<CR>", opts)
|
||||
|
||||
local initDir = vim.api.nvim_list_runtime_paths()[1]
|
||||
local masonpath = vim.fn.stdpath('data') .. '/mason'
|
||||
|
||||
-- PYTHON
|
||||
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
|
||||
|
||||
dap.adapters.python = {
|
||||
type = 'executable';
|
||||
command = masonpath .. '/packages/debugpy/venv/' .. getVenvSuffix();
|
||||
args = { '-m', 'debugpy.adapter' };
|
||||
options = {
|
||||
detached = true;
|
||||
};
|
||||
}
|
||||
|
||||
local dap, dapui = require("dap"), require("dapui")
|
||||
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
|
||||
|
||||
local function getPythonEnv()
|
||||
local venv = os.getenv("VIRTUAL_ENV")
|
||||
if venv ~= nil then
|
||||
return string.format("%s\\bin\\python.exe", venv)
|
||||
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
|
||||
|
||||
dap.configurations.python = {
|
||||
{
|
||||
type = 'python';
|
||||
request = 'launch';
|
||||
name = "Launch file with venv";
|
||||
justMyCode = false;
|
||||
program = "${file}";
|
||||
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 = os.getenv('SCOOP') .. '/apps/llvm/current/bin/lldb-vscode.exe',
|
||||
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')
|
||||
-- require("cmp").setup.filetype({ "dap-repl", "dapui_watches" }, {
|
||||
-- sources = {
|
||||
-- { name = "dap" },
|
||||
-- },
|
||||
-- })
|
||||
require("dapui").setup()
|
3
lua/setup/my_diffview.lua
Normal file
3
lua/setup/my_diffview.lua
Normal file
@ -0,0 +1,3 @@
|
||||
local actions = require("diffview.actions")
|
||||
|
||||
require("diffview").setup({})
|
4
lua/setup/my_gruvbox-baby.lua
Normal file
4
lua/setup/my_gruvbox-baby.lua
Normal file
@ -0,0 +1,4 @@
|
||||
vim.g.gruvbox_baby_telescope_theme = 1
|
||||
local colors = require("gruvbox-baby.colors").config()
|
||||
vim.g.gruvbox_baby_highlights = {Visual = {bg = '#384741'}}
|
||||
vim.cmd[[colorscheme gruvbox-baby]]
|
5
lua/setup/my_gruvbox-material.lua
Normal file
5
lua/setup/my_gruvbox-material.lua
Normal file
@ -0,0 +1,5 @@
|
||||
vim.g.gruvbox_material_background = 'hard'
|
||||
vim.g.gruvbox_material_foreground = 'original'
|
||||
vim.g.gruvbox_material_cursor = 'purple'
|
||||
vim.g.gruvbox_material_diagnostic_virtual_text = 'colored'
|
||||
vim.cmd('colorscheme gruvbox-material')
|
1
lua/setup/my_hlargs.lua
Normal file
1
lua/setup/my_hlargs.lua
Normal file
@ -0,0 +1 @@
|
||||
require('hlargs').setup()
|
1
lua/setup/my_leap.lua
Normal file
1
lua/setup/my_leap.lua
Normal file
@ -0,0 +1 @@
|
||||
require('leap').set_default_keymaps()
|
55
lua/setup/my_litee.lua
Normal file
55
lua/setup/my_litee.lua
Normal file
@ -0,0 +1,55 @@
|
||||
-- configure the litee.nvim library
|
||||
require('litee.lib').setup({
|
||||
tree = {
|
||||
icon_set = "codicons"
|
||||
},
|
||||
panel = {
|
||||
orientation = "left",
|
||||
panel_size = 30
|
||||
}
|
||||
})
|
||||
-- configure litee-calltree.nvim
|
||||
require('litee.calltree').setup({
|
||||
map_resize_keys = false,
|
||||
on_open = 'panel',
|
||||
keymaps = {
|
||||
expand = "<space>",
|
||||
collapse = "zc",
|
||||
collapse_all = "zM",
|
||||
jump = "<CR>",
|
||||
jump_split = "s",
|
||||
jump_vsplit = "v",
|
||||
jump_tab = "t",
|
||||
hover = "i",
|
||||
details = "d",
|
||||
close = "X",
|
||||
close_panel_pop_out = "<Esc>",
|
||||
help = "?",
|
||||
hide = "H",
|
||||
switch = "S",
|
||||
focus = "f"
|
||||
},
|
||||
})
|
||||
-- configure litee-symboltree.nvim
|
||||
require('litee.symboltree').setup({
|
||||
map_resize_keys = false,
|
||||
on_open = 'panel',
|
||||
keymaps = {
|
||||
expand = '<space>',
|
||||
collapse = 'zc',
|
||||
collapse_all = 'zM',
|
||||
jump = '<CR>',
|
||||
jump_split = 's',
|
||||
jump_vsplit = 'v',
|
||||
jump_tab = 't',
|
||||
hover = 'i',
|
||||
details = 'd',
|
||||
close = 'X',
|
||||
close_panel_pop_out = '<Esc>',
|
||||
help = '?',
|
||||
hide = 'H',
|
||||
},
|
||||
})
|
||||
|
||||
require('litee.gh').setup({})
|
||||
|
201
lua/setup/my_lspconfig.lua
Normal file
201
lua/setup/my_lspconfig.lua
Normal file
@ -0,0 +1,201 @@
|
||||
require('mason').setup()
|
||||
require('mason-lspconfig').setup({
|
||||
automatic_installation = true,
|
||||
})
|
||||
|
||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||
capabilities.textDocument.completion.completionItem.documentationFormat = { 'markdown', 'plaintext' }
|
||||
capabilities.textDocument.completion.completionItem.snippetSupport = true
|
||||
capabilities.textDocument.completion.completionItem.preselectSupport = true
|
||||
capabilities.textDocument.completion.completionItem.insertReplaceSupport = true
|
||||
capabilities.textDocument.completion.completionItem.labelDetailsSupport = true
|
||||
capabilities.textDocument.completion.completionItem.deprecatedSupport = true
|
||||
capabilities.textDocument.completion.completionItem.commitCharactersSupport = true
|
||||
capabilities.textDocument.completion.completionItem.tagSupport = { valueSet = { 1 } }
|
||||
capabilities.offsetEncoding = { 'utf-16' }
|
||||
capabilities.textDocument.completion.completionItem.resolveSupport = {
|
||||
properties = {
|
||||
'documentation',
|
||||
'detail',
|
||||
'additionalTextEdits',
|
||||
},
|
||||
}
|
||||
capabilities = require('cmp_nvim_lsp').update_capabilities(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 })
|
||||
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.
|
||||
local opts = { noremap = true, silent = false, buffer = bufnr }
|
||||
vim.keymap.set('n', '<space>,', vim.diagnostic.goto_prev, opts)
|
||||
vim.keymap.set('n', '<space>;', vim.diagnostic.goto_next, opts)
|
||||
vim.keymap.set('n', '<space>a', vim.lsp.buf.code_action, opts)
|
||||
vim.keymap.set('n', '<space>d', vim.lsp.buf.definition, opts)
|
||||
vim.keymap.set('n', '<space>e', vim.lsp.buf.declaration, opts)
|
||||
vim.keymap.set('n', '<space>h', vim.lsp.buf.hover, opts)
|
||||
vim.keymap.set('n', '<space>c', vim.lsp.buf.outgoing_calls, opts)
|
||||
vim.keymap.set('n', '<space>C', vim.lsp.buf.incoming_calls, opts)
|
||||
vim.keymap.set('n', '<space>m', vim.lsp.buf.rename, opts)
|
||||
local tele_builtins = require('telescope.builtin')
|
||||
vim.keymap.set('n', '<C-t>', tele_builtins.lsp_dynamic_workspace_symbols, opts)
|
||||
vim.keymap.set('n', '<space>D', vim.lsp.buf.type_definition, opts)
|
||||
vim.keymap.set('n', '<C-k>', vim.lsp.buf.signature_help, opts)
|
||||
vim.keymap.set('n', '<space>r', tele_builtins.lsp_references, opts)
|
||||
vim.keymap.set('n', '<A-m>', '<cmd>Telescope aerial<cr>', opts)
|
||||
vim.keymap.set('n', '<space>v', function() tele_builtins.diagnostics({ bufnr = 0 }) end, opts)
|
||||
vim.keymap.set('n', '<A-o>', '<cmd>ClangdSwitchSourceHeader<CR>', opts)
|
||||
|
||||
vim.cmd([[autocmd CursorHold <buffer> lua OpenDiagFloat()]])
|
||||
|
||||
-- Set some keybinds conditional on server capabilities
|
||||
if client.server_capabilities.documentFormattingProvider then
|
||||
if vim.version().minor >= 8 then
|
||||
vim.keymap.set('n', '<space>f', vim.lsp.buf.format, opts)
|
||||
else
|
||||
vim.keymap.set('n', '<space>f', vim.lsp.buf.formatting, opts)
|
||||
end
|
||||
end
|
||||
if client.server_capabilities.documentRangeFormattingProvider then
|
||||
vim.keymap.set('v', '<space>f', vim.lsp.buf.range_formatting, opts)
|
||||
end
|
||||
|
||||
-- Set autocommands conditional on server_capabilities
|
||||
if client.server_capabilities.documentHighlightProvider then
|
||||
vim.api.nvim_exec(
|
||||
[[
|
||||
hi LspReferenceRead cterm=bold ctermbg=red guibg=DarkGreen
|
||||
hi LspReferenceWrite cterm=bold ctermbg=red guibg=DarkRed
|
||||
]], false)
|
||||
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)
|
||||
require("aerial").on_attach(client, 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,
|
||||
}
|
||||
|
||||
require('lspconfig')['clangd'].setup{
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
cmd = { 'clangd', '--compile-commands-dir=build_nvim' },
|
||||
}
|
||||
-- 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),
|
||||
},
|
||||
-- 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 = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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.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 })
|
51
lua/setup/neo-tree.lua
Normal file
51
lua/setup/neo-tree.lua
Normal file
@ -0,0 +1,51 @@
|
||||
-- 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.
|
||||
},
|
||||
-- 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,
|
||||
},
|
||||
},
|
||||
})
|
||||
vim.keymap.set('n', '\\', '<cmd>Neotree reveal<cr>')
|
20
lua/setup/neogen.lua
Normal file
20
lua/setup/neogen.lua
Normal file
@ -0,0 +1,20 @@
|
||||
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' },
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
1
lua/setup/nvim-autopairs.lua
Normal file
1
lua/setup/nvim-autopairs.lua
Normal file
@ -0,0 +1 @@
|
||||
require('nvim-autopairs').setup({})
|
27
lua/setup/nvim-tree.lua
Normal file
27
lua/setup/nvim-tree.lua
Normal file
@ -0,0 +1,27 @@
|
||||
require('nvim-tree').setup({
|
||||
auto_close = true,
|
||||
update_cwd = true,
|
||||
update_to_buf_dir = {
|
||||
-- enable the feature
|
||||
enable = true,
|
||||
-- allow to open the tree if it was previously closed
|
||||
auto_open = false,
|
||||
},
|
||||
update_focused_file = {
|
||||
enable = true,
|
||||
update_cwd = false,
|
||||
ignore_list = {},
|
||||
},
|
||||
diagnostics = {
|
||||
enable = true,
|
||||
icons = {
|
||||
hint = '',
|
||||
info = '',
|
||||
warning = '',
|
||||
error = '',
|
||||
},
|
||||
},
|
||||
})
|
||||
vim.keymap.set('n', '<leader>tt', '<cmd>NvimTreeToggle<CR>')
|
||||
vim.g.nvim_tree_highlight_opened_files = 1
|
||||
vim.g.nvim_tree_respect_buf_cwd = 1
|
1
lua/setup/octo.lua
Normal file
1
lua/setup/octo.lua
Normal file
@ -0,0 +1 @@
|
||||
require('octo').setup()
|
5
lua/setup/project.lua
Normal file
5
lua/setup/project.lua
Normal file
@ -0,0 +1,5 @@
|
||||
require('project_nvim').setup({
|
||||
silent_chdir = true,
|
||||
ignore_lsp = { 'null-ls', 'cmake' },
|
||||
})
|
||||
require('telescope').load_extension('projects')
|
@ -1,48 +1,52 @@
|
||||
local actions = require('telescope.actions')
|
||||
|
||||
local mappingTab = {
|
||||
i = {
|
||||
['<cr>'] = actions.select_tab,
|
||||
['<C-b>'] = actions.select_default,
|
||||
}
|
||||
}
|
||||
|
||||
require('telescope').setup {
|
||||
defaults = {
|
||||
mappings = {
|
||||
i = {
|
||||
['<esc>'] = actions.close,
|
||||
['<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',
|
||||
},
|
||||
oldfiles = {
|
||||
theme = 'ivy',
|
||||
},
|
||||
git_files = {
|
||||
theme = 'ivy',
|
||||
},
|
||||
lsp_dynamic_workspace_symbols = {
|
||||
},
|
||||
}
|
||||
}
|
||||
local actions = require('telescope.actions')
|
||||
|
||||
local mappingTab = {
|
||||
i = {
|
||||
['<cr>'] = actions.select_tab,
|
||||
['<C-b>'] = actions.select_default,
|
||||
},
|
||||
}
|
||||
|
||||
require('telescope').setup({
|
||||
defaults = {
|
||||
mappings = {
|
||||
i = {
|
||||
['<esc>'] = actions.close,
|
||||
['<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_dynamic_workspace_symbols = {},
|
||||
},
|
||||
})
|
||||
|
||||
require('telescope').load_extension('fzf')
|
||||
require('telescope').load_extension('aerial')
|
3
lua/setup/terminal.lua
Normal file
3
lua/setup/terminal.lua
Normal file
@ -0,0 +1,3 @@
|
||||
require('nvim-terminal').setup({
|
||||
toggle_keymap = '<leader>z',
|
||||
})
|
30
lua/setup/toggleterm.lua
Normal file
30
lua/setup/toggleterm.lua
Normal file
@ -0,0 +1,30 @@
|
||||
require('toggleterm').setup({})
|
||||
|
||||
local Terminal = require('toggleterm.terminal').Terminal
|
||||
|
||||
function _G.set_terminal_keymaps()
|
||||
local opts = { noremap = true }
|
||||
vim.api.nvim_buf_set_keymap(0, 't', '<esc>', [[<C-\><C-n>]], opts)
|
||||
vim.api.nvim_buf_set_keymap(0, 't', 'jk', [[<C-\><C-n>]], opts)
|
||||
vim.api.nvim_buf_set_keymap(0, 't', '<C-h>', [[<C-\><C-n><C-W>h]], opts)
|
||||
vim.api.nvim_buf_set_keymap(0, 't', '<C-j>', [[<C-\><C-n><C-W>j]], opts)
|
||||
vim.api.nvim_buf_set_keymap(0, 't', '<C-k>', [[<C-\><C-n><C-W>k]], opts)
|
||||
vim.api.nvim_buf_set_keymap(0, 't', '<C-l>', [[<C-\><C-n><C-W>l]], opts)
|
||||
end
|
||||
|
||||
-- Disbled for the moment because it is also set for lazygit
|
||||
-- vim.cmd('autocmd! TermOpen term://* lua set_terminal_keymaps()')
|
||||
|
||||
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})
|
||||
end,
|
||||
})
|
||||
|
||||
function _lazygit_toggle()
|
||||
lazygit:toggle()
|
||||
end
|
48
lua/setup/treesitter.lua
Normal file
48
lua/setup/treesitter.lua
Normal file
@ -0,0 +1,48 @@
|
||||
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.
|
13
lua/setup/yanky.lua
Normal file
13
lua/setup/yanky.lua
Normal file
@ -0,0 +1,13 @@
|
||||
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')
|
@ -1,16 +1,12 @@
|
||||
local utils = { }
|
||||
local utils = {}
|
||||
|
||||
local scopes = {o = vim.o, b = vim.bo, w = vim.wo}
|
||||
local scopes = { o = vim.o, b = vim.bo, w = vim.wo }
|
||||
|
||||
function utils.opt(scope, key, value)
|
||||
scopes[scope][key] = value
|
||||
if scope ~= 'o' then scopes['o'][key] = value end
|
||||
scopes[scope][key] = value
|
||||
if scope ~= 'o' then
|
||||
scopes['o'][key] = value
|
||||
end
|
||||
end
|
||||
|
||||
function utils.map(mode, lhs, rhs, opts)
|
||||
local options = {noremap = true}
|
||||
if opts then options = vim.tbl_extend('force', options, opts) end
|
||||
vim.api.nvim_set_keymap(mode, lhs, rhs, options)
|
||||
end
|
||||
|
||||
return utils
|
||||
return utils
|
||||
|
0
my-snippets/all.json
Normal file
0
my-snippets/all.json
Normal file
12
my-snippets/cpp.json
Normal file
12
my-snippets/cpp.json
Normal file
@ -0,0 +1,12 @@
|
||||
{
|
||||
"test_getter": {
|
||||
"prefix": "test_getter",
|
||||
"body": [
|
||||
"TEST(${1:TestClass}, ${2:TestFunction}",
|
||||
"{",
|
||||
"\tget${CLIPBOARD}()",
|
||||
"};"
|
||||
],
|
||||
"description": "Code snippet for testing the getter"
|
||||
}
|
||||
}
|
19
my-snippets/package.json
Normal file
19
my-snippets/package.json
Normal file
@ -0,0 +1,19 @@
|
||||
{
|
||||
"name": "my-snippets",
|
||||
"contributes": {
|
||||
"snippets": [
|
||||
{
|
||||
"language": [
|
||||
"all"
|
||||
],
|
||||
"path": "all.json"
|
||||
},
|
||||
{
|
||||
"language": [
|
||||
"cpp"
|
||||
],
|
||||
"path": "cpp.json"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
1
snapshots/stable.json
Normal file
1
snapshots/stable.json
Normal file
@ -0,0 +1 @@
|
||||
{"litee.nvim": {"commit": "de1a3d6"}, "nvim-dap": {"commit": "f4a3be5"}, "telescope-fzf-native.nvim": {"commit": "6a33ece"}, "packer.nvim": {"commit": "d268d2e"}, "tabout.nvim": {"commit": "be655cc"}, "nvim-lspconfig": {"commit": "b9c375c"}, "command-center.nvim": {"commit": "baaf831"}, "nvim-cmp": {"commit": "9897465"}, "clangd_extensions.nvim": {"commit": "81b56d4"}, "cmp-emoji": {"commit": "19075c3"}, "null-ls.nvim": {"commit": "a2b7bf8"}, "lualine.nvim": {"commit": "5113cdb"}, "cmp-cmdline": {"commit": "c36ca4b"}, "nvim-treesitter-textobjects": {"commit": "c8a393e"}, "cmp-nvim-lsp": {"commit": "affe808"}, "cmp_luasnip": {"commit": "a9de941"}, "friendly-snippets": {"commit": "15ecafe"}, "gitsigns.nvim": {"commit": "4883988"}, "dressing.nvim": {"commit": "af17983"}, "indent-blankline.nvim": {"commit": "4a58fe6"}, "lspkind-nvim": {"commit": "57e5b5d"}, "neo-tree.nvim": {"commit": "8613c45"}, "cmp-nvim-lsp-signature-help": {"commit": "007dd27"}, "cmp-look": {"commit": "b39c50b"}, "telescope.nvim": {"commit": "6ea1063"}, "litee-calltree.nvim": {"commit": "71f7eee"}, "lsp_signature.nvim": {"commit": "9c51678"}, "Comment.nvim": {"commit": "4086630"}, "cmp-spell": {"commit": "5602f1a"}, "yanky.nvim": {"commit": "521b94d"}, "gruvbox.nvim": {"commit": "79419f9"}, "gh.nvim": {"commit": "cdf177c"}, "aerial.nvim": {"commit": "bd6de88"}, "neovim-cmake": {"commit": "d0ffe31"}, "nvim-autopairs": {"commit": "4a95b39"}, "LuaSnip": {"commit": "295cc9e"}, "popup.nvim": {"commit": "b7404d3"}, "litee-symboltree.nvim": {"commit": "8f13d50"}, "nvim-web-devicons": {"commit": "8d2c533"}, "nvim-treesitter": {"commit": "cf6d84b"}, "nui.nvim": {"commit": "4af402d"}, "nvim-terminal": {"commit": "e058de4"}, "cmp-treesitter": {"commit": "c2886bb"}, "neogen": {"commit": "c5a0c39"}, "nvim-lsp-installer": {"commit": "12e7c06"}, "cmp-calc": {"commit": "f7efc20"}, "toggleterm.nvim": {"commit": "04174e1"}, "plenary.nvim": {"commit": "46e8bb9"}, "project.nvim": {"commit": "541115e"}, "cmp-nvim-lua": {"commit": "d276254"}, "nvim-ts-rainbow": {"commit": "837167f"}, "cmp-path": {"commit": "981baf9"}, "cmp-buffer": {"commit": "62fc67a"}}
|
1
snapshots/working.json
Normal file
1
snapshots/working.json
Normal file
@ -0,0 +1 @@
|
||||
{"litee.nvim": {"commit": "d346001"}, "nvim-dap": {"commit": "66d33b7"}, "telescope-fzf-native.nvim": {"commit": "6a33ece"}, "packer.nvim": {"commit": "afab895"}, "nvim-lspconfig": {"commit": "a78831f"}, "command-center.nvim": {"commit": "31468fd"}, "clangd_extensions.nvim": {"commit": "2390bf7"}, "nvim-dap-virtual-text": {"commit": "2971ce3"}, "null-ls.nvim": {"commit": "53622ed"}, "mason-lspconfig.nvim": {"commit": "3cbd87f"}, "lualine.nvim": {"commit": "4b5048a"}, "cmp-cmdline": {"commit": "9c0e331"}, "hlargs.nvim": {"commit": "f603d88"}, "aerial.nvim": {"commit": "1abd19b"}, "nvim-autopairs": {"commit": "ca89ab9"}, "cmp_luasnip": {"commit": "a9de941"}, "friendly-snippets": {"commit": "7339def"}, "leap.nvim": {"commit": "b9bc061"}, "gitsigns.nvim": {"commit": "1e107c9"}, "dressing.nvim": {"commit": "d886a1b"}, "indent-blankline.nvim": {"commit": "c15bbe9"}, "lspkind-nvim": {"commit": "57e5b5d"}, "neo-tree.nvim": {"commit": "a922c3a"}, "cmp-nvim-lsp-signature-help": {"commit": "57c4db7"}, "cmp-look": {"commit": "b39c50b"}, "telescope.nvim": {"commit": "4725867"}, "litee-calltree.nvim": {"commit": "7779988"}, "lsp_signature.nvim": {"commit": "4665921"}, "Comment.nvim": {"commit": "fe9bbdb"}, "cmp-spell": {"commit": "5602f1a"}, "yanky.nvim": {"commit": "d55f095"}, "mason.nvim": {"commit": "6171213"}, "gh.nvim": {"commit": "a675ce6"}, "nvim-treesitter-textobjects": {"commit": "b8df8b0"}, "neovim-cmake": {"commit": "338fd2a"}, "cmp-nvim-lsp": {"commit": "affe808"}, "LuaSnip": {"commit": "c599c56"}, "nvim-dap-ui": {"commit": "225115a"}, "popup.nvim": {"commit": "b7404d3"}, "litee-symboltree.nvim": {"commit": "426d4db"}, "nvim-web-devicons": {"commit": "2d02a56"}, "vim-repeat": {"commit": "24afe92"}, "cmp-dap": {"commit": "e21f0e5"}, "nvim-treesitter": {"commit": "501db14"}, "nui.nvim": {"commit": "9531977"}, "nvim-terminal": {"commit": "e058de4"}, "gruvbox-baby": {"commit": "a7dd15a"}, "cmp-emoji": {"commit": "19075c3"}, "cmp-treesitter": {"commit": "c2886bb"}, "neogen": {"commit": "c5a0c39"}, "project.nvim": {"commit": "090bb11"}, "cmp-calc": {"commit": "f7efc20"}, "nvim-dap-python": {"commit": "86d2636"}, "toggleterm.nvim": {"commit": "dfce846"}, "plenary.nvim": {"commit": "31807ee"}, "nvim-cmp": {"commit": "b588569"}, "telescope-dap.nvim": {"commit": "b4134ff"}, "cmp-path": {"commit": "447c87c"}, "nvim-ts-rainbow": {"commit": "d16220f"}, "cmp-nvim-lua": {"commit": "d276254"}, "cmp-buffer": {"commit": "62fc67a"}}
|
6
stylua.toml
Normal file
6
stylua.toml
Normal file
@ -0,0 +1,6 @@
|
||||
column_width = 120
|
||||
line_endings = "Unix"
|
||||
indent_type = "Spaces"
|
||||
indent_width = 2
|
||||
quote_style = "AutoPreferSingle"
|
||||
call_parentheses = "Always"
|
Reference in New Issue
Block a user