Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restart with a new LazyVim starter #68

Merged
merged 8 commits into from
Oct 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions nvim/.gitignore

This file was deleted.

2 changes: 1 addition & 1 deletion nvim/LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright 2023 Michael Rolli
Copyright [yyyy] [name of copyright owner]

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
54 changes: 2 additions & 52 deletions nvim/README.md
Original file line number Diff line number Diff line change
@@ -1,54 +1,4 @@
# 💤 LazyVim

My own Neovim config based on starter template of [LazyVim](https://github.com/LazyVim/LazyVim).

In addition to the standard set of plugins coming with LazyVim I added a bunch
of additional plugins I'm used to. These are added using their own config files,
see `lua/plugins/*.lua`.

## Activated LazyVim Extras

The following LazyVim Extras are activated in `nvim/lua/config/lazy.lua`:

* lazyvim.plugins.extras.editor.navic
* lazyvim.plugins.extras.lang.markdown
* lazyvim.plugins.extras.lang.terraform
* lazyvim.plugins.extras.lang.yaml
* lazyvim.plugins.extras.util.project

## Additional plugins

| Plugin | Description |
|--------------- | --------------- |
| NvChad/nvim-colorizer.lua | Add visual representaton for colors inline as virtualtext |
| sainhe/gruvbox-material | A great colorscheme based on gruvbox |
| zbirenbaum/copilot | GitHub Copilot at your fingertips |
| folke/zen-mode.nvim | Plugin for distraction free coding |
| folke/twilight.nvim | Plugin that dims inactive portions of the code using TreeSitter |

## Custom Keymaps

As I use the Expose keybindings on my Mac, I added new key bindings for moving
lines. These work in normal, insert and virtual mode:

| Keymap | Function |
|--------| ----------- |
| \<M-k> | Move current line/selecton up one line |
| \<M-j> | Move current line/selecton down one line |

As I have turned off direct yanking to the system clipboard (unnamedplus), there
are additional keymaps regarding system clipboard handling:

| Keymap | Function |
|----------| ----------- |
| \<leader>y | Yank to the clipboard |
| \<leader>yy | Yank line to the clipboard |
| \<leader>p | Paste fromt the system clipboard |
| \<leader>d | Delete to the back hole register |

Other keymaps include:

| Keymap | Function |
|----------- | ----------- |
| \<leader>fx | Make current file in buffer executable |
| \<leader>cs | Show list of available snippets for the current filetype |
A starter template for [LazyVim](https://github.com/LazyVim/LazyVim).
Refer to the [documentation](https://lazyvim.github.io/installation) to get started.
19 changes: 11 additions & 8 deletions nvim/lazy-lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,16 @@
"bufferline.nvim": { "branch": "main", "commit": "0b2fd861eee7595015b6561dade52fb060be10c4" },
"catppuccin": { "branch": "main", "commit": "7be452ee067978cdc8b2c5f3411f0c71ffa612b9" },
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
"cmp-git": { "branch": "main", "commit": "50d526dff0f6bc441b51fc269d9fdc99a50c76af" },
"cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" },
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
"conform.nvim": { "branch": "master", "commit": "40d4e98fcc3e6f485f0e8924c63734bc7e305967" },
"copilot-cmp": { "branch": "master", "commit": "b6e5286b3d74b04256d0a7e3bd2908eabec34b44" },
"copilot.lua": { "branch": "master", "commit": "1a237cf50372830a61d92b0adf00d3b23882e0e1" },
"dashboard-nvim": { "branch": "master", "commit": "fabf5feec96185817c732d47d363f34034212685" },
"dressing.nvim": { "branch": "master", "commit": "1b7921eecc65af1baf8ac1dc06f0794934cbcfb2" },
"flash.nvim": { "branch": "main", "commit": "34c7be146a91fec3555c33fe89c7d643f6ef5cf1" },
"friendly-snippets": { "branch": "main", "commit": "de8fce94985873666bd9712ea3e49ee17aadb1ed" },
"gen.nvim": { "branch": "main", "commit": "83f1d6b6ffa6a6f32f6a93a33adc853f27541a94" },
"gitsigns.nvim": { "branch": "main", "commit": "863903631e676b33e8be2acb17512fdc1b80b4fb" },
"grug-far.nvim": { "branch": "main", "commit": "f47594f05d10b0bedfc0ed78e488e7fd714d57be" },
"gruvbox-material": { "branch": "master", "commit": "b16dcd787db5ba9302b54ebeac186784c2aed29a" },
Expand All @@ -31,18 +32,18 @@
"mini.icons": { "branch": "main", "commit": "a2742459f0ee32806c2438ca06b4d8b331f3f4d4" },
"mini.pairs": { "branch": "main", "commit": "694d9beb488ff1afaf3d1977b067e53c827d9af5" },
"mini.surround": { "branch": "main", "commit": "e1ac1ce5c7499aa4cc2ca9fb1adec9e730dd9394" },
"modicator.nvim": { "branch": "main", "commit": "d1d327fd4bdfc3af4cfdf83b85c2eaefa71de7a8" },
"neo-tree.nvim": { "branch": "main", "commit": "a77af2e764c5ed4038d27d1c463fa49cd4794e07" },
"noice.nvim": { "branch": "main", "commit": "df448c649ef6bc5a6a633a44f2ad0ed8d4442499" },
"nui.nvim": { "branch": "main", "commit": "b58e2bfda5cea347c9d58b7f11cf3012c7b3953f" },
"nvim-ansible": { "branch": "main", "commit": "9c3b4a771b8c8d7b4f2171466464d978cb3846f7" },
"nvim-cmp": { "branch": "main", "commit": "ae644feb7b67bf1ce4260c231d1d4300b19c6f30" },
"nvim-colorizer.lua": { "branch": "master", "commit": "0671e0eabc6842676d3310370e8fae4e1c51d7f9" },
"nvim-lint": { "branch": "master", "commit": "27f44d1cc3d733a38a736acb902f94879d99c76c" },
"nvim-lspconfig": { "branch": "master", "commit": "ff69ecca55d83ffc70657f260a799f79a5637831" },
"nvim-lint": { "branch": "master", "commit": "f707b3ae50417067fa63fdfe179b0bff6b380da1" },
"nvim-lspconfig": { "branch": "master", "commit": "c38af37e4ee71d70b7d60267d96b0a83e5d346f5" },
"nvim-navic": { "branch": "master", "commit": "8649f694d3e76ee10c19255dece6411c29206a54" },
"nvim-notify": { "branch": "master", "commit": "fbef5d32be8466dd76544a257d3f3dce20082a07" },
"nvim-snippets": { "branch": "main", "commit": "56b4052f71220144689caaa2e5b66222ba5661eb" },
"nvim-treesitter": { "branch": "master", "commit": "9d2acd49976e2a9da72949008df03436f781fd23" },
"nvim-treesitter": { "branch": "master", "commit": "19079207ba4a8c7ed956f40a111a22b1a2dfa6e8" },
"nvim-treesitter-textobjects": { "branch": "master", "commit": "b91c98afa6c42819aea6cbc1ba38272f5456a5cf" },
"nvim-ts-autotag": { "branch": "main", "commit": "e239a560f338be31337e7abc3ee42515daf23f5e" },
"persistence.nvim": { "branch": "main", "commit": "f6aad7dde7fcf54148ccfc5f622c6d5badd0cc3d" },
Expand All @@ -57,7 +58,9 @@
"tokyonight.nvim": { "branch": "main", "commit": "2c85fad417170d4572ead7bf9fdd706057bd73d7" },
"trouble.nvim": { "branch": "main", "commit": "254145ffd528b98eb20be894338e2d5c93fa02c2" },
"ts-comments.nvim": { "branch": "main", "commit": "98d7d4dec0af1312d38e288f800bbf6ff562b6ab" },
"twilight.nvim": { "branch": "main", "commit": "1584c0b0a979b71fd86b18d302ba84e9aba85b1b" },
"which-key.nvim": { "branch": "main", "commit": "8badb359f7ab8711e2575ef75dfe6fbbd87e4821" },
"zen-mode.nvim": { "branch": "main", "commit": "29b292bdc58b76a6c8f294c961a8bf92c5a6ebd6" }
"vim-dadbod": { "branch": "master", "commit": "7888cb7164d69783d3dce4e0283decd26b82538b" },
"vim-dadbod-completion": { "branch": "master", "commit": "880f7e9f2959e567c718d52550f9fae1aa07aa81" },
"vim-dadbod-ui": { "branch": "master", "commit": "f29c85ab42861c6ef683289b0c6a51e0d436dcf6" },
"virt-column.nvim": { "branch": "master", "commit": "b62b4ef0774d19452d4ed18e473e824c7a756f2f" },
"which-key.nvim": { "branch": "main", "commit": "8badb359f7ab8711e2575ef75dfe6fbbd87e4821" }
}
5 changes: 5 additions & 0 deletions nvim/lazyvim.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
{
"extras": [
"lazyvim.plugins.extras.coding.copilot",
"lazyvim.plugins.extras.coding.copilot-chat",
"lazyvim.plugins.extras.coding.mini-surround",
"lazyvim.plugins.extras.editor.inc-rename",
"lazyvim.plugins.extras.editor.navic",
"lazyvim.plugins.extras.lang.ansible",
"lazyvim.plugins.extras.lang.git",
"lazyvim.plugins.extras.lang.json",
"lazyvim.plugins.extras.lang.markdown",
"lazyvim.plugins.extras.lang.php",
"lazyvim.plugins.extras.lang.sql",
"lazyvim.plugins.extras.lang.terraform",
"lazyvim.plugins.extras.lang.toml",
"lazyvim.plugins.extras.lang.yaml",
"lazyvim.plugins.extras.ui.mini-animate",
"lazyvim.plugins.extras.util.dot",
Expand Down
59 changes: 0 additions & 59 deletions nvim/lua/config/autocmds.lua
Original file line number Diff line number Diff line change
@@ -1,62 +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

-- vim.api.nvim_create_autocmd("BufEnter", {
-- pattern = { "*.json", "*.jsonc" },
-- -- enable wrap mode for json files only
-- command = "setlocal wrap",
-- })
-- vim.api.nvim_create_autocmd("FileType", {
-- pattern = "zsh",
-- callback = function()
-- -- let treesitter use bash highlight for zsh files as well
-- require("nvim-treesitter.highlight").attach(0, "bash")
-- end,
-- })

-- Automatically set text width for markdown files
vim.api.nvim_create_autocmd({ "FileType" }, {
pattern = { "markdown" },
command = "set tw=80",
})

-- Empty formatexpr for markdwon files to make gqq and gqap work again
vim.api.nvim_create_autocmd({ "FileType" }, {
pattern = { "markdown", "gitcommit" },
command = "set formatexpr=",
})

-- Markdown should have wrapping enabled by default
vim.api.nvim_create_autocmd({ "FileType" }, {
pattern = { "markdown" },
command = "set wrap",
})

-- Disable the concealing in some file formats
-- The default conceallevel is 3 in LazyVim
vim.api.nvim_create_autocmd("FileType", {
pattern = { "json", "jsonc" },
callback = function()
vim.opt.conceallevel = 0
end,
})

-- Empty formatexpr for LSP buffers to make gqq and gqap work again
-- vim.api.nvim_create_autocmd('LspAttach', {
-- callback = function(args)
-- vim.bo[args.buf].formatexpr = nil
-- end,
-- })

-- Set relative line numbers when not in insert mode
vim.api.nvim_create_autocmd({ "BufEnter", "FocusGained", "InsertLeave", "WinEnter" }, {
pattern = "*",
command = 'if &nu && mode() != "i" | set rnu | endif',
})

-- Set absolute line numbers when in insert mode
vim.api.nvim_create_autocmd({ "BufLeave", "FocusLost", "InsertEnter", "WinLeave" }, {
pattern = "*",
command = "if &nu | set nornu | endif",
})
67 changes: 0 additions & 67 deletions nvim/lua/config/keymaps.lua
Original file line number Diff line number Diff line change
@@ -1,70 +1,3 @@
-- 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 function map(mode, lhs, rhs, opts)
local keys = require("lazy.core.handler").handlers.keys
---@cast keys LazyKeysHandler
-- do not create the keymap if a lazy keys handler exists
if not keys.active[keys.parse({ lhs, mode = mode }).id] then
opts = opts or {}
opts.silent = opts.silent ~= false
vim.keymap.set(mode, lhs, rhs, opts)
end
end

-- These remaps make the jumps scroll to the middle of
-- the screen for less eye distraction
map("n", "<C-o>", "<C-o>zz")
map("n", "<C-i>", "<C-i>zz")
map("n", "<C-d>", "<C-d>zz")
map("n", "<C-u>", "<C-u>zz")
map("n", "n", "nzzzv")
map("n", "N", "Nzzzv")
map("n", "gd", "gdzzzv")

-- Resize window using <ctrl> arrow keys
map("n", "<M-Up>", "<cmd>resize +2<cr>", { desc = "Increase window height" })
map("n", "<M-Down>", "<cmd>resize -2<cr>", { desc = "Decrease window height" })
map("n", "<M-Left>", "<cmd>vertical resize +2<cr>", { desc = "Decrease window width" })
map("n", "<M-Right>", "<cmd>vertical resize -2<cr>", { desc = "Increase window width" })

--[[
Using leader + y/Y to yank to unnameplus or paste from unnamedplus register.
The register unnamedplus is the system's clipboard and is the default
clipboard register in LazyVim, but I don't like that.
Therefore clipboard is changed to empty value (see lua/config/options.lua) and these
additional mappings below using the leader key are in place to yank to and paste
from the unnamedplus register.
Found at https://github.com/LunarVim/LunarVim/issues/930#issuecomment-890597260
]]

-- Increment/decrement
map("n", "+", "<C-a>", { desc = "Increment" })
map("n", "-", "<C-x>", { desc = "Decrement" })

-- Select all text in buffer
map("n", "<C-a>", "ggVG", { desc = "Select all" })

-- Yank to system clipboard
map("n", "<leader>y", '"+y', { desc = "Yank to clipboard" })
map("n", "<leader>yy", '"+yy', { desc = "Yank line to clipboard" })
map("v", "<leader>y", '"+y', { desc = "Yank to clipboard" })

-- Paste from system clipbard
map("n", "<leader>p", '"+p', { desc = "Paste from clipboard" })
map("n", "<leader>P", '"+P', { desc = "Paste from clipboard" })
map("v", "<leader>p", '"+p', { desc = "Paste from clipboard" })

-- Deliberately delete to black hole register
map("n", "<leader>d", '"_d', { desc = "Delete to black hole" })
map("v", "<leader>d", '"_d', { desc = "Delete to black hole" })

-- Make file in current buffer executable
map("n", "<leader>fx", "<cmd>silent !chmod +x %<CR>", { desc = "Make % executable" })

-- Show all known snippets for the current filetype
map("n", "<leader>cs", ":lua require('luasnip.extras.snippet_list').open()<CR>", { desc = "Show Snippet List" })

-- Align markdown tables using pa'doc
map("v", "<leader>ct", "!pandoc -t markdown-simple_tables<CR>", { desc = "Align selected md table using pandoc" })
39 changes: 18 additions & 21 deletions nvim/lua/config/lazy.lua
Original file line number Diff line number Diff line change
@@ -1,29 +1,23 @@
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 })
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(vim.env.LAZY or lazypath)
vim.opt.rtp:prepend(lazypath)

require("lazy").setup({
spec = {
-- add LazyVim and import its plugins
{
"LazyVim/LazyVim",
import = "lazyvim.plugins",
opts = {
colorscheme = "gruvbox-material",
news = {
lazyvim = true,
neovim = true,
},
},
},
-- import any extras modules here
-- { import = "lazyvim.plugins.extras.lang.typescript" },
-- { import = "lazyvim.plugins.extras.lang.json" },
-- { import = "lazyvim.plugins.extras.ui.mini-animate" },
{ "LazyVim/LazyVim", import = "lazyvim.plugins" },
-- import/override with your plugins
{ import = "plugins" },
},
Expand All @@ -37,7 +31,10 @@ require("lazy").setup({
-- version = "*", -- try installing the latest stable version for plugins that support semver
},
install = { colorscheme = { "tokyonight", "habamax" } },
checker = { enabled = true }, -- automatically check for plugin updates
checker = {
enabled = true, -- check for plugin updates periodically
notify = false, -- notify on update
}, -- automatically check for plugin updates
performance = {
rtp = {
-- disable some rtp plugins
Expand Down
28 changes: 3 additions & 25 deletions nvim/lua/config/options.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,10 @@

-- no automatic system clipboard usage
-- see also keybindings regarding yanking
vim.opt.clipboard = ""
-- add a highlighted column
vim.opt.colorcolumn = "80"
-- vim.opt.clipboard = ""

-- turn off formatting on save
-- vim.g.autoformat = false

-- configure spellcheck to use both english and german
vim.opt.spelllang = { "en", "de" }

-- configure wildmenu related options
vim.opt.wildmode = "full"
-- vim.opt.wildoptions = "pum"
vim.opt.wildignore = {
"*~",
"**/.git/*",
"**/.vagrant/*",
"*.o",
"*.pyc",
"*pycache*",
}
-- vim.opt.pumblend = 10 -- make pop-up menu slightly transparent

-- Custom filetypes
-- vim.filetype.add({
-- pattern = {
-- [".*/ansible.*/.*%.ya?ml"] = "yaml.ansible",
-- [".*/playbooks/.*%.ya?ml"] = "yaml.ansible",
-- [".*/roles/.*%.ya?ml"] = "yaml.ansible",
-- },
-- })
Loading
Loading