Compare commits
64 Commits
c80752ebea
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 87ab333ec9 | |||
| 93e281cbb5 | |||
| 4bd4d87f5b | |||
| 3ac01d9776 | |||
| 08784c625a | |||
| 59f4064788 | |||
| 74baebf3f8 | |||
| 3b7c034926 | |||
| 12152a20db | |||
| 3e6c115673 | |||
| fd6dd0ba8c | |||
| ee7157a23a | |||
| 3e3d7b8173 | |||
| 19cfaeab49 | |||
| 5b41b4d781 | |||
| 9faa5209bb | |||
| 36487d273e | |||
| 5b58207e16 | |||
| 270222bb57 | |||
| 75f9692e7d | |||
| 4bb854c54d | |||
| 15e21f333f | |||
| 1cb0d8ab2a | |||
| b6c4df13e0 | |||
| 3ded8e9e0d | |||
| 56136ef0f1 | |||
| e5f95df420 | |||
| 811b7d9c07 | |||
| 9b9673d159 | |||
| 6c8b1c87d4 | |||
| 3d6d0b38f3 | |||
| bec7627aaa | |||
| c38ec7f2e4 | |||
| 9206d3ca43 | |||
| f3157898b6 | |||
| 8f4cfc7926 | |||
| 3bed9ba9ad | |||
| cc0b3234bc | |||
| 2aeb29b3c6 | |||
| c53630b77d | |||
| 3866873ac8 | |||
| a503fed8d5 | |||
| e3cf322fc9 | |||
| 1561c18d35 | |||
| 3f6c8f995b | |||
| f30726c08b | |||
| d2d5262466 | |||
| 12bf12610a | |||
| 67dafbaf6c | |||
| 9a0c3a4ca2 | |||
| 294870a25b | |||
| 93bb8bc68c | |||
| 3c8916cf9e | |||
| 75e581e856 | |||
| 98149a4b8f | |||
| fab5a97e0c | |||
| 151a7e5833 | |||
| 7ffd390cb4 | |||
| e82602334e | |||
| de68c1e748 | |||
| 9e86ac8425 | |||
| 098b3c055e | |||
| a0b9561e10 | |||
| e9ef076ce5 |
3
after/ftplugin/asciidoc.lua
Normal file
3
after/ftplugin/asciidoc.lua
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
-- Options for AsciiDoc files, mainly used in diary situations
|
||||||
|
-- (pun intended)
|
||||||
|
vim.opt.textwidth = 80
|
||||||
13
after/ftplugin/org.lua
Normal file
13
after/ftplugin/org.lua
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
-- make C-CR in insert mode behave like org_meta_return
|
||||||
|
-- in normal mode
|
||||||
|
|
||||||
|
vim.keymap.set(
|
||||||
|
"i",
|
||||||
|
"<C-CR>",
|
||||||
|
|
||||||
|
'<cmd>lua require("orgmode").action("org_mappings.meta_return")<CR>', {
|
||||||
|
silent = true,
|
||||||
|
buffer = true,
|
||||||
|
desc = 'ORG: meta return'
|
||||||
|
}
|
||||||
|
)
|
||||||
37
after/ftplugin/rust.lua
Normal file
37
after/ftplugin/rust.lua
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
local bufnr = vim.api.nvim_get_current_buf()
|
||||||
|
|
||||||
|
vim.keymap.set(
|
||||||
|
"n",
|
||||||
|
"<space>x",
|
||||||
|
function()
|
||||||
|
vim.cmd.RustLsp({ 'explainError', 'current' })
|
||||||
|
end,
|
||||||
|
{ silent = true, buffer = bufnr, desc = 'RustLSP: explain error at cursor' }
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
-- show run targets
|
||||||
|
vim.keymap.set(
|
||||||
|
"n",
|
||||||
|
"<f5>",
|
||||||
|
function()
|
||||||
|
vim.cmd.RustLsp({ 'runnables' })
|
||||||
|
end,
|
||||||
|
{ silent = true, buffer = bufnr, desc = 'RustLSP: show runnables' }
|
||||||
|
)
|
||||||
|
|
||||||
|
-- run last target
|
||||||
|
vim.keymap.set(
|
||||||
|
"n",
|
||||||
|
"<S-f5>",
|
||||||
|
function()
|
||||||
|
vim.cmd.RustLsp({ 'runnables', bang = true })
|
||||||
|
end,
|
||||||
|
{ silent = true, buffer = bufnr, desc = 'RustLSP: show runnables' }
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
-- override signature hover to use RustLsp
|
||||||
|
vim.keymap.set('n', 'K', ":RustLsp hover actions<cr>", { desc = "RustLSP show signature" })
|
||||||
|
vim.keymap.set('n', 'J', ":RustLsp joinLines<cr>", { desc = "RustLSP join lines" })
|
||||||
|
|
||||||
4
colors/lunaperche-sl.vim
Normal file
4
colors/lunaperche-sl.vim
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
runtime colors/lunaperche.vim
|
||||||
|
|
||||||
|
" fix VertSplit for lunaperche
|
||||||
|
hi VertSplit guifg=#aaaaaa
|
||||||
4
init.lua
4
init.lua
@@ -1,6 +1,10 @@
|
|||||||
-- load configurations files from lua/*
|
-- load configurations files from lua/*
|
||||||
|
require('filetype')
|
||||||
require('options')
|
require('options')
|
||||||
|
require('functions')
|
||||||
require('plugins')
|
require('plugins')
|
||||||
require('colorscheme')
|
require('colorscheme')
|
||||||
require('lsp')
|
require('lsp')
|
||||||
require('keybindings')
|
require('keybindings')
|
||||||
|
require('diary')
|
||||||
|
require('layout')
|
||||||
|
|||||||
@@ -1,29 +0,0 @@
|
|||||||
{
|
|
||||||
"LuaSnip": { "branch": "master", "commit": "03c8e67eb7293c404845b3982db895d59c0d1538" },
|
|
||||||
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
|
|
||||||
"cmp-cmdline": { "branch": "main", "commit": "d250c63aa13ead745e3a40f61fdd3470efde3923" },
|
|
||||||
"cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" },
|
|
||||||
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
|
|
||||||
"cmp-rpncalc": { "branch": "master", "commit": "3d82861b41c54cb0b3c2c513563e1d8758c92625" },
|
|
||||||
"diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" },
|
|
||||||
"fzf-lua": { "branch": "main", "commit": "f513524561060f2b9e3bd6d36ff046bfa03ca114" },
|
|
||||||
"lazy.nvim": { "branch": "main", "commit": "460e1cd8f24e364d54543a4b0e83f6f4ec1f65fb" },
|
|
||||||
"lspkind.nvim": { "branch": "master", "commit": "cff4ae321a91ee3473a92ea1a8c637e3a9510aec" },
|
|
||||||
"lualine.nvim": { "branch": "master", "commit": "b431d228b7bbcdaea818bdc3e25b8cdbe861f056" },
|
|
||||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "25c11854aa25558ee6c03432edfa0df0217324be" },
|
|
||||||
"mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" },
|
|
||||||
"mini.icons": { "branch": "main", "commit": "2d89252993fec829b24720097a687412d10f6c85" },
|
|
||||||
"neo-tree.nvim": { "branch": "v3.x", "commit": "29f7c215332ba95e470811c380ddbce2cebe2af4" },
|
|
||||||
"neogit": { "branch": "master", "commit": "9959b58a897036ce89d47385021db1f716613399" },
|
|
||||||
"nui.nvim": { "branch": "main", "commit": "b58e2bfda5cea347c9d58b7f11cf3012c7b3953f" },
|
|
||||||
"nvim-cmp": { "branch": "main", "commit": "ae644feb7b67bf1ce4260c231d1d4300b19c6f30" },
|
|
||||||
"nvim-lspconfig": { "branch": "master", "commit": "aaec5d049af99e7b975bdf68aca582f1aa91b338" },
|
|
||||||
"nvim-treesitter": { "branch": "master", "commit": "2b2ac302324f4cd2194c5dcaa59332b65e1c6403" },
|
|
||||||
"nvim-web-devicons": { "branch": "master", "commit": "9154484705968658e9aab2b894d1b2a64bf9f83d" },
|
|
||||||
"orgmode": { "branch": "master", "commit": "a006c9318132d51d3b7058cf2a8cc557c7fa4f22" },
|
|
||||||
"plenary.nvim": { "branch": "master", "commit": "2d9b06177a975543726ce5c73fca176cedbffe9d" },
|
|
||||||
"todo-comments.nvim": { "branch": "main", "commit": "ae0a2afb47cf7395dc400e5dc4e05274bf4fb9e0" },
|
|
||||||
"vim-table-mode": { "branch": "master", "commit": "e4365bde024f73e205eefa2fb78e3029ddb92ea9" },
|
|
||||||
"which-key.nvim": { "branch": "main", "commit": "fb070344402cfc662299d9914f5546d840a22126" },
|
|
||||||
"workspaces.nvim": { "branch": "master", "commit": "0b03d3f2ffe38729b1792905ec447405ed76cb6e" }
|
|
||||||
}
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
-- define your colorscheme here
|
-- define your colorscheme here
|
||||||
local colorscheme = 'lunaperche'
|
local colorscheme = 'lunaperche-sl'
|
||||||
|
|
||||||
local is_ok, _ = pcall(vim.cmd, "colorscheme " .. colorscheme)
|
local is_ok, _ = pcall(vim.cmd, "colorscheme " .. colorscheme)
|
||||||
if not is_ok then
|
if not is_ok then
|
||||||
|
|||||||
109
lua/config/alpha-nvim.lua
Normal file
109
lua/config/alpha-nvim.lua
Normal file
@@ -0,0 +1,109 @@
|
|||||||
|
local alpha = require 'alpha'
|
||||||
|
local dashboard = require 'alpha.themes.dashboard'
|
||||||
|
|
||||||
|
_Gopts = {
|
||||||
|
position = 'center',
|
||||||
|
hl = 'Type',
|
||||||
|
wrap = 'overflow',
|
||||||
|
}
|
||||||
|
|
||||||
|
-- DASHBOARD HEADER
|
||||||
|
|
||||||
|
local function getGreeting()
|
||||||
|
local tableTime = os.date '*t'
|
||||||
|
local datetime = os.date ' %Y-%m-%d-%A %H:%M:%S '
|
||||||
|
local hour = tableTime.hour
|
||||||
|
local greetingsTable = {
|
||||||
|
[1] = ' Sleep well',
|
||||||
|
[2] = ' Good morning',
|
||||||
|
[3] = ' Good afternoon',
|
||||||
|
[4] = ' Good evening',
|
||||||
|
[5] = ' Good night',
|
||||||
|
}
|
||||||
|
local greetingIndex = 0
|
||||||
|
if hour == 23 or hour < 7 then
|
||||||
|
greetingIndex = 1
|
||||||
|
elseif hour < 12 then
|
||||||
|
greetingIndex = 2
|
||||||
|
elseif hour >= 12 and hour < 18 then
|
||||||
|
greetingIndex = 3
|
||||||
|
elseif hour >= 18 and hour < 21 then
|
||||||
|
greetingIndex = 4
|
||||||
|
elseif hour >= 21 then
|
||||||
|
greetingIndex = 5
|
||||||
|
end
|
||||||
|
return datetime .. ' ' .. greetingsTable[greetingIndex]
|
||||||
|
end
|
||||||
|
|
||||||
|
local logo = [[
|
||||||
|
|
||||||
|
|
||||||
|
████ ██████ █████ ██
|
||||||
|
███████████ █████
|
||||||
|
█████████ ███████████████████ ███ ███████████
|
||||||
|
█████████ ███ █████████████ █████ ██████████████
|
||||||
|
█████████ ██████████ █████████ █████ █████ ████ █████
|
||||||
|
███████████ ███ ███ █████████ █████ █████ ████ █████
|
||||||
|
██████ █████████████████████ ████ █████ █████ ████ ██████
|
||||||
|
|
||||||
|
]]
|
||||||
|
|
||||||
|
local greeting = getGreeting()
|
||||||
|
local marginBottom = 0
|
||||||
|
|
||||||
|
-- Split logo into lines
|
||||||
|
local logoWidth = 0
|
||||||
|
for line in logo:gmatch '[^\n]+' do
|
||||||
|
logoWidth = math.max(logoWidth, #line / 2)
|
||||||
|
end
|
||||||
|
logoWidth = 75 -- code above does not work with utf8 strings in lua 5.1
|
||||||
|
|
||||||
|
-- Calculate padding for centering the greeting
|
||||||
|
local greetingWidth = #greeting - 3
|
||||||
|
local padding = math.floor((logoWidth - greetingWidth) / 2)
|
||||||
|
-- Generate spaces for padding
|
||||||
|
local paddedGreeting = string.rep(' ', padding) .. greeting
|
||||||
|
|
||||||
|
|
||||||
|
local userName = "You work as '" .. vim.env.USER .. "'."
|
||||||
|
|
||||||
|
-- Calculate padding for centering the username
|
||||||
|
local userNameWidth = #userName
|
||||||
|
local padding = math.floor((logoWidth - userNameWidth) / 2)
|
||||||
|
-- Generate spaces for padding
|
||||||
|
local userNamePadded = string.rep(' ', padding) .. userName
|
||||||
|
|
||||||
|
|
||||||
|
-- Add margin lines below the padded greeting
|
||||||
|
local margin = string.rep('\n', marginBottom * 5)
|
||||||
|
|
||||||
|
-- Concatenate logo, padded greeting, and margin
|
||||||
|
local adjustedLogo = logo .. '\n' .. paddedGreeting .. '\n\n' .. userNamePadded .. '\n' .. margin
|
||||||
|
dashboard.section.header.val = vim.split(adjustedLogo, '\n')
|
||||||
|
|
||||||
|
dashboard.section.buttons.val = {
|
||||||
|
dashboard.button('d', ' Diary Entry', '<cmd>Diary<CR>'),
|
||||||
|
dashboard.button('n', ' New file', ':ene <BAR> startinsert <CR>'),
|
||||||
|
dashboard.button('s', ' Settings', '<cmd>WorkspacesOpen config-nvim<CR>'),
|
||||||
|
dashboard.button('u', ' Update plugins', '<cmd>Lazy update<CR>'),
|
||||||
|
dashboard.button('w', ' Workspaces', '<cmd>WorkspacesOpen<CR>'),
|
||||||
|
dashboard.button('q', ' Quit', '<cmd>qa<CR>'),
|
||||||
|
}
|
||||||
|
|
||||||
|
-- dashboard.section.footer.val = greeting
|
||||||
|
|
||||||
|
vim.api.nvim_create_autocmd('User', {
|
||||||
|
pattern = 'LazyVimStarted',
|
||||||
|
desc = 'Add Alpha dashboard footer',
|
||||||
|
once = true,
|
||||||
|
callback = function()
|
||||||
|
local stats = require('lazy').stats()
|
||||||
|
local ms = math.floor(stats.startuptime * 100 + 0.5) / 100
|
||||||
|
dashboard.section.footer.val = { ' ', ' ', ' ', ' Loaded ' .. stats.count .. ' plugins in ' .. ms .. ' ms ' }
|
||||||
|
dashboard.section.header.opts.hl = 'DashboardFooter'
|
||||||
|
pcall(vim.cmd.AlphaRedraw)
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
dashboard.opts.opts.noautocmd = true
|
||||||
|
alpha.setup(dashboard.opts)
|
||||||
41
lua/config/lualine.lua
Normal file
41
lua/config/lualine.lua
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
require("lualine").setup {
|
||||||
|
options = {
|
||||||
|
icons_enabled = false,
|
||||||
|
theme = 'papercolor_light',
|
||||||
|
component_separators = {},
|
||||||
|
section_separators = {},
|
||||||
|
disabled_filetypes = {
|
||||||
|
statusline = {},
|
||||||
|
winbar = { "neo-tree" },
|
||||||
|
},
|
||||||
|
ignore_focus = {},
|
||||||
|
always_divide_middle = true,
|
||||||
|
globalstatus = false,
|
||||||
|
refresh = {
|
||||||
|
statusline = 1000,
|
||||||
|
tabline = 1000,
|
||||||
|
winbar = 1000,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
sections = {
|
||||||
|
lualine_a = { { 'filename', path = 1, shorting_target = 50 } },
|
||||||
|
lualine_b = { 'branch', 'diff', 'diagnostics' },
|
||||||
|
lualine_c = {},
|
||||||
|
lualine_x = { 'encoding', 'fileformat', 'filetype', 'lsp_status' },
|
||||||
|
lualine_y = { 'filesize' },
|
||||||
|
lualine_z = { 'progress', 'location' }
|
||||||
|
},
|
||||||
|
inactive_sections = {
|
||||||
|
lualine_a = { { 'filename', path = 1, shorting_target = 50 } },
|
||||||
|
lualine_b = {},
|
||||||
|
lualine_c = {},
|
||||||
|
-- lualine_x = { 'encoding', 'fileformat', 'filetype' },
|
||||||
|
lualine_x = {},
|
||||||
|
lualine_y = { 'filesize' },
|
||||||
|
lualine_z = { 'location' }
|
||||||
|
},
|
||||||
|
tabline = {},
|
||||||
|
winbar = {}, -- formerly breadcrumb here
|
||||||
|
inactive_winbar = {},
|
||||||
|
extensions = {}
|
||||||
|
}
|
||||||
@@ -1,81 +0,0 @@
|
|||||||
local has_words_before = function()
|
|
||||||
unpack = unpack or table.unpack
|
|
||||||
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
|
|
||||||
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
|
|
||||||
end
|
|
||||||
|
|
||||||
local luasnip = require("luasnip")
|
|
||||||
local cmp = require("cmp")
|
|
||||||
|
|
||||||
cmp.setup({
|
|
||||||
snippet = {
|
|
||||||
-- REQUIRED - you must specify a snippet engine
|
|
||||||
expand = function(args)
|
|
||||||
require('luasnip').lsp_expand(args.body) -- For `luasnip` users.
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
mapping = cmp.mapping.preset.insert({
|
|
||||||
-- Use <C-b/f> to scroll the docs
|
|
||||||
['<C-b>'] = cmp.mapping.scroll_docs(-4),
|
|
||||||
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
|
||||||
-- Use <C-k/j> to switch in items
|
|
||||||
['<C-k>'] = cmp.mapping.select_prev_item(),
|
|
||||||
['<C-j>'] = cmp.mapping.select_next_item(),
|
|
||||||
-- Use <CR>(Enter) to confirm selection
|
|
||||||
-- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
|
|
||||||
['<CR>'] = cmp.mapping.confirm({ select = true }),
|
|
||||||
|
|
||||||
-- A super tab
|
|
||||||
-- sourc: https://github.com/hrsh7th/nvim-cmp/wiki/Example-mappings#luasnip
|
|
||||||
["<Tab>"] = cmp.mapping(function(fallback)
|
|
||||||
-- Hint: if the completion menu is visible select next one
|
|
||||||
if cmp.visible() then
|
|
||||||
cmp.select_next_item()
|
|
||||||
elseif has_words_before() then
|
|
||||||
cmp.complete()
|
|
||||||
else
|
|
||||||
fallback()
|
|
||||||
end
|
|
||||||
end, { "i", "s" }), -- i - insert mode; s - select mode
|
|
||||||
["<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, { "i", "s" }),
|
|
||||||
}),
|
|
||||||
|
|
||||||
-- Let's configure the item's appearance
|
|
||||||
-- source: https://github.com/hrsh7th/nvim-cmp/wiki/Menu-Appearance
|
|
||||||
formatting = {
|
|
||||||
-- Set order from left to right
|
|
||||||
-- kind: single letter indicating the type of completion
|
|
||||||
-- abbr: abbreviation of "word"; when not empty it is used in the menu instead of "word"
|
|
||||||
-- menu: extra text for the popup menu, displayed after "word" or "abbr"
|
|
||||||
fields = { 'abbr', 'menu' },
|
|
||||||
|
|
||||||
-- customize the appearance of the completion menu
|
|
||||||
format = function(entry, vim_item)
|
|
||||||
vim_item.menu = ({
|
|
||||||
nvim_lsp = '[Lsp]',
|
|
||||||
luasnip = '[Luasnip]',
|
|
||||||
buffer = '[File]',
|
|
||||||
path = '[Path]',
|
|
||||||
})[entry.source.name]
|
|
||||||
return vim_item
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
|
|
||||||
-- Set source precedence
|
|
||||||
sources = cmp.config.sources({
|
|
||||||
{ name = 'nvim_lsp' }, -- For nvim-lsp
|
|
||||||
{ name = 'luasnip' }, -- For luasnip user
|
|
||||||
{ name = 'buffer' }, -- For buffer word completion
|
|
||||||
{ name = 'path' }, -- For path completion
|
|
||||||
{ name = 'rpncalc' }, -- for RPN calculations
|
|
||||||
{ name = 'orgmode' }, -- for nvim-orgmode
|
|
||||||
})
|
|
||||||
})
|
|
||||||
22
lua/diary.lua
Normal file
22
lua/diary.lua
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
local diary_open = function(opts)
|
||||||
|
local date = opts.args ~= '' and opts.args or os.date('%Y-%m-%d')
|
||||||
|
local year, month = date:match('(%d%d%d%d)-(%d%d)')
|
||||||
|
local file = string.format('~/.diary/asciidoc/%s/diary-%s-%s.adoc', year, year, month)
|
||||||
|
print("file is:", file)
|
||||||
|
vim.cmd('e ' .. file)
|
||||||
|
vim.cmd('normal! G')
|
||||||
|
|
||||||
|
-- NOTE.2025-06-08 [1] and [2] should be replaced with snippet name, but I
|
||||||
|
-- don't know how -- neither do grok nor chatgpt ...
|
||||||
|
local snips = require('luasnip')
|
||||||
|
local asnippets = snips.get_snippets('asciidoc')
|
||||||
|
if vim.fn.getfsize(file) == 0 then
|
||||||
|
snips.snip_expand(asnippets[1])
|
||||||
|
vim.cmd('normal! G')
|
||||||
|
end
|
||||||
|
|
||||||
|
vim.cmd('normal! 3o') -- insert some newlines before new entry
|
||||||
|
snips.snip_expand(asnippets[2])
|
||||||
|
end
|
||||||
|
|
||||||
|
vim.api.nvim_create_user_command("Diary", diary_open, { nargs = '?' })
|
||||||
5
lua/filetype.lua
Normal file
5
lua/filetype.lua
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
vim.filetype.add({
|
||||||
|
extension = {
|
||||||
|
CON = 'confile',
|
||||||
|
},
|
||||||
|
})
|
||||||
15
lua/functions.lua
Normal file
15
lua/functions.lua
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
-- custom defined functions
|
||||||
|
|
||||||
|
-- Return the currently, visually selected text range
|
||||||
|
function SL_get_visual_selection()
|
||||||
|
vim.cmd([[ execute "normal! \<ESC>" ]])
|
||||||
|
local s_start = vim.fn.getcharpos("'<")
|
||||||
|
local s_end = vim.fn.getcharpos("'>")
|
||||||
|
vim.cmd([[ execute "normal! gv" ]])
|
||||||
|
|
||||||
|
local current_buffer = vim.api.nvim_get_current_buf()
|
||||||
|
local r = vim.api.nvim_buf_get_text(current_buffer, s_start[2] - 1, s_start[3] - 1,
|
||||||
|
s_end[2] - 1, s_end[3], {})
|
||||||
|
-- print("region might be", current_buffer, s_start[2], s_start[3], s_end[2], s_end[3])
|
||||||
|
return table.concat(r, "\n")
|
||||||
|
end
|
||||||
@@ -1,48 +1,84 @@
|
|||||||
-- Setup fzf-lua keybindings and some other searches
|
-- Setup fzf-lua keybindings and some other searches
|
||||||
local fzf = require('fzf-lua')
|
local fzf = require('fzf-lua')
|
||||||
vim.keymap.set('n', '<leader>ff', fzf.files, { desc = "Find file" })
|
|
||||||
vim.keymap.set('n', '<leader>fs', fzf.blines, { desc = "Search buffer" })
|
|
||||||
vim.keymap.set('n', '<leader>fg', fzf.live_grep, { desc = "Grep" })
|
|
||||||
vim.keymap.set('n', '<leader>fG', fzf.grep_cword, { desc = "Grep word under cursor" })
|
|
||||||
vim.keymap.set('n', '<leader>fc', fzf.commands, { desc = "Commands" })
|
|
||||||
vim.keymap.set('n', '<leader>fm', fzf.manpages, { desc = "Manpages" })
|
|
||||||
vim.keymap.set('n', '<leader>b', fzf.buffers, { desc = "Buffers" })
|
vim.keymap.set('n', '<leader>b', fzf.buffers, { desc = "Buffers" })
|
||||||
|
vim.keymap.set('n', '<leader>fG', fzf.grep_cword, { desc = "Grep word under cursor" })
|
||||||
|
vim.keymap.set('n', '<leader>fT', fzf.treesitter, { desc = "Treesitter symbols" })
|
||||||
|
vim.keymap.set('n', '<leader>fc', fzf.commands, { desc = "Commands" })
|
||||||
|
vim.keymap.set('n', '<leader>ff', fzf.files, { desc = "Find file" })
|
||||||
|
vim.keymap.set('n', '<leader>fg', fzf.live_grep, { desc = "Grep" })
|
||||||
|
vim.keymap.set('n', '<leader>fm', fzf.manpages, { desc = "Manpages" })
|
||||||
|
vim.keymap.set('n', '<leader>fr', fzf.resume, { desc = "Resume last search" })
|
||||||
|
vim.keymap.set('n', '<leader>fs', fzf.blines, { desc = "Search buffer" })
|
||||||
vim.keymap.set('n', '<leader>ft', ":TodoFzfLua<CR>", { desc = "Todos" })
|
vim.keymap.set('n', '<leader>ft', ":TodoFzfLua<CR>", { desc = "Todos" })
|
||||||
|
|
||||||
-- use fzf buffer lines as default search
|
-- use fzf buffer lines as default search
|
||||||
vim.keymap.set('n', '/', fzf.blines, { desc = "Search buffer" })
|
vim.keymap.set('n', '<C-/>', fzf.blines, { desc = "Search buffer" })
|
||||||
vim.keymap.set('n', 'z=', fzf.spell_suggest, { desc = "Spelling suggestions" })
|
vim.keymap.set('n', 'z=', fzf.spell_suggest, { desc = "Spelling suggestions" })
|
||||||
|
|
||||||
-- open file manager and git
|
-- open file manager and git
|
||||||
vim.keymap.set('n', '<leader>g', ":Neogit<CR>", { desc = "Neogit" })
|
vim.keymap.set('n', '<leader>g', ":Neogit<CR>", { desc = "Neogit" })
|
||||||
vim.keymap.set('n', '<leader>T', ":Neotree reveal<CR>", { desc = "File Manager" })
|
vim.keymap.set('n', '<leader>T', ":Neotree reveal<CR>", { desc = "File Manager" })
|
||||||
|
|
||||||
|
-- calendar
|
||||||
|
vim.keymap.set('n', '<leader>c', ":Calendar -split=horizontal -position=below -height=12<CR>", { desc = "Show calendar below" })
|
||||||
|
vim.keymap.set('n', '<leader>C', ":Calendar -view=year -split=vertical -width=27<CR>", { desc = "Show calendar right" })
|
||||||
|
|
||||||
|
-- Open current file in browser (chromium)
|
||||||
|
vim.keymap.set('n', '<space>o', ":silent !chromium '%'<cr>", { desc = "Open in browser" })
|
||||||
|
|
||||||
|
-- Open org file folder in neotree
|
||||||
|
vim.keymap.set('n', '<leader>of', ':silent :Neotree dir=/home/saschal/Documents/Eigene\\ (Briefe\\ etc.)/org<cr>', { desc = "Open org folder" })
|
||||||
|
|
||||||
|
-- toggle colorscheme between dark and light
|
||||||
|
vim.keymap.set('n', '<leader>m', function()
|
||||||
|
if vim.opt.background:get() == "dark" then
|
||||||
|
vim.o.background = "light"
|
||||||
|
else
|
||||||
|
vim.o.background = "dark"
|
||||||
|
end
|
||||||
|
end, { desc = "Toggle dark/light mode" })
|
||||||
|
|
||||||
--
|
--
|
||||||
-- configure workspaces
|
-- configure workspaces
|
||||||
-- also add a custom picker to fzf
|
-- also add a custom picker to fzf
|
||||||
--
|
--
|
||||||
local workspaces = require('workspaces')
|
local workspaces = require('workspaces')
|
||||||
workspaces_fzf_picker = function(opts)
|
local workspaces_fzf_picker = function(opts)
|
||||||
local fzf_lua = require('fzf-lua')
|
local fzf_lua = require('fzf-lua')
|
||||||
opts = opts or {}
|
opts = opts or {}
|
||||||
opts.prompt = "Workspaces> "
|
opts.prompt = "Workspaces> "
|
||||||
opts.actions = {
|
opts.actions = {
|
||||||
['default'] = function(selected)
|
['default'] = function(selected)
|
||||||
workspaces.open(selected[1])
|
workspaces.open(selected[1])
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
fzf_lua.fzf_exec(function(fzf_cb)
|
fzf_lua.fzf_exec(function(fzf_cb)
|
||||||
-- NOP
|
-- NOP
|
||||||
local ws = workspaces.get()
|
local ws = workspaces.get()
|
||||||
ws = ws or {}
|
ws = ws or {}
|
||||||
for i = 1, #ws do
|
for i = 1, #ws do
|
||||||
fzf_cb(ws[i].name)
|
fzf_cb(ws[i].name)
|
||||||
end
|
end
|
||||||
fzf_cb() -- EOF
|
fzf_cb() -- EOF
|
||||||
end, opts)
|
end, opts)
|
||||||
end
|
end
|
||||||
vim.keymap.set('n', '<leader>w', workspaces_fzf_picker, { desc = "Workspaces" } )
|
vim.keymap.set('n', '<leader>w', workspaces_fzf_picker, { desc = "Workspaces" })
|
||||||
|
|
||||||
|
------------------------------------------
|
||||||
|
--
|
||||||
|
-- Window layout save and restore
|
||||||
|
--
|
||||||
|
------------------------------------------
|
||||||
|
|
||||||
|
local layout = require('layout')
|
||||||
|
vim.keymap.set('n', '<leader>ss', function()
|
||||||
|
layout.save('default')
|
||||||
|
print("Window layout saved")
|
||||||
|
end, { desc = "Save window layout" })
|
||||||
|
vim.keymap.set('n', '<leader>sr', function()
|
||||||
|
layout.restore('default')
|
||||||
|
print("Window layout restored")
|
||||||
|
end, { desc = "Restore window layout" })
|
||||||
|
|
||||||
------------------------------------------
|
------------------------------------------
|
||||||
--
|
--
|
||||||
@@ -55,10 +91,30 @@ vim.keymap.set('n', '<space>mr', mywords.hl_toggle_regex, { desc = "Highlight re
|
|||||||
vim.keymap.set('n', '<space>mc', mywords.uhl_all, { desc = "Clear all highlights" })
|
vim.keymap.set('n', '<space>mc', mywords.uhl_all, { desc = "Clear all highlights" })
|
||||||
|
|
||||||
|
|
||||||
|
------------------------------------------
|
||||||
|
--
|
||||||
|
-- Moving lines up and down
|
||||||
|
--
|
||||||
|
------------------------------------------
|
||||||
|
|
||||||
|
vim.keymap.set('n', '<M-Up>', ":m -2<cr>", { desc = "Move current line up" })
|
||||||
|
vim.keymap.set('n', '<M-Down>', ":m +1<cr>", { desc = "Move current line down" })
|
||||||
|
|
||||||
|
vim.keymap.set('i', '<M-Up>', "<c-o>:m -2<cr>", { desc = "Move current line up" })
|
||||||
|
vim.keymap.set('i', '<M-Down>', "<c-o>:m +1<cr>", { desc = "Move current line down" })
|
||||||
|
|
||||||
------------------------------------------
|
------------------------------------------
|
||||||
--
|
--
|
||||||
-- Shortcuts which are known from Emacs
|
-- Shortcuts which are known from Emacs
|
||||||
--
|
--
|
||||||
------------------------------------------
|
------------------------------------------
|
||||||
vim.keymap.set('n', '<C-W>1', ":wincmd o<CR>", { desc = "Win: close others" })
|
vim.keymap.set('n', '<space>q', "gwap", { desc = "Wrap paragraph" })
|
||||||
vim.keymap.set('n', '<C-W>0', ":only<CR>", { desc = "Win: close current" })
|
vim.keymap.set('n', '<esc><esc>', ":silent! nohls<CR>", { desc = "Clear search" })
|
||||||
|
vim.keymap.set('i', '<c-Del>', '<c-o>dW', {desc = "Delete word right" })
|
||||||
|
|
||||||
|
-- horizontally scroll with mouse
|
||||||
|
vim.keymap.set('n', '<S-ScrollWheelUp>', 'zh')
|
||||||
|
vim.keymap.set('n', '<S-ScrollWheelDown>', 'zl')
|
||||||
|
|
||||||
|
vim.keymap.set('i', '<S-ScrollWheelUp>', '<c-o>zh')
|
||||||
|
vim.keymap.set('i', '<S-ScrollWheelDown>', '<c-o>zl')
|
||||||
|
|||||||
71
lua/layout.lua
Normal file
71
lua/layout.lua
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
-- save and restore current window layout
|
||||||
|
-- inspired by:
|
||||||
|
-- - https://github.com/dedowsdi/.vim/blob/master/autoload/ddd/layout.vim
|
||||||
|
-- - https://vi.stackexchange.com/a/22545/53081
|
||||||
|
--
|
||||||
|
-- added cursor position handling
|
||||||
|
|
||||||
|
local M = {}
|
||||||
|
local layouts = {}
|
||||||
|
local resize_cmds = {}
|
||||||
|
|
||||||
|
function M.save(name)
|
||||||
|
layouts[name] = vim.fn.winlayout()
|
||||||
|
resize_cmds[name] = vim.fn.winrestcmd()
|
||||||
|
M.add_buf_to_layout(layouts[name])
|
||||||
|
end
|
||||||
|
|
||||||
|
function M.add_buf_to_layout(layout)
|
||||||
|
if layout[1] == "leaf" then
|
||||||
|
local win_id = layout[2]
|
||||||
|
table.insert(layout, vim.fn.winbufnr(win_id))
|
||||||
|
table.insert(layout, vim.api.nvim_win_get_cursor(win_id))
|
||||||
|
else
|
||||||
|
for _, child_layout in ipairs(layout[2]) do
|
||||||
|
M.add_buf_to_layout(child_layout)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function M.restore(name)
|
||||||
|
if not layouts[name] then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Create clean window
|
||||||
|
vim.cmd("new")
|
||||||
|
vim.cmd("wincmd o")
|
||||||
|
|
||||||
|
-- Recursively restore buffers and cursor positions
|
||||||
|
M.apply_layout(layouts[name], name)
|
||||||
|
|
||||||
|
-- Resize
|
||||||
|
vim.cmd(resize_cmds[name])
|
||||||
|
end
|
||||||
|
|
||||||
|
function M.apply_layout(layout, name)
|
||||||
|
if layout[1] == "leaf" then
|
||||||
|
-- Load buffer for leaf
|
||||||
|
if vim.fn.bufexists(layout[3]) == 1 then
|
||||||
|
vim.cmd(string.format("b %d", layout[3]))
|
||||||
|
-- Restore cursor position
|
||||||
|
vim.api.nvim_win_set_cursor(vim.fn.win_getid(), layout[4])
|
||||||
|
end
|
||||||
|
else
|
||||||
|
-- Split cols or rows, split n-1 times
|
||||||
|
local split_method = layout[1] == "col" and "rightbelow split" or "rightbelow vsplit"
|
||||||
|
local wins = { vim.fn.win_getid() }
|
||||||
|
for i = 2, #layout[2] do
|
||||||
|
vim.cmd(split_method)
|
||||||
|
table.insert(wins, vim.fn.win_getid())
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Recursive into child windows
|
||||||
|
for index, win_id in ipairs(wins) do
|
||||||
|
vim.fn.win_gotoid(win_id)
|
||||||
|
M.apply_layout(layout[2][index], name)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
||||||
226
lua/lsp.lua
226
lua/lsp.lua
@@ -1,110 +1,126 @@
|
|||||||
require('mason').setup({
|
-- attach using autocommand and setup keybindings
|
||||||
ui = {
|
vim.api.nvim_create_autocmd('LspAttach', {
|
||||||
icons = {
|
group = vim.api.nvim_create_augroup('sl.lsp', {}),
|
||||||
package_installed = "✓",
|
callback = function(args)
|
||||||
package_pending = "➜",
|
-- See `:help vim.lsp.*` for documentation on any of the below functions
|
||||||
package_uninstalled = "✗"
|
local bufopts = { noremap = true, silent = true, buffer = args.buf }
|
||||||
}
|
vim.keymap.set('n', 'K', vim.lsp.buf.hover, { desc = "LSP show signature", unpack(bufopts) })
|
||||||
}
|
vim.keymap.set('n', '<space>wa', vim.lsp.buf.add_workspace_folder,
|
||||||
})
|
{ desc = "Workspace add folder", unpack(bufopts) })
|
||||||
|
vim.keymap.set('n', '<space>wr', vim.lsp.buf.remove_workspace_folder,
|
||||||
|
{ desc = "Workspace remove folder", unpack(bufopts) })
|
||||||
|
vim.keymap.set('n', '<space>wl', function()
|
||||||
|
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
||||||
|
end, { desc = "Workspace list folders", unpack(bufopts) })
|
||||||
|
vim.keymap.set('n', '<space>rn', vim.lsp.buf.rename, { desc = "LSP Rename", unpack(bufopts) })
|
||||||
|
vim.keymap.set("n", "<space>f", function()
|
||||||
|
vim.lsp.buf.format({ async = true })
|
||||||
|
end, { desc = "LSP Format buffer", unpack(bufopts) })
|
||||||
|
vim.keymap.set("n", '<space>F', ":silent !dx fmt --file %<cr>", { desc = "DX format rsx! regions", unpack(bufopts) })
|
||||||
|
vim.keymap.set("v", "<space>f", LSPRangeFormatFunction, { desc = "LSP Format region" })
|
||||||
|
|
||||||
require('mason-lspconfig').setup({
|
-- 2024-09-09 - some ccflow commands for diagnostics, symbols and code actions
|
||||||
-- A list of servers to automatically install if they're not already installed
|
local fzf = require('fzf-lua')
|
||||||
ensure_installed = {
|
vim.keymap.set('n', '<space>d', fzf.diagnostics_document, { desc = "Document diagnostics" })
|
||||||
'pylsp',
|
vim.keymap.set('n', '<space>D', fzf.diagnostics_workspace, { desc = "Workspace diagnostics" })
|
||||||
'lua_ls',
|
vim.keymap.set('n', '<space>e', function()
|
||||||
'rust_analyzer',
|
local new_config = not vim.diagnostic.config().virtual_lines
|
||||||
'yamlls',
|
vim.diagnostic.config({ virtual_lines = new_config })
|
||||||
'ts_ls',
|
end, { desc = "Virtual line diagnostics" })
|
||||||
'gopls',
|
vim.keymap.set('n', '<space>E', vim.diagnostic.open_float, { desc = "Popup diagnostics" })
|
||||||
'pylsp',
|
vim.keymap.set('n', '<space>s', fzf.lsp_document_symbols, { desc = "Doc symbols" })
|
||||||
'clangd',
|
vim.keymap.set('n', '<space>c', fzf.lsp_code_actions, { desc = "Code Actions" })
|
||||||
},
|
vim.keymap.set('n', '<space>[', vim.diagnostic.goto_prev, { desc = "Previous diagnostics" })
|
||||||
})
|
vim.keymap.set('n', '<space>]', vim.diagnostic.goto_next, { desc = "Previous diagnostics" })
|
||||||
|
|
||||||
-- Customized on_attach function
|
local gitsigns = require('gitsigns')
|
||||||
-- See `:help vim.diagnostic.*` for documentation on any of the below functions
|
vim.keymap.set('n', '<space>=l', ":NeogitLogCurrent<CR>", { desc = "Neogit: log for this file" })
|
||||||
local opts = { noremap = true, silent = true }
|
vim.keymap.set('n', '<space>==', gitsigns.preview_hunk_inline, { desc = "Git hunk preview" })
|
||||||
vim.keymap.set('n', '<space>e', vim.diagnostic.open_float, { noremap = true, silent = true, desc = "Popup diagnostics" })
|
vim.keymap.set('n', '<space>=B', gitsigns.blame, { desc = "Git blame file" })
|
||||||
-- 2024-09-23 - currently unused
|
vim.keymap.set('n', '<space>=D', function() gitsigns.diffthis('~') end, { desc = "Git diff this (~)" })
|
||||||
-- vim.keymap.set('n', '<space>q', vim.diagnostic.setloclist, opts)
|
vim.keymap.set('n', '<space>=R', gitsigns.reset_buffer, { desc = "Git reset file" })
|
||||||
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, opts)
|
vim.keymap.set('n', '<space>=S', gitsigns.stage_buffer, { desc = "Git stage file" })
|
||||||
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, opts)
|
vim.keymap.set('n', '<space>=[', gitsigns.prev_hunk, { desc = "Git previous hunk" })
|
||||||
|
vim.keymap.set('n', '<space>=]', gitsigns.next_hunk, { desc = "Git next hunk" })
|
||||||
|
vim.keymap.set('n', '<space>=b', gitsigns.blame_line, { desc = "Git blame line" })
|
||||||
|
vim.keymap.set('n', '<space>=d', gitsigns.diffthis, { desc = "Git diff this" })
|
||||||
|
vim.keymap.set('n', '<space>=r', gitsigns.reset_hunk, { desc = "Git reset hunk" })
|
||||||
|
vim.keymap.set('n', '<space>=s', gitsigns.stage_hunk, { desc = "Git stage hunk" })
|
||||||
|
vim.keymap.set('v', '<space>=s', function() gitsigns.stage_hunk({ vim.fn.line('.'), vim.fn.line('v') }) end,
|
||||||
|
{ desc = "Git stage hunk" })
|
||||||
|
|
||||||
-- Use an on_attach function to only map the following keys
|
-- vim.keymap.set('n', 'gr', vim.lsp.buf.references, bufopts)
|
||||||
-- after the language server attaches to the current buffer
|
vim.keymap.set('n', '<C-,>', fzf.lsp_references, { desc = "Find References" })
|
||||||
local on_attach = function(client, bufnr)
|
vim.keymap.set('n', '<C-.>', fzf.lsp_definitions, { desc = "Find References" })
|
||||||
-- Enable completion triggered by <c-x><c-o>
|
|
||||||
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
|
|
||||||
|
|
||||||
-- See `:help vim.lsp.*` for documentation on any of the below functions
|
|
||||||
local bufopts = { noremap = true, silent = true, buffer = bufnr }
|
|
||||||
vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, bufopts)
|
|
||||||
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, bufopts)
|
|
||||||
vim.keymap.set('n', 'K', vim.lsp.buf.hover, bufopts)
|
|
||||||
vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, bufopts)
|
|
||||||
vim.keymap.set('n', '<C-k>', vim.lsp.buf.signature_help, bufopts)
|
|
||||||
vim.keymap.set('n', '<space>wa', vim.lsp.buf.add_workspace_folder, bufopts)
|
|
||||||
vim.keymap.set('n', '<space>wr', vim.lsp.buf.remove_workspace_folder, bufopts)
|
|
||||||
vim.keymap.set('n', '<space>wl', function()
|
|
||||||
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
|
||||||
end, bufopts)
|
|
||||||
-- vim.keymap.set('n', '<space>D', vim.lsp.buf.type_definition, bufopts)
|
|
||||||
vim.keymap.set('n', '<space>rn', vim.lsp.buf.rename, bufopts)
|
|
||||||
-- vim.keymap.set('n', '<space>ca', vim.lsp.buf.code_action, bufopts)
|
|
||||||
vim.keymap.set("n", "<space>f", function()
|
|
||||||
vim.lsp.buf.format({ async = true })
|
|
||||||
end, bufopts)
|
|
||||||
|
|
||||||
-- 2024-09-09 - some ccflow commands
|
|
||||||
|
|
||||||
local fzf = require('fzf-lua')
|
|
||||||
vim.keymap.set('n', '<space>d', fzf.diagnostics_document, { desc = "Document diagnostics" })
|
|
||||||
vim.keymap.set('n', '<space>D', fzf.diagnostics_workspace, { desc = "Workspace diagnostics" })
|
|
||||||
vim.keymap.set('n', '<space>s', fzf.lsp_document_symbols, { desc = "Doc symbols" })
|
|
||||||
vim.keymap.set('n', '<space>c', fzf.lsp_code_actions, { desc = "Code Actions" })
|
|
||||||
-- vim.keymap.set('n', 'gr', vim.lsp.buf.references, bufopts)
|
|
||||||
vim.keymap.set('n', '<C-,>', fzf.lsp_references, { desc = "Find References" })
|
|
||||||
vim.keymap.set('n', '<C-.>', fzf.lsp_definitions, { desc = "Find References" })
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Set different settings for different languages' LSP
|
|
||||||
-- LSP list: https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md
|
|
||||||
-- How to use setup({}): https://github.com/neovim/nvim-lspconfig/wiki/Understanding-setup-%7B%7D
|
|
||||||
-- - the settings table is sent to the LSP
|
|
||||||
-- - on_attach: a lua callback function to run after LSP attaches to a given buffer
|
|
||||||
local lspconfig = require('lspconfig')
|
|
||||||
|
|
||||||
-- from :h mason-lspconfig-automatic-server-setup
|
|
||||||
require('mason-lspconfig').setup_handlers({
|
|
||||||
-- The first entry (without a key) will be the default handler
|
|
||||||
-- and will be called for each installed server that doesn't have
|
|
||||||
-- a dedicated handler.
|
|
||||||
function(server_name) -- default handler (optional)
|
|
||||||
if server_name == 'ts_ls' then
|
|
||||||
-- taken from https://github.com/vuejs/language-tools
|
|
||||||
-- If you are using mason.nvim, you can get the ts_plugin_path like this
|
|
||||||
local mason_registry = require('mason-registry')
|
|
||||||
local vue_language_server_path = mason_registry.get_package('vue-language-server'):get_install_path() ..
|
|
||||||
'/node_modules/@vue/language-server'
|
|
||||||
|
|
||||||
lspconfig[server_name].setup {
|
|
||||||
on_attach = on_attach,
|
|
||||||
init_options = {
|
|
||||||
plugins = {
|
|
||||||
{
|
|
||||||
name = '@vue/typescript-plugin',
|
|
||||||
location = vue_language_server_path,
|
|
||||||
languages = { 'vue' },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
filetypes = { 'typescript', 'javascript', 'javascriptreact', 'typescriptreact', 'vue' },
|
|
||||||
}
|
|
||||||
else
|
|
||||||
lspconfig[server_name].setup {
|
|
||||||
on_attach = on_attach
|
|
||||||
}
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
|
-- lsp format selected range
|
||||||
|
function LSPRangeFormatFunction()
|
||||||
|
vim.lsp.buf.format({
|
||||||
|
async = true,
|
||||||
|
range = {
|
||||||
|
["start"] = vim.api.nvim_buf_get_mark(0, "<"),
|
||||||
|
["end"] = vim.api.nvim_buf_get_mark(0, ">"),
|
||||||
|
}
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
-- VUE and Typescript as of vue-language-server 3.0.x
|
||||||
|
-- taken from:
|
||||||
|
-- https://github.com/neovim/nvim-lspconfig/blob/master/doc/configs.md#vtsls
|
||||||
|
local vue_language_server_path = '/home/saschal/.config/yarn/global/node_modules'
|
||||||
|
local vue_plugin = {
|
||||||
|
name = '@vue/typescript-plugin',
|
||||||
|
location = vue_language_server_path,
|
||||||
|
languages = { 'vue' },
|
||||||
|
configNamespace = 'typescript',
|
||||||
|
}
|
||||||
|
local vtsls_config = {
|
||||||
|
settings = {
|
||||||
|
vtsls = {
|
||||||
|
tsserver = {
|
||||||
|
globalPlugins = {
|
||||||
|
vue_plugin,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
filetypes = { 'typescript', 'javascript', 'javascriptreact', 'typescriptreact', 'vue' },
|
||||||
|
}
|
||||||
|
vim.lsp.config('vtsls', vtsls_config)
|
||||||
|
|
||||||
|
-- enable this list of lsps
|
||||||
|
local enable_this_lsp = {
|
||||||
|
'vue_ls',
|
||||||
|
'vtsls',
|
||||||
|
'gopls',
|
||||||
|
'bashls',
|
||||||
|
'html',
|
||||||
|
'lua_ls',
|
||||||
|
'jsonls', -- arch extra: vscode-json-languageserver
|
||||||
|
'kotlin_lsp', -- arch aur: kotlin-lsp-bin
|
||||||
|
'lemminx', -- arch aur: lemminx
|
||||||
|
'clangd',
|
||||||
|
}
|
||||||
|
|
||||||
|
for l in pairs(enable_this_lsp) do
|
||||||
|
vim.lsp.enable(enable_this_lsp[l])
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
-- add autoformat to Dioxus projects
|
||||||
|
vim.api.nvim_create_autocmd("BufWritePost", {
|
||||||
|
pattern = "*.rs",
|
||||||
|
callback = function()
|
||||||
|
local cwd = vim.lsp.buf.list_workspace_folders()
|
||||||
|
if not (cwd == nil) then
|
||||||
|
if vim.fn.filereadable(cwd[1] .. "/Dioxus.toml") == 1 then
|
||||||
|
local command = "dx fmt --file %"
|
||||||
|
vim.cmd("silent ! " .. command)
|
||||||
|
-- vim.notify(command)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|||||||
@@ -14,16 +14,20 @@ vim.opt.mouse = 'a' -- allow the mouse to be used in Nvim
|
|||||||
vim.opt.tabstop = 2 -- number of visual spaces per TAB
|
vim.opt.tabstop = 2 -- number of visual spaces per TAB
|
||||||
vim.opt.softtabstop = 2 -- number of spaces in tab when editing
|
vim.opt.softtabstop = 2 -- number of spaces in tab when editing
|
||||||
vim.opt.shiftwidth = 2 -- insert 4 spaces on a tab
|
vim.opt.shiftwidth = 2 -- insert 4 spaces on a tab
|
||||||
vim.opt.expandtab = true -- tabs are spaces, mainly because of python
|
vim.opt.expandtab = true -- tabs are spaces, mainly because of python and because it is consistent
|
||||||
|
|
||||||
-- UI config
|
-- UI config
|
||||||
vim.opt.number = true -- show absolute number
|
vim.opt.number = true -- show absolute number
|
||||||
vim.opt.relativenumber = false -- add numbers to each line on the left side
|
vim.opt.relativenumber = false -- add numbers to each line on the left side
|
||||||
vim.opt.cursorline = true -- highlight cursor line underneath the cursor horizontally
|
vim.opt.cursorline = true -- highlight cursor line underneath the cursor horizontally
|
||||||
|
vim.opt.guicursor = "" .. -- cursor highlight group needs to be Cursor to have lunaperche have a proper light cursor
|
||||||
|
"n-v-c-sm:block-Cursor,i-ci-ve:ver25-Cursor,r-cr-o:hor20,t:block-blinkon500-blinkoff500-Cursor"
|
||||||
vim.opt.splitbelow = true -- open new vertical split bottom
|
vim.opt.splitbelow = true -- open new vertical split bottom
|
||||||
vim.opt.splitright = true -- open new horizontal splits right
|
vim.opt.splitright = true -- open new horizontal splits right
|
||||||
vim.opt.termguicolors = true -- enable 24-bit RGB color in the TUI
|
vim.opt.termguicolors = true -- enable 24-bit RGB color in the TUI
|
||||||
vim.opt.showmode = false -- we are experienced, wo don't need the "-- INSERT --" mode hint
|
vim.opt.showmode = false -- we are experienced, wo don't need the "-- INSERT --" mode hint
|
||||||
|
vim.opt.showtabline = 0 -- never show top line with tabs, not used anyways
|
||||||
|
vim.opt.winborder = 'rounded' -- UI borders are rounded
|
||||||
|
|
||||||
-- Searching
|
-- Searching
|
||||||
vim.opt.incsearch = true -- search as characters are entered
|
vim.opt.incsearch = true -- search as characters are entered
|
||||||
@@ -46,6 +50,17 @@ vim.opt.wrap = false
|
|||||||
vim.opt.spell = true
|
vim.opt.spell = true
|
||||||
vim.opt.spelllang = "de,en"
|
vim.opt.spelllang = "de,en"
|
||||||
|
|
||||||
|
--------------------------------------------------
|
||||||
|
--
|
||||||
|
-- calendar.vim options
|
||||||
|
--
|
||||||
|
--------------------------------------------------
|
||||||
|
-- :Calendar -split=horizontal -position=below -height=12
|
||||||
|
|
||||||
|
vim.g.calendar_first_day = "monday"
|
||||||
|
vim.g.calendar_view = "year"
|
||||||
|
vim.g.calendar_week_number = true
|
||||||
|
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
--
|
--
|
||||||
-- Other options
|
-- Other options
|
||||||
|
|||||||
424
lua/plugins.lua
424
lua/plugins.lua
@@ -12,51 +12,153 @@ end
|
|||||||
vim.opt.rtp:prepend(lazypath)
|
vim.opt.rtp:prepend(lazypath)
|
||||||
|
|
||||||
require("lazy").setup({
|
require("lazy").setup({
|
||||||
-- Vscode-like pictograms
|
|
||||||
{
|
|
||||||
"onsails/lspkind.nvim",
|
|
||||||
event = { "VimEnter" },
|
|
||||||
},
|
|
||||||
|
|
||||||
-- Auto-completion engine
|
-- Auto-completion engine
|
||||||
{
|
{
|
||||||
"hrsh7th/nvim-cmp",
|
'saghen/blink.cmp',
|
||||||
dependencies = {
|
-- optional: provides snippets for the snippet source
|
||||||
"lspkind.nvim",
|
dependencies = { 'rafamadriz/friendly-snippets',
|
||||||
"hrsh7th/cmp-nvim-lsp", -- lsp auto-completion
|
{
|
||||||
"hrsh7th/cmp-buffer", -- buffer auto-completion
|
"L3MON4D3/LuaSnip",
|
||||||
"hrsh7th/cmp-path", -- path auto-completion
|
version = "v2.*"
|
||||||
"hrsh7th/cmp-cmdline", -- cmdline auto-completion
|
}
|
||||||
"saadparwaiz1/cmp_luasnip", -- luasnip auto-completion
|
|
||||||
},
|
},
|
||||||
config = function()
|
|
||||||
require("config.nvim-cmp")
|
-- use a release tag to download pre-built binaries
|
||||||
end,
|
version = '1.*',
|
||||||
|
-- AND/OR build from source, requires nightly: https://rust-lang.github.io/rustup/concepts/channels.html#working-with-nightly-rust
|
||||||
|
-- build = 'cargo build --release',
|
||||||
|
-- If you use nix, you can build from source using latest nightly rust with:
|
||||||
|
-- build = 'nix run .#build-plugin',
|
||||||
|
|
||||||
|
---@module 'blink.cmp'
|
||||||
|
---@type blink.cmp.Config
|
||||||
|
opts = {
|
||||||
|
-- 'default' (recommended) for mappings similar to built-in completions (C-y to accept)
|
||||||
|
-- 'super-tab' for mappings similar to vscode (tab to accept)
|
||||||
|
-- 'enter' for enter to accept
|
||||||
|
-- 'none' for no mappings
|
||||||
|
--
|
||||||
|
-- All presets have the following mappings:
|
||||||
|
-- C-space: Open menu or open docs if already open
|
||||||
|
-- C-n/C-p or Up/Down: Select next/previous item
|
||||||
|
-- C-e: Hide menu
|
||||||
|
-- C-k: Toggle signature help (if signature.enabled = true)
|
||||||
|
--
|
||||||
|
-- See :h blink-cmp-config-keymap for defining your own keymap
|
||||||
|
keymap = {
|
||||||
|
-- preset = 'enter',
|
||||||
|
preset = 'default',
|
||||||
|
-- ['<Up>'] = { 'select_prev', 'fallback' },
|
||||||
|
-- ['<Down>'] = { 'select_next', 'fallback' },
|
||||||
|
-- ['<S-Tab>'] = { 'select_prev', 'fallback' },
|
||||||
|
-- ['<Tab>'] = { 'select_next', 'fallback' },
|
||||||
|
['<CR>'] = { 'select_and_accept', 'fallback' },
|
||||||
|
['<C-space>'] = { 'show_and_insert', 'fallback' },
|
||||||
|
-- ['<C-space>'] = { 'show', 'fallback' },
|
||||||
|
-- ['<C-n>'] = { 'accept', 'fallback' },
|
||||||
|
},
|
||||||
|
signature = { enabled = true },
|
||||||
|
|
||||||
|
appearance = {
|
||||||
|
-- 'mono' (default) for 'Nerd Font Mono' or 'normal' for 'Nerd Font'
|
||||||
|
-- Adjusts spacing to ensure icons are aligned
|
||||||
|
nerd_font_variant = 'mono'
|
||||||
|
},
|
||||||
|
|
||||||
|
-- (Default) Only show the documentation popup when manually triggered
|
||||||
|
completion = {
|
||||||
|
documentation = { auto_show = true },
|
||||||
|
menu = {
|
||||||
|
-- show more things in the menu
|
||||||
|
draw = {
|
||||||
|
columns = {
|
||||||
|
{ "label", "label_description", gap = 1 },
|
||||||
|
{ "kind_icon", "kind", gap = 1 },
|
||||||
|
{ "source_name" },
|
||||||
|
},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
-- Default list of enabled providers defined so that you can extend it
|
||||||
|
-- elsewhere in your config, without redefining it, due to `opts_extend`
|
||||||
|
sources = {
|
||||||
|
default = { 'lsp', 'path', 'snippets', 'buffer', 'orgmode' },
|
||||||
|
-- per_filetype = {
|
||||||
|
-- org = { 'orgmode' }
|
||||||
|
-- },
|
||||||
|
|
||||||
|
providers = {
|
||||||
|
orgmode = {
|
||||||
|
name = 'Orgmode',
|
||||||
|
module = 'orgmode.org.autocompletion.blink',
|
||||||
|
fallbacks = { 'lsp', 'path', 'snippets', 'buffer' },
|
||||||
|
-- fallbacks = { 'buffer' },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
snippets = { preset = 'luasnip' },
|
||||||
|
|
||||||
|
|
||||||
|
-- (Default) Rust fuzzy matcher for typo resistance and significantly better performance
|
||||||
|
-- You may use a lua implementation instead by using `implementation = "lua"` or fallback to the lua implementation,
|
||||||
|
-- when the Rust fuzzy matcher is not available, by using `implementation = "prefer_rust"`
|
||||||
|
--
|
||||||
|
-- See the fuzzy documentation for more information
|
||||||
|
fuzzy = { implementation = "prefer_rust_with_warning" }
|
||||||
|
},
|
||||||
|
opts_extend = { "sources.default" }
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
-- Code snippet engine
|
-- Code snippet engine
|
||||||
{
|
{
|
||||||
"L3MON4D3/LuaSnip",
|
"L3MON4D3/LuaSnip",
|
||||||
version = "v2.*",
|
version = "v2.*",
|
||||||
config = function()
|
config = function()
|
||||||
require("luasnip.loaders.from_snipmate").lazy_load()
|
require("luasnip.loaders.from_snipmate").lazy_load()
|
||||||
|
require("luasnip.loaders.from_lua").lazy_load()
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
--
|
--
|
||||||
-- LSP manager and others
|
-- LSP manager and others
|
||||||
--
|
--
|
||||||
"williamboman/mason.nvim",
|
-- "williamboman/mason.nvim",
|
||||||
"williamboman/mason-lspconfig.nvim",
|
-- "williamboman/mason-lspconfig.nvim",
|
||||||
"neovim/nvim-lspconfig",
|
"neovim/nvim-lspconfig",
|
||||||
|
|
||||||
|
-- Nice plugin to show what LSPs are doing in the background (and others
|
||||||
|
-- using $/progress and vim.notify())
|
||||||
|
{
|
||||||
|
"j-hui/fidget.nvim",
|
||||||
|
opts = {
|
||||||
|
-- options
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
-- show lsp signature while coding
|
-- show lsp signature while coding
|
||||||
{
|
{
|
||||||
"ray-x/lsp_signature.nvim",
|
"ray-x/lsp_signature.nvim",
|
||||||
event = "VeryLazy",
|
event = "VeryLazy",
|
||||||
opts = {},
|
opts = {
|
||||||
config = function(_, opts) require 'lsp_signature'.setup(opts) end
|
bind = true,
|
||||||
|
floating_window = false,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
-- fzf-lua
|
||||||
|
{
|
||||||
|
"ibhagwan/fzf-lua",
|
||||||
|
-- optional for icon support
|
||||||
|
dependencies = { "nvim-tree/nvim-web-devicons" },
|
||||||
|
config = function()
|
||||||
|
require('fzf-lua').register_ui_select()
|
||||||
|
end
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
-- neogit setup
|
-- neogit setup
|
||||||
{
|
{
|
||||||
"NeogitOrg/neogit",
|
"NeogitOrg/neogit",
|
||||||
@@ -68,7 +170,11 @@ require("lazy").setup({
|
|||||||
-- "nvim-telescope/telescope.nvim", -- optional
|
-- "nvim-telescope/telescope.nvim", -- optional
|
||||||
"ibhagwan/fzf-lua", -- optional
|
"ibhagwan/fzf-lua", -- optional
|
||||||
},
|
},
|
||||||
config = true
|
config = function()
|
||||||
|
require('neogit').setup({
|
||||||
|
sort_branches = "refname"
|
||||||
|
})
|
||||||
|
end
|
||||||
},
|
},
|
||||||
|
|
||||||
-- org-mode
|
-- org-mode
|
||||||
@@ -79,8 +185,40 @@ require("lazy").setup({
|
|||||||
config = function()
|
config = function()
|
||||||
-- Setup orgmode
|
-- Setup orgmode
|
||||||
require('orgmode').setup({
|
require('orgmode').setup({
|
||||||
org_agenda_files = '~/orgfiles/**/*',
|
-- cf: https://github.com/nvim-orgmode/orgmode/blob/master/docs/configuration.org#mappings
|
||||||
org_default_notes_file = '~/orgfiles/refile.org',
|
mappings = {
|
||||||
|
org = {
|
||||||
|
org_move_subtree_up = { '<Leader>oK', '<C-M-Up>' },
|
||||||
|
org_move_subtree_down = { '<Leader>oJ', '<C-M-Down>' },
|
||||||
|
org_promote_subtree = { '<s', '<C-M-Left>' },
|
||||||
|
org_demote_subtree = { '>s', '<C-M-Right>' },
|
||||||
|
}
|
||||||
|
},
|
||||||
|
-- org_agenda_files = '~/orgfiles/**/*',
|
||||||
|
-- org_default_notes_file = '~/orgfiles/refile.org',
|
||||||
|
org_agenda_files = '~/Documents/Eigene (Briefe etc.)/org/*.org',
|
||||||
|
org_default_notes_file = '~/Documents/Eigene (Briefe etc.)/org/refile.org',
|
||||||
|
org_todo_keywords = { 'TODO(t)', 'STARTED(s)', 'PLANNED(p)', '|', 'DONE(d)', 'UNPLANNED(u)' },
|
||||||
|
org_custom_exports = {
|
||||||
|
f = {
|
||||||
|
label = 'Export to HTML format',
|
||||||
|
action = function(exporter)
|
||||||
|
local current_file = vim.api.nvim_buf_get_name(0)
|
||||||
|
local target = vim.fn.fnamemodify(current_file, ':p:r') .. '.html'
|
||||||
|
local command = { 'pandoc', '--filter', 'pandoc-plot', current_file, '--standalone', '--toc',
|
||||||
|
'--number-sections', '--output', target }
|
||||||
|
local on_success = function(output)
|
||||||
|
print('Success!')
|
||||||
|
vim.api.nvim_echo({ { table.concat(output, '\n') } }, true, {})
|
||||||
|
end
|
||||||
|
local on_error = function(err)
|
||||||
|
print('Error!')
|
||||||
|
vim.api.nvim_echo({ { table.concat(err, '\n'), 'ErrorMsg' } }, true, {})
|
||||||
|
end
|
||||||
|
return exporter(command, target, on_success, on_error)
|
||||||
|
end
|
||||||
|
}
|
||||||
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
-- NOTE: If you are using nvim-treesitter with ~ensure_installed = "all"~ option
|
-- NOTE: If you are using nvim-treesitter with ~ensure_installed = "all"~ option
|
||||||
@@ -92,20 +230,29 @@ require("lazy").setup({
|
|||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
-- fzf-lua
|
-- org-roam - lets try it out (2025-05-20)
|
||||||
{
|
{
|
||||||
"ibhagwan/fzf-lua",
|
"chipsenkbeil/org-roam.nvim",
|
||||||
-- optional for icon support
|
|
||||||
dependencies = { "nvim-tree/nvim-web-devicons" },
|
|
||||||
config = function()
|
config = function()
|
||||||
-- calling `setup` is optional for customization
|
require("org-roam").setup({
|
||||||
local fzf = require("fzf-lua")
|
directory = "~/Documents/Eigene (Briefe etc.)/org/roam",
|
||||||
fzf.setup({ "default-title" })
|
-- optional
|
||||||
fzf.register_ui_select()
|
-- org_files = {
|
||||||
|
-- "~/another_org_dir",
|
||||||
|
-- "~/some/folder/*.org",
|
||||||
|
-- "~/a/single/org_file.org",
|
||||||
|
-- }
|
||||||
|
bindings = {
|
||||||
|
prefix = "<LocalLeader>r"
|
||||||
|
}
|
||||||
|
})
|
||||||
end
|
end
|
||||||
},
|
},
|
||||||
|
|
||||||
-- whichkey
|
-- comfortable table editing, esp. used in orgmode
|
||||||
|
{ 'dhruvasagar/vim-table-mode' },
|
||||||
|
|
||||||
|
-- which-key
|
||||||
{
|
{
|
||||||
"folke/which-key.nvim",
|
"folke/which-key.nvim",
|
||||||
event = "VeryLazy",
|
event = "VeryLazy",
|
||||||
@@ -113,8 +260,11 @@ require("lazy").setup({
|
|||||||
-- your configuration comes here
|
-- your configuration comes here
|
||||||
-- or leave it empty to use the default settings
|
-- or leave it empty to use the default settings
|
||||||
-- refer to the configuration section below
|
-- refer to the configuration section below
|
||||||
preset = 'helix',
|
-- preset = 'helix',
|
||||||
expand = 4,
|
-- preset = 'classic',
|
||||||
|
-- preset = 'modern',
|
||||||
|
preset = false,
|
||||||
|
expand = 3,
|
||||||
keys = {
|
keys = {
|
||||||
scroll_down = "<c-d>", -- binding to scroll down inside the popup
|
scroll_down = "<c-d>", -- binding to scroll down inside the popup
|
||||||
scroll_up = "<c-u>", -- binding to scroll up inside the popup
|
scroll_up = "<c-u>", -- binding to scroll up inside the popup
|
||||||
@@ -125,6 +275,23 @@ require("lazy").setup({
|
|||||||
g = true,
|
g = true,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
win = {
|
||||||
|
-- no_overlap = false,
|
||||||
|
height = { min = 4 },
|
||||||
|
-- height = { min = 4, max = math.huge },
|
||||||
|
width = { min = 25, max = 120 },
|
||||||
|
-- title = true,
|
||||||
|
-- title_pos = "center",
|
||||||
|
-- border = "rounded",
|
||||||
|
col = -1,
|
||||||
|
row = -1,
|
||||||
|
padding = { 1, 3 },
|
||||||
|
},
|
||||||
|
layout = {
|
||||||
|
spacing = 2,
|
||||||
|
-- width = { min = math.huge },
|
||||||
|
width = { min = 20 },
|
||||||
|
},
|
||||||
},
|
},
|
||||||
keys = {
|
keys = {
|
||||||
{
|
{
|
||||||
@@ -159,46 +326,7 @@ require("lazy").setup({
|
|||||||
'nvim-lualine/lualine.nvim',
|
'nvim-lualine/lualine.nvim',
|
||||||
dependencies = { 'nvim-tree/nvim-web-devicons' },
|
dependencies = { 'nvim-tree/nvim-web-devicons' },
|
||||||
config = function()
|
config = function()
|
||||||
require("lualine").setup {
|
require('config.lualine')
|
||||||
options = {
|
|
||||||
icons_enabled = false,
|
|
||||||
theme = 'papercolor_light',
|
|
||||||
component_separators = {},
|
|
||||||
section_separators = {},
|
|
||||||
disabled_filetypes = {
|
|
||||||
statusline = {},
|
|
||||||
winbar = {},
|
|
||||||
},
|
|
||||||
ignore_focus = {},
|
|
||||||
always_divide_middle = true,
|
|
||||||
globalstatus = false,
|
|
||||||
refresh = {
|
|
||||||
statusline = 1000,
|
|
||||||
tabline = 1000,
|
|
||||||
winbar = 1000,
|
|
||||||
}
|
|
||||||
},
|
|
||||||
sections = {
|
|
||||||
lualine_a = { 'filename' },
|
|
||||||
lualine_b = { 'branch', 'diff', 'diagnostics' },
|
|
||||||
lualine_c = {},
|
|
||||||
lualine_x = { 'encoding', 'fileformat', 'filetype' },
|
|
||||||
lualine_y = { 'filesize' },
|
|
||||||
lualine_z = { 'progress', 'location' }
|
|
||||||
},
|
|
||||||
inactive_sections = {
|
|
||||||
lualine_a = {},
|
|
||||||
lualine_b = {},
|
|
||||||
lualine_c = { 'filename' },
|
|
||||||
lualine_x = { 'location' },
|
|
||||||
lualine_y = {},
|
|
||||||
lualine_z = {}
|
|
||||||
},
|
|
||||||
tabline = {},
|
|
||||||
winbar = {},
|
|
||||||
inactive_winbar = {},
|
|
||||||
extensions = {}
|
|
||||||
}
|
|
||||||
end
|
end
|
||||||
|
|
||||||
},
|
},
|
||||||
@@ -212,7 +340,30 @@ require("lazy").setup({
|
|||||||
"nvim-tree/nvim-web-devicons", -- not strictly required, but recommended
|
"nvim-tree/nvim-web-devicons", -- not strictly required, but recommended
|
||||||
"MunifTanjim/nui.nvim",
|
"MunifTanjim/nui.nvim",
|
||||||
-- "3rd/image.nvim", -- Optional image support in preview window: See `# Preview Mode` for more information
|
-- "3rd/image.nvim", -- Optional image support in preview window: See `# Preview Mode` for more information
|
||||||
}
|
},
|
||||||
|
config = function()
|
||||||
|
require("neo-tree").setup({
|
||||||
|
window = {
|
||||||
|
position = "left",
|
||||||
|
mappings = {
|
||||||
|
["<tab>"] = {
|
||||||
|
"toggle_node",
|
||||||
|
nowait = false, -- disable `nowait` if you have existing combos starting with this char that you want to use
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
end
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"antosha417/nvim-lsp-file-operations",
|
||||||
|
dependencies = {
|
||||||
|
"nvim-lua/plenary.nvim",
|
||||||
|
"nvim-neo-tree/neo-tree.nvim",
|
||||||
|
},
|
||||||
|
config = function()
|
||||||
|
require("lsp-file-operations").setup()
|
||||||
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
-- workspaces, lightweight "projects"
|
-- workspaces, lightweight "projects"
|
||||||
@@ -227,7 +378,7 @@ require("lazy").setup({
|
|||||||
mru_sort = false,
|
mru_sort = false,
|
||||||
|
|
||||||
-- option to automatically activate workspace when opening neovim in a workspace directory
|
-- option to automatically activate workspace when opening neovim in a workspace directory
|
||||||
auto_open = true,
|
auto_open = false,
|
||||||
|
|
||||||
-- option to automatically activate workspace when changing directory not via this plugin
|
-- option to automatically activate workspace when changing directory not via this plugin
|
||||||
auto_dir = true,
|
auto_dir = true,
|
||||||
@@ -239,25 +390,27 @@ require("lazy").setup({
|
|||||||
end
|
end
|
||||||
},
|
},
|
||||||
|
|
||||||
-- rpn calculator
|
-- calculate using qalc cli, call :QalcAttach or :Qalc
|
||||||
-- also added as source to cmp
|
|
||||||
{
|
{
|
||||||
"PhilRunninger/cmp-rpncalc",
|
"Apeiros-46B/qalc.nvim",
|
||||||
|
config = function()
|
||||||
|
require('qalc').setup({
|
||||||
|
bufname = "Qalculate",
|
||||||
|
})
|
||||||
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
-- comfortable table editing, esp. used in orgmode
|
|
||||||
{ 'dhruvasagar/vim-table-mode' },
|
|
||||||
|
|
||||||
-- TODO, WARN, HACK, PERF, NOTE, TEST and others highlighting and searching
|
-- TODO, WARN, HACK, PERF, NOTE, TEST and others highlighting and searching
|
||||||
{
|
-- {
|
||||||
"folke/todo-comments.nvim",
|
-- "folke/todo-comments.nvim",
|
||||||
dependencies = { "nvim-lua/plenary.nvim" },
|
-- dependencies = { "nvim-lua/plenary.nvim" },
|
||||||
opts = {
|
-- opts = {
|
||||||
-- your configuration comes here
|
-- -- your configuration comes here
|
||||||
-- or leave it empty to use the default settings
|
-- -- or leave it empty to use the default settings
|
||||||
-- refer to the configuration section below
|
-- -- refer to the configuration section below
|
||||||
}
|
-- }
|
||||||
},
|
-- },
|
||||||
|
|
||||||
-- highlight word under cursor
|
-- highlight word under cursor
|
||||||
{
|
{
|
||||||
@@ -269,14 +422,87 @@ require("lazy").setup({
|
|||||||
"itchyny/calendar.vim"
|
"itchyny/calendar.vim"
|
||||||
},
|
},
|
||||||
|
|
||||||
--------------------------------------------------
|
-- Greeter to run on NeoVim startup
|
||||||
--
|
|
||||||
-- Color schemes
|
|
||||||
--
|
|
||||||
--------------------------------------------------
|
|
||||||
{
|
{
|
||||||
"rktjmp/lush.nvim"
|
'goolord/alpha-nvim',
|
||||||
-- if you wish to use your own colorscheme:
|
dependencies = {
|
||||||
-- { dir = '/absolute/path/to/colorscheme', lazy = true },
|
'nvim-tree/nvim-web-devicons',
|
||||||
|
},
|
||||||
|
config = function()
|
||||||
|
require('config.alpha-nvim')
|
||||||
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
-- improved Rust support
|
||||||
|
{
|
||||||
|
'mrcjkb/rustaceanvim',
|
||||||
|
version = '^6', -- Recommended
|
||||||
|
lazy = false, -- This plugin is already lazy
|
||||||
|
},
|
||||||
|
|
||||||
|
-- show git changes on the left
|
||||||
|
{
|
||||||
|
"lewis6991/gitsigns.nvim",
|
||||||
|
config = function()
|
||||||
|
require('gitsigns').setup()
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
-- easy term on a shortcut
|
||||||
|
{
|
||||||
|
"akinsho/toggleterm.nvim",
|
||||||
|
config = true,
|
||||||
|
keys = {
|
||||||
|
{
|
||||||
|
"<C-`>",
|
||||||
|
":ToggleTerm<CR>",
|
||||||
|
desc = "Toggle terminal",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"<C-`>",
|
||||||
|
"<C-\\><C-n>:ToggleTerm<CR>",
|
||||||
|
mode = 't',
|
||||||
|
desc = "Toggle terminal",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
-- show indent markers
|
||||||
|
{
|
||||||
|
"lukas-reineke/indent-blankline.nvim",
|
||||||
|
main = "ibl",
|
||||||
|
---@module "ibl"
|
||||||
|
---@type ibl.config
|
||||||
|
opts = {},
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
-- improved (wrapping!) diagnostics
|
||||||
|
{
|
||||||
|
"rachartier/tiny-inline-diagnostic.nvim",
|
||||||
|
event = "VeryLazy", -- one of LspAttach, VeryLazy
|
||||||
|
priority = 1000, -- needs to be loaded in first
|
||||||
|
config = function()
|
||||||
|
require('tiny-inline-diagnostic').setup({
|
||||||
|
options = {
|
||||||
|
use_icons_from_diagnostic = true,
|
||||||
|
enable_on_insert = true,
|
||||||
|
show_all_diags_on_cursorline = true,
|
||||||
|
}
|
||||||
|
})
|
||||||
|
vim.diagnostic.config({ virtual_text = false }) -- Only if needed in your configuration, if you already have native LSP diagnostics
|
||||||
|
end
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
-- 2025-05-21 not yet clear if this is a good thing or not
|
||||||
|
{
|
||||||
|
'xemptuous/sqlua.nvim',
|
||||||
|
lazy = true,
|
||||||
|
cmd = 'SQLua',
|
||||||
|
config = function() require('sqlua').setup() end
|
||||||
|
},
|
||||||
|
|
||||||
|
-- new plugins BEFORE here
|
||||||
})
|
})
|
||||||
|
|||||||
67
luasnippets/asciidoc.lua
Normal file
67
luasnippets/asciidoc.lua
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
-- these are already defined elsewhere, but LSP does not recognize that
|
||||||
|
-- doc says luasnip.config.snip_env
|
||||||
|
local ls = require("luasnip")
|
||||||
|
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 events = require("luasnip.util.events")
|
||||||
|
local ai = require("luasnip.nodes.absolute_indexer")
|
||||||
|
local extras = require("luasnip.extras")
|
||||||
|
local l = extras.lambda
|
||||||
|
local rep = extras.rep
|
||||||
|
local p = extras.partial
|
||||||
|
local m = extras.match
|
||||||
|
local n = extras.nonempty
|
||||||
|
local dl = extras.dynamic_lambda
|
||||||
|
local fmt = require("luasnip.extras.fmt").fmt
|
||||||
|
local fmta = require("luasnip.extras.fmt").fmta
|
||||||
|
local conds = require("luasnip.extras.expand_conditions")
|
||||||
|
local postfix = require("luasnip.extras.postfix").postfix
|
||||||
|
local types = require("luasnip.util.types")
|
||||||
|
local parse = require("luasnip.util.parser").parse_snippet
|
||||||
|
local ms = ls.multi_snippet
|
||||||
|
local k = require("luasnip.nodes.key_indexer").new_key
|
||||||
|
|
||||||
|
-- ensure current locale is used to format dates
|
||||||
|
local curlang = os.getenv("LANG")
|
||||||
|
os.setlocale(curlang)
|
||||||
|
|
||||||
|
return {
|
||||||
|
|
||||||
|
-- = Oktober 2024
|
||||||
|
-- :toc:
|
||||||
|
-- :numbered!:
|
||||||
|
--
|
||||||
|
-- <cursor>
|
||||||
|
s("diahead",
|
||||||
|
{
|
||||||
|
t "= ",
|
||||||
|
f(function() return os.date("%0B %Y") end),
|
||||||
|
t({ "", "", }),
|
||||||
|
t({ ":toc:", "" }),
|
||||||
|
t({ ":numbered!:", "" }),
|
||||||
|
t({ "", "", }),
|
||||||
|
}
|
||||||
|
),
|
||||||
|
|
||||||
|
-- == 7. Oktober, 11:14, Montag
|
||||||
|
--
|
||||||
|
-- <cursor>
|
||||||
|
s("diaentry",
|
||||||
|
{
|
||||||
|
t "== ",
|
||||||
|
f(function() return os.date("%e. %0B, %H:%M, %A") end),
|
||||||
|
t({ "", "", }),
|
||||||
|
t({ "", "", }),
|
||||||
|
}
|
||||||
|
),
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
--
|
||||||
@@ -1,13 +1,16 @@
|
|||||||
# ccflow local snippets for all modes
|
# ccflow local snippets for all modes
|
||||||
|
|
||||||
snippet todo "Add a TODO marker"
|
snippet todo "Add a TODO marker"
|
||||||
// TODO.`strftime("%Y-%m-%d")`
|
// TODO.`strftime("%Y-%m-%d -")`
|
||||||
|
|
||||||
snippet note "Add a NOTE marker"
|
snippet note "Add a NOTE marker"
|
||||||
// NOTE.`strftime("%Y-%m-%d")`
|
// NOTE.`strftime("%Y-%m-%d -")`
|
||||||
|
|
||||||
snippet date "Insert current date"
|
snippet date "Insert current date"
|
||||||
`strftime("%Y-%m-%d")`
|
`strftime("%Y-%m-%d ")`
|
||||||
|
|
||||||
|
snippet datetime "Insert current date and time"
|
||||||
|
`strftime("%Y-%m-%d %H:%M ")`
|
||||||
|
|
||||||
snippet lorem "Insert a lorem ipsum paragraph"
|
snippet lorem "Insert a lorem ipsum paragraph"
|
||||||
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
|
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
|
||||||
|
|||||||
26
syntax/confile.vim
Normal file
26
syntax/confile.vim
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
" Vim Syntax file for CON files
|
||||||
|
|
||||||
|
syn match SetLength /^\d\{3\}/ nextgroup=SetKeyword,SetKeywordMarked,SetKeywordInfoMarked
|
||||||
|
hi SetLength guifg=grey
|
||||||
|
|
||||||
|
syn match SetKeyword /\d\{4\}/ contained
|
||||||
|
hi SetKeyword guifg=lightgreen
|
||||||
|
|
||||||
|
" Visitations marked completely
|
||||||
|
syn match SetKeywordMarked /310[123]\|5000/ contained nextgroup=SetKeywordMarkedInfo
|
||||||
|
hi SetKeywordMarked gui=inverse guifg=lightgreen
|
||||||
|
|
||||||
|
" Treatments only mark treatment info
|
||||||
|
syn match SetKeywordInfoMarked /5001/ contained nextgroup=SetKeywordMarkedInfo
|
||||||
|
hi SetKeywordInfoMarked guifg=lightgreen
|
||||||
|
|
||||||
|
" mark keyword value
|
||||||
|
syn match SetKeywordMarkedInfo /..*/ contained
|
||||||
|
hi SetKeywordMarkedInfo gui=inverse
|
||||||
|
|
||||||
|
" Mark datasets like patient
|
||||||
|
syn match SetStart /^0138000/ nextgroup=SetType
|
||||||
|
syn match SetType /con0\|con9\|besa\|adt0\|adt9\|010[1-4]\|rvsa/ contained " 0101
|
||||||
|
|
||||||
|
hi SetStart guifg=white guibg=green
|
||||||
|
hi SetType guifg=white guibg=red
|
||||||
Reference in New Issue
Block a user