191 Commits
lua ... 0.1

Author SHA1 Message Date
4c9b016540 added working.json 2022-09-15 09:31:35 +02:00
e32ff73562 fixed fzf build by using Ninja 2022-09-15 09:30:17 +02:00
774fdda969 added diffview 2022-09-15 09:25:58 +02:00
612ec0cbe6 some more fixes for different nvim versions 2022-09-10 13:39:45 +02:00
c19072c4cd winbar only with nvim ^>= 0.8 2022-09-09 20:51:20 +02:00
e72eaa724e added lldb-vscode adapter 2022-09-09 20:51:20 +02:00
e6d1091430 map build to f4 2022-09-09 20:51:20 +02:00
59d9b95eb9 add cpp config and fix adapter 2022-09-09 20:51:20 +02:00
ebd55ecc55 correctly call getpythonenv 2022-09-09 20:51:20 +02:00
41ce8f2063 use debugpy from mason 2022-09-09 20:51:20 +02:00
652a1c2aa7 fixed dap python config 2022-09-09 20:51:20 +02:00
988db59976 fixed clangd search dir 2022-09-09 08:35:10 +02:00
54e6d1b844 set capabilities correctly 2022-08-31 12:18:50 +02:00
bf80f95a9a Merge branch 'master' of https://git.freiewildbahn.de/oli/nvim 2022-08-31 10:56:40 +02:00
99e1139337 cleanup python debug config 2022-08-09 14:47:36 +02:00
382871be03 auto launch debug ui 2022-08-09 14:47:20 +02:00
1ba7731c16 fixed visual selection in gruvbox baby 2022-08-09 14:47:05 +02:00
4a21802429 added python debug session with venv search 2022-08-09 14:17:01 +02:00
087e0faad2 added commands for font size 2022-08-08 10:00:45 +02:00
14fd19bde6 more dap plugins 2022-08-06 18:46:41 +02:00
8030c44a93 switch to gruvbox-baby 2022-08-06 18:40:48 +02:00
49f8494072 first running verion of dab python 2022-08-06 15:26:18 +02:00
69b5cace69 setup groovyls 2022-08-03 14:57:58 +02:00
5a22a03eba add clangd_extension as cmp dependency 2022-08-02 09:20:33 +02:00
c9c630ce61 format lua files 2022-07-31 14:18:55 +02:00
c792c0839b delete unused mason lua file 2022-07-31 14:16:20 +02:00
80cff42519 fixed lua language server loading with mason 2022-07-31 14:15:06 +02:00
d019626efb first version of dap 2022-07-31 13:57:57 +02:00
8953d89f3c Merge branch 'master' of https://git.freiewildbahn.de/oli/nvim 2022-07-31 13:57:03 +02:00
860b97c24c fixd fzf build 2022-07-31 13:56:56 +02:00
deb6dea93b removed lazy loading 2022-07-31 13:56:40 +02:00
b396169fca replaced deprecated diagnostic calls 2022-07-31 13:16:40 +02:00
6a8c84250f set ttimeoutlen 2022-07-26 22:35:52 +02:00
894dba3337 use mason for lsp install 2022-07-26 22:17:09 +02:00
8ebf953ec7 added leap 2022-07-10 23:42:52 +02:00
3aea401281 added yanky keys and telescope 2022-07-09 00:43:34 +02:00
98a9f00bd6 delete tabout 2022-07-09 00:29:26 +02:00
03c102be95 format 2022-07-08 23:43:04 +02:00
3b3bc5b937 support for my own vscode snippets 2022-07-08 23:43:04 +02:00
5d4cf9bfdc setup the linux font 2022-07-07 22:21:57 +02:00
219a8c3e81 fixed autocommand for checktime 2022-07-07 21:59:04 +02:00
d7b2cc3156 added hlargs 2022-07-05 23:20:51 +02:00
f9888e9c2a update stable 2022-07-04 23:41:44 +02:00
8b79b38ca0 disable virtual text again 2022-07-04 23:40:56 +02:00
d6f71c8ab2 disbable get to location after file load 2022-07-01 21:14:12 +02:00
23a3a8f7c6 added additional command for comment 2022-07-01 21:13:57 +02:00
d525388f3f fixed highlight 2022-07-01 21:08:37 +02:00
4bd385dd55 disable indent for treesitter 2022-07-01 20:55:20 +02:00
f9d9bbd258 disable bold and italic 2022-07-01 20:55:03 +02:00
c607af6115 updated font 2022-07-01 20:25:37 +02:00
b12a673ba1 update colorscheme 2022-07-01 20:24:41 +02:00
3c9ecc9d53 added cmp signature help 2022-07-01 17:28:13 +02:00
be42757e5e fixed aerial keybinding 2022-07-01 17:27:43 +02:00
8020639f31 use x for visual mode instead of v 2022-07-01 16:44:37 +02:00
ec56132c85 no aerial status message 2022-07-01 15:26:30 +02:00
3392ebe270 use virtual text for diagnostics again 2022-07-01 15:26:14 +02:00
ad480c4d35 just use all treesitter modules 2022-07-01 13:56:35 +02:00
49bb25aec6 fixed statusline 2022-07-01 13:56:06 +02:00
c27b582b89 removed some unused keymaps 2022-07-01 13:55:21 +02:00
9e2890aed9 use vim.keymap.set 2022-07-01 13:47:16 +02:00
0a31d71c0c disable default mappings for comment 2022-06-30 13:57:03 +02:00
7b776c7e9f no lazyloading of treesitter 2022-06-27 09:19:51 +02:00
1f60a85098 removed jsonc treesitter 2022-06-27 09:18:50 +02:00
688493d39d disable virtual line blame 2022-06-26 15:13:02 +02:00
b099ba7efd rework status line 2022-06-26 14:38:26 +02:00
0c66846e4e setup aerial 2022-06-26 14:32:29 +02:00
d609883ff7 set lualine theme to gruvbox 2022-06-26 14:10:53 +02:00
5ad1c4be90 fixed deprecated format call 2022-06-26 14:00:43 +02:00
5f357b0db5 load blankline after treesitter 2022-06-26 13:53:32 +02:00
0a60ff63bd updated stable snapshot 2022-06-26 13:23:05 +02:00
a1bff62966 set winbar statusline 2022-06-26 13:22:46 +02:00
3a0e386252 fixed deprecated resolved_capabilities 2022-06-26 13:15:47 +02:00
37b7a68c45 comment out some cmp sources 2022-06-26 13:01:28 +02:00
607245c47d removed incline 2022-06-26 13:01:00 +02:00
2c277ee846 add cmp treesitter 2022-06-26 12:59:50 +02:00
37d7e60eef added litee calltree keys 2022-06-07 15:24:42 +02:00
2951e86e06 fixed f5 to build all 2022-06-07 15:24:23 +02:00
228171561f use find files if there is not git repo 2022-06-01 11:47:00 +02:00
b1754cf7db remove modes.nvim 2022-05-31 14:28:06 +02:00
1f8ef76f81 Merge branch 'master' of https://git.freiewildbahn.de/oli/nvim 2022-05-31 14:06:11 +02:00
9b4fcca0ce put comment to ctrl slash 2022-05-31 09:56:37 +02:00
d9f90a1f4b remove stylua because of the lsp serverr 2022-05-27 10:19:24 +02:00
5b4878f76d replace octo with litee gh 2022-05-27 10:19:03 +02:00
c6d9e5b891 add litee 2022-05-26 22:09:25 +02:00
b31bd343fa fixed code actions command 2022-05-25 11:13:26 +02:00
c6bdb676aa set yaml for clang config files 2022-05-25 11:12:36 +02:00
2bdc01b56f added clangd file 2022-05-23 15:37:11 +02:00
6eba3c6f3a added some octo keymaps 2022-05-13 15:00:21 +02:00
3b66cc0b3c fixed wrap 2022-05-13 13:41:05 +02:00
db6d89471c more commands 2022-05-13 13:40:55 +02:00
892ac617ee added incline 2022-05-13 13:40:46 +02:00
c54a515556 removed focus only from modes plugin 2022-05-11 23:35:15 +02:00
20cb51e2b5 removed tree sitter query lang 2022-05-11 17:47:15 +02:00
d6930cbb2f added octo 2022-05-11 17:46:54 +02:00
76a7aad423 set additional keymappings for us keyboard 2022-05-11 17:46:28 +02:00
c921ae0f4f format 2022-05-05 15:26:58 +02:00
8db95a1880 use something else for shada 2022-05-05 15:26:43 +02:00
4a6de72626 removed maintained from treesitter 2022-05-05 15:26:18 +02:00
6c8531b67a don't validate yaml files 2022-05-02 10:28:46 +02:00
e34744b677 set title and titlestring 2022-04-29 15:56:22 +02:00
8cafa90c01 added doskey file type in autocommands 2022-04-29 15:04:26 +02:00
2da1322e7f ignore cmake lsp for project plugin 2022-04-29 15:04:11 +02:00
c65f2c543b use command center for yanky 2022-04-20 22:54:51 +02:00
7bd0f10847 added yanky 2022-04-20 22:49:07 +02:00
2c4617f462 treesitter folding with space x :) 2022-04-20 22:18:18 +02:00
5dde3be206 reworked options 2022-04-20 21:54:55 +02:00
4fbe1c4174 use new autocommand functions 2022-04-20 21:35:50 +02:00
d7b49c4c4b use 0.7 keymappings 2022-04-20 15:14:11 +02:00
8a000f811c update to new command center format 2022-04-19 09:29:36 +02:00
7f99415c02 format my_plugins 2022-04-13 23:47:54 +02:00
257d2fffcf convert some keybindings to command center 2022-04-13 23:40:53 +02:00
3dc493ff7e command center added 2022-04-13 22:41:05 +02:00
651d1d0d2f don't lazyload luasnip 2022-04-07 20:44:35 +02:00
579cdff054 disable nvim-tree 2022-04-07 20:40:41 +02:00
96e1f3f6ed Merge branch 'master' of https://git.freiewildbahn.de/oli/nvim 2022-04-05 08:28:28 +02:00
99e257dbc1 added toggleterm 2022-04-04 20:12:20 +02:00
f0f1c35740 Don't use null-ls in project nvimm 2022-04-04 20:12:20 +02:00
2425d5f29d more lua style 2022-04-04 20:12:20 +02:00
ab1de6c1de stylua 2022-04-04 20:12:20 +02:00
595a4d287b Configure lua lsp to have vim and use as global variables 2022-04-04 20:12:20 +02:00
641d2e0c9e Load cmp_luasnip after luasnip 2022-04-04 15:15:11 +02:00
1c10794866 Merge branch 'master' of https://git.freiewildbahn.de/oli/nvim 2022-04-04 14:49:13 +02:00
204f38c947 Don't show diagnostic windows if there is already a floating window 2022-04-04 14:46:22 +02:00
ee3b97648a Some lazy loading of plugins 2022-04-01 23:38:59 +02:00
4462d4af5c lazy load snippets 2022-04-01 23:15:33 +02:00
f307fb2124 Don't autoinstall groovyls 2022-04-01 23:15:25 +02:00
d23279a4a4 Fixed snippet loading 2022-03-31 20:31:59 +02:00
8220799933 Don't use neotree for buffers 2022-03-31 13:28:44 +02:00
752814db02 Added neotree 2022-03-29 13:02:25 +02:00
d57067ea70 get_setup is local 2022-03-28 23:42:05 +02:00
198141f63f removed whitespaces 2022-03-28 23:40:45 +02:00
018c25d0d7 Disable gruvbox material and setup config for gruvbox 2022-03-28 23:39:05 +02:00
04d69955d7 Fixed clangd extensions url 2022-03-28 22:58:20 +02:00
434611abf4 Move some keybinding to the plugin config file 2022-03-23 21:25:06 +01:00
f9d0bf5366 Removed unused variables in init 2022-03-23 21:18:39 +01:00
479c8686eb Move terminal to own config file 2022-03-23 21:18:03 +01:00
aa7bc38af6 Use default sorting in cmp 2022-03-17 00:11:28 +01:00
e3a6774b76 Added clangd_extensions 2022-03-16 23:55:26 +01:00
d219e43cc7 Fixed packer bootstrap 2022-03-16 23:04:13 +01:00
cb2b0e521f Added stable.json 2022-03-16 22:58:46 +01:00
c3deaa45c6 lua format 2022-03-16 22:56:51 +01:00
4c543d7f44 Added lua style file 2022-03-16 22:53:30 +01:00
8860d92ed1 Small fixes 2022-03-16 22:16:06 +01:00
a3d76bbd15 Finished all plugins 2022-03-16 21:37:13 +01:00
a1d6d33b34 move fzf native to telescope 2022-03-16 21:07:35 +01:00
fbdad999cd gitsigns, comment, cmake 2022-03-16 21:04:13 +01:00
cf9b76d0e0 nvim-tree and treesitter config to packer 2022-03-16 19:53:08 +01:00
c0aa5e03d0 More movement of setup files 2022-03-16 18:03:36 +01:00
86b8b65c99 Fixed autocommand for packer 2022-03-16 17:38:50 +01:00
61a052b960 Same for lsp and cmp 2022-03-16 17:38:38 +01:00
7e1182a11b First version of the packer plugin setup calls 2022-03-16 17:22:06 +01:00
d1b14f05c1 Floating window for packer 2022-02-28 21:20:18 +01:00
961ec74fbd Removed symbols outline 2022-02-28 20:47:25 +01:00
f8ff3b647f Added modes.nvim 2022-02-28 20:46:35 +01:00
79486cd892 set 'completeopt' to menu,menuone,noselect 2022-02-28 20:46:18 +01:00
da4f4674a5 Some lsp fixes 2022-02-28 14:31:25 +01:00
4a076eacd9 Set snapshot path of packer 2022-02-28 14:30:23 +01:00
7e40d7732f Disable the virtual text for warnings 2022-02-21 10:55:37 +01:00
b259a2ae23 Fixed the to regestry a keybinding 2022-02-21 10:55:14 +01:00
c643e834e0 Changed order of cmp sources, prefer snippets 2022-02-10 18:57:19 +01:00
ff41531888 Better leader a 2022-02-10 18:56:14 +01:00
3a700044c4 Fixed path to compile_commands.json 2022-02-10 18:56:04 +01:00
3209e01c99 More snippets 2022-02-10 18:55:49 +01:00
9bf991c537 First custom lua snippets 2022-02-10 10:55:13 +01:00
b8bca37446 No italic 2022-02-09 13:28:15 +01:00
86b5aeb691 Changed font and disabled bold 2022-02-04 09:58:23 +01:00
464644246c Only one treesitter config 2022-02-04 09:41:54 +01:00
6689c9b523 Changed git blame align to eol 2022-02-04 09:11:30 +01:00
4c5aa10996 Added dressing plugin (for cmake) 2022-02-04 09:11:10 +01:00
29b32edada changed to gruvbox 2022-02-04 09:10:56 +01:00
667e42fe57 Format 2022-02-04 09:10:33 +01:00
4dd3918382 added nvim-treesitter-textobjects 2022-02-04 09:10:20 +01:00
bec752c6b7 Small refactor 2022-02-01 15:42:50 +01:00
ab444ed7d9 Neogen fixes for doxygen 2022-02-01 15:42:30 +01:00
bd3af2a9a4 Disable cmake telescope integration 2022-02-01 13:12:25 +01:00
e72fa7324b For the moment disable previewer for files and git files 2022-02-01 13:12:11 +01:00
577a3cd1a7 Removed gitblame and neoclip 2022-02-01 13:11:53 +01:00
0d93bc8fa5 Update treesitter after packer update 2022-02-01 12:56:23 +01:00
9325519929 Dont use .gitignore for telescope files 2022-02-01 12:56:02 +01:00
71321b1d16 Enhance gruvbox theme 2022-01-31 10:58:13 +01:00
faeea7fb5f Fixed and added cmake-format 2022-01-31 10:58:13 +01:00
5c4e7a4000 Adjust lualine 2022-01-31 10:58:13 +01:00
cfff367b83 Keymapping for telescopy fuzzy find 2022-01-31 10:58:13 +01:00
25a5283cd6 Set format expr 2022-01-31 10:58:13 +01:00
3f9a7f38fb Added neogen 2022-01-29 23:45:16 +01:00
0e13e43fc3 Disable space key in normal mode 2021-12-21 22:22:08 +01:00
0e92584aaf Only set lsp keymaps if server attached 2021-12-21 22:21:54 +01:00
b7020671d7 Removed double mappings 2021-12-21 22:21:41 +01:00
31ca3a6d00 Auto install lsp servers 2021-12-21 22:07:59 +01:00
8fabdb2d07 Merge branch 'lua'
# Conflicts:
#	init.vim
2021-12-21 21:52:54 +01:00
6db33686b5 Adopt for vscode neovim plugin 2021-06-12 20:07:54 +02:00
46 changed files with 1907 additions and 617 deletions

