moved nvim to submodule

This commit is contained in:
Thies Lennart Alff 2024-03-27 12:22:32 +01:00
parent d9704edfe8
commit a7bc60df8a
28 changed files with 4 additions and 718 deletions

1
.config/nvim Submodule

@ -0,0 +1 @@
Subproject commit d2309ca00ad0a6cc77ad2354547f6f81a1e0026e

View file

@ -1,4 +0,0 @@
vim.opt.tabstop = 2
vim.opt.softtabstop = 2
vim.opt.shiftwidth = 2
vim.opt.expandtab = true

View file

@ -1 +0,0 @@
vim.opt_local.shiftwidth = 2

View file

@ -1,6 +0,0 @@
vim.opt.wrap = true -- softwrap the text
vim.opt.linebreak = true -- do not break in the middle of words
vim.opt.tabstop = 3
vim.opt.softtabstop = 3
vim.opt.shiftwidth = 3
vim.opt.expandtab = true

View file

@ -1 +0,0 @@
vim.keymap.set("n", "<leader>gs", vim.cmd.Git);

View file

@ -1,9 +0,0 @@
require('gitsigns').setup {
signs = {
add = {text='+'},
change = {text='~'},
delete = {text='_'},
topdelete = {text=''},
changedelete = {text='~'},
}
}

View file

@ -1,16 +0,0 @@
local mark = require('harpoon.mark')
local ui = require('harpoon.ui')
local cmd_ui = require('harpoon.cmd-ui')
local term = require('harpoon.term')
vim.keymap.set('n', '<leader>a', mark.add_file)
vim.keymap.set('n', '<C-e>', ui.toggle_quick_menu)
vim.keymap.set('n', '<C-h>', function() ui.nav_file(1) end)
vim.keymap.set('n', '<C-t>', function() ui.nav_file(2) end)
vim.keymap.set('n', '<C-n>', function() ui.nav_file(3) end)
vim.keymap.set('n', '<C-s>', function() ui.nav_file(4) end)
vim.keymap.set('n', '<leader>c', cmd_ui.toggle_quick_menu)
vim.keymap.set('n', '<leader>gt1', function() term.gotoTerminal(1) end)
vim.keymap.set('n', '<leader>br', function() term.sendCommand(1, 'build_ros') end)

View file

@ -1,14 +0,0 @@
local lspconfig = require('lspconfig')
lspconfig.lua_ls.setup({
settings = {
Lua = {
diagnostics = {
globals = {
'vim',
'require',
},
},
},
},
})

View file

@ -1,46 +0,0 @@
local ls = require('luasnip')
local ll = require('luasnip.loaders.from_lua')
local types = require('luasnip.util.types')
ls.config.set_config({
enable_autosnippets = true,
store_selection_keys = '<C-s>',
history = true,
updateevents = 'TextChanged,TextChangedI',
delete_check_events = 'TextChanged',
ext_opts = {
[types.insertNode] = {
active = {},
unvisited = {
virt_text = { { '<- insert', 'DiagnosticVirtualTextHint' } }
},
visited = {},
passive = {},
snippet_passive = {},
},
[types.choiceNode] = {
active = {
virt_text = { { '<- insert', 'DiagnosticVirtualTextError' } },
},
}
},
})
ll.load({ paths = { vim.fn.stdpath('config') .. '/snippets' } })
vim.keymap.set({ 'i', 's' }, '<C-j>', function()
if ls.expand_or_jumpable() then
ls.expand_or_jump()
end
end, { silent = true })
vim.keymap.set({ 'i', 's' }, '<C-k>', function()
if ls.jumpable(-1) then
ls.jump(-1)
end
end, { silent = true })
vim.keymap.set('n', '<leader><leader>s', function()
vim.cmd('source ' .. vim.fn.stdpath('config') .. '/after/plugin/luasnip.lua')
vim.notify('Sourced snippets', 'info', { title = 'LuaSnip' })
end)

View file

@ -1,2 +0,0 @@
vim.keymap.set('n', '<leader>nf', '<cmd>Neotree<cr>')
vim.keymap.set('n', '<leader>nb', '<cmd>Neotree source=buffers<cr>')

View file

