nvim: start rewriting config

- switch to lazy
- rip out obsolete stuff
- hopefully better organization
This commit is contained in:
tea 2024-08-18 14:17:27 +02:00
parent d011bf1ac8
commit d575feaa75
No known key found for this signature in database
17 changed files with 265 additions and 1507 deletions

View File

@ -1,8 +1,11 @@
local version_required = 'nvim-0.7.0'
local version_required = 'nvim-0.8.0'
-- 0.7.0 features we need:
-- - autocommands in Lua
-- - bind key mappings directly to Lua functions
-- - desc in keymaps
-- 0.8.0 features we need:
-- - dunno, needed for lazy.nvim
-- - CursorHold fix
if vim.fn.has(version_required) == 0 then
print("💥 need " .. version_required .. ", config files will NOT be read!")
return nil
@ -13,31 +16,8 @@ if vim.fn.isdirectory('/usr/share/vim/vimfiles') == 1 then
vim.opt.runtimepath:append('/usr/share/vim/vimfiles')
end
require('my/plugins')
require('my/early')
require('my.functions')
require('my/settings')
require('my/keymaps')
require('my/lazy')
require('my/options')
require('my/filetypes')
require('my/completion')
require('my/lsp')
require('my/tools')
require('my/coding')
require('my/git')
require('my/net')
require('my/commands')
-- reload config file after writing
vim.api.nvim_create_augroup('config_init', { clear = true })
vim.api.nvim_create_autocmd({ 'BufWritePost' }, {
group = 'config_init',
pattern = {
vim.fn.stdpath('config') .. '/lua/my/*.lua',
vim.fn.stdpath('config') .. '/init.lua'
},
callback = function()
-- exclude plugins.lua, because it is sourced in another autocmd
if not vim.api.nvim_buf_get_name(0):match('plugins.lua$') then
vim.cmd([[source <afile>]])
end
end
})

View File

@ -1,104 +0,0 @@
local map = require('my.functions').map
require('Comment').setup({
toggler = {
line = '<Leader>cc',
block = '<Leader>CC'
},
opleader = {
line = '<Leader>c',
block = '<Leader>C'
},
extra = {
above = '<Leader>cO',
below = '<Leader>co',
eol = '<Leader>cA',
},
pre_hook = require('ts_context_commentstring.integrations.comment_nvim')
.create_pre_hook(),
})
require("nvim-autopairs").setup({})
require('luasnip.loaders.from_lua').load({
paths = vim.fn.stdpath('config') .. '/snippets'
})
-- icons for diagnostics in the symbol column
local signs = { Error = "", Warn = "", Hint = "", Info = "" }
for type, icon in pairs(signs) do
local hl = "DiagnosticSign" .. type
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl })
end
local dap = require('dap')
if vim.fn.executable('lldb-vscode') > 0 then
dap.adapters.lldb = {
type = 'executable',
command = 'lldb-vscode',
name = 'lldb'
}
dap.configurations.cpp = {
{
name = 'Launch',
type = 'lldb',
request = 'launch',
program = function()
return vim.fn.input('Path to executable: ',
vim.fn.getcwd() .. '/', 'file')
end,
cwd = '${workspaceFolder}',
stopOnEntry = false,
args = {},
},
{
name = "Attach to process",
type = 'lldb',
request = 'attach',
pid = require('dap.utils').pick_process,
args = {},
}
}
dap.configurations.c = dap.configurations.cpp
end
require('which-key').add({{ '<Leader>d', group = 'DAP' }})
map('n', '<Leader>dc', dap.continue, 'Continue')
map('n', '<F10>', dap.step_over, 'DAP: step over')
map('n', '<F11>', dap.step_into, 'DAP: step into')
map('n', '<F12>', dap.step_out, 'DAP: step out')
map('n', '<Leader>db', dap.toggle_breakpoint, 'Toggle breakpoint')
map('n', '<Leader>dB', function()
dap.set_breakpoint(vim.fn.input('Breakpoint condition: '))
end, 'Set breakpoint')
map('n', '<Leader>dr', dap.repl.open, 'Open REPL')
map('n', '<Leader>dl', dap.run_last, 'Run last')
map('n', '<Leader>dj', function()
require('dap.ext.vscode').load_launchjs(
vim.fn.input('Path to launch.json: ',
vim.fn.getcwd() .. '/launch.json', 'file'))
end, 'Load launch.json')
require('dapui').setup({})
map('n', '<Leader>du', require("dapui").toggle, 'Toggle UI')
require('nvim-dap-virtual-text').setup({})
require('femaco').setup({})
map('n', '<Leader>E', require('femaco.edit').edit_code_block,
'Edit inline code block')
require('projections').setup({
workspaces = { '~/Projekte', '~/Dokumente' },
patterns = require('my.functions').project_root_markers
})
require('neogen').setup({
snippet_engine = 'luasnip',
languages = {
['cpp.doxygen'] = require('neogen.configurations.cpp')
}
})

View File

@ -1,9 +0,0 @@
vim.api.nvim_create_user_command('PkgCommit', function()
vim.cmd(string.format('vsplit | ' ..
'terminal cd %s && pkgdev --verbose commit --signoff --edit',
vim.fn.expand('%:p:h')))
end, {})
vim.api.nvim_create_user_command('PkgManifest', function()
vim.cmd(string.format('vsplit | ' ..
'terminal cd %s && pkgdev --verbose manifest', vim.fn.expand('%:p:h')))
end, {})

View File

@ -1,109 +0,0 @@
local cmp = require('cmp')
local luasnip = require('luasnip')
local lspkind = require('lspkind')
if cmp and luasnip then
cmp.setup({
snippet = {
expand = function(args)
luasnip.lsp_expand(args.body)
end,
},
window = {
completion = cmp.config.window.bordered(),
documentation = cmp.config.window.bordered(),
},
formatting = {
format = lspkind.cmp_format({
mode = "symbol_text",
maxwidth = math.floor(vim.o.columns / 2),
ellipsis_char = '',
menu = ({
buffer = "[Buffer]",
nvim_lsp = "[LSP]",
luasnip = "[LuaSnip]",
nvim_lua = "[Lua]",
latex_symbols = "[Latex]",
})
}),
},
mapping = cmp.mapping.preset.insert({
['<S-PageUp>'] = cmp.mapping.scroll_docs(-4),
['<S-PageDown>'] = cmp.mapping.scroll_docs(4),
['<C-Space>'] = cmp.mapping.complete(),
['<C-e>'] = cmp.mapping.abort(),
['<Left>'] = cmp.mapping.abort(),
['<CR>'] = cmp.mapping.confirm({ select = false }),
['<Tab>'] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif luasnip.expandable() then
luasnip.expand({})
elseif luasnip.expand_or_jumpable() then
luasnip.expand_or_jump()
else
fallback()
end
end),
['<S-Tab>'] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif luasnip.jumpable(-1) then
luasnip.jump(-1)
else
fallback()
end
end)
}),
sources = cmp.config.sources({
{ name = 'nvim_lsp' },
{ name = 'luasnip' },
{ name = 'nvim_lua' },
{ name = 'dictionary' },
{ name = 'zsh' },
{ name = 'doxygen' },
}, {
{ name = 'buffer' },
-- { name = 'spell' },
})
})
-- Use LSP symbols and buffer source for `/`
cmp.setup.cmdline('/', {
mapping = cmp.mapping.preset.cmdline(),
sources = cmp.config.sources({
{ name = 'nvim_lsp_document_symbol' }
}, {
{ name = 'buffer' }
})
})
-- Use cmdline & path source for ':'
cmp.setup.cmdline(':', {
mapping = cmp.mapping.preset.cmdline(),
sources = cmp.config.sources({
{ name = 'path' }
}, {
{ name = 'cmdline' }
})
})
require('cmp_dictionary').setup({
dic = {
['gitcommit'] =
vim.fn.stdpath('config') .. '/resources/git.dict',
-- doesn't work, filetype is probably set too late
['NeogitCommitMessage'] =
vim.fn.stdpath('config') .. '/resources/git.dict',
}
})
-- add jump maps for select mode
local map = require('my.functions').map
map('s', '<Tab>', function() luasnip.jump(1) end)
map('s', '<S-Tab>', function() luasnip.jump(-1) end)
require('cmp_zsh').setup({
filetypes = { 'zsh', 'bash', 'sh' }
})
end

