Update nvim config

This commit is contained in:
Jan Eitzinger 2024-12-24 23:07:16 +01:00
parent 1bf0c3029b
commit 8dab7cb3a6
Signed by: moebiusband
GPG Key ID: 2574BA29B90D6DD5
11 changed files with 91 additions and 250 deletions

View File

@ -11,7 +11,6 @@ LICENSE
.xsession
.config/openbox/*
.config/nvim/lua/plugins/lsp.lua
{{ else }}
.config/fish/conf.d/fish-ssh-agent.fish
.config/fish/functions/__ssh_agent_*
.config/nvim/lazy-lock.json
.config/nvim/lazyvim.json
{{ end }}

View File

@ -180,8 +180,6 @@ enabled_layouts Horizontal,Stack
tab_bar_edge top
tab_bar_style separator
tab_separator ""
tab_title_template " {index} {title} "
tab_bar_background #434C5E
shell {{ .shell }}
editor nvim
@ -603,7 +601,8 @@ map kitty_mod+R set_tab_title
# BEGIN_KITTY_THEME
include Nord.conf
# Catppuccin-Mocha
include current-theme.conf
# END_KITTY_THEME
# BEGIN_KITTY_FONTS

View File

@ -11,5 +11,41 @@ vim.api.nvim_create_autocmd("FileType", {
vim.opt_local.softtabstop = 2
vim.opt_local.shiftwidth = 2
vim.opt_local.expandtab = true
-- Add the key mappings only for Markdown files in a zk notebook.
if require("zk.util").notebook_root(vim.fn.expand("%:p")) ~= nil then
local function map(...)
vim.api.nvim_buf_set_keymap(0, ...)
end
local opts = { noremap = true, silent = false }
-- Open the link under the caret.
map("n", "<CR>", "<Cmd>lua vim.lsp.buf.definition()<CR>", opts)
-- Create a new note after asking for its title.
-- This overrides the global `<leader>zn` mapping to create the note in the same directory as the current buffer.
map("n", "<leader>zn", "<Cmd>ZkNew { dir = vim.fn.expand('%:p:h'), title = vim.fn.input('Title: ') }<CR>", opts)
-- Create a new note in the same directory as the current buffer, using the current selection for title.
map("v", "<leader>znt", ":'<,'>ZkNewFromTitleSelection { dir = vim.fn.expand('%:p:h') }<CR>", opts)
-- Create a new note in the same directory as the current buffer, using the current selection for note content and asking for its title.
map(
"v",
"<leader>znc",
":'<,'>ZkNewFromContentSelection { dir = vim.fn.expand('%:p:h'), title = vim.fn.input('Title: ') }<CR>",
opts
)
-- Open notes linking to the current buffer.
map("n", "<leader>zb", "<Cmd>ZkBacklinks<CR>", opts)
-- Alternative for backlinks using pure LSP and showing the source context.
--map('n', '<leader>zb', '<Cmd>lua vim.lsp.buf.references()<CR>', opts)
-- Open notes linked by the current buffer.
map("n", "<leader>zl", "<Cmd>ZkLinks<CR>", opts)
-- Preview a linked note.
map("n", "K", "<Cmd>lua vim.lsp.buf.hover()<CR>", opts)
-- Open the code actions for a visual selection.
map("v", "<leader>za", ":'<,'>lua vim.lsp.buf.range_code_action()<CR>", opts)
end
end,
})

View File

@ -19,3 +19,17 @@ map("n", "<leader>td", "require('dap-go').debug_test()<CR>")
map("n", "<leader>to", "require('neotest').output.open({enter = true})<CR>")
map("n", "<leader>tS", "require('neotest').run.stop()<CR>")
map("n", "<leader>ts", "require('neotest').summary.toggle()<CR>")
-- zk
-- Create a new note after asking for its title.
map("n", "<leader>zn", "<Cmd>ZkNew { title = vim.fn.input('Title: ') }<CR>")
-- Open notes.
map("n", "<leader>zo", "<Cmd>ZkNotes { sort = { 'modified' } }<CR>")
-- Open notes associated with the selected tags.
map("n", "<leader>zt", "<Cmd>ZkTags<CR>")
-- Search for the notes matching a given query.
map("n", "<leader>zf", "<Cmd>ZkNotes { sort = { 'modified' }, match = { vim.fn.input('Search: ') } }<CR>")
-- Search for the notes matching the current visual selection.
map("v", "<leader>zf", ":'<,'>ZkMatch<CR>")

View File

@ -1,23 +1,16 @@
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)
if not vim.loop.fs_stat(lazypath) then
-- bootstrap lazy.nvim
-- stylua: ignore
vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", "--branch=stable", lazypath })
end
end
vim.opt.rtp:prepend(lazypath)
vim.opt.rtp:prepend(vim.env.LAZY or lazypath)
require("lazy").setup({
spec = {
-- add LazyVim and import its plugins
{ "LazyVim/LazyVim", import = "lazyvim.plugins" },
-- import any extras modules here
-- import/override with your plugins
{ import = "plugins" },
},
@ -31,10 +24,7 @@ require("lazy").setup({
-- version = "*", -- try installing the latest stable version for plugins that support semver
},
install = { colorscheme = { "tokyonight", "habamax" } },
checker = {
enabled = true, -- check for plugin updates periodically
notify = false, -- notify on update
}, -- automatically check for plugin updates
checker = { enabled = true, notify = false, frequency = 259200 }, -- automatically check for plugin updates
performance = {
rtp = {
-- disable some rtp plugins

View File

@ -1,3 +1,5 @@
-- Options are automatically loaded before lazy.nvim startup
-- Default options that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/options.lua
-- Add any additional options here
vim.g.snacks_animate = false

View File

@ -1,14 +1,4 @@
return {
{
"kylechui/nvim-surround",
version = "*", -- Use for stability; omit to use `main` branch for the latest features
event = "VeryLazy",
config = function()
require("nvim-surround").setup({
-- Configuration here, or leave empty to use defaults
})
end,
},
{
"windwp/nvim-autopairs",
event = "InsertEnter",

View File

@ -1,13 +0,0 @@
return {
{
"shaunsingh/nord.nvim",
lazy = false,
priority = 1000,
},
{
"LazyVim/LazyVim",
opts = {
colorscheme = "nord",
},
},
}

View File

@ -0,0 +1,27 @@
return {
{
{
"zk-org/zk-nvim",
config = function()
require("zk").setup({
picker = "fzf_lua",
lsp = {
config = {
cmd = { "zk", "lsp" },
name = "zk",
-- on_attach = ...
-- etc, see `:h vim.lsp.start_client()`
},
-- automatically attach buffers in a zk notebook that match the given filetypes
auto_attach = {
enabled = true,
filetypes = { "markdown" },
},
},
})
end,
},
},
}

View File

@ -1,83 +0,0 @@
return {
{
"renerocksai/telekasten.nvim",
lazy = true,
dependencies = {
"nvim-telescope/telescope.nvim",
"renerocksai/calendar-vim",
},
opts = {
take_over_my_home = true,
auto_set_filetype = false,
home = "{{ .home }}/doc/zettelkasten",
dailies = "{{ .home }}/doc/zettelkasten/daily",
weeklies = "{{ .home }}/doc/zettelkasten/weekly",
templates = "{{ .home }}/doc/zettelkasten/templates",
image_subdir = "img",
extension = ".md",
new_note_filename = "uuid-title",
uuid_type = "%Y%m%d%H%M",
uuid_sep = "-",
follow_creates_nonexisting = true,
dailies_create_nonexisting = true,
weeklies_create_nonexisting = true,
journal_auto_open = false,
-- template for new notes (new_note, follow_link)
-- set to `nil` or do not specify if you do not want a template
template_new_note = "{{ .home }}/doc/zettelkasten/templates/new_note.md",
-- template for newly created daily notes (goto_today)
-- set to `nil` or do not specify if you do not want a template
template_new_daily = "{{ .home }}/doc/zettelkasten/templates/daily.md",
-- template for newly created weekly notes (goto_thisweek)
-- set to `nil` or do not specify if you do not want a template
template_new_weekly = "{{ .home }}/doc/zettelkasten/templates/weekly.md",
-- image link style
-- wiki: ![[image name]]
-- markdown: ![](image_subdir/xxxxx.png)
image_link_style = "wiki",
-- default sort option: 'filename', 'modified'
sort = "filename",
-- integrate with calendar-vim
plug_into_calendar = true,
calendar_opts = {
weeknm = 4,
calendar_monday = 1,
calendar_mark = "left-fit",
},
close_after_yanking = false,
insert_after_inserting = true,
tag_notation = "#tag",
command_palette_theme = "dropdown",
show_tags_theme = "ivy",
subdirs_in_links = true,
template_handling = "smart",
new_note_location = "smart",
rename_update_links = true,
follow_url_fallback = nil,
},
keys = {
{ "<leader>zf", "<cmd>Telekasten find_notes<cr>" },
{ "<leader>zd", "<cmd>Telekasten find_daily_notes<cr>" },
{ "<leader>zg", "<cmd>Telekasten search_notes<cr>" },
{ "<leader>zz", "<cmd>Telekasten follow_link<cr>" },
{ "<leader>zn", "<cmd>Telekasten new_note<cr>" },
{ "<leader>zr", "<cmd>Telekasten rename_note<cr>" },
{ "<leader>zc", "<cmd>Telekasten show_calendar<cr>" },
{ "<leader>zb", "<cmd>Telekasten show_backlinks<cr>" },
{ "<leader>z[", "<cmd>Telekasten insert_link<cr>" },
{ "<leader>#", "<cmd>Telekasten show_tags<cr>" },
{ "<leader>z", "<cmd>Telekasten panel<cr>" },
},
init = function()
vim.api.nvim_set_hl(0, "tklink", { fg = "#689d6a", bg = "" })
vim.api.nvim_set_hl(0, "tkBrackets", { fg = "gray", bg = "gray" })
end,
},
}

View File

@ -5,6 +5,7 @@ return {
colorscheme = "catppuccin-mocha",
},
},
{
"nvim-lualine/lualine.nvim",
event = "VeryLazy",
@ -13,16 +14,6 @@ return {
end,
},
{
"RRethy/vim-illuminate",
config = function()
-- change the highlight style
vim.api.nvim_set_hl(0, "IlluminatedWordText", { link = "Visual" })
vim.api.nvim_set_hl(0, "IlluminatedWordRead", { link = "Visual" })
vim.api.nvim_set_hl(0, "IlluminatedWordWrite", { link = "Visual" })
end,
},
{
"snacks.nvim",
opts = {
@ -41,117 +32,6 @@ return {
},
},
{
"NvChad/nvim-colorizer.lua",
opts = function(_, opts)
opts.filetypes = {
"html",
"css",
"scss",
"javascript",
"typescript",
"typescriptreact",
"javascriptreact",
"lua",
}
opts.user_default_options = {
mode = "background",
tailwind = false, -- Enable tailwind colors
}
end,
},
{
"nvimdev/dashboard-nvim",
event = "VimEnter",
opts = function()
vim.api.nvim_set_hl(0, "DashboardHeader", { fg = "#79b8ff" })
vim.api.nvim_set_hl(0, "DashboardIcon", { fg = "#39c5cf" })
vim.api.nvim_set_hl(0, "DashboardKey", { fg = "#39c5cf" })
vim.api.nvim_set_hl(0, "DashboardFooter", { fg = "#959da5" })
local logo = [[
_ _ _ _
| | (_) | | | |
_ __ ___ ___ ___| |__ _ _ _ ___| |__ __ _ _ __ __| |
| '_ ` _ \ / _ \ / _ \ '_ \| | | | / __| '_ \ / _` | '_ \ / _` |
| | | | | | (_) | __/ |_) | | |_| \__ \ |_) | (_| | | | | (_| |
|_| |_| |_|\___/ \___|_.__/|_|\__,_|___/_.__/ \__,_|_| |_|\__,_| ]]
logo = string.rep("\n", 8) .. logo .. "\n\n"
local opts = {
theme = "doom",
hide = {
statusline = false,
},
config = {
header = vim.split(logo, "\n"),
center = {
{
action = "lua LazyVim.pick()()",
desc = " Find file",
icon = "",
key = "f",
},
{
action = "Telescope oldfiles",
desc = " Recent files",
icon = "",
key = "r",
},
{
action = 'lua LazyVim.pick("live_grep")()',
desc = " Find text",
icon = "",
key = "g",
},
{
action = "lua LazyVim.pick.config_files()()",
desc = " Config",
icon = "",
key = "c",
},
{
action = "Telekasten find_notes",
desc = " Find notes",
icon = "",
key = "n",
},
{
action = "Lazy",
desc = " Lazy",
icon = "󰒲 ",
key = "l",
},
{ action = "qa", desc = " Quit", icon = "", key = "q" },
},
footer = function()
local stats = require("lazy").stats()
local ms = (math.floor(stats.startuptime * 100 + 0.5) / 100)
return { "⚡ Neovim loaded " .. stats.loaded .. "/" .. stats.count .. " plugins in " .. ms .. "ms" }
end,
},
}
for _, button in ipairs(opts.config.center) do
button.desc = button.desc .. string.rep(" ", 43 - #button.desc)
button.key_format = " %s"
end
-- close Lazy and re-open when the dashboard is ready
if vim.o.filetype == "lazy" then
vim.cmd.close()
vim.api.nvim_create_autocmd("User", {
pattern = "DashboardLoaded",
callback = function()
require("lazy").show()
end,
})
end
return opts
end,
},
{
"stevearc/oil.nvim",
opts = {},