From 9f0dbfe7d57786c2dfc0e292aea510a0475a2855 Mon Sep 17 00:00:00 2001 From: Jan Eitzinger Date: Fri, 13 Oct 2023 21:54:13 +0200 Subject: [PATCH] Introduce lazyvim for macos and linux --- .chezmoiignore | 4 + dot_config/nvim/init.lua.tmpl | 10 +- dot_config/nvim/lazyvim.json | 9 ++ dot_config/nvim/lua/config/autocmds.lua | 3 + dot_config/nvim/lua/config/keymaps.lua | 12 +++ dot_config/nvim/lua/config/lazy.lua | 47 +++++++++ dot_config/nvim/lua/config/options.lua | 9 ++ dot_config/nvim/lua/plugins/colorscheme.lua | 20 ++++ dot_config/nvim/lua/plugins/core.lua | 4 + dot_config/nvim/lua/plugins/notes.lua | 101 ++++++++++++++++++++ dot_config/nvim/lua/plugins/telescope.lua | 14 +++ dot_config/nvim/stylua.toml | 3 + 12 files changed, 231 insertions(+), 5 deletions(-) create mode 100644 dot_config/nvim/lazyvim.json create mode 100644 dot_config/nvim/lua/config/autocmds.lua create mode 100644 dot_config/nvim/lua/config/keymaps.lua create mode 100644 dot_config/nvim/lua/config/lazy.lua create mode 100644 dot_config/nvim/lua/config/options.lua create mode 100644 dot_config/nvim/lua/plugins/colorscheme.lua create mode 100644 dot_config/nvim/lua/plugins/core.lua create mode 100644 dot_config/nvim/lua/plugins/notes.lua create mode 100644 dot_config/nvim/lua/plugins/telescope.lua create mode 100644 dot_config/nvim/stylua.toml diff --git a/.chezmoiignore b/.chezmoiignore index 423cfd4..3921257 100644 --- a/.chezmoiignore +++ b/.chezmoiignore @@ -8,4 +8,8 @@ LICENSE .Xresources .xsession .config/openbox/* +.config/nvim/after +{{ else }} +lazyvim.json +stylua.toml {{ end }} diff --git a/dot_config/nvim/init.lua.tmpl b/dot_config/nvim/init.lua.tmpl index 8f249ba..6bdc699 100644 --- a/dot_config/nvim/init.lua.tmpl +++ b/dot_config/nvim/init.lua.tmpl @@ -1,3 +1,4 @@ +{{- if eq .chezmoi.os "openbsd" }} HOME = os.getenv("HOME") vim.cmd([[colorscheme gruvbox]]) @@ -22,11 +23,6 @@ require "paq" { "lukas-reineke/lsp-format.nvim", "neovim/nvim-lspconfig", -{{- if ne .chezmoi.os "openbsd" }} - "williamboman/mason.nvim", - "williamboman/mason-lspconfig.nvim", -{{- end }} - -- Autocomplete "hrsh7th/nvim-cmp", "hrsh7th/cmp-buffer", @@ -301,3 +297,7 @@ map('n', 'xl', 'TroubleToggle loclist', { noremap = true, silen map('n', 'xq', 'TroubleToggle quickfix', { noremap = true, silent = true }) map('n', 'g', 'vertical rightbelow Git', { noremap = true, silent = true }) +{{ else }} +-- bootstrap lazy.nvim, LazyVim and your plugins +require("config.lazy") +{{ end }} diff --git a/dot_config/nvim/lazyvim.json b/dot_config/nvim/lazyvim.json new file mode 100644 index 0000000..ff6a139 --- /dev/null +++ b/dot_config/nvim/lazyvim.json @@ -0,0 +1,9 @@ +{ + "extras": [ + + ], + "news": { + "NEWS.md": "2123" + }, + "version": 2 +} \ No newline at end of file diff --git a/dot_config/nvim/lua/config/autocmds.lua b/dot_config/nvim/lua/config/autocmds.lua new file mode 100644 index 0000000..27e9e06 --- /dev/null +++ b/dot_config/nvim/lua/config/autocmds.lua @@ -0,0 +1,3 @@ +-- Autocmds are automatically loaded on the VeryLazy event +-- Default autocmds that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/autocmds.lua +-- Add any additional autocmds here diff --git a/dot_config/nvim/lua/config/keymaps.lua b/dot_config/nvim/lua/config/keymaps.lua new file mode 100644 index 0000000..54f5a2a --- /dev/null +++ b/dot_config/nvim/lua/config/keymaps.lua @@ -0,0 +1,12 @@ +-- Keymaps are automatically loaded on the VeryLazy event +-- Default keymaps that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/keymaps.lua +-- Add any additional keymaps here +local map = vim.keymap.set + +-- replace ex mode map and use it for repeating 'q' macro +map("n", "Q", "@q") +map("v", "Q", "norm @q") + +-- Easier in-file navigation with Tab and S-Tab +map("n", "", "") +map("n", "", "") diff --git a/dot_config/nvim/lua/config/lazy.lua b/dot_config/nvim/lua/config/lazy.lua new file mode 100644 index 0000000..eac5f8b --- /dev/null +++ b/dot_config/nvim/lua/config/lazy.lua @@ -0,0 +1,47 @@ +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +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 +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 = "lazyvim.plugins.extras.editor.leap" }, + { import = "lazyvim.plugins.extras.lang.go" }, + { import = "lazyvim.plugins.extras.lang.json" }, + { import = "lazyvim.plugins.extras.lang.clangd" }, + -- import/override with your plugins + { import = "plugins" }, + }, + defaults = { + -- By default, only LazyVim plugins will be lazy-loaded. Your custom plugins will load during startup. + -- If you know what you're doing, you can set this to `true` to have all your custom plugins lazy-loaded by default. + lazy = false, + -- It's recommended to leave version=false for now, since a lot the plugin that support versioning, + -- have outdated releases, which may break your Neovim install. + version = false, -- always use the latest git commit + -- version = "*", -- try installing the latest stable version for plugins that support semver + }, + install = { colorscheme = { "tokyonight", "habamax" } }, + checker = { enabled = true }, -- automatically check for plugin updates + performance = { + rtp = { + -- disable some rtp plugins + disabled_plugins = { + "gzip", + -- "matchit", + -- "matchparen", + -- "netrwPlugin", + "tarPlugin", + "tohtml", + "tutor", + "zipPlugin", + }, + }, + }, +}) diff --git a/dot_config/nvim/lua/config/options.lua b/dot_config/nvim/lua/config/options.lua new file mode 100644 index 0000000..d95943a --- /dev/null +++ b/dot_config/nvim/lua/config/options.lua @@ -0,0 +1,9 @@ +-- 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 + +if vim.g.neovide then + vim.g.neovide_cursor_animation_length = 0 + vim.o.guifont = "BrutalistMono Nerd Font Regular:h16" + vim.g.neovide_theme = "auto" +end diff --git a/dot_config/nvim/lua/plugins/colorscheme.lua b/dot_config/nvim/lua/plugins/colorscheme.lua new file mode 100644 index 0000000..8800c77 --- /dev/null +++ b/dot_config/nvim/lua/plugins/colorscheme.lua @@ -0,0 +1,20 @@ +return { + -- gruvbox + { + "ellisonleao/gruvbox.nvim", + opts = { contrast = "hard" }, + }, + + -- kanagawa + { + "rebelot/kanagawa.nvim", + }, + + -- Configure LazyVim to load gruvbox + { + "LazyVim/LazyVim", + opts = { + colorscheme = "kanagawa", + }, + }, +} diff --git a/dot_config/nvim/lua/plugins/core.lua b/dot_config/nvim/lua/plugins/core.lua new file mode 100644 index 0000000..19d97fa --- /dev/null +++ b/dot_config/nvim/lua/plugins/core.lua @@ -0,0 +1,4 @@ +return { + { "folke/lazy.nvim", version = false }, + { "LazyVim/LazyVim", version = false }, +} diff --git a/dot_config/nvim/lua/plugins/notes.lua b/dot_config/nvim/lua/plugins/notes.lua new file mode 100644 index 0000000..2dffbf3 --- /dev/null +++ b/dot_config/nvim/lua/plugins/notes.lua @@ -0,0 +1,101 @@ +return { + { + "renerocksai/telekasten.nvim", + lazy = true, + dependencies = { + "nvim-telescope/telescope.nvim", + "renerocksai/calendar-vim", + }, + opts = { + home = vim.fn.expand("~/doc/zettelkasten"), + take_over_my_home = true, + auto_set_filetype = true, + -- dailies = home .. '/' .. 'daily', + -- weeklies = home .. '/' .. 'weekly', + -- templates = home .. '/' .. '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 .. '/' .. '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 .. '/' .. '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 .. '/' .. '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 = { + { "zf", "Telekasten find_notes" }, + { "zd", "Telekasten find_daily_notes" }, + { "zg", "Telekasten search_notes" }, + { "zz", "Telekasten follow_link" }, + { "zn", "Telekasten new_note" }, + { "zr", "Telekasten rename_note" }, + { "zc", "Telekasten show_calendar" }, + { "#", "Telekasten show_tags" }, + { "z", "Telekasten panel" }, + }, + init = function() + vim.api.nvim_set_hl(0, "tklink", { fg = "#689d6a", bg = "" }) + vim.api.nvim_set_hl(0, "tkBrackets", { fg = "gray", bg = "gray" }) + end, + }, + + { + "nvim-neorg/neorg", + build = ":Neorg sync-parsers", + dependencies = { "nvim-lua/plenary.nvim" }, + opts = { + load = { + ["core.defaults"] = {}, + ["core.concealer"] = {}, -- Adds pretty icons to your documents + ["core.dirman"] = { -- Manages Neorg workspaces + config = { + workspaces = { + notes = "~/doc/notes/private", + work = "~/doc/notes/work", + }, + }, + }, + }, + }, + }, +} diff --git a/dot_config/nvim/lua/plugins/telescope.lua b/dot_config/nvim/lua/plugins/telescope.lua new file mode 100644 index 0000000..d0495ff --- /dev/null +++ b/dot_config/nvim/lua/plugins/telescope.lua @@ -0,0 +1,14 @@ +return { + + -- add telescope-fzf-native + { + "telescope.nvim", + dependencies = { + "nvim-telescope/telescope-fzf-native.nvim", + build = "make", + config = function() + require("telescope").load_extension("fzf") + end, + }, + }, +} diff --git a/dot_config/nvim/stylua.toml b/dot_config/nvim/stylua.toml new file mode 100644 index 0000000..5d6c50d --- /dev/null +++ b/dot_config/nvim/stylua.toml @@ -0,0 +1,3 @@ +indent_type = "Spaces" +indent_width = 2 +column_width = 120 \ No newline at end of file