View File

@ -0,0 +1,2 @@
vim.g.mapleader = ' ' -- <Leader>
vim.g.maplocalleader = ' ' -- <LocalLeader> (2 spaces)

View File

@ -1,91 +1,24 @@
require 'nvim-treesitter.configs'.setup {
ensure_installed = 'all',
ignore_install = { 'comment', 'help' },
sync_install = true,
highlight = {
enable = true,
additional_vim_regex_highlighting = { 'cpp', 'org' }
}
}
require('ts_context_commentstring').setup({
enable = true,
enable_autocmd = false -- handled by Comment (?)
})
vim.g.skip_ts_context_commentstring_module = true; -- disable backwards compat
require('orgmode').setup {}
require('which-key').add({{ '<Leader>o', group = 'Orgmode' }})
local ffgroup = vim.api.nvim_create_augroup('config_ff', { clear = true })
vim.api.nvim_create_autocmd({ 'FileType' }, {
group = ffgroup,
pattern = { 'org' },
callback = function()
-- allow to hide stuff, like links
vim.opt_local.conceallevel = 2
vim.opt_local.concealcursor = 'nc'
end
})
vim.api.nvim_create_autocmd({ 'FileType' }, {
group = ffgroup,
group = ftgroup,
pattern = { 'gentoo-package-*' },
command = [[set tabstop=2 shiftwidth=2]]
})
vim.api.nvim_create_autocmd({ 'BufEnter' }, {
group = ffgroup,
group = ftgroup,
pattern = { '*.m3u8', '*.m3u' },
command = [[set textwidth=0]]
})
vim.api.nvim_create_autocmd({ 'BufEnter' }, {
group = ffgroup,
group = ftgroup,
pattern = { '*.log' },
command = [[AnsiEsc]]
})
-- <https://github.com/tree-sitter/tree-sitter-cpp/issues/116>
vim.api.nvim_create_autocmd({ 'FileType' }, {
group = ffgroup,
pattern = { 'cpp' },
command = [[set ft=cpp.doxygen]]
})
vim.api.nvim_create_autocmd({ 'FileType' }, {
group = ffgroup,
group = ftgroup,
pattern = { 'mail' },
command = [[set textwidth=72]]
})
require("todo-comments").setup({
signs = false,
highlight = {
keyword = 'bg',
after = ''
}
})
vim.g.vimtex_compiler_latexmk_engines = { _ = '-xelatex' }
require('colorizer').setup({
filetypes = { '*' },
user_default_options = {
mode = 'virtualtext',
rgb_fn = true,
hsl_fn = true,
RRGGBBAA = true,
}
})
-- workarounds for missing syntax highlighting
require('paint').setup({
highlights = {
{
filter = { filetype = 'cpp.doxygen' },
pattern = '%s*%*!?%s*(@%w+)',
hl = 'Constant'
},
}
})

View File