71
.clangd Normal file
View 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
View File

@ -5,3 +5,4 @@ vim.bundle
plugged
rplugin.vim
plugin/packer_compiled.lua
venv_debugpy

133
init.lua
View File

@ -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')

View File

@ -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 =]]})

View File

@ -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)

View File

@ -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>')

View File

@ -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
}

View File

@ -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()'

View File

@ -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
View 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
View 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
View 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
View File

@ -0,0 +1,3 @@
require('Comment').setup({
mappings = false,
})

9
lua/setup/gitsigns.lua Normal file
View 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
View 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')

View 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
View 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
View 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
View 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" } })

View 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
View 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()

View File

@ -0,0 +1,3 @@
local actions = require("diffview.actions")
require("diffview").setup({})

View 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]]

View 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
View File

@ -0,0 +1 @@
require('hlargs').setup()

1
lua/setup/my_leap.lua Normal file
View File

@ -0,0 +1 @@
require('leap').set_default_keymaps()

55
lua/setup/my_litee.lua Normal file
View 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
View 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
View 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
View 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' },
},
},
},
},
})

View File

@ -0,0 +1 @@
require('nvim-autopairs').setup({})

27
lua/setup/nvim-tree.lua Normal file
View 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
View File

@ -0,0 +1 @@
require('octo').setup()

5
lua/setup/project.lua Normal file
View File

@ -0,0 +1,5 @@
require('project_nvim').setup({
silent_chdir = true,
ignore_lsp = { 'null-ls', 'cmake' },
})
require('telescope').load_extension('projects')

View File

@ -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
View File

@ -0,0 +1,3 @@
require('nvim-terminal').setup({
toggle_keymap = '<leader>z',
})

30
lua/setup/toggleterm.lua Normal file
View 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
View 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
View 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')

View File

@ -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
View File

12
my-snippets/cpp.json Normal file
View 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
View 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
View 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
View 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
View File

@ -0,0 +1,6 @@
column_width = 120
line_endings = "Unix"
indent_type = "Spaces"
indent_width = 2
quote_style = "AutoPreferSingle"
call_parentheses = "Always"