@ -1,6 +0,0 @@
local builtin = require('telescope.builtin')
vim.keymap.set('n', '<leader>pf', builtin.find_files, {})
vim.keymap.set('n', '<C-p>', builtin.find_files, {})
vim.keymap.set("n", '<C-s>', function()
builtin.grep_string({ search = vim.fn.input("Grep > ") });
end)

View file

@ -1,35 +0,0 @@
require('nvim-treesitter.configs').setup {
-- A list of parser names, or "all" (the five listed parsers should always be installed)
ensure_installed = { "c", "lua", "vim", "vimdoc", "query", "cpp", "python", "yaml" },
-- Install parsers synchronously (only applied to `ensure_installed`)
sync_install = false,
-- Automatically install missing parsers when entering buffer
-- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally
auto_install = true,
-- List of parsers to ignore installing (for "all")
ignore_install = { "javascript" },
---- If you need to change the installation directory of the parsers (see -> Advanced Setup)
-- parser_install_dir = "/some/path/to/store/parsers", -- Remember to run vim.opt.runtimepath:append("/some/path/to/store/parsers")!
highlight = {
enable = true,
-- Or use a function for more flexibility, e.g. to disable slow treesitter highlight for large files
disable = function(lang, buf)
local max_filesize = 100 * 1024 -- 100 KB
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,
-- Setting this to true will run `:h syntax` and tree-sitter at the same time.
-- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
-- Using this option may slow down your editor, and you may see some duplicate highlights.
-- Instead of true it can also be a list of languages
additional_vim_regex_highlighting = false,
},
}

View file

@ -1,18 +0,0 @@
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({
"git",
"clone",
"--filter=blob:none",
"https://github.com/folke/lazy.nvim.git",
"--branch=stable", -- latest stable release
lazypath,
})
end
vim.opt.rtp:prepend(lazypath)
vim.g.mapleader = ' ' -- needs to be set before lazy im
require('lazy').setup('plugins')
require('lennartalff')
require('plugins.lsp')

View file

@ -1,4 +0,0 @@
require('lennartalff.remap')
require('lennartalff.set')
vim.o.termguicolors = true
vim.cmd.colorscheme 'catppuccin-frappe'

View file

@ -1,53 +0,0 @@
vim.g.mapleader = " "
vim.keymap.set("n", "<leader>pv", vim.cmd.Ex)
-- move selected text
vim.keymap.set('v', 'J', ":m '>+1<CR>gv=gv")
vim.keymap.set('v', 'K', ":m '<-2<CR>gv=gv")
vim.keymap.set('n', 'J', 'mzJ`z')
vim.keymap.set('n', '<C-d>', '<C-d>zz')
vim.keymap.set('n', '<C-u>', '<C-u>zz')
-- yank to clipboard
vim.keymap.set('n', '<leader>y', '"+y')
vim.keymap.set('v', '<leader>y', '"+y')
-- delete to void
vim.keymap.set('n', '<leader>d', '"_d')
vim.keymap.set('v', '<leader>d', '"_d')
vim.keymap.set('i', '<C-c>', '<Esc>')
-- avoid accidentally closing everything!
vim.keymap.set('n', 'Q', '<nop>')
vim.keymap.set('n', '<leader>f', function()
vim.lsp.buf.format()
end)
-- quickfix navigation
vim.keymap.set('n', '<C-j>', '<cmd>cnext<CR>zz')
vim.keymap.set('n', '<C-k>', '<cmd>cprev<CR>zz')
vim.keymap.set('n', '<leader>j', '<cmd>lnext<CR>zz')
vim.keymap.set('n', '<leader>k', '<cmd>lprev<CR>zz')
vim.keymap.set('n', '<leader>dq', vim.diagnostic.setqflist)
local function quickfix()
vim.lsp.buf.code_action({
filter = function(a) return a.isPreferred end,
apply = true
})
end
vim.keymap.set('n', '<leader>qf', quickfix)
vim.keymap.set('v', '<leader>dgh', "<cmd>diffget LOCAL<cr>")
vim.keymap.set('v', '<leader>dgl', "<cmd>diffget REMOTE<cr>")
vim.keymap.set('n', '<leader>dgh', "<cmd>diffget LOCAL<cr>")
vim.keymap.set('n', '<leader>dgl', "<cmd>diffget REMOTE<cr>")
-- stay in visual mode after indenting/dedenting
vim.keymap.set('v', '<', '<gv')
vim.keymap.set('v', '>', '>gv')

