Nvim: many small changes around whole project

This commit is contained in:
Robert Kmieć
2024-03-29 09:33:27 +01:00
parent a2832ed454
commit 687646da32
16 changed files with 291 additions and 99 deletions

View File

@@ -8,6 +8,11 @@ vim.opt.startofline = true
vim.g.loaded_ruby_provider = 0
vim.g.loaded_perl_provider = 0
local undodir = vim.fn.expand('~/.cache/nvim/undo')
vim.fn.mkdir(undodir, 'p')
vim.opt.undodir = undodir
vim.opt.undofile = true
vim.opt.conceallevel = 1
vim.opt.shell = '/bin/bash'

View File

@@ -11,7 +11,7 @@ map('t', '<ESC><ESC>', '<C-\\><C-n>', default_options)
map('i', 'jj', '<ESC>', default_options)
map('i', 'jk', '<ESC>', default_options)
--map('i', ':w<CR>', '<Esc>:w<CR>', default_options)
map('n', 'Q', '<cmd>q<CR>', default_options)
map('n', 'Q', '<cmd>q', default_options)
-- Reselect visual block after incrementing/decrementing
map('v', '<c-a>', '<c-a>gv', default_options)

View File

@@ -1,7 +1,8 @@
return {
'samodostal/image.nvim',
name = 'ascii-image',
opts = {
render = {
render = {
min_padding = 5,
show_label = true,
use_dither = true,

View File

@@ -9,6 +9,7 @@ return {{
{
"wuelnerdotexe/vim-enfocado",
lazy = false,
priority = 1000,
config = function()
--vim.cmd.colorscheme('enfocado')
end
@@ -16,6 +17,7 @@ return {{
{
"fenetikm/falcon",
lazy = false,
priority = 1000,
config = function()
--vim.cmd.colorscheme('falcon')
end
@@ -23,6 +25,7 @@ return {{
{
"casr/vim-colors-reference",
lazy = false,
priority = 1000,
config = function()
--vim.cmd.colorscheme('reference')
end
@@ -30,6 +33,7 @@ return {{
{
"blazkowolf/gruber-darker.nvim",
lazy = false,
priority = 1000,
config = function()
--vim.cmd.colorscheme('gruber-darker')
end
@@ -37,6 +41,7 @@ return {{
{
"rebelot/kanagawa.nvim",
lazy = false,
priority = 1000,
config = function()
--vim.cmd.colorscheme('kanagawa')
end
@@ -44,6 +49,7 @@ return {{
{
"jaredgorski/spacecamp",
lazy = false,
priority = 1000,
config = function()
--vim.cmd.colorscheme('spacecamp')
end
@@ -51,6 +57,7 @@ return {{
{
"lifepillar/vim-gruvbox8",
lazy = false,
priority = 1000,
config = function()
--vim.cmd.colorscheme('gruvbox8')
end
@@ -58,6 +65,7 @@ return {{
{
"marko-cerovac/material.nvim",
lazy = false,
priority = 1000,
config = function()
--vim.cmd.colorscheme('material')
end
@@ -65,6 +73,7 @@ return {{
{
"srcery-colors/srcery-vim",
lazy = false,
priority = 1000,
config = function()
--vim.cmd.colorscheme('srcery')
end
@@ -72,6 +81,7 @@ return {{
{
"tanvirtin/monokai.nvim",
lazy = false,
priority = 1000,
config = function()
--vim.cmd.colorscheme('monokai')
end
@@ -79,13 +89,15 @@ return {{
{
"dasupradyumna/midnight.nvim",
lazy = false,
priority = 1000,
config = function()
--vim.cmd.colorscheme('midnight')
vim.cmd.colorscheme('midnight')
end
},
{
"bluz71/vim-moonfly-colors",
lazy = false,
priority = 1000,
config = function()
--vim.cmd.colorscheme('moonfly')
end
@@ -93,6 +105,7 @@ return {{
{
"kuznetsss/meadow.nvim",
lazy = false,
priority = 1000,
config = function()
--require('meadow').setup()
--vim.cmd.colorscheme('meadow')
@@ -102,20 +115,28 @@ return {{
{
"kepano/flexoki-neovim",
lazy = false,
priority = 1000,
config = function()
--vim.cmd.colorscheme('flexoki-dark')
end
},
{
"https://gitlab.com/bartekjaszczak/distinct-nvim",
priority = 1000,
config = function()
require("distinct").setup({
doc_comments_different_color = true, -- Use different colour for documentation comments
})
vim.cmd.colorscheme('distinct')
end
"https://gitlab.com/bartekjaszczak/distinct-nvim",
lazy = false,
priority = 1000,
config = function()
-- require("distinct").setup({
-- doc_comments_different_color = true, -- Use different colour for documentation comments
-- })
-- vim.cmd.colorscheme('distinct')
end
},
{
'kevinm6/kurayami.nvim',
lazy = false,
priority = 1000,
config = function()
--vim.cmd.colorscheme('kurayami')
end
}
}

View File

@@ -2,6 +2,8 @@ return {
'AckslD/nvim-FeMaco.lua',
config = function()
require('femaco').setup()
vim.keymap.set('n', '<leader>!', '<cmd>FeMaCo<cr>', { noremap = true, silent = true })
vim.keymap.set('n', '<leader>!', '<cmd>FeMaco<cr>', { noremap = true, silent = true })
end,
cmd = { "FeMaco" },
keys = { "<leader>!" }
}

View File

@@ -3,18 +3,17 @@ return {
'neovim/nvim-lspconfig',
dependencies = {
-- "SmiteshP/nvim-navbuddy",
{url = "http://git.sr.ht/~p00f/clangd_extensions.nvim"},
"jubnzv/virtual-types.nvim",
--"ray-x/lsp_signature.nvim",
"folke/neodev.nvim",
"artemave/workspace-diagnostics.nvim"
{url = "http://git.sr.ht/~p00f/clangd_extensions.nvim"},
},
config = function()
require("neodev").setup({
library = { plugins = { "nvim-dap-ui" }, types = true },
})
local nvim_lsp = require('lspconfig')
local clangd_extensions = require('clangd_extensions').setup({
require('clangd_extensions').setup({
inlay_hints = {
inline = false,
-- Options other than `highlight' and `priority' only work
@@ -136,7 +135,6 @@ return {
-- })
require("clangd_extensions.inlay_hints").setup_autocmd()
require("clangd_extensions.inlay_hints").set_inlay_hints()
--require("workspace-diagnostics").populate_workspace_diagnostics(ev.buf)
local signs = {
{ name = "DiagnosticSignError", text = "" },
@@ -201,11 +199,6 @@ return {
nvim_lsp.matlab_ls.setup({
cmd = { "matlab-language-server", "--stdio"},
filetypes = { "matlab" },
-- handlers = { [ "workspace/configuration"] = function(_, _, ctx)
-- local client = vim.lsp.get_client_by_id(ctx.client_id)
-- return {client.config.settings.matlab}
-- end
-- },
root_dir = nvim_lsp.util.find_git_ancestor,
single_file_support = true,
settings = {

View File

@@ -1,22 +1,15 @@
return {
'nvimtools/none-ls.nvim',
config = function()
null_ls = require("null-ls")
null_ls.setup({
local none_ls = require("null-ls")
none_ls.setup({
sources = {
null_ls.builtins.formatting.stylua,
--null_ls.builtins.completion.spell,
null_ls.builtins.code_actions.gitsigns,
null_ls.builtins.diagnostics.gitlint,
null_ls.builtins.diagnostics.cmake_lint,
null_ls.builtins.diagnostics.codespell,
--null_ls.builtins.diagnostics.misspell,
null_ls.builtins.diagnostics.hadolint,
null_ls.builtins.diagnostics.buf,
--null_ls.builtins.code_actions.proselint,
--null_ls.builtins.diagnostics.proselint,
null_ls.builtins.hover.dictionary,
null_ls.builtins.formatting.black},
none_ls.builtins.code_actions.gitsigns,
none_ls.builtins.diagnostics.gitlint,
none_ls.builtins.diagnostics.cmake_lint,
none_ls.builtins.diagnostics.codespell,
none_ls.builtins.hover.dictionary,
none_ls.builtins.formatting.black},
})
end
}

View File

@@ -1,4 +1,7 @@
return {
{ 'tzachar/cmp-ai', dependencies = 'nvim-lua/plenary.nvim'},
{ 'petertriho/cmp-git'},
{
'hrsh7th/nvim-cmp',
dependencies = {
'dcampos/cmp-snippy',
@@ -10,11 +13,71 @@ return {
'hrsh7th/cmp-nvim-lsp-signature-help',
'hrsh7th/cmp-path',
'hrsh7th/cmp-calc',
'tzachar/cmp-ai'
},
event = "InsertEnter",
config = function()
local cmp = require'cmp'
local snippy = require'snippy'
local cmp_ai = require('cmp_ai.config')
cmp_ai:setup({
max_lines = 100,
provider = 'Ollama',
provider_options = {
model = 'deepseek-coder:6.7b',
base_url = 'http://batman.local:11434/api/generate',
prompt = function(lines_before, lines_after)
-- prompt depends on the model you use. Here is an example for deepseek coder
return '<PRE> ' .. lines_before .. ' <SUF>' .. lines_after .. ' <MID>' -- for codellama
end,
},
debounce_delay = 600, -- ms llama may be GPU hungry, wait x ms after last key input, before sending request to it
notify = true,
notify_callback = function(msg)
vim.notify(msg)
end,
run_on_every_keystroke = true,
ignored_file_types = {
-- default is not to ignore
-- uncomment to ignore in lua:
-- lua = true
},
})
local default_cmp_sources = cmp.config.sources({
{ name = 'nvim_lsp' },
{ name = 'nvim_lsp_signature_help' },
{ name = 'path' },
{ name = 'snippy' },
{ name = 'calc' },
--{ name = 'cmp_git' },
--{ name = 'cmp_ai' },
})
local bufIsBig = function(bufnr)
local max_filesize = 100 * 1024 -- 100 KB
local ok, stats = vim.loop.fs_stat(vim.api.nvim_buf_get_name(bufnr))
if ok and stats and stats.size > max_filesize then
return true
else
return false
end
end
-- If a file is too large, I don't want to add to it's cmp sources treesitter, see:
-- https://github.com/hrsh7th/nvim-cmp/issues/1522
vim.api.nvim_create_autocmd('BufReadPre', {
callback = function(t)
local sources = default_cmp_sources
if not bufIsBig(t.buf) then
sources[#sources+1] = {name = 'treesitter', group_index = 2}
end
cmp.setup.buffer {
sources = sources
}
end
})
cmp.setup({
snippet = {
@@ -48,8 +111,10 @@ return {
}, {
{ name = 'buffer', keyword_length = 5, max_item_count = 10, priority = -5 },
}),
sources = sources,
sorting = {
comparators = {
require('cmp_ai.compare'),
cmp.config.compare.offset,
cmp.config.compare.exact,
cmp.config.compare.recently_used,
@@ -89,3 +154,4 @@ return {
require("cmp_git").setup()
end
}
}

View File

@@ -68,24 +68,24 @@ return {
}
}
local keymap = vim.api.nvim_set_keymap
local opts = {noremap = true, silent = true}
keymap("n", "<LEADER>plf", ":PerfLoadFlat<CR>", opts)
keymap("n", "<LEADER>plg", ":PerfLoadCallGraph<CR>", opts)
keymap("n", "<LEADER>plo", ":PerfLoadFlameGraph<CR>", opts)
keymap("n", "<LEADER>pe", ":PerfPickEvent<CR>", opts)
keymap("n", "<LEADER>pa", ":PerfAnnotate<CR>", opts)
keymap("n", "<LEADER>pf", ":PerfAnnotateFunction<CR>", opts)
keymap("v", "<LEADER>pa", ":PerfAnnotateSelection<CR>", opts)
keymap("n", "<LEADER>pt", ":PerfToggleAnnotations<CR>", opts)
keymap("n", "<LEADER>ph", ":PerfHottestLines<CR>", opts)
keymap("n", "<LEADER>ps", ":PerfHottestSymbols<CR>", opts)
keymap("n", "<LEADER>pc", ":PerfHottestCallersFunction<CR>", opts)
keymap("v", "<LEADER>pc", ":PerfHottestCallersSelection<CR>", opts)
-- local keymap = vim.api.nvim_set_keymap
-- local opts = {noremap = true, silent = true}
--
-- keymap("n", "<LEADER>plf", ":PerfLoadFlat<CR>", opts)
-- keymap("n", "<LEADER>plg", ":PerfLoadCallGraph<CR>", opts)
-- keymap("n", "<LEADER>plo", ":PerfLoadFlameGraph<CR>", opts)
--
-- keymap("n", "<LEADER>pe", ":PerfPickEvent<CR>", opts)
--
-- keymap("n", "<LEADER>pa", ":PerfAnnotate<CR>", opts)
-- keymap("n", "<LEADER>pf", ":PerfAnnotateFunction<CR>", opts)
-- keymap("v", "<LEADER>pa", ":PerfAnnotateSelection<CR>", opts)
--
-- keymap("n", "<LEADER>pt", ":PerfToggleAnnotations<CR>", opts)
--
-- keymap("n", "<LEADER>ph", ":PerfHottestLines<CR>", opts)
-- keymap("n", "<LEADER>ps", ":PerfHottestSymbols<CR>", opts)
-- keymap("n", "<LEADER>pc", ":PerfHottestCallersFunction<CR>", opts)
-- keymap("v", "<LEADER>pc", ":PerfHottestCallersSelection<CR>", opts)
end
}

View File

@@ -1,5 +1,16 @@
return {
'hedyhli/outline.nvim',
config = true,
cmd = { 'OutlineOpen' }
'stevearc/aerial.nvim',
config = function()
require("aerial").setup({
-- optionally use on_attach to set keymaps when aerial has attached to a buffer
on_attach = function(bufnr)
-- Jump forwards/backwards with '{' and '}'
vim.keymap.set("n", "{", "<cmd>AerialPrev<CR>", { buffer = bufnr })
vim.keymap.set("n", "}", "<cmd>AerialNext<CR>", { buffer = bufnr })
end,
})
-- You probably also want to set a keymap to toggle aerial
--vim.keymap.set("n", "<leader>a", "<cmd>AerialToggle!<CR>")
end,
cmd = { 'AerialToggle' }
}

View File

@@ -1,3 +1,3 @@
return {
"wellle/targets.vim",
"tpope/vim-surround",
}

View File

@@ -4,6 +4,12 @@ return {
'debugloop/telescope-undo.nvim',
'molecule-man/telescope-menufacture',
'xiyaowong/telescope-emoji.nvim',
{
{
"isak102/telescope-git-file-history.nvim",
dependencies = { "tpope/vim-fugitive" }
}
}
},
event = 'VeryLazy',
--cmd = ":Telescope",
@@ -33,6 +39,7 @@ return {
require('telescope').load_extension('undo')
require('telescope').load_extension('menufacture')
require("telescope").load_extension("emoji")
require("telescope").load_extension("git_file_history")
local def = { noremap = true, silent = true }
local map = vim.keymap.set
map('n', '<leader>r', '<cmd>lua require("telescope.builtin").resume()<cr>', def)
@@ -52,6 +59,7 @@ return {
-- map('n', '<leader>gc', '<cmd>lua require("telescope.builtin").git_commits()<cr>', def)
-- map('n', '<leader>gC', '<cmd>lua require("telescope.builtin").git_bcommits()<cr>', def)
-- map('n', '<leader>gb', '<cmd>lua require("telescope.builtin").git_branches()<cr>', def)
-- map('n', '<leader>gb', '<cmd>lua require("telescope.builtin").git_branches()<cr>', def)
-- other
-- map('n', '<leader>s', '<cmd>lua require('telescope').extensions.ultisnips.ultisnips()<cr>, def)
map('n', '<leader>u', '<cmd>lua require("telescope").extensions.undo.undo()<cr>', def)

View File

@@ -10,13 +10,17 @@ return {
config = function()
-- Tree-sitter configuration
ts = require'nvim-treesitter.configs'
local ts = require'nvim-treesitter.configs'
ts.setup {
highlight = {
enable = true,
disable = function(lang, buf)
return vim.api.nvim_buf_line_count(buf) > 5000
local max_filesize = 100 * 1024
local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf))
if ok and stats and stats.size > max_filesize then
return true
end
end,
additional_vim_regex_highlighting = false,
},
@@ -60,10 +64,9 @@ return {
"vim",
"yaml",
},
-- disabled, since it mostly shifts to four characters
--indent = {
-- enable = true,
--},
indent = {
enable = true,
},
incremental_selection = {
enable = true,
keymaps = {
@@ -79,7 +82,7 @@ return {
include_match_words
},
}
-- vim.opt.foldmethod = "expr"
-- vim.opt.foldexpr = "nvim_treesitter#foldexpr()"
vim.opt.foldmethod = "expr"
vim.opt.foldexpr = "nvim_treesitter#foldexpr()"
end
}

View File

@@ -1,4 +1,4 @@
return {
'artemave/workspace-diagnostics.nvim',
'folke/trouble.nvim',
config = true,
}

View File

@@ -18,17 +18,125 @@ return {
require("cmake-tools").setup {
cmake_command = "cmake",
ctest_command = "ctest",
cmake_generate_options = { "-DCMAKE_EXPORT_COMPILE_COMMANDS=1" },
cmake_build_options = { "-j 15" },
cmake_build_directory = "build",
cmake_generate_options = { "-D", "CMAKE_EXPORT_COMPILE_COMMANDS=1" },
cmake_build_options = {},
cmake_console_size = 10, -- cmake output window height
cmake_show_console = "always", -- "always", "only_on_error"
cmake_dap_configuration = { name = "cpp", type = "codelldb", request = "launch" }, -- dap configuration, optional
--cmake_dap_open_command = require("dap").repl.open, -- optional
cmake_soft_link_compile_commands = true, -- this will automatically make a soft link from compile commands file to project root dir
cmake_compile_commands_from_lsp = false, -- this will automatically set compile commands file location using lsp, to use it, please set `cmake_soft_link_compile_commands` to false
cmake_kits_path = nil, -- this is used to specify global cmake kits path, see CMakeKits for detailed usage
cmake_variants_message = {
short = { show = true },
long = { show = true, max_length = 40 }
}
}
short = { show = true }, -- whether to show short message
long = { show = true, max_length = 40 }, -- whether to show long message
},
cmake_dap_configuration = { -- debug settings for cmake
name = "cmake_tools",
type = "gdb",
request = "launch",
stopOnEntry = false,
runInTerminal = true,
console = "integratedTerminal",
},
cmake_executor = { -- executor to use
name = "toggleterm", -- name of the executor
opts = {}, -- the options the executor will get, possible values depend on the executor type. See `default_opts` for possible values.
default_opts = { -- a list of default and possible values for executors
quickfix = {
show = "always", -- "always", "only_on_error"
position = "belowright", -- "vertical", "horizontal", "leftabove", "aboveleft", "rightbelow", "belowright", "topleft", "botright", use `:h vertical` for example to see help on them
size = 10,
encoding = "utf-8", -- if encoding is not "utf-8", it will be converted to "utf-8" using `vim.fn.iconv`
auto_close_when_success = true, -- typically, you can use it with the "always" option; it will auto-close the quickfix buffer if the execution is successful.
},
toggleterm = {
direction = "float", -- 'vertical' | 'horizontal' | 'tab' | 'float'
close_on_exit = false, -- whether close the terminal when exit
auto_scroll = true, -- whether auto scroll to the bottom
},
overseer = {
new_task_opts = {
strategy = {
"toggleterm",
direction = "horizontal",
autos_croll = true,
quit_on_exit = "success"
}
}, -- options to pass into the `overseer.new_task` command
on_new_task = function(task)
require("overseer").open(
{ enter = false, direction = "right" }
)
end, -- a function that gets overseer.Task when it is created, before calling `task:start`
},
terminal = {
name = "Main Terminal",
prefix_name = "[CMakeTools]: ", -- This must be included and must be unique, otherwise the terminals will not work. Do not use a simple spacebar " ", or any generic name
split_direction = "horizontal", -- "horizontal", "vertical"
split_size = 11,
-- Window handling
single_terminal_per_instance = true, -- Single viewport, multiple windows
single_terminal_per_tab = true, -- Single viewport per tab
keep_terminal_static_location = true, -- Static location of the viewport if available
-- Running Tasks
start_insert = false, -- If you want to enter terminal with :startinsert upon using :CMakeRun
focus = false, -- Focus on terminal when cmake task is launched.
do_not_add_newline = false, -- Do not hit enter on the command inserted when using :CMakeRun, allowing a chance to review or modify the command before hitting enter.
}, -- terminal executor uses the values in cmake_terminal
},
},
cmake_runner = { -- runner to use
name = "toggleterm", -- name of the runner
opts = {}, -- the options the runner will get, possible values depend on the runner type. See `default_opts` for possible values.
default_opts = { -- a list of default and possible values for runners
quickfix = {
show = "always", -- "always", "only_on_error"
position = "belowright", -- "bottom", "top"
size = 10,
encoding = "utf-8",
auto_close_when_success = true, -- typically, you can use it with the "always" option; it will auto-close the quickfix buffer if the execution is successful.
},
toggleterm = {
direction = "float", -- 'vertical' | 'horizontal' | 'tab' | 'float'
close_on_exit = false, -- whether close the terminal when exit
auto_scroll = true, -- whether auto scroll to the bottom
},
overseer = {
new_task_opts = {
strategy = {
"toggleterm",
direction = "horizontal",
autos_croll = true,
quit_on_exit = "success"
}
}, -- options to pass into the `overseer.new_task` command
on_new_task = function(task)
end, -- a function that gets overseer.Task when it is created, before calling `task:start`
},
terminal = {
name = "Main Terminal",
prefix_name = "[CMakeTools]: ", -- This must be included and must be unique, otherwise the terminals will not work. Do not use a simple spacebar " ", or any generic name
split_direction = "horizontal", -- "horizontal", "vertical"
split_size = 11,
-- Window handling
single_terminal_per_instance = true, -- Single viewport, multiple windows
single_terminal_per_tab = true, -- Single viewport per tab
keep_terminal_static_location = true, -- Static location of the viewport if available
-- Running Tasks
start_insert = false, -- If you want to enter terminal with :startinsert upon using :CMakeRun
focus = false, -- Focus on terminal when cmake task is launched.
do_not_add_newline = false, -- Do not hit enter on the command inserted when using :CMakeRun, allowing a chance to review or modify the command before hitting enter.
},
},
},
cmake_notifications = {
runner = { enabled = true },
executor = { enabled = true },
spinner = { "", "", "", "", "", "", "", "", "", "" }, -- icons used for progress display
refresh_rate_ms = 100, -- how often to iterate icons
}, }
end
}