@ -1,183 +1,3 @@
local M = {}
function M.map(mode, shortcut, command, description, buffer)
local opts = { noremap = true, silent = true }
opts.desc = description or nil
opts.buffer = buffer or nil
vim.keymap.set(mode, shortcut, command, opts)
end
function M.remove_trailing_whitespace()
if vim.b.cleanup_file == false then
return
end
local curpos = vim.api.nvim_win_get_cursor(0)
vim.cmd([[keeppatterns %s/\s\+$//e]])
vim.api.nvim_win_set_cursor(0, curpos)
end
vim.api.nvim_create_augroup('config_functions', { clear = true })
vim.api.nvim_create_autocmd({ 'BufWritePre' }, {
group = 'config_functions',
pattern = {
'*.lua', '*.cpp', '*.hpp',
'*.conf', '*.cfg', '*.ini', '*.adoc'
},
callback = M.remove_trailing_whitespace
})
-- Insert or update a modeline at the bottom of the buffer
function M.insert_modeline()
local comment_string = vim.o.commentstring
if comment_string == '' then
comment_string = '%s'
end
local space_maybe = ''
if string.match(comment_string, '%%s(.*)') ~= '' then
space_maybe = ' '
end
local fenc = vim.o.fileencoding
if fenc == '' then
fenc = 'utf-8'
end
local modeline_elements = {
' vim: set',
' ts=' .. vim.o.tabstop,
' sw=' .. vim.o.shiftwidth,
(vim.o.expandtab and ' et' or ' noet'),
' tw=' .. vim.o.textwidth,
' ft=' .. vim.o.filetype,
(vim.o.spell and ' spell' .. ' spl=' .. vim.o.spelllang or ''),
(vim.o.wrap and ' wrap' or ' nowrap'),
':',
space_maybe
}
local modeline = comment_string:gsub('%%s', table.concat(modeline_elements))
modeline = modeline:gsub(' ', ' ')
local buffer = vim.api.nvim_win_get_buf(0)
local current = vim.api.nvim_buf_get_lines(buffer, -2, -1, true)[1]
if current == modeline then
print('modeline already exists')
elseif string.match(current, 'vim:') then
vim.api.nvim_buf_set_lines(buffer, -2, -1, true, { modeline })
print('modeline updated')
else
vim.api.nvim_buf_set_lines(buffer, -1, -1, true, { '', modeline })
print('modeline inserted')
end
end
vim.api.nvim_create_user_command('ModelineInsert', M.insert_modeline, {})
-- Files that could indicate the project's root directory
M.project_root_markers = {
'.git', '.hg', '.svn', '.bzr', '_darcs',
'.projectile', '.luarc.json', '.editorconfig', 'Cargo.toml'
}
function M.get_project_root()
local lsp_root = vim.lsp.buf.list_workspace_folders()[1]
if lsp_root ~= nil then
return lsp_root
end
local path = vim.api.nvim_buf_get_name(0)
local sep = '/'
repeat
path = path:gsub(string.format('%s[^%s]*$', sep, sep), '')
for _, marker in ipairs(M.project_root_markers) do
if path ~= os.getenv('HOME') and io.open(path .. sep .. marker) then
return path
end
end
until path == ''
return nil
end
function M.shell_capture(command)
local handle = io.popen(command)
if not handle then return nil end
local result = handle:read() or nil
handle:close()
return result
end
-- return colours from highlight groups in web notation (#rrggbb)
function M.get_hl_hex(hl_group)
local hl = vim.api.nvim_get_hl_by_name(hl_group, true)
local hl_hex = {}
if hl.foreground then
hl_hex.foreground = string.format('#%.6x', hl.foreground)
end
if hl.background then
hl_hex.background = string.format('#%.6x', hl.background)
end
return hl_hex
end
-- return true if 'Symbols Nerd Font' is known to fontconfig
function M.nerdfont_installed()
if vim.fn.executable('fc-list') == 1 and
os.execute([[fc-list -q 'Symbols Nerd Font']]) == 0 then
return true
end
return false
end
-- return LSP status
function M.lsp_status()
local status = ''
for _, msg in ipairs(require('lsp-status/messaging').messages()) do
if msg.progress then
status = ''
elseif msg.status then
-- clangd parsing includes and whatnot
if msg.content ~= 'idle' then
status = ''
end
end
end
return status
end
function M.lsp_sig_status()
if not vim.lsp.buf.server_ready() then
return ""
end
local width = vim.o.columns / 3
if width < 40 then
return ""
end
if width > 50 then
width = width * 1.5
end
local label = require('lsp_signature').status_line().label
if label:len() > width then
label = label:sub(1, math.floor(width)) .. ''
end
return label
end
function M.not_firenvim()
return vim.g.started_by_firenvim == nil
end
-- returns the name of the current function in brackets or an empty string
function M.current_function()
local curfun = vim.b.lsp_current_function
if curfun and curfun ~= '' then
return '(' .. curfun .. ')'
end
return ''
end
return M

View File

@ -1,83 +0,0 @@
local map = require('my.functions').map
local neogit = require('neogit')
neogit.setup {
disable_commit_confirmation = true,
kind = 'tab',
integrations = {
diffview = true
},
disable_insert_on_commit = false
}
map('n', '<Leader>gg', neogit.open, 'Open Neogit')
local gitgroup = vim.api.nvim_create_augroup('config_git', { clear = true })
-- enable spell checking
vim.api.nvim_create_autocmd({ 'FileType' }, {
group = gitgroup,
pattern = { 'gitcommit' },
command = [[setlocal spell]]
})
-- start git commits in insert mode
vim.api.nvim_create_autocmd({ 'FileType' }, {
group = gitgroup,
pattern = { 'gitcommit', 'gitrebase' },
command = [[startinsert | 1]]
})
-- split Neogit commit messages vertically if possible
vim.api.nvim_create_autocmd({ 'FileType' }, {
group = gitgroup,
pattern = { 'NeogitCommitMessage' },
callback = require('autosplit')
})
-- fugitive and Neogit buffers
vim.api.nvim_create_autocmd({ 'FileType' }, {
group = gitgroup,
pattern = { 'git', 'Neogit*' },
callback = function()
vim.o.list = false
-- this messes up the path of the current file for some reason
--vim.cmd.lcd(require('my.functions').get_project_root())
end
})
require('gitsigns').setup({
on_attach = function(bufnr)
local gs = package.loaded.gitsigns
map('n', '<Leader>gb', function() gs.blame_line({ full = true }) end,
'Show blame for current line', bufnr)
end
})
require('gitlinker').setup({
callbacks = {
['schlomp.space'] = require('gitlinker.hosts').get_gitea_type_url,
['git.gentoo.org'] = function(url_data)
url_data.host = 'gitweb.gentoo.org'
return require('gitlinker.hosts').get_cgit_type_url(url_data)
end,
['anongit.gentoo.org'] = function(url_data)
url_data.host = 'gitweb.gentoo.org'
url_data.repo = url_data.repo:gsub('^git/', '', 1)
return require('gitlinker.hosts').get_cgit_type_url(url_data)
end,
}
})
require('which-key').add({{ '<Leader>g', group = 'Git' }})
require('which-key').add({{ '<Leader>gc', group = 'commit' }})
map('n', '<Leader>gcc', ':Git commit<CR>', 'commit')
map('n', '<Leader>gca', ':Git commit --amend<CR>', 'amend')
map('n', '<Leader>gP', ':Git push<CR>', 'push')
require('which-key').add({{ '<Leader>gp', group = 'pull' }})
map('n', '<Leader>gpo', ':Git pull origin<CR>', 'origin')
map('n', '<Leader>gpu', ':Git pull upstream<CR>', 'upstream')
require('which-key').add({{ '<Leader>ga', group = 'add' }})
map('n', '<Leader>gau', ':Git add --update --patch<CR>', '--update --patch')
map('n', '<Leader>ga%', ':Git add %<CR>', 'This file')
map('n', '<Leader>gl', ':Git log --decorate<CR>', 'log')
map('n', '<Leader>gs', ':Git status<CR>', 'status')

View File

@ -1,115 +0,0 @@
---@format disable
local map = require('my.functions').map
vim.g.mapleader = ' ' -- <Leader>
vim.g.maplocalleader = ' ' -- <LocalLeader> (2 spaces)
local format = string.format
-- buffers
map('n', '<Leader>b', ':buffers<CR>:buffer<Space>', 'Show open buffers')
for key, cmd in pairs({ Left = 'bprevious', Right = 'bnext' }) do
map('n', format('<M-%s>', key), format(':%s<cr>', cmd))
map('i', format('<M-%s>', key), format('<esc>:%s<cr>', cmd))
end
---- move buffer without moving cursor
map({ 'n', 'v' }, '<M-Up>', '<C-y>')
map({ 'n', 'v' }, '<M-Down>', '<C-e>')
-- windows
for key, letter in pairs({ Left = 'h', Down = 'j', Up = 'k', Right = 'l' }) do
map('n', format('<M-S-%s>', key), format(':wincmd %s<cr>', letter))
map('i', format('<M-S-%s>', key), format('<esc>:wincmd %s<cr>', letter))
end
-- remove word
map('n', '<C-BS>', 'db')
map('n', '', 'db')
vim.cmd([[map! <C-BS> <C-W>]]) -- map('c', … doesn't work
vim.cmd([[map!  <C-W>]])
map('n', '<M-BS>', 'db') -- terminal sends M-BS for C-BS
vim.cmd([[map! <M-BS> <C-W>]])
map('n', '<C-Del>', 'dw')
map('i', '<C-Del>', '<C-O>dw')
-- remove whitespace around cursor
map({ 'n', 'i' }, '<C-S-Del>',
function()
local row, pos_cursor = unpack(vim.api.nvim_win_get_cursor(0))
pos_cursor = pos_cursor + 1 -- api / lua is off by one
local line = vim.api.nvim_get_current_line()
local pos_start, pos_end = 0, 0
while pos_start ~= nil do
if pos_start <= pos_cursor and pos_end >= pos_cursor then
local before = line:sub(1, pos_start - 1)
local after = line:sub(pos_end + 1)
local space = ''
if before:len() > 0 and after:len() > 0 then
space = ' '
end
vim.api.nvim_set_current_line(before .. space .. after)
vim.api.nvim_win_set_cursor(0, { row, pos_start - 1 })
break
end
pos_start, pos_end = line:find('%s+', pos_end + 1)
end
end
)
-- system clipboard (clipboard = <C-v>, selection = middle mouse button)
map({ 'v', 'n' }, '<Leader>y', '"+y', 'Yank to system clipboard')
map({ 'v', 'n' }, '<Leader><C-y>', '"*y', 'Yank to system selection')
map('n', '<Leader>p', '"+p', 'Paste from system clipboard')
map('n', '<Leader>P', '"+P', 'Paste from system clipboard')
map('n', '<Leader><C-p>', '"*p', 'Paste from system selection')
map('n', '<Leader><C-M-p>', '"*P', 'Paste from system selection')
-- toggle between beginning of line and beginning of text
map({ 'n', 'i', 'v' }, '<Home>',
function()
local row, col = unpack(vim.api.nvim_win_get_cursor(0))
if col == 0 then
local col_new = vim.api.nvim_get_current_line():match('^%s*'):len()
vim.api.nvim_win_set_cursor(0, { row, col_new })
else
vim.api.nvim_win_set_cursor(0, { row, 0 })
end
end
)
map({ 'n', 'v' }, '<C-F>', '==') -- re-indent line
-- select text with shift + arrow
for _, key in ipairs({ 'Left', 'Up', 'Down', 'Right' }) do
map({ 'n', 'i' }, format('<S-%s>', key), format('<Esc>v<%s>', key))
map({ 'v' }, format('<S-%s>', key), format('<%s>', key))
end
map('n', '<M-.>', '<C-]>', 'Follow symbol')
map('n', '<M-,>', '<C-T>', 'Go back to previous pos')
map('v', '<Leader>f', 'gq', 'Reformat text')
map('n', '<C-D>', ':bdelete<CR>', 'Close buffer')
-- use ui.select for spelling suggestions so dressing can make it look nice
local function spellsugg_select()
local word = vim.fn.expand('<cword>')
local suggestions = vim.fn.spellsuggest(word)
vim.ui.select(suggestions, {}, vim.schedule_wrap(function(selected)
if selected then
vim.api.nvim_feedkeys('ciw' .. selected, 'n', true)
vim.api.nvim_feedkeys(
vim.api.nvim_replace_termcodes('<Esc>', true, true, true),
'n', true)
end
end))
end
map('n', 'z=', spellsugg_select)
-- use easier keys for spell
map('n', '<F17>', '[s', 'Previous misspelled word') -- <S-F5>
map('n', '<F18>', ']s', 'Next misspelled word') -- <S-F6>
map('n', '<F19>', spellsugg_select, 'Spelling suggestions') -- <S-F7>

View File

@ -0,0 +1,26 @@
-- Bootstrap lazy.nvim
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not (vim.uv or vim.loop).fs_stat(lazypath) then
local lazyrepo = "https://github.com/folke/lazy.nvim.git"
local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
if vim.v.shell_error ~= 0 then
vim.api.nvim_echo({
{ "Failed to clone lazy.nvim:\n", "ErrorMsg" },
{ out, "WarningMsg" },
{ "\nPress any key to exit..." },
}, true, {})
vim.fn.getchar()
os.exit(1)
end
end
vim.opt.rtp:prepend(lazypath)
-- Setup lazy.nvim
require("lazy").setup({
spec = {
-- import your plugins
{ import = "my/plugins" },
},
-- automatically check for plugin updates
checker = { enabled = true },
})

View File

@ -1,264 +0,0 @@
local map = require('my.functions').map
-- only do this after the language server attaches to the current buffer
local on_attach = function(client, bufnr)
---@format disable
map('n', '<f5>', vim.diagnostic.goto_prev, 'Prev diagnostic', bufnr)
map('n', '<f6>', vim.diagnostic.goto_next, 'Next diagnostic', bufnr)
map('n', 'gD', vim.lsp.buf.declaration, 'Go to declaration', bufnr)
map('n', 'gd', vim.lsp.buf.definition, 'Go to definition', bufnr)
map('n', '<M-.>', vim.lsp.buf.definition, 'Go to definition', bufnr)
map('n', 'gi', vim.lsp.buf.implementation, 'Go to implementation',
bufnr)
map('n', 'gr', vim.lsp.buf.references, 'Show references', bufnr)
map('n', 'K', vim.lsp.buf.hover, 'Hover', bufnr)
map('i', '<C-K>', vim.lsp.buf.hover, 'Hover', bufnr)
require('which-key').add({{ '<Leader>l', group = 'LSP' }})
require('which-key').add({{ '<Leader>lw', group = 'workspace' }})
map('n', '<Leader>lwa', vim.lsp.buf.add_workspace_folder,
'Add workspace folder', bufnr)
map('n', '<Leader>lwr', vim.lsp.buf.remove_workspace_folder,
'Remove workspace folder', bufnr)
map('n', '<Leader>lwl', function()
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
end, 'List workspace folders', bufnr)
map('n', '<Leader>lr', vim.lsp.buf.rename, 'Rename symbol', bufnr)
map('n', '<Leader>la', vim.lsp.buf.code_action, 'Code action', bufnr)
if vim.fn.has('nvim-0.8.0') == 1 then
map('n', '<Leader>lf', vim.lsp.buf.format, 'Format buffer', bufnr)
else
map('n', '<Leader>lf', vim.lsp.buf.formatting, 'Format buffer', bufnr)
end
-- highlight symbol under cursor
local has_highlight = false
if vim.fn.has('nvim-0.8.0') == 1 then
if client.server_capabilities.documentHighlightProvider then
has_highlight = true
end
else
if client.resolved_capabilities.document_highlight then
has_highlight = true
end
end
if has_highlight then
vim.api.nvim_create_augroup('config_lsp', { clear = false })
vim.api.nvim_clear_autocmds({
buffer = bufnr,
group = 'config_lsp',
})
vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, {
group = 'config_lsp',
buffer = bufnr,
callback = vim.lsp.buf.document_highlight,
})
vim.api.nvim_create_autocmd({ 'CursorMoved', 'CursorMovedI' }, {
group = 'config_lsp',
buffer = bufnr,
callback = vim.lsp.buf.clear_references,
})
-- Don't autoformat code like text
vim.bo.formatoptions = vim.o.formatoptions:gsub('t', '')
-- Let LSP autoformat on save
require('lsp-format').on_attach(client)
-- virtual text hint for parameters
require ('lsp_signature').on_attach({
bind = true,
handler_opts = {
border = 'rounded'
},
floating_window = false
}, bufnr)
end
-- -- show help on hover (<https://github.com/neovim/neovim/issues/20457>)
-- if client.server_capabilities.hoverProvider then
-- vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, {
-- group = 'config_lsp',
-- buffer = bufnr,
-- callback = vim.lsp.buf.hover
-- })
-- end
require('lsp-status').on_attach(client)
end
-- add completion capabilities
local capabilities = require('cmp_nvim_lsp').default_capabilities()
-- add progress capabilities
local lsp_status = require('lsp-status')
lsp_status.register_progress()
capabilities = vim.tbl_extend('keep', capabilities, lsp_status.capabilities)
-- opens lsp.util.open_floating_preview() -> nvim_open_win()
vim.lsp.handlers['textDocument/hover'] = vim.lsp.with(vim.lsp.handlers.hover, {
border = 'rounded',
width = 60,
focusable = false,
-- next 2 lines do nothing, overwritten by open_floating_preview()
relative = 'win',
anchor = 'NE',
})
-- setup servers
local lspconfig = require('lspconfig')
-- set up language servers that don't need any special configuration
local simple_ls = {
['vscode-html-language-server'] = 'html',
['vscode-css-language-server'] = 'cssls',
['vscode-json-language-server'] = 'jsonls',
['gopls'] = 'gopls',
['cmake-language-server'] = 'cmake',
['yaml-language-server'] = 'yamlls',
['docker-langserver'] = 'dockerls',
}
for exe, ls in pairs(simple_ls) do
if vim.fn.executable(exe) > 0 then
lspconfig[ls].setup({
on_attach = on_attach,
capabilities = capabilities
})
end
end
if vim.fn.executable('clangd') > 0 then
require("clangd_extensions").setup({
server = {
cmd = {
'clangd',
'--compile-commands-dir=build',
'--clang-tidy', -- needs >=clangd-9
'--ranking-model=decision_forest' -- needs >=clangd-12
},
init_options = { clangdFileStatus = true },
on_attach = on_attach,
capabilities = capabilities,
handlers = lsp_status.extensions.clangd.setup(),
},
extensions = {
inlay_hints = {
show_parameter_hints = false
}
}
})
end
-- TODO: re-check config recommendation, looks like some things changed
-- <https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#lua_ls>
if vim.fn.executable('lua-language-server') > 0 then
lspconfig.lua_ls.setup({
settings = {
Lua = {
runtime = {
version = 'LuaJIT',
},
diagnostics = {
globals = { 'vim' },
},
workspace = {
library = vim.api.nvim_get_runtime_file('', true),
},
telemetry = {
enable = false,
},
completion = {
-- complete full function signature
callSnippet = 'Replace',
},
},
},
on_attach = on_attach,
capabilities = capabilities
})
end
if vim.fn.executable('pylsp') > 0 then
lspconfig.pylsp.setup({
settings = {
pylsp = {
}
},
on_attach = on_attach,
capabilities = capabilities
})
end
if vim.fn.executable('lemminx') > 0 then
lspconfig.lemminx.setup({
filetypes = {
'xml', 'xsd', 'xsl', 'xslt', 'svg', 'gentoo-metadata'
},
settings = {
xml = {
server = { -- path for cached XML Schemas
workDir = vim.fn.stdpath('cache') .. '/lemminx'
}
}
},
on_attach = on_attach,
capabilities = capabilities
})
end
if vim.fn.glob('/usr/lib64/perl5/vendor_perl/5.*/Perl/LanguageServer.pm') ~= ''
then
lspconfig.perlls.setup({
on_attach = on_attach,
capabilities = capabilities
})
end
if vim.fn.executable('qml-lsp') > 0 then
lspconfig.qml_lsp.setup({
filetypes = { 'qml', 'qmljs' },
on_attach = on_attach,
capabilities = capabilities
})
end
if vim.fn.executable('bash-language-server') > 0 then
lspconfig.bashls.setup({
filetypes = { 'sh', 'bash', 'ebuild', 'gentoo-init-d.sh' },
on_attach = on_attach,
capabilities = capabilities
})
end
if vim.fn.executable('typescript-language-server') > 0 then
lspconfig.tsserver.setup({
cmd = {
'typescript-language-server', '--stdio',
'--tsserver-path', 'tsserver'
},
on_attach = on_attach,
capabilities = capabilities
})
end
require('lsp-format').setup({
sync = true -- seems to be needed to not interfere with Neogit
})
local rt = require("rust-tools")
rt.setup({
server = {
on_attach = on_attach,
capabilities = capabilities,
settings = {
["rust-analyzer"] = {
-- checkOnSave = {
-- command = "clippy",
-- },
-- diagnostics = {
-- enable = true,
-- },
}
}
},
})

View File

@ -1,46 +0,0 @@
if not vim.g.started_by_firenvim then
local sockdir = (vim.env['XDG_RUNTIME_DIR']
or vim.env['XDG_STATE_HOME'] or vim.env['HOME'] .. '/.local/state')
vim.fn.mkdir(sockdir, 'p')
if vim.fn.filereadable(sockdir .. '/nvim.sock') == 0 then
vim.fn.serverstart(sockdir .. '/nvim.sock');
end
else
vim.g.firenvim_config = {
localSettings = {
[".*"] = {
priority = 0,
takeover = 'never',
}
}
}
vim.o.wrap = true
vim.o.guifont = 'Source_Code_Pro:h10'
vim.o.textwidth = 0
local fv_fileprefix = vim.env['XDG_RUNTIME_DIR'] .. '/firenvim/'
vim.api.nvim_create_augroup('firenvim', { clear = true })
vim.api.nvim_create_autocmd({ 'BufEnter' }, {
group = 'firenvim',
pattern = {
fv_fileprefix .. 'schlomp.space_*',
fv_fileprefix .. 'codeberg.org_*',
fv_fileprefix .. 'gitlab.com_*',
fv_fileprefix .. 'github.com_*',
fv_fileprefix .. 'very.tastytea.de_*',
fv_fileprefix .. 'bookwyrm.social_*',
fv_fileprefix .. 'openlibrary.org_*',
fv_fileprefix .. 'bugs.gentoo.org_*',
},
command = [[set filetype=markdown | set tw=0]]
})
vim.api.nvim_create_autocmd({ 'BufEnter' }, {
group = 'firenvim',
pattern = {
fv_fileprefix .. 'wiki.gentoo.org_*',
fv_fileprefix .. '*.wikipedia.org_*',
},
command = [[set filetype=mediawiki | set tw=0]]
})
end

View File

@ -32,28 +32,3 @@ local options = {
for k, v in pairs(options) do
vim.o[k] = v
end
-- fire CursorHold autocommand event (FixCursorHold.nvim)
vim.g.cursorhold_updatetime = 500
vim.api.nvim_create_user_command('Ht', 'tab help <args>', {
nargs = 1, complete = 'help'
})
-- split these vertically if there is enough space
vim.g.autosplit_bt = { 'help', 'terminal' }
vim.g.autosplit_ft = {
'man', 'fugitive', 'gitcommit', 'gitrebase', 'git'
}
-- theme
vim.o.termguicolors = true -- 24 bit colours
vim.cmd('colorscheme amora')
---- make comments a bit lighter
vim.api.nvim_set_hl(0, 'AmoraComment', { fg = '#7C4180', ctermfg = 61 })
vim.api.nvim_set_hl(0, 'AmoraCommentBold',
{ fg = '#7C4180', ctermfg = 61, bold = true })
-- if require('my.functions').nerdfont_installed() then
-- require('nvim-web-devicons').setup({})
-- end

View File

@ -1,297 +0,0 @@
local install_path = vim.fn.stdpath('data') ..
'/site/pack/packer/start/packer.nvim'
local packer_bootstrap
if vim.fn.empty(vim.fn.glob(install_path)) > 0 then
packer_bootstrap = vim.fn.system({
'git',
'clone',
'https://github.com/wbthomason/packer.nvim',
install_path
})
vim.cmd [[packadd packer.nvim]]
end
require('packer').startup({
function(use)
use { 'https://github.com/wbthomason/packer.nvim' }
-- settings
use { 'https://github.com/owozsh/amora' }
use { 'https://github.com/editorconfig/editorconfig-vim' }
use { 'https://github.com/antoinemadec/FixCursorHold.nvim' }
use { 'https://github.com/ii14/autosplit.nvim' }
-- filetypes
use {
'https://github.com/nvim-treesitter/nvim-treesitter',
tag = '*',
run = [[:TSUpdateSync]]
}
use {
'https://github.com/nvim-orgmode/orgmode',
tag = '*'
}
use {
'https://github.com/JoosepAlviste/nvim-ts-context-commentstring',
requires = 'https://github.com/nvim-treesitter/nvim-treesitter'
}
if vim.version().api_level >= 10 then -- >=0.8.0
use {
'https://github.com/folke/todo-comments.nvim',
requires = { 'https://github.com/nvim-lua/plenary.nvim' }
}
else
use {
'https://github.com/folke/todo-comments.nvim',
requires = { 'https://github.com/nvim-lua/plenary.nvim' },
branch = 'neovim-pre-0.8.0'
}
end
use { 'https://github.com/powerman/vim-plugin-AnsiEsc' }
use {
'https://github.com/lervag/vimtex',
tag = '*',
cond = vim.fn.executable('xelatex') == 1
}
use { 'https://github.com/NvChad/nvim-colorizer.lua' }
use { 'https://github.com/chikamichi/mediawiki.vim' }
if vim.version().api_level >= 10 then -- >=0.8.0
use { 'https://github.com/folke/paint.nvim' }
end
use {
'https://github.com/gennaro-tedesco/nvim-jqx',
tag = '*',
ft = { "json", "yaml" }
}
use { 'https://github.com/isobit/vim-caddyfile' }
-- completion
use {
'https://github.com/hrsh7th/nvim-cmp',
requires = {
'https://github.com/hrsh7th/cmp-nvim-lsp',
'https://github.com/hrsh7th/cmp-buffer',
'https://github.com/hrsh7th/cmp-path',
'https://github.com/hrsh7th/cmp-cmdline',
{
'https://github.com/saadparwaiz1/cmp_luasnip',
requires = 'https://github.com/L3MON4D3/LuaSnip'
},
'https://github.com/hrsh7th/cmp-nvim-lua',
'https://github.com/uga-rosa/cmp-dictionary',
'https://github.com/f3fora/cmp-spell',
'https://github.com/hrsh7th/cmp-nvim-lsp-document-symbol',
'https://github.com/tamago324/cmp-zsh',
{
'https://github.com/paopaol/cmp-doxygen',
requires = {
'https://github.com/nvim-treesitter/nvim-treesitter',
'https://github.com/nvim-treesitter/nvim-treesitter-textobjects'
}
},
'https://github.com/onsails/lspkind.nvim'
}
}
-- lsp
use {
'https://github.com/neovim/nvim-lspconfig',
tag = '*',
requires = 'https://github.com/hrsh7th/cmp-nvim-lsp'
}
use {
'https://github.com/lukas-reineke/lsp-format.nvim',
tag = '*'
}
use { 'https://github.com/ray-x/lsp_signature.nvim' }
use { 'https://github.com/p00f/clangd_extensions.nvim' }
use {
'https://github.com/simrat39/rust-tools.nvim',
requires = { 'neovim/nvim-lspconfig' }
}
-- tools
local nerdfont_installed = require('my.functions').nerdfont_installed()
use {
'https://github.com/kyazdani42/nvim-web-devicons',
cond = nerdfont_installed
}
use { 'https://github.com/folke/which-key.nvim' }
use {
'https://github.com/nvim-telescope/telescope.nvim',
tag = '*',
requires = {
'https://github.com/nvim-lua/plenary.nvim',
'https://github.com/nvim-treesitter/nvim-treesitter',
{
'https://github.com/kyazdani42/nvim-web-devicons',
cond = nerdfont_installed
}
},
}
use {
'https://github.com/nvim-telescope/telescope-fzf-native.nvim',
run = [[make]]
}
use {
'https://github.com/kyazdani42/nvim-tree.lua',
tag = '*',
requires = {
{
'https://github.com/kyazdani42/nvim-web-devicons',
cond = nerdfont_installed
}
}
}
use {
'https://github.com/nvim-lualine/lualine.nvim',
requires = {
{
'https://github.com/kyazdani42/nvim-web-devicons',
cond = nerdfont_installed
},
'https://github.com/nvim-lua/lsp-status.nvim'
}
}
use { 'https://codeberg.org/tastytea/bug-reference.nvim' }
use {
'https://github.com/phaazon/mind.nvim',
tag = '*'
}
use {
'https://github.com/dhruvasagar/vim-table-mode',
tag = '*'
}
use { 'https://github.com/stevearc/dressing.nvim' }
use {
'https://github.com/rcarriga/nvim-notify',
tag = '*'
}
use {
'https://github.com/gaoDean/autolist.nvim',
tag = '*'
}
use {
'https://github.com/ThePrimeagen/harpoon',
requires = {
'https://github.com/nvim-lua/plenary.nvim'
}
}
use {
'https://github.com/lambdalisue/suda.vim',
tag = '*'
}
use {
'https://github.com/LittleMorph/copyright-updater.nvim'
}
-- coding
use {
'https://github.com/numToStr/Comment.nvim',
tag = '*'
}
use { 'https://github.com/windwp/nvim-autopairs' }
use { 'https://github.com/L3MON4D3/LuaSnip' }
use {
'https://github.com/GnikDroy/projections.nvim',
branch = 'pre_release' }
use {
'https://github.com/mfussenegger/nvim-dap',
tag = '*'
}
use {
'https://github.com/rcarriga/nvim-dap-ui',
tag = '*',
requires = {
'https://github.com/mfussenegger/nvim-dap',
'https://github.com/nvim-neotest/nvim-nio'
}
}
use {
'https://github.com/nvim-telescope/telescope-dap.nvim',
requires = 'https://github.com/mfussenegger/nvim-dap'
}
use {
'https://github.com/theHamsta/nvim-dap-virtual-text',
requires = 'https://github.com/mfussenegger/nvim-dap'
}
use {
'https://github.com/krady21/compiler-explorer.nvim',
requires = { 'https://github.com/nvim-lua/plenary.nvim' }
}
use {
'https://github.com/AckslD/nvim-FeMaco.lua'
}
use {
'https://github.com/danymat/neogen',
requires = 'https://github.com/nvim-treesitter/nvim-treesitter',
tag = '*'
}
-- git
use {
'https://github.com/TimUntersberger/neogit',
requires = {
'https://github.com/nvim-lua/plenary.nvim',
'https://github.com/folke/which-key.nvim',
'https://github.com/sindrets/diffview.nvim'
}
}
use {
'https://github.com/tpope/vim-fugitive',
tag = '*'
}
use {
'https://github.com/lewis6991/gitsigns.nvim',
tag = '*'
}
-- use {
-- 'https://github.com/ruifm/gitlinker.nvim',
-- requires = { 'https://github.com/nvim-lua/plenary.nvim' }
-- }
use { -- <https://github.com/ruifm/gitlinker.nvim/pull/67>
'https://github.com/tastytea/gitlinker.nvim',
requires = { 'https://github.com/nvim-lua/plenary.nvim' },
branch = 'fix-cgit'
}
-- net
use { -- embed nvim in browsers
'https://github.com/glacambre/firenvim',
tag = '*',
run = [[call firenvim#install(0)]]
}
-- ensure plugins are installed and compiled
if packer_bootstrap then
require('packer').sync()
end
end,
config = {
git = {
depth = 999999
},
display = {
open_fn = require('packer.util').float
}
}
})
-- source file, install and compile plugins when this file is written
vim.api.nvim_create_augroup('config_plugins', { clear = true })
vim.api.nvim_create_autocmd({ 'BufWritePost' }, {
group = 'config_plugins',
pattern = { vim.fn.stdpath('config') .. '/lua/my/plugins.lua' },
command = [[source <afile> | PackerInstall]]
})
vim.api.nvim_create_autocmd({ 'User' }, {
group = 'config_plugins',
pattern = 'PackerComplete',
command = [[PackerCompile]]
})
vim.api.nvim_create_autocmd({ 'User' }, {
group = 'config_plugins',
pattern = 'PackerCompileDone',
command = [[echo 'plugins compiled']]
})

View File

@ -0,0 +1,127 @@
return {
{ 'https://github.com/hrsh7th/nvim-cmp',
dependencies = {
'https://github.com/hrsh7th/cmp-nvim-lsp',
'https://github.com/hrsh7th/cmp-buffer',
'https://github.com/hrsh7th/cmp-path',
'https://github.com/hrsh7th/cmp-cmdline',
{ 'https://github.com/saadparwaiz1/cmp_luasnip',
dependencies = 'https://github.com/L3MON4D3/LuaSnip',
},
'https://github.com/hrsh7th/cmp-nvim-lua',
{ 'https://github.com/uga-rosa/cmp-dictionary',
opts = {
dic = {
['gitcommit'] =
vim.fn.stdpath('config') .. '/resources/git.dict',
-- doesn't work, filetype is probably set too late
['NeogitCommitMessage'] =
vim.fn.stdpath('config') .. '/resources/git.dict',
},
},
},
'https://github.com/f3fora/cmp-spell',
{ 'https://github.com/tamago324/cmp-zsh',
opts = {
filetypes = { 'zsh', 'bash', 'sh' },
}
},
{ 'https://github.com/paopaol/cmp-doxygen',
dependencies = {
'nvim-treesitter',
'https://github.com/nvim-treesitter/nvim-treesitter-textobjects',
},
},
'https://github.com/onsails/lspkind.nvim',
},
config = function()
local cmp = require('cmp')
local luasnip = require('luasnip')
local lspkind = require('lspkind')
cmp.setup({
snippet = {
expand = function(args)
luasnip.lsp_expand(args.body)
end,
},
window = {
completion = cmp.config.window.bordered(),
documentation = cmp.config.window.bordered(),
},
formatting = {
format = lspkind.cmp_format({
mode = "symbol_text",
maxwidth = math.floor(vim.o.columns / 2),
ellipsis_char = '',
menu = ({
buffer = "[Buffer]",
nvim_lsp = "[LSP]",
luasnip = "[LuaSnip]",
nvim_lua = "[Lua]",
latex_symbols = "[Latex]",
})
}),
},
mapping = cmp.mapping.preset.insert({
['<S-PageUp>'] = cmp.mapping.scroll_docs(-4),
['<S-PageDown>'] = cmp.mapping.scroll_docs(4),
['<C-Space>'] = cmp.mapping.complete(),
['<C-e>'] = cmp.mapping.abort(),
['<Left>'] = cmp.mapping.abort(),
['<CR>'] = cmp.mapping.confirm({ select = false }),
['<Tab>'] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif luasnip.expandable() then
luasnip.expand({})
elseif luasnip.expand_or_jumpable() then
luasnip.expand_or_jump()
else
fallback()
end
end),
['<S-Tab>'] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif luasnip.jumpable(-1) then
luasnip.jump(-1)
else
fallback()
end
end)
}),
sources = cmp.config.sources({
{ name = 'nvim_lsp' },
{ name = 'luasnip' },
{ name = 'nvim_lua' },
{ name = 'dictionary' },
{ name = 'zsh' },
{ name = 'doxygen' },
}, {
{ name = 'buffer' },
-- { name = 'spell' },
})
})
-- Use LSP symbols and buffer source for `/`
cmp.setup.cmdline('/', {
mapping = cmp.mapping.preset.cmdline(),
sources = cmp.config.sources({
{ name = 'nvim_lsp_document_symbol' }
}, {
{ name = 'buffer' }
})
})
-- Use cmdline & path source for ':'
cmp.setup.cmdline(':', {
mapping = cmp.mapping.preset.cmdline(),
sources = cmp.config.sources({
{ name = 'path' }
}, {
{ name = 'cmdline' }
})
})
end
},
}

View File

@ -0,0 +1,99 @@
local function has_api_level(desired)
return vim.version().api_level >= desired
end
return {
-- common dependencies
{ 'https://github.com/nvim-lua/plenary.nvim',
lazy = true
},
-- basics
{ 'https://github.com/owozsh/amora',
init = function()
vim.o.termguicolors = true -- 24 bit colors
end,
config = function()
vim.cmd('colorscheme amora')
-- make comments a bit lighter
vim.api.nvim_set_hl(0, 'AmoraComment', { fg = '#7C4180', ctermfg = 61 })
vim.api.nvim_set_hl(0, 'AmoraCommentBold',
{ fg = '#7C4180', ctermfg = 61, bold = true })
end,
},
{ 'https://github.com/editorconfig/editorconfig-vim',
-- 0.9.0 has EditorConfig support included
enabled = not has_api_level(11)
},
{ 'https://github.com/ii14/autosplit.nvim',
init = function()
-- split these vertically if there is enough space
vim.g.autosplit_bt = { 'help', 'terminal' }
vim.g.autosplit_ft = {
'man', 'fugitive', 'gitcommit', 'gitrebase', 'git'
}
end,
},
-- filetypes
{ 'https://github.com/nvim-treesitter/nvim-treesitter',
version = '*',
build = [[:TSUpdateSync]],
opts = {
ensure_installed = 'all',
ignore_install = { 'comment', 'help' },
sync_install = true,
highlight = {
enable = true,
additional_vim_regex_highlighting = { 'cpp' }
}
},
},
{ 'https://github.com/JoosepAlviste/nvim-ts-context-commentstring',
dependencies = 'nvim-treesitter',
enabled = has_api_level(11),
opts = {
enable = true,
enable_autocmd = false
},
init = function()
vim.g.skip_ts_context_commentstring_module = true
end,
},
{ 'https://github.com/folke/todo-comments.nvim',
version = '*',
dependencies = { 'plenary.nvim' },
enabled = has_api_level(11),
opts = {
signs = false,
highlight = {
keyword = 'bg',
after = ''
}
},
init = function()
vim.g.vimtex_compiler_latexmk_engines = { _ = '-xelatex' }
end,
},
{ 'https://github.com/powerman/vim-plugin-AnsiEsc' },
{ 'https://github.com/lervag/vimtex',
version = '*',
enabled = has_api_level(11) and vim.fn.executable('xelatex') == 1
},
{ 'https://github.com/NvChad/nvim-colorizer.lua',
opts = {
filetypes = { '*' },
user_default_options = {
mode = 'virtualtext',
rgb_fn = true,
hsl_fn = true,
RRGGBBAA = true,
}
},
},
{ 'https://github.com/gennaro-tedesco/nvim-jqx',
version = '*',
ft = { "json", "yaml" },
},
{ 'https://github.com/isobit/vim-caddyfile' },
}

View File

@ -1,177 +0,0 @@
require('which-key').setup({})
local map = require('my.functions').map
local telescope = require('telescope')
local t_actions = require('telescope.actions')
telescope.load_extension('projections')
telescope.load_extension('dap')
telescope.load_extension('fzf')
telescope.setup({
mappings = {
i = {
["<C-_>"] = t_actions.which_key,
},
n = {
["?"] = t_actions.which_key,
}
},
defaults = {
file_ignore_patterns = { '^\\.git', '^fun' },
},
pickers = {
find_files = {
-- show hidden files by default
find_command = { "rg", "--files", "--hidden", "--glob", "!.git/*" }
}
}
})
local t_builtin = require('telescope.builtin')
local my = require('my.functions')
require('which-key').add({{ '<Leader>t', group = 'Telescope' }})
map('n', '<Leader>tb', t_builtin.buffers, 'Buffers')
map('n', '<Leader>tf', function()
t_builtin.find_files({ cwd = my.get_project_root() })
end, 'Files')
map('n', '<Leader>tF', t_builtin.find_files, 'Files in cwd')
map('n', '<Leader>to', t_builtin.oldfiles, 'Recently opened files')
map('n', '<Leader>tg', function()
t_builtin.live_grep({ cwd = my.get_project_root() })
end, 'Live-grep')
map('n', '<Leader>tm', t_builtin.man_pages, 'Man pages')
map('n', '<Leader>tr', t_builtin.registers, 'Registers')
map('n', '<Leader>gh', t_builtin.git_bcommits, 'History of this file')
map('n', '<F7>', t_builtin.diagnostics, 'Show diagnostics')
map('n', '<Leader>tp', telescope.extensions.projections.projections, 'Projects')
map('n', '<Leader>tt',
require("telescope._extensions.todo-comments").exports.todo,
'Display TODO comments in project')
map('n', '<Leader>tn', telescope.extensions.notify.notify, 'Notifications')
local nerdfont_installed = require('my.functions').nerdfont_installed()
require("nvim-tree").setup({
filters = {
dotfiles = false,
custom = { '^\\.git' }
},
sync_root_with_cwd = true,
respect_buf_cwd = true,
update_focused_file = {
enable = true,
update_root = true
},
renderer = {
icons = {
show = {
file = nerdfont_installed,
folder = nerdfont_installed,
folder_arrow = nerdfont_installed,
git = nerdfont_installed
}
}
}
})
map('n', '<F9>', require("nvim-tree.api").tree.toggle, 'Open nvim-tree')
map('i', '<F9>', require("nvim-tree.api").tree.toggle, 'Open nvim-tree')
vim.o.showmode = false
local not_firenvim = require('my.functions').not_firenvim
require('lualine').setup({
options = {
icons_enabled = nerdfont_installed,
component_separators = {},
section_separators = {},
extensions = {},
globalstatus = true
},
sections = {
lualine_a = { { 'mode' } },
lualine_b = {
{ 'branch', icons_enabled = true },
{ 'diff' },
{ require('my.functions').lsp_status, padding = 0 },
{ 'diagnostics' }
},
lualine_c = {
{
'filename',
path = 1,
newfile_status = true,
cond = not_firenvim
},
{
require('my.functions').current_function,
padding = 0,
color = 'StatusLineNC'
}
},
lualine_x = { {
require('my.functions').lsp_sig_status,
color = 'StatusLineNC'
}, { 'filetype' } },
lualine_y = { { 'progress' } },
lualine_z = { { 'location' }, { '"🍄"', padding = 0 }
}
},
})
if vim.version().api_level >= 10 then -- >=0.8.0
require('lualine').setup({
inactive_winbar = {
lualine_c = { { 'filename', cond = not_firenvim } },
}
})
end
map('n', '<Leader>B', require('bug-reference').open, 'Open bug under cursor')
local mind = require('mind')
mind.setup({
ui = {
width = 50
}
})
local function mind_project()
vim.cmd.lcd(require('my.functions').get_project_root())
mind.open_project()
end
map('n', '<C-F9>', mind.open_main, 'Open main mind')
map('n', '<F33>', mind.open_main, 'Open main mind') -- <C-F9> = <F33>
map('n', '<S-F9>', mind_project, 'Open project mind')
map('n', '<F21>', mind_project, 'Open project mind') -- <S-F9> = <F21>
vim.g.table_mode_map_prefix = '<Leader>T'
require('which-key').add({{ '<Leader>T', group = 'Table mode' }})
require('dressing').setup({
input = {
relative = 'win',
min_width = { 60, 0.4 },
}
})
require('notify').setup({
on_open = function(win)
vim.api.nvim_win_set_option(win, 'wrap', true) -- does not work
end,
stages = 'static',
})
vim.notify = require('notify')
require('autolist').setup({})
require('which-key').add({{ '<Leader>j', group = 'Jump' }})
map('n', '<Leader>ja', require('harpoon.mark').add_file, 'Add file')
map('n', '<Leader>jm', require('harpoon.ui').toggle_quick_menu, 'Quick menu')
require('copyright-updater').setup({
enabled = true,
return_cursor = true,
mappings = nil,
limiters = {
range = '1,10'
}
})