View file

@ -1,44 +0,0 @@
-- vim.opt.guicursor = ''
vim.notify = require('notify')
-- line numbers
vim.opt.nu = true
vim.opt.relativenumber = true
-- highlight current line
vim.opt.cursorline = true
vim.opt.breakindent = true
-- default indentation
vim.opt.tabstop = 4
vim.opt.softtabstop = 4
vim.opt.shiftwidth = 4
vim.opt.expandtab = true
vim.opt.smartindent = true
vim.opt.wrap = false
vim.api.nvim_create_autocmd('FileType', {
pattern = 'Makefile',
callback = function ()
vim.opt_local.expandtab = false
end
})
vim.opt.scrolloff = 8
vim.opt.signcolumn = 'yes'
vim.opt.updatetime = 500
vim.opt.colorcolumn = '80'
vim.api.nvim_create_autocmd('BufReadPost', {
callback = function(args)
local valid_line = vim.fn.line([['"]]) >= 1 and vim.fn.line([['"]]) < vim.fn.line('$')
local not_commit = vim.b[args.buf].filetype ~= 'commit'
if valid_line and not_commit then
vim.cmd([[normal! g`"]])
end
end,
})

View file

@ -1,13 +0,0 @@
return {
'catppuccin/nvim',
name = 'catppuccin',
priority = 1000,
config = function()
local catpuccin = require('catppuccin')
catpuccin.setup({
flavour = 'frappe',
styles = {
},
})
end
}

View file

@ -1,46 +0,0 @@
return {
'hrsh7th/nvim-cmp',
dependencies = {
{'hrsh7th/cmp-nvim-lsp'},
{'hrsh7th/cmp-nvim-lua'},
{'L3MON4D3/LuaSnip'},
},
config = function()
local cmp = require('cmp')
cmp.setup({
snippet = {
expand = function(args)
require('luasnip').lsp_expand(args.body)
end,
},
sources = {
{ name = 'nvim_lsp' },
{ name = 'nvim_lua' },
{ name = 'luasnip' },
},
mapping = cmp.mapping.preset.insert({
['<Tab>'] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
else
fallback()
end
end),
['<S-Tab>'] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
else
fallback()
end
end),
['<C-e>'] = cmp.mapping.abort(),
['<C-space>'] = cmp.mapping.complete(),
['<CR>'] = cmp.mapping.confirm({ select = false }),
}),
window = {
completion = cmp.config.window.bordered(),
documentation = cmp.config.window.bordered(),
},
})
end
}

View file

@ -1,11 +0,0 @@
return {
'klen/nvim-config-local',
opts = {
config_files = { '.nvim.lua' },
hasfile = vim.fn.stdpath('data') .. '/config-local',
autocommands_create = true,
commands_create = true,
lookup_parents = true,
silent = false,
},
}

View file

@ -1,2 +0,0 @@
require('ibl').setup()
return {}

View file

@ -1,45 +0,0 @@
return {
{ 'nvim-treesitter/nvim-treesitter', build = ':TSUpdate' },
{
'L3MON4D3/LuaSnip',
version = "v2.*",
build = 'make install_jsregexp',
},
{ 'saadparwaiz1/cmp_luasnip' },
'lewis6991/gitsigns.nvim',
{
'nvim-telescope/telescope.nvim',
dependencies = {
{ 'nvim-lua/plenary.nvim' } }
},
{
'tpope/vim-fugitive',
name = 'fugitive'
},
{
'ThePrimeagen/harpoon',
dependencies = {
{ 'nvim-lua/plenary.nvim' },
},
},
{
'ray-x/lsp_signature.nvim',
event = 'VeryLazy',
opts = {},
config = function(_, opts) require('lsp_signature').setup(opts) end
},
'rcarriga/nvim-notify',
{
'danymat/neogen',
dependencies = 'nvim-treesitter/nvim-treesitter',
config = true,
},
{
'lukas-reineke/indent-blankline.nvim',
main = 'ibl',
opts = {},
},
{
'jiangmiao/auto-pairs',
},
}

View file

@ -1,118 +0,0 @@
--local lspconfig = require('lspconfig')
--local lsp_defaults = lspconfig.util.default_config
--
--lsp_defaults.capabilities = vim.tbl_deep_extend(
-- 'force',
-- lsp_defaults.capabilities,
-- require('cmp_nvim_lsp').default_capabilities()
--)
--vim.api.nvim_create_autocmd('FileType', {
-- pattern = 'tex',
-- callback = function()
-- require('cmp').setup.buffer { sources = {{ name = 'omni' }} }
-- end,
--})
vim.api.nvim_create_autocmd('LspAttach', {
desc = 'LSP actions',
callback = function(event)
local opts = { buffer = event.buf }
vim.keymap.set('n', '<leader>i', '<cmd>lua vim.lsp.buf.hover()<cr>', opts)
vim.keymap.set('n', 'gd', '<cmd>lua vim.lsp.buf.definition()<cr>', opts)
vim.keymap.set('n', 'gD', '<cmd>lua vim.lsp.buf.declaration()<cr>', opts)
vim.keymap.set('n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<cr>', opts)
vim.keymap.set('n', 'go', '<cmd>lua vim.lsp.buf.type_definition()<cr>', opts)
vim.keymap.set('n', 'gr', '<cmd>lua vim.lsp.buf.references()<cr>', opts)
vim.keymap.set('n', 'gs', '<cmd>lua vim.lsp.buf.signature_help()<cr>', opts)
vim.keymap.set('n', '<leader>r', '<cmd>lua vim.lsp.buf.rename()<cr>', opts)
vim.keymap.set('n', '<leader>f', '<cmd>lua vim.lsp.buf.format({async=true})<cr>', opts)
vim.keymap.set('n', '<leader>ca', '<cmd>lua vim.lsp.buf.code_action()<cr>', opts)
vim.keymap.set('n', 'gl', '<cmd>lua vim.diagnostic.open_float()<cr>', opts)
vim.keymap.set('n', '[d', '<cmd>lua vim.diagnostic.goto_prev({float = {border = "rounded"}})<cr>', opts)
vim.keymap.set('n', ']d', '<cmd>lua vim.diagnostic.goto_next({float = {border = "rounded"}})<cr>', opts)
vim.keymap.set('n', '<leader>vd', '<cmd>lua vim.diagnostic.open_float({border = "rounded"})<cr>', opts)
end
})
local handlers = {
function(server)
require('lspconfig')[server].setup({})
end,
pylsp = function()
require('lspconfig').pylsp.setup({
settings = {
pylsp = {
plugins = {
pyflakes = { enabled = false },
mccabe = { enabled = false },
pycodestyle = { enabled = false },
flake8 = { enabled = false },
pylint = { enabled = false },
autopep8 = { enabled = false },
yapf = { enabled = true },
},
},
},
})
end,
ruff_lsp = function()
require('lspconfig').ruff_lsp.setup({
on_attach = function(client, bufnr)
client.server_capabilities.hoverProvider = false
client.server_capabilities.documentFormattingProvider = false
end,
})
end,
texlab = function()
require('lspconfig').texlab.setup({
settings = {
texlab = {
build = {
onSave = false,
forwardSearchAfter = true,
},
chktex = {
onOpenAndSave = true,
},
forwardSearch = {
executable = 'zathura',
args = {
'--synctex-forward',
'%l:1:%f',
'%p',
},
},
},
},
})
end,
}
return {
{
'williamboman/mason.nvim',
config = function()
require('mason').setup({
ui = {
border = 'rounded'
}
})
require('mason-registry'):on('package:install:success', require('plugins.lsp.python').mason_post_install)
end
},
{
'williamboman/mason-lspconfig.nvim',
dependencies = {
'rcarriga/nvim-notify',
},
opts = {
handlers = handlers,
ensure_installed = {
'lua_ls', 'clangd', 'pylsp', 'yamlls', 'esbonio', 'ruff_lsp', 'lemminx',
},
},
},
{ 'neovim/nvim-lspconfig' },
}

View file

@ -1,34 +0,0 @@
local M = {}
local notify = require('notify')
M.mason_post_install = function(pkg)
--if pkg.name ~= 'python-lsp-server' then
-- return
--end
--local venv = vim.fn.stdpath('data') .. '/mason/packages/python-lsp-server/venv'
--local job = require('plenary.job')
--job:new({
-- command = venv .. '/bin/pip',
-- args = {
-- 'install',
-- '-U',
-- '--disable-pip-version-check',
-- 'pylsp-mypy',
-- },
-- cwd = venv,
-- env = { VIRTUAL_ENV = venv },
-- on_exit = function()
-- notify('Finished installing pylsp modules.')
-- end,
-- on_start = function()
-- notify('Installing pylsp modules...')
-- end,
--}):start()
end
M.ruff = function()
local config = {}
return config
end
return M

View file

@ -1,11 +0,0 @@
return {
'nvim-lualine/lualine.nvim',
dependencies = {
{ 'nvim-tree/nvim-web-devicons' },
},
config = function()
require('lualine').setup({
theme = 'catppuccin-frappe'
})
end,
}

View file

@ -1,18 +0,0 @@
return {
{
'nvim-neo-tree/neo-tree.nvim',
branch = 'v3.x',
dependencies = {
'nvim-lua/plenary.nvim',
'nvim-tree/nvim-web-devicons',
'MunifTanjim/nui.nvim',
},
opts = {
filesystem = {
follow_current_file = {
enabled = true,
},
}
},
},
}

View file

@ -1,73 +0,0 @@
local ls = require('luasnip')
local s = ls.snippet
local sn = ls.snippet_node
local t = ls.text_node
local i = ls.insert_node
local f = ls.function_node
local d = ls.dynamic_node
local fmt = require('luasnip.extras.fmt').fmt
local fmta = require('luasnip.extras.fmt').fmta
local rep = require('luasnip.extras').rep
return {
s(
{
trig = 'console',
name = 'Console Code-Block',
dscr = 'Creates a console code block'
},
fmta(
[[
.. code-block:: console
$ <>
]],
{
i(1),
}
)
),
s(
{
trig = 'shell',
name = 'Shell Code-Block',
dscr = 'Create a shell code block'
},
fmta(
[[
.. code-block:: sh
<>
<>
]],
{
i(1),
i(2),
}
)
),
s(
{
trig = 'python',
name = 'Python Code-Block',
dscr = 'Create python code block',
},
fmta(
[[
.. code-block:: python
:linenos:
:caption: <>
:emphasize-lines: <>
<>
]],
{
i(1),
i(2),
i(3),
}
)
),
}

View file

@ -1,88 +0,0 @@
local ls = require('luasnip')
local s = ls.snippet
local sn = ls.snippet_node
local t = ls.text_node
local i = ls.insert_node
local f = ls.function_node
local d = ls.dynamic_node
local fmt = require('luasnip.extras.fmt').fmt
local fmta = require('luasnip.extras.fmt').fmta
local rep = require('luasnip.extras').rep
return {
s(
{
trig = 'env',
name = 'Environment',
dscr = 'Creates generic \\begin{} \\end{} environment',
},
fmta(
[[
\begin{<>}
<>
\end{<>}
]],
{
i(1),
i(2),
rep(1),
}
)
),
s(
{
trig = 'frame',
name = 'Beamer Frame',
dscr = 'Frame environment for beamer slides',
},
fmta(
[[
\begin{frame}
\frametitle{<>}
<>
\end{frame}
]],
{
i(1),
i(2),
}
)
),
s(
{
trig = 'frame-fragile',
name = 'Frame Fragile',
dscr = 'Required for verbatim content like code listings.',
},
fmta(
[[
\begin{frame}[fragile]
\frametitle{<>}
<>
\end{frame}
]],
{
i(1),
i(2),
}
)
),
s(
{
trig = 'noindent',
name = 'No Indent',
dscr = 'Add no indent instructin for latexindent. Useful for code-blocks.'
},
fmta(
[[
% \begin{noindent}
<>
% \end{noindent}
]]
,
{
i(1),
}
)
),
}

3
.gitmodules vendored Normal file
View file

@ -0,0 +1,3 @@
[submodule ".config/nvim"]
path = .config/nvim
url = ssh://git@git.lennartalff.net:6622/lennartalff/nvim.git