feat(nvim): new nvim config (#28)

* feat(nvim): clean config, work in progress
* feat: refactored plugins and configs
* feat: stylua config, ufo, lsp refactor, cleanup
* feat: renamed nvim to nvim-lazy, added alias
* feat: renamed nvim-clean to be nvim, updated alias
This commit is contained in:
Ismo Vuorinen
2024-09-22 03:52:02 +03:00
committed by GitHub
parent 36e0f36e06
commit 6f1e1a0416
50 changed files with 2046 additions and 131 deletions

View File

@@ -65,6 +65,11 @@ alias ta='command tmux attach || command tmux'
# nvim
alias nvim-ks='NVIM_APPNAME="nvim-kickstart" nvim'
alias ks='NVIM_APPNAME="nvim-kickstart" nvim'
alias nvim-lazy='NVIM_APPNAME="nvim-lazy" nvim'
alias nl='NVIM_APPNAME="nvim-lazy" nvim'
alias vim='nvim'
alias vi='nvim'
alias c='nvim'
# xdg-ninja aliases for better experience
alias xdg='xdg-ninja --skip-ok --skip-unsupported'

View File

@@ -0,0 +1,3 @@
{
"diagnostics.globals": ["vim"]
}

View File

@@ -0,0 +1,2 @@
-- bootstrap lazy.nvim, LazyVim and your plugins
require("config.lazy")

View File

@@ -0,0 +1,82 @@
{
"LazyVim": { "branch": "main", "commit": "12818a6cb499456f4903c5d8e68af43753ebc869" },
"LuaSnip": { "branch": "master", "commit": "03c8e67eb7293c404845b3982db895d59c0d1538" },
"SchemaStore.nvim": { "branch": "main", "commit": "b546852f7a477276805b01f84ac79c28a962c55b" },
"aerial.nvim": { "branch": "master", "commit": "b59e01e4380932b375ecff165b48a9400c4af929" },
"animation.nvim": { "branch": "main", "commit": "fb77091ab72ec9971aee0562e7081182527aaa6a" },
"bufdelete.nvim": { "branch": "master", "commit": "f6bcea78afb3060b198125256f897040538bcb81" },
"bufferline.nvim": { "branch": "main", "commit": "2e3c8cc5a57ddd32f1edd2ffd2ccb10c09421f6c" },
"catppuccin": { "branch": "main", "commit": "c9e205fe035d622b3c2d66ee42edf368c0c31fd5" },
"cloak.nvim": { "branch": "main", "commit": "648aca6d33ec011dc3166e7af3b38820d01a71e4" },
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
"cmp-emoji": { "branch": "main", "commit": "e8398e2adf512a03bb4e1728ca017ffeac670a9f" },
"cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" },
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
"comment-box.nvim": { "branch": "main", "commit": "e04635ed2b423448b87ddb2f35c26d1a7b7b3f1c" },
"conform.nvim": { "branch": "master", "commit": "0ebe875d9c306f5fc829db38492ffff2a70d8e9d" },
"copilot-cmp": { "branch": "master", "commit": "b6e5286b3d74b04256d0a7e3bd2908eabec34b44" },
"copilot.lua": { "branch": "master", "commit": "86537b286f18783f8b67bccd78a4ef4345679625" },
"dashboard-nvim": { "branch": "master", "commit": "fabf5feec96185817c732d47d363f34034212685" },
"dressing.nvim": { "branch": "master", "commit": "71349f24c6e07b39f33600985843c289ca735308" },
"edgy.nvim": { "branch": "main", "commit": "ebb77fde6f5cb2745431c6c0fe57024f66471728" },
"flit.nvim": { "branch": "main", "commit": "1ef72de6a02458d31b10039372c8a15ab8989e0d" },
"friendly-snippets": { "branch": "main", "commit": "00ebcaa159e817150bd83bfe2d51fa3b3377d5c4" },
"gitsigns.nvim": { "branch": "main", "commit": "0b04035bb7b3c83e999b9676e2fb46fd0aa9f910" },
"glance.nvim": { "branch": "master", "commit": "51059bcf21016387b6233c89eed220cf47fca752" },
"grug-far.nvim": { "branch": "main", "commit": "308e357be687197605cf19222f843fbb331f50f5" },
"harpoon": { "branch": "harpoon2", "commit": "0378a6c428a0bed6a2781d459d7943843f374bce" },
"indent-blankline.nvim": { "branch": "master", "commit": "3fe94b8034dd5241cb882bb73847303b58857ecf" },
"lazy.nvim": { "branch": "main", "commit": "077102c5bfc578693f12377846d427f49bc50076" },
"lazydev.nvim": { "branch": "main", "commit": "491452cf1ca6f029e90ad0d0368848fac717c6d2" },
"leap.nvim": { "branch": "main", "commit": "c6bfb191f1161fbabace1f36f578a20ac6c7642c" },
"lualine.nvim": { "branch": "master", "commit": "b431d228b7bbcdaea818bdc3e25b8cdbe861f056" },
"luvit-meta": { "branch": "main", "commit": "ce76f6f6cdc9201523a5875a4471dcfe0186eb60" },
"markdown-preview.nvim": { "branch": "master", "commit": "9becceee5740b7db6914da87358a183ad11b2049" },
"markdown.nvim": { "branch": "main", "commit": "a0777ec640acbf455da32aa856922d4187c5c27f" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "25c11854aa25558ee6c03432edfa0df0217324be" },
"mason.nvim": { "branch": "main", "commit": "c43eeb5614a09dc17c03a7fb49de2e05de203924" },
"middleclass": { "branch": "master", "commit": "9fab4d5bca67262614960960ca35c4740eb2be2c" },
"mini.ai": { "branch": "main", "commit": "a7e90f110e6274262616311b93cef12cd2667a2d" },
"mini.animate": { "branch": "main", "commit": "0a35f6db55cfac04a0999abe3465f7b692dc56a7" },
"mini.hipatterns": { "branch": "main", "commit": "427712c754bfdccd8da7073576cd8e2586c0fe93" },
"mini.icons": { "branch": "main", "commit": "2d89252993fec829b24720097a687412d10f6c85" },
"mini.pairs": { "branch": "main", "commit": "40261dfcec7623cd57be3c3beb50fa73f2650cdf" },
"neo-tree.nvim": { "branch": "main", "commit": "29f7c215332ba95e470811c380ddbce2cebe2af4" },
"neogen": { "branch": "main", "commit": "dc50715c009f89b8111197fd2f282f6042daa7ea" },
"noice.nvim": { "branch": "main", "commit": "448bb9c524a7601035449210838e374a30153172" },
"nui.nvim": { "branch": "main", "commit": "a0fd35fcbb4cb479366f1dc5f20145fd718a3733" },
"nvim-ansible": { "branch": "main", "commit": "9c3b4a771b8c8d7b4f2171466464d978cb3846f7" },
"nvim-cmp": { "branch": "main", "commit": "ae644feb7b67bf1ce4260c231d1d4300b19c6f30" },
"nvim-lint": { "branch": "master", "commit": "a7ce9c78a7c710c28bee56dfab10a5c0c80b7fb5" },
"nvim-lspconfig": { "branch": "master", "commit": "0b8165cf95806bc4bb8f745bb0c92021b2ed4b98" },
"nvim-notify": { "branch": "master", "commit": "d333b6f167900f6d9d42a59005d82919830626bf" },
"nvim-regexplainer": { "branch": "main", "commit": "41c1b90a54e1d6c8f5b0d79ff05104c3877b5025" },
"nvim-snippets": { "branch": "main", "commit": "5fae279c75d8b6bd608574a180b46a605b0a73c3" },
"nvim-treesitter": { "branch": "master", "commit": "4770d9a1a77b0cc2b723c646c3dbe43a9133e5db" },
"nvim-treesitter-textobjects": { "branch": "master", "commit": "bf8d2ad35d1d1a687eae6c065c3d524f7ab61b23" },
"nvim-ts-autotag": { "branch": "main", "commit": "e239a560f338be31337e7abc3ee42515daf23f5e" },
"nvim-ufo": { "branch": "main", "commit": "a5390706f510d39951dd581f6d2a972741b3fa26" },
"outline.nvim": { "branch": "main", "commit": "90fb2f96eed97abe3d1c5c3fef1103ae6bea3cf8" },
"persistence.nvim": { "branch": "main", "commit": "c45ff862b53ce07a853a753fb0b33e148dbb99d2" },
"plenary.nvim": { "branch": "master", "commit": "50012918b2fc8357b87cff2a7f7f0446e47da174" },
"promise-async": { "branch": "main", "commit": "38a4575da9497326badd3995e768b4ccf0bb153e" },
"refactoring.nvim": { "branch": "master", "commit": "c406fc5fb4d7ba5fce7b668637075fad6e75e9f8" },
"statuscol.nvim": { "branch": "main", "commit": "1022f922b77b44c36f8057ac29adbfd89ce86958" },
"stickybuf.nvim": { "branch": "master", "commit": "2160fcd536d81f5fa43f7167dba6634e814e3154" },
"tailwind-sorter.nvim": { "branch": "main", "commit": "efc34952eb0a20520f12c8a273ea44298c11a4fa" },
"tailwindcss-colorizer-cmp.nvim": { "branch": "main", "commit": "3d3cd95e4a4135c250faf83dd5ed61b8e5502b86" },
"telescope-fzf-native.nvim": { "branch": "main", "commit": "cf48d4dfce44e0b9a2e19a008d6ec6ea6f01a83b" },
"telescope-terraform-doc.nvim": { "branch": "main", "commit": "7ac642765615e6ff164ecfc82eb278aa68d06840" },
"telescope-terraform.nvim": { "branch": "main", "commit": "072c97023797ca1a874668aaa6ae0b74425335df" },
"telescope.nvim": { "branch": "master", "commit": "5972437de807c3bc101565175da66a1aa4f8707a" },
"todo-comments.nvim": { "branch": "main", "commit": "313b04e5b02d29ab9275c9295ff5e2b73921b0eb" },
"tokyonight.nvim": { "branch": "main", "commit": "2cd12582c98a3552032824ffa67fd44b4d81184a" },
"trouble.nvim": { "branch": "main", "commit": "40c5317a6e90fe3393f07b0fee580d9e93a216b4" },
"ts-comments.nvim": { "branch": "main", "commit": "79e4337e4231ff8ca33dab85162b5ee8e78f22ce" },
"venv-selector.nvim": { "branch": "regexp", "commit": "2543638b93f6f901614eebffd8536e8c1333e357" },
"vim-repeat": { "branch": "master", "commit": "8106e142dfdc278ff3eaaadd7b362ad7949d4357" },
"vim-wakatime": { "branch": "master", "commit": "87c6861ea81700ec4a6a27c81413cf07cb2c883c" },
"which-key.nvim": { "branch": "main", "commit": "6c1584eb76b55629702716995cca4ae2798a9cca" },
"windows.nvim": { "branch": "main", "commit": "c7492552b23d0ab30325e90b56066ec51242adc8" },
"yanky.nvim": { "branch": "main", "commit": "9268018e92d02650a94e39dd5f5903c542f7ea11" }
}

View File

@@ -0,0 +1,23 @@
return {
{
"nvim-treesitter/nvim-treesitter",
opts = function(_, opts)
vim.list_extend(opts.ensure_installed, {
"bash",
"html",
"javascript",
"json",
"lua",
"markdown",
"markdown_inline",
"python",
"query",
"regex",
"tsx",
"typescript",
"vim",
"yaml",
})
end,
},
}

View File

@@ -0,0 +1,135 @@
-- luacheck: globals vim
return {
-- Neotree configuration
{
"nvim-neo-tree/neo-tree.nvim",
opts = {
filesystem = {
filtered_items = {
always_show = {
".github",
".gitignore",
".editorconfig",
".python-version",
".nvmrc",
".env",
".env.example",
},
},
},
},
},
-- Cloak allows you to overlay *'s over defined patterns in defined files.
-- https://github.com/laytan/cloak.nvim
{ "laytan/cloak.nvim" },
-- Not UFO in the sky, but an ultra fold in Neovim.
-- https://github.com/kevinhwang91/nvim-ufo/
{
"kevinhwang91/nvim-ufo",
lazy = false,
enabled = true,
dependencies = {
"kevinhwang91/promise-async",
{ "nvim-treesitter/nvim-treesitter", run = ":TSUpdate" },
{
"luukvbaal/statuscol.nvim",
config = function()
local builtin = require("statuscol.builtin")
require("statuscol").setup({
relculright = true,
segments = {
{ text = { builtin.foldfunc }, click = "v:lua.ScFa" },
{ text = { "%s" }, click = "v:lua.ScSa" },
{ text = { builtin.lnumfunc, " " }, click = "v:lua.ScLa" },
},
})
end,
},
},
init = function()
vim.o.fillchars = [[eob: ,fold: ,foldopen:,foldsep: ,foldclose:]]
vim.o.foldcolumn = "1" -- '0' is not bad
vim.o.foldlevel = 99 -- Using ufo provider need a large value, feel free to decrease the value
vim.o.foldlevelstart = 99
vim.o.foldenable = true
end,
opts = {
open_fold_hl_timeout = 150,
close_fold_kinds_for_ft = { "imports", "comment" },
preview = {
win_config = {
border = { "", "", "", "", "", "", "", "" },
winhighlight = "Normal:Folded",
winblend = 0,
},
mappings = {
scrollU = "<C-u>",
scrollD = "<C-d>",
jumpTop = "[",
jumpBot = "]",
},
},
provider_selector = function(_, _, _) -- bufnr, filetype, buftype
return { "treesitter", "indent" }
end,
fold_virt_text_handler = function(virtText, lnum, endLnum, width, truncate)
local newVirtText = {}
local suffix = (" 󰁂 %d "):format(endLnum - lnum)
local sufWidth = vim.fn.strdisplaywidth(suffix)
local targetWidth = width - sufWidth
local curWidth = 0
for _, chunk in ipairs(virtText) do
local chunkText = chunk[1]
local chunkWidth = vim.fn.strdisplaywidth(chunkText)
if targetWidth > curWidth + chunkWidth then
table.insert(newVirtText, chunk)
else
chunkText = truncate(chunkText, targetWidth - curWidth)
local hlGroup = chunk[2]
table.insert(newVirtText, { chunkText, hlGroup })
chunkWidth = vim.fn.strdisplaywidth(chunkText)
-- str width returned from truncate() may less than 2nd argument, need padding
if curWidth + chunkWidth < targetWidth then
suffix = suffix .. (" "):rep(targetWidth - curWidth - chunkWidth)
end
break
end
curWidth = curWidth + chunkWidth
end
table.insert(newVirtText, { suffix, "MoreMsg" })
return newVirtText
end,
},
},
-- Indent guides for Neovim
-- https://github.com/lukas-reineke/indent-blankline.nvim
{ "lukas-reineke/indent-blankline.nvim" },
-- Git integration for buffers
-- https://github.com/lewis6991/gitsigns.nvim
{ "lewis6991/gitsigns.nvim" },
-- Close buffer without messing up with the window.
-- https://github.com/famiu/bufdelete.nvim
{ "famiu/bufdelete.nvim" },
-- Neovim plugin for locking a buffer to a window
-- https://github.com/stevearc/stickybuf.nvim
{ "stevearc/stickybuf.nvim", opts = {} },
-- A pretty window for previewing, navigating and editing your LSP locations
-- https://github.com/DNLHC/glance.nvim
{ "dnlhc/glance.nvim" },
-- Automatically expand width of the current window.
-- Maximizes and restore it. And all this with nice animations!
-- https://github.com/anuvyklack/windows.nvim
{
"anuvyklack/windows.nvim",
dependencies = {
"anuvyklack/middleclass",
"anuvyklack/animation.nvim",
},
config = function()
vim.o.winwidth = 15
vim.o.winminwidth = 10
vim.o.equalalways = false
require("windows").setup()
end,
},
}

11
config/nvim/.editorconfig Normal file
View File

@@ -0,0 +1,11 @@
# EditorConfig is awesome: https://editorconfig.org
# top-most EditorConfig file
root = true
[*]
end_of_line = lf
insert_final_newline = true
charset = utf-8
indent_style = space
indent_size = 2

View File

@@ -1,3 +1,5 @@
{
"diagnostics.globals": ["vim"]
}
"diagnostics.globals": [
"vim"
]
}

7
config/nvim/.stylua.toml Normal file
View File

@@ -0,0 +1,7 @@
column_width = 160
line_endings = "Unix"
indent_type = "Spaces"
indent_width = 2
quote_style = "AutoPreferSingle"
call_parentheses = "None"

View File

@@ -1,2 +1,67 @@
-- bootstrap lazy.nvim, LazyVim and your plugins
require("config.lazy")
-- vim: ts=2 sts=2 sw=2 et
-- Install lazylazy
-- https://github.com/folke/lazy.nvim
local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim'
if not vim.loop.fs_stat(lazypath) then
vim.fn.system {
'git',
'clone',
'--filter=blob:none',
'https://github.com/folke/lazy.nvim.git',
'--branch=stable', -- latest stable release
lazypath,
}
end
vim.opt.rtp:prepend(lazypath)
require 'options'
require 'keymaps'
require('lazy').setup {
checker = {
-- Automatically check for updates
enabled = true,
},
spec = {
-- Useful plugin to show you pending keybinds.
-- https://github.com/folke/which-key.nvim
{
'folke/which-key.nvim',
event = 'VimEnter', -- Sets the loading event to 'VimEnter'
priority = 1001, -- Make sure to load this as soon as possible
config = function() -- This is the function that runs, AFTER loading
local wk = require 'which-key'
wk.setup()
wk.add {
{ '<leader>b', group = '[b] Buffer' },
{ '<leader>c', group = '[c] Code' },
{ '<leader>d', group = '[d] Document' },
{ '<leader>f', group = '[f] File' },
{ '<leader>g', group = '[g] Git' },
{ '<leader>l', group = '[l] LSP' },
{ '<leader>o', group = '[o] Open' },
{ '<leader>p', group = '[p] Project' },
{ '<leader>q', group = '[q] Quit' },
{ '<leader>s', group = '[s] Search' },
{ '<leader>t', group = '[t] Toggle' },
{ '<leader>w', group = '[w] Workspace' },
{ '<leader>z', group = '[x] FZF' },
{ '<leader>?', group = '[?] Help' },
{
'<leader>?w',
function()
wk.show { global = false }
end,
desc = 'Buffer Local Keymaps (which-key)',
},
}
end,
},
-- Import plugins from `lua/plugins` directory
{ import = 'plugins' },
},
}
require 'config.misc'

View File

@@ -0,0 +1,74 @@
{
"Comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" },
"LuaSnip": { "branch": "master", "commit": "e808bee352d1a6fcf902ca1a71cee76e60e24071" },
"animation.nvim": { "branch": "main", "commit": "fb77091ab72ec9971aee0562e7081182527aaa6a" },
"auto-dark-mode.nvim": { "branch": "master", "commit": "14cad96b80a07e9e92a0dcbe235092ed14113fb2" },
"bufdelete.nvim": { "branch": "master", "commit": "f6bcea78afb3060b198125256f897040538bcb81" },
"cloak.nvim": { "branch": "main", "commit": "648aca6d33ec011dc3166e7af3b38820d01a71e4" },
"cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" },
"cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" },
"comment-box.nvim": { "branch": "main", "commit": "06bb771690bc9df0763d14769b779062d8f12bc5" },
"conform.nvim": { "branch": "master", "commit": "1a99fdc1d3aa9ccdf3021e67982a679a8c5c740c" },
"copilot.lua": { "branch": "master", "commit": "1a237cf50372830a61d92b0adf00d3b23882e0e1" },
"fidget.nvim": { "branch": "main", "commit": "d855eed8a06531a7e8fd0684889b2943f373c469" },
"fzf": { "branch": "master", "commit": "855f90727af7827d9934b7fa00ea5ed51f5e4e81" },
"fzf.vim": { "branch": "master", "commit": "c5ce7908ee86af7d4090d2007086444afb6ec1c9" },
"git-worktree.nvim": { "branch": "master", "commit": "f247308e68dab9f1133759b05d944569ad054546" },
"gitsigns.nvim": { "branch": "main", "commit": "1ef74b546732f185d0f806860fa5404df7614f28" },
"go.nvim": { "branch": "master", "commit": "97899b2130ec88a5f67f6f669cd7e9137c751a05" },
"goto-preview": { "branch": "main", "commit": "1519ea3512828c944eed5b2bbb66a8f8deb92447" },
"guihua.lua": { "branch": "master", "commit": "225db770e36aae6a1e9e3a65578095c8eb4038d3" },
"harpoon": { "branch": "harpoon2", "commit": "0378a6c428a0bed6a2781d459d7943843f374bce" },
"indent-blankline.nvim": { "branch": "master", "commit": "18603eb949eba08300799f64027af11ef922283f" },
"lazy.nvim": { "branch": "main", "commit": "460e1cd8f24e364d54543a4b0e83f6f4ec1f65fb" },
"lazydev.nvim": { "branch": "main", "commit": "491452cf1ca6f029e90ad0d0368848fac717c6d2" },
"lspkind.nvim": { "branch": "master", "commit": "cff4ae321a91ee3473a92ea1a8c637e3a9510aec" },
"lualine.nvim": { "branch": "master", "commit": "b431d228b7bbcdaea818bdc3e25b8cdbe861f056" },
"luvit-meta": { "branch": "main", "commit": "ce76f6f6cdc9201523a5875a4471dcfe0186eb60" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "25c11854aa25558ee6c03432edfa0df0217324be" },
"mason-tool-installer.nvim": { "branch": "main", "commit": "c5e07b8ff54187716334d585db34282e46fa2932" },
"mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" },
"middleclass": { "branch": "master", "commit": "9fab4d5bca67262614960960ca35c4740eb2be2c" },
"neo-tree.nvim": { "branch": "main", "commit": "8c75e8a2949cd6cd35525799200a8d34471ee9eb" },
"neogit": { "branch": "master", "commit": "9959b58a897036ce89d47385021db1f716613399" },
"noice.nvim": { "branch": "main", "commit": "c1ba80ccf6b3bd8c7fc88fe2e61085131d44ad65" },
"nui.nvim": { "branch": "main", "commit": "b58e2bfda5cea347c9d58b7f11cf3012c7b3953f" },
"nvim-cmp": { "branch": "main", "commit": "ae644feb7b67bf1ce4260c231d1d4300b19c6f30" },
"nvim-dap": { "branch": "master", "commit": "90616ae6ae40053103dc66872886fc26b94c70c8" },
"nvim-dap-go": { "branch": "main", "commit": "5511788255c92bdd845f8d9690f88e2e0f0ff9f2" },
"nvim-dap-ui": { "branch": "master", "commit": "1c351e4e417d4691da12948b6ecf966936a56d28" },
"nvim-dap-virtual-text": { "branch": "master", "commit": "3497eb39bf413a57ab5b7e7e2e192683e462148c" },
"nvim-lint": { "branch": "master", "commit": "c823e2d0621b5c15aa6b46be4d69b1379bcb8fa6" },
"nvim-lspconfig": { "branch": "master", "commit": "f4fef355efa3c5d0813512480ee7b2c050b09fe4" },
"nvim-nio": { "branch": "master", "commit": "a428f309119086dc78dd4b19306d2d67be884eee" },
"nvim-notify": { "branch": "master", "commit": "d333b6f167900f6d9d42a59005d82919830626bf" },
"nvim-regexplainer": { "branch": "main", "commit": "2ec38892e7ce36f0c58b478f3570936fa5bd11f1" },
"nvim-transparent": { "branch": "main", "commit": "8a2749a2fa74f97fe6557f61b89ac7fd873f3c21" },
"nvim-treesitter": { "branch": "master", "commit": "929ca9c76ee20bb27cffbde4ee90583b6c54d616" },
"nvim-treesitter-textobjects": { "branch": "master", "commit": "bf8d2ad35d1d1a687eae6c065c3d524f7ab61b23" },
"nvim-ufo": { "branch": "main", "commit": "a5390706f510d39951dd581f6d2a972741b3fa26" },
"nvim-web-devicons": { "branch": "master", "commit": "26220156aafb198b2de6a4cf80c1b120a3768da0" },
"nvim-window-picker": { "branch": "main", "commit": "41cfaa428577c53552200a404ae9b3a0b5719706" },
"obsidian.nvim": { "branch": "main", "commit": "ae1f76a75c7ce36866e1d9342a8f6f5b9c2caf9b" },
"plenary.nvim": { "branch": "master", "commit": "2d9b06177a975543726ce5c73fca176cedbffe9d" },
"promise-async": { "branch": "main", "commit": "119e8961014c9bfaf1487bf3c2a393d254f337e2" },
"schemastore.nvim": { "branch": "main", "commit": "6e2af7e093a4b92e3dce014aa1cbb5449ad1ebf9" },
"statuscol.nvim": { "branch": "main", "commit": "1022f922b77b44c36f8057ac29adbfd89ce86958" },
"stickybuf.nvim": { "branch": "master", "commit": "183b9569bef78f44b17c078214f7d731f19cbefe" },
"telescope-fzf-native.nvim": { "branch": "main", "commit": "cf48d4dfce44e0b9a2e19a008d6ec6ea6f01a83b" },
"telescope-symbols.nvim": { "branch": "master", "commit": "a6d0127a53d39b9fc2af75bd169d288166118aec" },
"telescope.nvim": { "branch": "master", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" },
"todo-comments.nvim": { "branch": "main", "commit": "ae0a2afb47cf7395dc400e5dc4e05274bf4fb9e0" },
"tokyonight.nvim": { "branch": "main", "commit": "817bb6ffff1b9ce72cdd45d9fcfa8c9cd1ad3839" },
"trouble.nvim": { "branch": "main", "commit": "6efc446226679fda0547c0fd6a7892fd5f5b15d8" },
"twilight.nvim": { "branch": "main", "commit": "1584c0b0a979b71fd86b18d302ba84e9aba85b1b" },
"vim-fugitive": { "branch": "master", "commit": "d4877e54cef67f5af4f950935b1ade19ed6b7370" },
"vim-obsession": { "branch": "master", "commit": "fe9d3e1a9a50171e7d316a52e1e56d868e4c1fe5" },
"vim-pencil": { "branch": "master", "commit": "6d70438a8886eaf933c38a7a43a61adb0a7815ed" },
"vim-sleuth": { "branch": "master", "commit": "be69bff86754b1aa5adcbb527d7fcd1635a84080" },
"vim-surround": { "branch": "master", "commit": "3d188ed2113431cf8dac77be61b842acb64433d9" },
"vim-tmux-navigator": { "branch": "master", "commit": "a9b52e7d36114d40350099f254b5f299a35df978" },
"vim-wakatime": { "branch": "master", "commit": "f699e30ca1ba0c7f316847316fd0ba19d3ee51c1" },
"which-key.nvim": { "branch": "main", "commit": "fb070344402cfc662299d9914f5546d840a22126" },
"windows.nvim": { "branch": "main", "commit": "c7492552b23d0ab30325e90b56066ec51242adc8" }
}

View File

@@ -0,0 +1,10 @@
-- Go
local format_sync_grp = vim.api.nvim_create_augroup('GoFormat', {})
vim.api.nvim_create_autocmd('BufWritePre', {
pattern = '*.go',
callback = function()
require('go.format').goimport()
end,
group = format_sync_grp,
})
require('go').setup()

View File

@@ -0,0 +1,77 @@
vim.api.nvim_set_keymap('i', 'jj', '<Esc>', { noremap = false })
-- twilight
vim.api.nvim_set_keymap('n', 'tw', ':Twilight<enter>', { noremap = false })
-- buffers
vim.api.nvim_set_keymap('n', 'bk', ':blast<enter>', { desc = 'Last', noremap = false })
vim.api.nvim_set_keymap('n', 'bj', ':bfirst<enter>', { desc = 'First', noremap = false })
vim.api.nvim_set_keymap('n', 'bh', ':bprev<enter>', { desc = 'Prev', noremap = false })
vim.api.nvim_set_keymap('n', 'bl', ':bnext<enter>', { desc = 'Next', noremap = false })
vim.api.nvim_set_keymap('n', 'bd', ':bdelete<enter>', { desc = 'Delete', noremap = false })
-- files
vim.api.nvim_set_keymap('n', 'QQ', ':q!<enter>', { desc = 'Quickly Quit', noremap = false })
vim.api.nvim_set_keymap('n', 'WW', ':w!<enter>', { desc = 'Force write', noremap = false })
vim.api.nvim_set_keymap('n', 'E', '$', { noremap = false })
vim.api.nvim_set_keymap('n', 'B', '^', { noremap = false })
vim.api.nvim_set_keymap('n', 'tT', ':TransparentToggle<CR>', { desc = 'Toggle Transparency', noremap = true })
vim.api.nvim_set_keymap('n', 'ss', ':noh<CR>', { noremap = true })
-- splits
vim.api.nvim_set_keymap('n', '<C-W>,', ':vertical resize -10<CR>', { desc = 'V Resize -', noremap = true })
vim.api.nvim_set_keymap('n', '<C-W>.', ':vertical resize +10<CR>', { desc = 'V Resize +', noremap = true })
-- Quicker close split
vim.keymap.set('n', '<leader>qf', ':q<CR>', { desc = 'Quicker close split', silent = true, noremap = true })
-- Keymaps for better default experience
-- See `:help vim.keymap.set()`
vim.keymap.set({ 'n', 'v' }, '<Space>', '<Nop>', { silent = true })
-- Remap for dealing with word wrap
vim.keymap.set('n', 'k', "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true })
vim.keymap.set('n', 'j', "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true })
-- Noice
vim.api.nvim_set_keymap('n', '<leader>nn', ':Noice dismiss<CR>', { desc = 'Noice dismiss', noremap = true })
vim.keymap.set('n', '<leader>xe', '<cmd>GoIfErr<cr>', { desc = 'Go If Error', silent = true, noremap = true })
-- TIP: Disable arrow keys in normal mode
vim.keymap.set('n', '<left>', '<cmd>echo "Use h to move!!"<CR>')
vim.keymap.set('n', '<right>', '<cmd>echo "Use l to move!!"<CR>')
vim.keymap.set('n', '<up>', '<cmd>echo "Use k to move!!"<CR>')
vim.keymap.set('n', '<down>', '<cmd>echo "Use j to move!!"<CR>')
-- Keybinds to make split navigation easier.
-- Use CTRL+<hjkl> to switch between windows
--
-- See `:help wincmd` for a list of all window commands
vim.keymap.set('n', '<C-h>', '<C-w><C-h>', { desc = 'Move focus to the left window' })
vim.keymap.set('n', '<C-l>', '<C-w><C-l>', { desc = 'Move focus to the right window' })
vim.keymap.set('n', '<C-j>', '<C-w><C-j>', { desc = 'Move focus to the lower window' })
vim.keymap.set('n', '<C-k>', '<C-w><C-k>', { desc = 'Move focus to the upper window' })
-- Old habits
vim.keymap.set('n', '<C-s>', '<cmd>w<CR>', { desc = 'Save file' })
vim.keymap.set('n', '<leader>qq', '<cmd>wq!<CR>', { desc = '[qq] Quickly Quit' })
-- Exit terminal mode in the builtin terminal with a shortcut that is a bit easier
-- for people to discover. Otherwise, you normally need to press <C-\><C-n>, which
-- is not what someone will guess without a bit more experience.
--
-- NOTE: This won't work in all terminal emulators/tmux/etc. Try your own mapping
-- or just use <C-\><C-n> to exit terminal mode
vim.keymap.set('t', '<Esc><Esc>', '<C-\\><C-n>', { desc = 'Exit terminal mode' })
-- [[ Highlight on yank ]]
-- See `:help vim.highlight.on_yank()`
local highlight_group = vim.api.nvim_create_augroup('YankHighlight', { clear = true })
vim.api.nvim_create_autocmd('TextYankPost', {
callback = function()
vim.highlight.on_yank()
end,
group = highlight_group,
pattern = '*',
})

View File

@@ -0,0 +1,80 @@
vim.g.mapleader = ' '
vim.g.maplocalleader = ' '
-- Set to true if you have a Nerd Font installed and selected in the terminal
vim.g.have_nerd_font = true
-- Make sure editorconfig support is enabled
vim.g.editorconfig = true
-- [[ Setting options ]]
-- See `:help vim.opt`
-- For more options, you can see `:help option-list`
vim.opt.number = true
vim.opt.relativenumber = true
-- Enable mouse mode, can be useful for resizing splits for example!
vim.opt.mouse = 'a'
-- Don't show the mode, since it's already in the status line
vim.opt.showmode = false
-- Sync clipboard between OS and Neovim.
-- Schedule the setting after `UiEnter` because it can increase startup-time.
-- Remove this option if you want your OS clipboard to remain independent.
-- See `:help 'clipboard'`
vim.schedule(function()
vim.opt.clipboard = 'unnamedplus'
end)
vim.opt.breakindent = true -- Enable break indent
vim.opt.smartindent = true -- Insert indents automatically
-- Save undo history
vim.opt.undofile = true
-- Case-insensitive searching UNLESS \C or one or more capital letters in the search term
vim.opt.ignorecase = true
vim.opt.smartcase = true
-- Keep signcolumn on by default
vim.opt.signcolumn = 'yes'
-- Decrease update time
vim.opt.updatetime = 250
vim.wo.signcolumn = 'yes'
-- Decrease mapped sequence wait time
-- Displays which-key popup sooner
vim.opt.timeoutlen = 300
-- Configure how new splits should be opened
vim.opt.splitright = true
vim.opt.splitbelow = true
-- Sets how neovim will display certain whitespace characters in the editor.
-- See `:help 'list'`
-- and `:help 'listchars'`
vim.opt.list = true
vim.opt.listchars = { tab = '» ', trail = '·', nbsp = '' }
-- Preview substitutions live, as you type!
vim.opt.inccommand = 'split'
-- Show which line your cursor is on
vim.opt.cursorline = true
-- Minimal number of screen lines to keep above and below the cursor.
vim.opt.scrolloff = 10
-- Enable break indent
vim.o.breakindent = true
-- Save undo history
vim.o.undofile = true
-- Set completeopt to have a better completion experience
vim.o.completeopt = 'menuone,noselect'
-- Fixes Notify opacity issues
vim.o.termguicolors = true

View File

@@ -0,0 +1,38 @@
-- Autoformat
-- https://github.com/stevearc/conform.nvim
return {
'stevearc/conform.nvim',
event = { 'BufWritePre' },
cmd = { 'ConformInfo' },
keys = {
{
'<leader>f',
function()
require('conform').format { async = true, lsp_fallback = true }
end,
mode = '',
desc = '[f] Format buffer',
},
},
opts = {
notify_on_error = false,
format_on_save = function(bufnr)
-- Disable "format_on_save lsp_fallback" for languages that don't
-- have a well standardized coding style. You can add additional
-- languages here or re-enable it for the disabled ones.
local disable_filetypes = { c = true, cpp = true }
return {
timeout_ms = 500,
lsp_fallback = not disable_filetypes[vim.bo[bufnr].filetype],
}
end,
formatters_by_ft = {
lua = { 'stylua' },
-- Conform can also run multiple formatters sequentially
-- python = { "isort", "black" },
--
-- You can use 'stop_after_first' to run the first available formatter from the list
javascript = { 'prettierd', 'prettier', stop_after_first = true },
},
},
}

View File

@@ -0,0 +1,60 @@
return {
-- Autocompletion
-- https://github.com/hrsh7th/nvim-cmp
{
'hrsh7th/nvim-cmp',
event = 'InsertEnter',
dependencies = {
'hrsh7th/cmp-nvim-lsp',
'L3MON4D3/LuaSnip',
'saadparwaiz1/cmp_luasnip',
},
config = function()
-- nvim-cmp setup
local cmp = require 'cmp'
local luasnip = require 'luasnip'
cmp.setup {
view = {
entries = 'native',
},
snippet = {
expand = function(args)
luasnip.lsp_expand(args.body)
end,
},
mapping = cmp.mapping.preset.insert {
['<C-d>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-Space>'] = cmp.mapping.complete(),
['<CR>'] = cmp.mapping.confirm {
behavior = cmp.ConfirmBehavior.Replace,
select = true,
},
['<Tab>'] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif luasnip.expand_or_jumpable() then
luasnip.expand_or_jump()
else
fallback()
end
end, { 'i', 's' }),
['<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' }),
},
sources = {
{ name = 'nvim_lsp' },
{ name = 'luasnip' },
},
}
end,
},
}

View File

@@ -0,0 +1,16 @@
-- CoPilot
-- https://github.com/zbirenbaum/copilot.lua
return {
'zbirenbaum/copilot.lua',
cmd = 'Copilot',
build = ':Copilot setup',
event = 'InsertEnter',
opts = {
suggestion = { enabled = false },
panel = { enabled = false },
filetypes = {
markdown = true,
help = true,
},
},
}

View File

@@ -0,0 +1,29 @@
return {
'ray-x/go.nvim',
'ray-x/guihua.lua',
{
'rcarriga/nvim-dap-ui',
dependencies = {
'mfussenegger/nvim-dap',
'nvim-neotest/nvim-nio',
'theHamsta/nvim-dap-virtual-text',
'leoluz/nvim-dap-go',
},
setup = function()
require('dapui').setup()
require('dap-go').setup()
require('nvim-dap-virtual-text').setup()
vim.fn.sign_define('DapBreakpoint', { text = '🔴', texthl = 'DapBreakpoint', linehl = 'DapBreakpoint', numhl = 'DapBreakpoint' })
-- Debugger
vim.api.nvim_set_keymap('n', '<leader>dt', ':DapUiToggle<CR>', { noremap = true })
vim.api.nvim_set_keymap('n', '<leader>db', ':DapToggleBreakpoint<CR>', { noremap = true })
vim.api.nvim_set_keymap('n', '<leader>dc', ':DapContinue<CR>', { noremap = true })
vim.api.nvim_set_keymap('n', '<leader>dr', ":lua require('dapui').open({reset = true})<CR>", { noremap = true })
vim.api.nvim_set_keymap('n', '<leader>ht', ":lua require('harpoon.ui').toggle_quick_menu()<CR>", { noremap = true })
end,
},
}

View File

@@ -0,0 +1,32 @@
return {
-- fzf <3 vim
-- https://github.com/junegunn/fzf.vim
'junegunn/fzf.vim',
dependencies = {
{ 'junegunn/fzf', run = ':call fzf#install()' },
},
config = function()
-- Stolen from https://github.com/erikw/dotfiles/blob/d68d6274d67ac47afa20b9a0b9f3b0fa54bcdaf3/.config/nvim/lua/plugins.lua
-- Comment must be on line of its own...
-- Search for files in given path.
vim.keymap.set('n', '<Leader>zf', ':FZF<space>', { silent = true, desc = 'FZF: search for files in given path.' })
-- Sublime-like shortcut 'go to file' ctrl+p.
vim.keymap.set('n', '<C-p>', ':Files<CR>', { silent = true, desc = 'FZF: search for files starting at current directory.' })
vim.keymap.set('n', '<Leader>zc', ':Commands<CR>', { silent = true, desc = 'FZF: search commands.' })
vim.keymap.set('n', '<Leader>zt', ':Tags<CR>', { silent = true, desc = 'FZF: search in tags file' })
vim.keymap.set('n', '<Leader>zb', ':Buffers<CR>', { silent = true, desc = 'FZF: search open buffers.' })
-- Ref: https://medium.com/@paulodiovani/vim-buffers-windows-and-tabs-an-overview-8e2a57c57afa).
vim.keymap.set('n', '<Leader>zt', ':Windows<CR>', { silent = true, desc = 'FZF: search open tabs.' })
vim.keymap.set('n', '<Leader>zh', ':History<CR>', { silent = true, desc = 'FZF: search history of opened files' })
vim.keymap.set('n', '<Leader>zm', ':Maps<CR>', { silent = true, desc = 'FZF: search mappings.' })
vim.keymap.set('n', '<Leader>zg', ':Rg<CR>', { silent = true, desc = 'FZF: search with rg (aka live grep).' })
-- To ignore a certain path in a git project from both RG and FD used by FZF,
-- the eaiest way is to create ignore files and exclude the in local git clone.
-- Ref: https://stackoverflow.com/a/1753078/265508
-- $ cd git_proj/
-- $ echo "path/to/exclude" > .rgignore
-- $ echo "path/to/exclude" > .fdignore
-- $ printf ".rgignore\n.fdignore" >> .git/info/exclude
end,
}

View File

@@ -0,0 +1,116 @@
return {
-- fugitive.vim: A Git wrapper so awesome, it should be illegal
-- https://github.com/tpope/vim-fugitive
{ 'tpope/vim-fugitive' },
-- Git integration for buffers
-- https://github.com/lewis6991/gitsigns.nvim
{
'lewis6991/gitsigns.nvim',
config = function()
require('gitsigns').setup {
signs = {
add = { text = '+' },
change = { text = '~' },
delete = { text = '_' },
topdelete = { text = '' },
changedelete = { text = '~' },
},
current_line_blame = false,
on_attach = function(bufnr)
local gs = package.loaded.gitsigns
local function map(mode, l, r, opts)
opts = opts or {}
opts.buffer = bufnr
vim.keymap.set(mode, l, r, opts)
end
-- Navigation
map('n', ']c', function()
if vim.wo.diff then
return ']c'
end
vim.schedule(function()
gs.next_hunk()
end)
return '<Ignore>'
end, { expr = true })
map('n', '[c', function()
if vim.wo.diff then
return '[c'
end
vim.schedule(function()
gs.prev_hunk()
end)
return '<Ignore>'
end, { expr = true })
-- Actions
map({ 'n', 'v' }, '<leader>hs', ':Gitsigns stage_hunk<CR>')
map({ 'n', 'v' }, '<leader>hr', ':Gitsigns reset_hunk<CR>')
map('n', '<leader>hS', gs.stage_buffer)
map('n', '<leader>ha', gs.stage_hunk)
map('n', '<leader>hu', gs.undo_stage_hunk)
map('n', '<leader>hR', gs.reset_buffer)
map('n', '<leader>hp', gs.preview_hunk)
map('n', '<leader>hb', function()
gs.blame_line { full = true }
end)
map('n', '<leader>tB', gs.toggle_current_line_blame)
map('n', '<leader>hd', gs.diffthis)
map('n', '<leader>hD', function()
gs.diffthis '~'
end)
-- Text object
map({ 'o', 'x' }, 'ih', ':<C-U>Gitsigns select_hunk<CR>')
end,
}
end,
},
-- git-worktree.nvim: Manage git worktrees
-- https://github.com/ThePrimeagen/git-worktree.nvim
{
'ThePrimeagen/git-worktree.nvim',
config = function()
require('git-worktree').setup()
end,
},
-- An interactive and powerful Git interface for Neovim, inspired by Magit
-- https://github.com/NeogitOrg/neogit
{
'NeogitOrg/neogit',
config = function()
-- This contains mainly Neogit but also a bunch of Git settings
-- like fetching branches with telescope or blaming with fugitive
local neogit = require 'neogit'
vim.keymap.set('n', '<leader>gs', neogit.open, { silent = true, noremap = true })
vim.keymap.set('n', '<leader>gc', ':Neogit commit<CR>', { silent = true, noremap = true })
vim.keymap.set('n', '<leader>gp', ':Neogit pull<CR>', { silent = true, noremap = true })
vim.keymap.set('n', '<leader>gP', ':Neogit push<CR>', { silent = true, noremap = true })
vim.keymap.set('n', '<leader>gb', ':Telescope git_branches<CR>', { silent = true, noremap = true })
vim.keymap.set('n', '<leader>gB', ':G blame<CR>', { silent = true, noremap = true })
neogit.setup {
disable_commit_confirmation = true,
disable_signs = false,
disable_context_highlighting = false,
disable_builtin_notifications = false,
signs = {
section = { '', '' },
item = { '', '' },
hunk = { '', '' },
},
integrations = {
diffview = true,
},
}
end,
},
}

View File

@@ -0,0 +1,29 @@
return {
-- A small Neovim plugin for previewing definitions using floating windows.
-- https://github.com/rmagatti/goto-preview
'rmagatti/goto-preview',
config = function()
require('goto-preview').setup {
width = 120, -- Width of the floating window
height = 15, -- Height of the floating window
border = { '', '', '', '', '', '', '', '' }, -- Border characters of the floating window
default_mappings = true,
debug = false, -- Print debug information
opacity = nil, -- 0-100 opacity level of the floating window where 100 is fully transparent.
resizing_mappings = false, -- Binds arrow keys to resizing the floating window.
post_open_hook = nil, -- A function taking two arguments, a buffer and a window to be ran as a hook.
references = { -- Configure the telescope UI for slowing the references cycling window.
telescope = require('telescope.themes').get_dropdown {
hide_preview = false,
},
},
-- These two configs can also be passed down to the goto-preview definition and implementation calls for one off "peak" functionality.
focus_on_open = true, -- Focus the floating window when opening it.
dismiss_on_move = false, -- Dismiss the floating window when moving the cursor.
force_close = true, -- passed into vim.api.nvim_win_close's second argument. See :h nvim_win_close
bufhidden = 'wipe', -- the bufhidden option to set on the floating window. See :h bufhidden
stack_floating_preview_windows = true, -- Whether to nest floating windows
preview_window_title = { enable = true, position = 'left' },
}
end,
}

View File

@@ -0,0 +1,103 @@
return {
-- Getting you where you want with the fewest keystrokes.
-- https://github.com/ThePrimeagen/harpoon
{
'ThePrimeagen/harpoon',
branch = 'harpoon2',
dependencies = {
'nvim-lua/plenary.nvim',
'nvim-telescope/telescope.nvim',
},
config = function()
local harpoon = require 'harpoon'
harpoon:setup {}
vim.keymap.set('n', '<leader>ht', function()
harpoon.ui:toggle_quick_menu(harpoon:list())
end)
-- basic telescope configuration
local conf = require('telescope.config').values
local function toggle_telescope(harpoon_files)
local file_paths = {}
for _, item in ipairs(harpoon_files.items) do
table.insert(file_paths, item.value)
end
require('telescope.pickers')
.new({}, {
prompt_title = 'Harpoon',
finder = require('telescope.finders').new_table {
results = file_paths,
},
previewer = conf.file_previewer {},
sorter = conf.generic_sorter {},
})
:find()
end
vim.keymap.set('n', '<leader>xa', function()
toggle_telescope(harpoon:list())
end, { desc = 'Open harpoon window' })
end,
keys = {
{
'<leader>xa',
function()
require('harpoon'):list():add()
end,
desc = 'harpoon file',
},
{
'<leader>xN',
function()
require('harpoon'):list():prev()
end,
desc = 'harpoon to previous file',
},
{
'<leader>xn',
function()
require('harpoon'):list():next()
end,
desc = 'harpoon to next file',
},
{
'<leader>1',
function()
require('harpoon'):list():select(1)
end,
desc = 'harpoon to file 1',
},
{
'<leader>2',
function()
require('harpoon'):list():select(2)
end,
desc = 'harpoon to file 2',
},
{
'<leader>3',
function()
require('harpoon'):list():select(3)
end,
desc = 'harpoon to file 3',
},
{
'<leader>4',
function()
require('harpoon'):list():select(4)
end,
desc = 'harpoon to file 4',
},
{
'<leader>5',
function()
require('harpoon'):list():select(5)
end,
desc = 'harpoon to file 5',
},
},
},
}

View File

@@ -0,0 +1,72 @@
return {
-- vscode-like pictograms for neovim lsp completion items
-- https://github.com/onsails/lspkind-nvim
{ 'onsails/lspkind.nvim' },
-- Rethinking Vim as a tool for writing
-- https://github.com/preservim/vim-pencil
{ 'preservim/vim-pencil' },
-- obsession.vim: continuously updated session files
-- https://github.com/tpope/vim-obsession
{ 'tpope/vim-obsession' },
-- surround.vim: Delete/change/add parentheses/quotes/XML-tags/much more with ease
-- https://github.com/tpope/vim-surround
{ 'tpope/vim-surround' },
-- Highlight, list and search todo comments in your projects
-- https://github.com/folke/todo-comments.nvim
{
'folke/todo-comments.nvim',
dependencies = 'nvim-lua/plenary.nvim',
config = function()
require('todo-comments').setup {}
end,
},
-- LSP Configuration & Plugins
{
-- `lazydev` configures Lua LSP for your Neovim config, runtime and plugins
-- used for completion, annotations and signatures of Neovim apis
'folke/lazydev.nvim',
ft = 'lua',
opts = {
library = {
-- Load luvit types when the `vim.uv` word is found
{ path = 'luvit-meta/library', words = { 'vim%.uv' } },
},
},
},
-- Meta type definitions for the Lua platform Luvit.
-- https://github.com/Bilal2453/luvit-meta
{ 'Bilal2453/luvit-meta', lazy = true },
-- Indent guides for Neovim
-- https://github.com/lukas-reineke/indent-blankline.nvim
{
'lukas-reineke/indent-blankline.nvim',
main = 'ibl',
opts = {},
},
-- Commenting
-- https://github.com/numToStr/Comment.nvim
{
'numToStr/Comment.nvim', -- "gc" to comment visual regions/lines
event = { 'BufRead', 'BufNewFile' },
config = function()
require('Comment').setup()
end,
},
-- Detect tabstop and shiftwidth automatically
-- https://github.com/tpope/vim-sleuth
{ 'tpope/vim-sleuth' },
-- Vim plugin for automatic time tracking and metrics
-- generated from your programming activity.
-- https://github.com/wakatime/vim-wakatime
{ 'wakatime/vim-wakatime', lazy = false, enabled = true },
}

View File

@@ -0,0 +1,55 @@
return {
{ -- Linting
'mfussenegger/nvim-lint',
event = { 'BufReadPre', 'BufNewFile' },
config = function()
local lint = require 'lint'
lint.linters_by_ft = {
markdown = { 'markdownlint' },
}
-- To allow other plugins to add linters to require('lint').linters_by_ft,
-- instead set linters_by_ft like this:
-- lint.linters_by_ft = lint.linters_by_ft or {}
-- lint.linters_by_ft['markdown'] = { 'markdownlint' }
--
-- However, note that this will enable a set of default linters,
-- which will cause errors unless these tools are available:
-- {
-- clojure = { "clj-kondo" },
-- dockerfile = { "hadolint" },
-- inko = { "inko" },
-- janet = { "janet" },
-- json = { "jsonlint" },
-- markdown = { "vale" },
-- rst = { "vale" },
-- ruby = { "ruby" },
-- terraform = { "tflint" },
-- text = { "vale" }
-- }
--
-- You can disable the default linters by setting their filetypes to nil:
-- lint.linters_by_ft['clojure'] = nil
-- lint.linters_by_ft['dockerfile'] = nil
-- lint.linters_by_ft['inko'] = nil
-- lint.linters_by_ft['janet'] = nil
-- lint.linters_by_ft['json'] = nil
-- lint.linters_by_ft['markdown'] = nil
-- lint.linters_by_ft['rst'] = nil
-- lint.linters_by_ft['ruby'] = nil
-- lint.linters_by_ft['terraform'] = nil
-- lint.linters_by_ft['text'] = nil
-- Create autocommand which carries out the actual linting
-- on the specified events.
local lint_augroup = vim.api.nvim_create_augroup('lint', { clear = true })
vim.api.nvim_create_autocmd({ 'BufEnter', 'BufWritePost', 'InsertLeave' }, {
group = lint_augroup,
callback = function()
lint.try_lint()
end,
})
end,
},
}

View File

@@ -0,0 +1,245 @@
-- Quickstart configs for Nvim LSP
-- https://github.com/neovim/nvim-lspconfig
return {
'neovim/nvim-lspconfig',
dependencies = {
-- Automatically install LSPs to stdpath for neovim
'williamboman/mason.nvim',
'williamboman/mason-lspconfig.nvim',
'WhoIsSethDaniel/mason-tool-installer.nvim',
-- Useful status updates for LSP
{
'j-hui/fidget.nvim',
opts = {
notification = {
window = {
winblend = 50,
align = 'top',
},
},
},
},
'b0o/schemastore.nvim',
},
config = function()
-- Diagnostic keymaps
vim.keymap.set('n', 'dp', vim.diagnostic.goto_prev, { desc = 'Diagnostic: Goto Prev' })
vim.keymap.set('n', 'dn', vim.diagnostic.goto_next, { desc = 'Diagnostic: Goto Next' })
vim.keymap.set('n', '<leader>do', vim.diagnostic.open_float, { desc = 'Diagnostic: Open float' })
vim.keymap.set('n', '<leader>dq', vim.diagnostic.setloclist, { desc = 'Diagnostic: Set loc list' })
-- LSP settings.
-- This function gets run when an LSP connects to a particular buffer.
local on_attach = function(_, bufnr)
local nmap = function(keys, func, desc)
if desc then
desc = 'LSP: ' .. desc
end
vim.keymap.set('n', keys, func, { buffer = bufnr, desc = desc })
end
nmap('<leader>rn', vim.lsp.buf.rename, '[R]e[n]ame')
nmap('<leader>ca', vim.lsp.buf.code_action, '[C]ode [A]ction')
nmap('gd', vim.lsp.buf.definition, '[G]oto [D]efinition')
nmap('gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences')
nmap('gI', vim.lsp.buf.implementation, '[G]oto [I]mplementation')
nmap('<leader>D', vim.lsp.buf.type_definition, 'Type [D]efinition')
nmap('<leader>ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols')
nmap('<leader>ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols')
-- See `:help K` for why this keymap
nmap('K', vim.lsp.buf.hover, 'Hover Documentation')
nmap('<C-k>', vim.lsp.buf.signature_help, 'Signature Documentation')
-- Lesser used LSP functionality
nmap('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration')
nmap('<leader>wa', vim.lsp.buf.add_workspace_folder, '[W]orkspace [A]dd Folder')
nmap('<leader>wr', vim.lsp.buf.remove_workspace_folder, '[W]orkspace [R]emove Folder')
nmap('<leader>wl', function()
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
end, '[W]orkspace [L]ist Folders')
-- Create a command `:Format` local to the LSP buffer
vim.api.nvim_buf_create_user_command(bufnr, 'Format', function(_)
if vim.lsp.buf.format then
vim.lsp.buf.format()
elseif vim.lsp.buf.formatting then
vim.lsp.buf.formatting()
end
end, { desc = 'Format current buffer with LSP' })
end
-- Setup mason so it can manage external tooling
require('mason').setup()
-- Enable the following language servers
-- Feel free to add/remove any LSPs that you want here. They will automatically be installed.
local servers = {
-- :help lspconfig-all for all pre-configured LSPs
ast_grep = {},
actionlint = {}, -- GitHub Actions
ansiblels = {}, -- Ansible
bashls = {}, -- Bash
css_variables = {}, -- CSS
cssls = {}, -- CSS
docker_compose_language_service = {}, -- Docker compose
dockerls = {}, -- Docker
eslint = {}, -- ESLint
gitlab_ci_ls = {}, -- GitLab CI
gopls = {}, -- Go
grammarly = {}, -- Grammar and better writing
html = {}, -- HTML
intelephense = {}, -- PHP
jinja_lsp = {}, -- Jinja templates
pest_ls = {}, -- Pest (PHP)
phpactor = {}, -- PHP
psalm = {}, -- PHP
pyright = {}, -- Python
semgrep = {}, -- Security
shellcheck = {}, -- Shell scripts
shfmt = {}, -- Shell scripts formatting
stylelint_lsp = {}, -- Stylelint for S/CSS
stylua = {}, -- Used to format Lua code
tailwindcss = {}, -- Tailwind CSS
terraformls = {}, -- Terraform
tflint = {}, -- Terraform
ts_ls = {}, -- TypeScript/JS
typos_lsp = {}, -- Better writing
volar = {}, -- Vue
yamlls = {}, -- YAML
lua_ls = {
-- cmd = {...},
-- filetypes = { ...},
-- capabilities = {},
settings = {
Lua = {
completion = {
callSnippet = 'Replace',
},
-- You can toggle below to ignore Lua_LS's noisy `missing-fields` warnings
diagnostics = { disable = { 'missing-fields' } },
},
},
},
jsonls = {
settings = {
json = {
schemas = require('schemastore').json.schemas(),
validate = { enable = true },
},
yaml = {
schemaStore = {
-- You must disable built-in schemaStore support if you want to use
-- this plugin and its advanced options like `ignore`.
enable = false,
-- Avoid TypeError: Cannot read properties of undefined (reading 'length')
url = '',
},
schemas = require('schemastore').yaml.schemas(),
},
},
},
}
local ensure_installed = vim.tbl_keys(servers or {})
vim.list_extend(ensure_installed, {
'actionlint',
'ansible-language-server',
'ansible-lint',
'bash-language-server',
'blade-formatter',
'cfn-lint',
'codeql',
'codespell',
'commitlint',
'diagnostic-languageserver',
'docker-compose-language-service',
'dockerfile-language-server',
'editorconfig-checker',
'fixjson',
'flake8',
'html-lsp',
'jq',
'jsonlint',
'luacheck',
'nginx-language-server',
'php-cs-fixer',
'phpcs',
'phpmd',
'semgrep',
'shellcheck',
'shfmt',
'stylelint',
'stylua',
'yamllint',
})
require('mason-tool-installer').setup {
ensure_installed = ensure_installed,
auto_update = true,
}
-- Ensure the servers above are installed
require('mason-lspconfig').setup {
automatic_installation = true,
ensure_installed = servers,
}
-- nvim-cmp supports additional completion capabilities
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities)
for _, lsp in ipairs(servers) do
require('lspconfig')[lsp].setup {
on_attach = on_attach,
capabilities = capabilities,
}
end
-- Turn on lsp status information
require('fidget').setup()
-- Example custom configuration for lua
--
-- Make runtime files discoverable to the server
local runtime_path = vim.split(package.path, ';')
table.insert(runtime_path, 'lua/?.lua')
table.insert(runtime_path, 'lua/?/init.lua')
require('lspconfig').lua_ls.setup {
on_attach = on_attach,
capabilities = capabilities,
settings = {
Lua = {
runtime = {
-- Tell the language server which version of Lua you're using (most likely LuaJIT)
version = 'LuaJIT',
-- Setup your lua path
path = runtime_path,
},
diagnostics = {
globals = { 'vim' },
},
workspace = {
library = vim.api.nvim_get_runtime_file('', true),
checkThirdParty = false,
},
-- Do not send telemetry data containing a randomized but unique identifier
telemetry = { enable = false },
},
},
}
vim.api.nvim_create_autocmd('FileType', {
pattern = 'sh',
callback = function()
vim.lsp.start {
name = 'bash-language-server',
cmd = { 'bash-language-server', 'start' },
}
end,
})
end,
}

View File

@@ -0,0 +1,33 @@
-- Fancier statusline
-- https://github.com/nvim-lualine/lualine.nvim
return {
'nvim-lualine/lualine.nvim',
config = function()
require('lualine').setup {
options = {
icons_enabled = true,
component_separators = '|',
section_separators = '',
},
sections = {
lualine_x = {
{
require('noice').api.statusline.mode.get,
cond = require('noice').api.statusline.mode.has,
-- color = { fg = '#ff9e64' },
},
{
require('noice').api.status.command.get,
cond = require('noice').api.status.command.has,
-- color = { fg = '#ff9e64' },
},
},
lualine_a = {
{
'buffers',
},
},
},
}
end,
}

View File

@@ -0,0 +1,95 @@
-- Neo-tree is a Neovim plugin to browse the file system
-- https://github.com/nvim-neo-tree/neo-tree.nvim
return {
'nvim-neo-tree/neo-tree.nvim',
version = '*',
dependencies = {
'nvim-lua/plenary.nvim',
'nvim-tree/nvim-web-devicons', -- not strictly required, but recommended
'MunifTanjim/nui.nvim',
{
's1n7ax/nvim-window-picker',
version = '2.*',
config = function()
require('window-picker').setup {
filter_rules = {
include_current_win = false,
autoselect_one = true,
-- filter using buffer options
bo = {
-- if the file type is one of following, the window will be ignored
filetype = { 'neo-tree', 'neo-tree-popup', 'notify' },
-- if the buffer type is one of following, the window will be ignored
buftype = { 'terminal', 'quickfix' },
},
},
}
end,
},
},
cmd = 'Neotree',
keys = {
{ '<leader>e', ':Neotree reveal<CR>', { desc = 'NeoTree reveal' } },
},
opts = {
close_if_last_window = true,
filesystem = {
window = {
mappings = {
['<Esc>'] = 'close_window',
},
},
filtered_items = {
hide_dotfiles = true,
hide_gitignored = true,
hide_hidden = true, -- only works on Windows for hidden files/directories
hide_by_name = {
'.DS_Store',
'node_modules',
},
always_show = {
'.actrc',
'.browserslistrc',
'.commitlintrc.json',
'.editorconfig',
'.env',
'.env.example',
'.envrc',
'.eslintrc.json',
'.github',
'.gitignore',
'.gitkeep',
'.ignore',
'.markdownlint.json',
'.markdownlint.yaml',
'.markdownlintignore',
'.nvmrc',
'.prettierignore',
'.prettierrc.js',
'.prettierrc.json',
'.prettierrc.yaml',
'.python-version',
'.releaserc.json',
'.shellcheckrc',
'.simple-git-hooks.json',
'.stylelintrc.json',
'.stylua.toml',
'.yamlignore',
'.yamllint.yaml',
},
always_show_by_pattern = {
'.*.json',
'.*.toml',
'.*.yaml',
'.*.yml',
'.*rc',
'.*rc.*',
'.env*',
'.prettierrc*',
'.stylua.*',
},
},
},
},
}

View File

@@ -0,0 +1,80 @@
return {
-- Highly experimental plugin that completely replaces the UI
-- for messages, cmdline and the popupmenu.
-- https://github.com/folke/noice.nvim
{
'folke/noice.nvim',
dependencies = {
'MunifTanjim/nui.nvim',
-- A fancy, configurable, notification manager for NeoVim
-- https://github.com/rcarriga/nvim-notify
{
'rcarriga/nvim-notify',
config = function()
require('notify').setup {
background_colour = '#000000',
enabled = false,
}
end,
},
},
setup = function()
vim.g.noice_ignored_filetypes = { 'fugitiveblame', 'fugitive', 'gitcommit' }
require('noice').setup {
-- you can enable a preset for easier configuration
presets = {
bottom_search = true, -- use a classic bottom cmdline for search
command_palette = true, -- position the cmdline and popupmenu together
long_message_to_split = true, -- long messages will be sent to a split
inc_rename = false, -- enables an input dialog for inc-rename.nvim
lsp_doc_border = false, -- add a border to hover docs and signature help
},
views = {
cmdline_popup = {
position = {
row = 5,
col = '50%',
},
size = {
width = 60,
height = 'auto',
},
},
popupmenu = {
relative = 'editor',
position = {
row = 8,
col = '50%',
},
size = {
width = 60,
height = 10,
},
border = {
style = 'rounded',
padding = { 0, 1 },
},
win_options = {
winhighlight = { Normal = 'Normal', FloatBorder = 'DiagnosticInfo' },
},
},
},
routes = {
{
filter = {
event = 'msg_show',
any = {
{ find = '%d+L, %d+B' },
{ find = '; after #%d+' },
{ find = '; before #%d+' },
{ find = '%d fewer lines' },
{ find = '%d more lines' },
},
},
opts = { skip = true },
},
},
}
end,
},
}

View File

@@ -0,0 +1,19 @@
return {
'epwalsh/obsidian.nvim',
version = '*', -- recommended, use latest release instead of latest commit
lazy = true,
ft = 'markdown',
dependencies = {
'nvim-lua/plenary.nvim',
},
config = function()
require('obsidian').setup {
workspaces = {
{
name = 'Notes',
path = vim.fn.expand '$HOME/Code/ivuorinen/obsidian',
},
},
}
end,
}

View File

@@ -0,0 +1,85 @@
return {
-- Fuzzy Finder (files, lsp, etc)
-- https://github.com/nvim-telescope/telescope.nvim
{
'nvim-telescope/telescope.nvim',
version = '*',
dependencies = {
{ 'nvim-lua/plenary.nvim' },
{ 'nvim-telescope/telescope-symbols.nvim' },
-- Fuzzy Finder Algorithm which requires local dependencies to be built.
-- Only load if `make` is available
{
'nvim-telescope/telescope-fzf-native.nvim',
build = 'make',
cond = vim.fn.executable 'make' == 1,
},
},
setup = function()
local t = require 'telescope'
local a = require 'telescope.actions'
local b = require 'telescope.builtin'
local themes = require 'telescope.themes'
require('telescope').load_extension 'harpoon'
t.load_extension 'git_worktree'
-- [[ Configure Telescope ]]
-- See `:help telescope` and `:help telescope.setup()`
t.setup {
defaults = {
layout_strategy = 'horizontal',
layout_config = {
preview_width = 0.65,
horizontal = {
size = {
width = '95%',
height = '95%',
},
},
},
pickers = {
find_files = {
theme = 'dropdown',
},
},
mappings = {
i = {
['<C-u>'] = false,
['<C-j>'] = a.move_selection_next,
['<C-k>'] = a.move_selection_previous,
['<C-d>'] = a.move_selection_previous,
},
},
},
}
-- Enable telescope fzf native, if installed
pcall(t.load_extension, 'fzf')
-- See `:help telescope.builtin`
vim.keymap.set('n', '<leader>so', b.oldfiles, { desc = '[?] Find recently opened files' })
vim.keymap.set('n', '<leader>/', function()
-- You can pass additional configuration to telescope to change theme, layout, etc.
b.current_buffer_fuzzy_find(themes.get_dropdown {
winblend = 10,
previewer = true,
})
end, { desc = '[/] Fuzzily search in current buffer]' })
vim.keymap.set('n', '<leader>sf', b.find_files, { desc = '[S]earch [F]iles' })
vim.keymap.set('n', '<leader>sw', b.grep_string, { desc = '[S]earch current [W]ord' })
vim.keymap.set('n', '<leader>sg', b.live_grep, { desc = '[S]earch by [G]rep' })
vim.keymap.set('n', '<leader>sd', b.diagnostics, { desc = '[S]earch [D]iagnostics' })
vim.keymap.set('n', '<leader>sb', b.buffers, { desc = '[ ] Find existing buffers' })
vim.keymap.set('n', '<leader>sS', b.git_status, { desc = '' })
vim.keymap.set('n', '<leader>sm', ':Telescope harpoon marks<CR>', { desc = 'Harpoon [M]arks' })
vim.keymap.set('n', '<Leader>sr', "<CMD>lua require('telescope').extensions.git_worktree.git_worktrees()<CR>")
vim.keymap.set('n', '<Leader>sR', "<CMD>lua require('telescope').extensions.git_worktree.create_git_worktree()<CR>")
vim.keymap.set('n', '<Leader>sn', "<CMD>lua require('telescope').extensions.notify.notify()<CR>")
vim.api.nvim_set_keymap('n', 'st', ':TodoTelescope<CR>', { noremap = true })
vim.api.nvim_set_keymap('n', '<Leader><tab>', "<Cmd>lua require('telescope.builtin').commands()<CR>", { noremap = false })
end,
},
}

View File

@@ -1,23 +1,107 @@
return {
{
"nvim-treesitter/nvim-treesitter",
opts = function(_, opts)
vim.list_extend(opts.ensure_installed, {
"bash",
"html",
"javascript",
"json",
"lua",
"markdown",
"markdown_inline",
"python",
"query",
"regex",
"tsx",
"typescript",
"vim",
"yaml",
})
end,
-- Highlight, edit, and navigate code
-- https://github.com/nvim-treesitter/nvim-treesitter
'nvim-treesitter/nvim-treesitter',
build = function()
pcall(require('nvim-treesitter.install').update { with_sync = true })
end,
dependencies = {
'nvim-treesitter/nvim-treesitter-textobjects',
},
config = function()
require('nvim-treesitter.configs').setup {
-- Add languages to be installed here that you want installed for treesitter
ensure_installed = {
'bash',
'c',
'css',
'diff',
'go',
'html',
'javascript',
'jsdoc',
'json',
'jsonc',
'lua',
'luadoc',
'markdown',
'markdown_inline',
'python',
'query',
'regex',
'rust',
'sql',
'terraform',
'toml',
'tsx',
'typescript',
'vim',
'vimdoc',
'xml',
'yaml',
},
highlight = { enable = true },
indent = { enable = true },
incremental_selection = {
enable = true,
keymaps = {
init_selection = '<c-space>',
node_incremental = '<c-space>',
scope_incremental = '<c-s>',
node_decremental = '<c-backspace>',
},
},
textobjects = {
select = {
enable = true,
lookahead = true, -- Automatically jump forward to textobj, similar to targets.vim
keymaps = {
-- You can use the capture groups defined in textobjects.scm
['aa'] = '@parameter.outer',
['ia'] = '@parameter.inner',
['af'] = '@function.outer',
['if'] = '@function.inner',
['ac'] = '@class.outer',
['ic'] = '@class.inner',
['ii'] = '@conditional.inner',
['ai'] = '@conditional.outer',
['il'] = '@loop.inner',
['al'] = '@loop.outer',
['at'] = '@comment.outer',
},
},
move = {
enable = true,
set_jumps = true, -- whether to set jumps in the jumplist
goto_next_start = {
[']f'] = '@function.outer',
[']]'] = '@class.outer',
},
goto_next_end = {
[']F'] = '@function.outer',
[']['] = '@class.outer',
},
goto_previous_start = {
['[f'] = '@function.outer',
['[['] = '@class.outer',
},
goto_previous_end = {
['[F'] = '@function.outer',
['[]'] = '@class.outer',
},
},
swap = {
enable = true,
swap_next = {
['<leader>a'] = '@parameter.inner',
},
swap_previous = {
['<leader>A'] = '@parameter.inner',
},
},
},
}
end,
}

View File

@@ -0,0 +1,32 @@
return {
'folke/trouble.nvim',
lazy = false,
dependencies = 'nvim-tree/nvim-web-devicons',
config = function()
require('trouble').setup {
auto_preview = false,
auto_fold = true,
auto_close = true,
use_lsp_diagnostic_signs = true,
}
vim.keymap.set('n', '<leader>xx', '<cmd>TroubleToggle<cr>', { silent = true, noremap = true })
vim.keymap.set('n', '<leader>xw', '<cmd>TroubleToggle workspace_diagnostics<cr>', { silent = true, noremap = true })
vim.keymap.set('n', '<leader>xd', '<cmd>TroubleToggle document_diagnostics<cr>', { silent = true, noremap = true })
vim.keymap.set('n', '<leader>xl', '<cmd>TroubleToggle loclist<cr>', { silent = true, noremap = true })
vim.keymap.set('n', '<leader>xq', '<cmd>TroubleToggle quickfix<cr>', { silent = true, noremap = true })
vim.keymap.set('n', 'gR', '<cmd>TroubleToggle lsp_references<cr>', { silent = true, noremap = true })
-- Diagnostic signs
-- https://github.com/folke/trouble.nvim/issues/52
local signs = {
Error = '',
Warning = '',
Hint = '',
Information = '',
}
for type, icon in pairs(signs) do
local hl = 'DiagnosticSign' .. type
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl })
end
end,
}

View File

@@ -0,0 +1,84 @@
local handler = function(virtText, lnum, endLnum, width, truncate)
local newVirtText = {}
local suffix = (' 󰁂 %d '):format(endLnum - lnum)
local sufWidth = vim.fn.strdisplaywidth(suffix)
local targetWidth = width - sufWidth
local curWidth = 0
for _, chunk in ipairs(virtText) do
local chunkText = chunk[1]
local chunkWidth = vim.fn.strdisplaywidth(chunkText)
if targetWidth > curWidth + chunkWidth then
table.insert(newVirtText, chunk)
else
chunkText = truncate(chunkText, targetWidth - curWidth)
local hlGroup = chunk[2]
table.insert(newVirtText, { chunkText, hlGroup })
chunkWidth = vim.fn.strdisplaywidth(chunkText)
-- str width returned from truncate() may less than 2nd argument, need padding
if curWidth + chunkWidth < targetWidth then
suffix = suffix .. (' '):rep(targetWidth - curWidth - chunkWidth)
end
break
end
curWidth = curWidth + chunkWidth
end
table.insert(newVirtText, { suffix, 'MoreMsg' })
return newVirtText
end
return {
-- Not UFO in the sky, but an ultra fold in Neovim.
-- https://github.com/kevinhwang91/nvim-ufo/
{
'kevinhwang91/nvim-ufo',
lazy = false,
enabled = true,
version = '*',
dependencies = {
'kevinhwang91/promise-async',
{ 'nvim-treesitter/nvim-treesitter', run = ':TSUpdate' },
{
'luukvbaal/statuscol.nvim',
config = function()
local builtin = require 'statuscol.builtin'
require('statuscol').setup {
relculright = true,
segments = {
{ text = { builtin.foldfunc }, click = 'v:lua.ScFa' },
{ text = { '%s' }, click = 'v:lua.ScSa' },
{ text = { builtin.lnumfunc, ' ' }, click = 'v:lua.ScLa' },
},
}
end,
},
},
init = function()
vim.o.fillchars = [[eob: ,fold: ,foldopen:,foldsep: ,foldclose:]]
vim.o.foldcolumn = '1' -- '0' is not bad
vim.o.foldlevel = 99 -- Using ufo provider need a large value, feel free to decrease the value
vim.o.foldlevelstart = 99
vim.o.foldenable = true
end,
opts = {
open_fold_hl_timeout = 150,
close_fold_kinds_for_ft = { 'imports', 'comment' },
preview = {
win_config = {
border = { '', '', '', '', '', '', '', '' },
winhighlight = 'Normal:Folded',
winblend = 0,
},
mappings = {
scrollU = '<C-u>',
scrollD = '<C-d>',
jumpTop = '[',
jumpBot = ']',
},
},
provider_selector = function(_, _, _) -- bufnr, filetype, buftype
return { 'treesitter', 'indent' }
end,
fold_virt_text_handler = handler,
},
},
}

View File

@@ -1,135 +1,154 @@
-- luacheck: globals vim
return {
-- Neotree configuration
-- Theme of choice, tokyonight
-- https://github.com/folke/tokyonight.nvim
{
"nvim-neo-tree/neo-tree.nvim",
'folke/tokyonight.nvim',
priority = 1000, -- Make sure to load this before all the other start plugins.
init = function()
vim.cmd.colorscheme 'tokyonight'
end,
opts = {
filesystem = {
filtered_items = {
always_show = {
".github",
".gitignore",
".editorconfig",
".python-version",
".nvmrc",
".env",
".env.example",
},
},
},
transparent = true,
},
},
-- Automatic dark mode
-- https://github.com/f-person/auto-dark-mode.nvim
{
'f-person/auto-dark-mode.nvim',
opts = {
update_interval = 1000,
set_dark_mode = function()
vim.api.nvim_set_option_value('background', 'dark', {})
vim.cmd 'colorscheme tokyonight-storm'
end,
set_light_mode = function()
vim.api.nvim_set_option_value('background', 'light', {})
vim.cmd 'colorscheme tokyonight-day'
end,
},
},
-- Remove all background colors to make nvim transparent
-- https://github.com/xiyaowong/nvim-transparent
{ 'xiyaowong/nvim-transparent' },
-- Twilight is a Lua plugin for Neovim 0.5 that dims inactive
-- portions of the code you're editing using TreeSitter.
-- https://github.com/folke/twilight.nvim
{
'folke/twilight.nvim',
ft = 'markdown', -- Highlight markdown files
},
-- Seamless navigation between tmux panes and vim splits
-- https://github.com/christoomey/vim-tmux-navigator
{
'christoomey/vim-tmux-navigator',
lazy = false,
enabled = true,
cmd = {
'TmuxNavigateLeft',
'TmuxNavigateDown',
'TmuxNavigateUp',
'TmuxNavigateRight',
'TmuxNavigatePrevious',
},
keys = {
{ '<c-h>', '<cmd><C-U>TmuxNavigateLeft<cr>' },
{ '<c-j>', '<cmd><C-U>TmuxNavigateDown<cr>' },
{ '<c-k>', '<cmd><C-U>TmuxNavigateUp<cr>' },
{ '<c-l>', '<cmd><C-U>TmuxNavigateRight<cr>' },
{ '<c-\\>', '<cmd><C-U>TmuxNavigatePrevious<cr>' },
},
},
-- Cloak allows you to overlay *'s over defined patterns in defined files.
-- https://github.com/laytan/cloak.nvim
{ "laytan/cloak.nvim" },
-- Not UFO in the sky, but an ultra fold in Neovim.
-- https://github.com/kevinhwang91/nvim-ufo/
{
"kevinhwang91/nvim-ufo",
'laytan/cloak.nvim',
enabled = true,
lazy = false,
version = '*',
config = function()
require('cloak').setup {
enabled = true,
cloak_character = '*',
-- The applied highlight group (colors) on the cloaking, see `:h highlight`.
highlight_group = 'Comment',
patterns = {
{
-- Match any file starting with ".env".
-- This can be a table to match multiple file patterns.
file_pattern = {
'.env*',
'wrangler.toml',
'.dev.vars',
},
-- Match an equals sign and any character after it.
-- This can also be a table of patterns to cloak,
-- example: cloak_pattern = { ":.+", "-.+" } for yaml files.
cloak_pattern = '=.+',
},
},
}
end,
keys = {
{ '<leader>tc', '<cmd>CloakToggle<cr>', desc = '[tc] Toggle Cloak' },
},
},
-- Close buffer without messing up with the window.
-- https://github.com/famiu/bufdelete.nvim
{ 'famiu/bufdelete.nvim' },
-- Neovim plugin for locking a buffer to a window
-- https://github.com/stevearc/stickybuf.nvim
{ 'stevearc/stickybuf.nvim', opts = {} },
-- Describe the regexp under the cursor
-- https://github.com/bennypowers/nvim-regexplainer
{
'bennypowers/nvim-regexplainer',
lazy = false,
enabled = true,
dependencies = {
"kevinhwang91/promise-async",
{ "nvim-treesitter/nvim-treesitter", run = ":TSUpdate" },
{
"luukvbaal/statuscol.nvim",
config = function()
local builtin = require("statuscol.builtin")
require("statuscol").setup({
relculright = true,
segments = {
{ text = { builtin.foldfunc }, click = "v:lua.ScFa" },
{ text = { "%s" }, click = "v:lua.ScSa" },
{ text = { builtin.lnumfunc, " " }, click = "v:lua.ScLa" },
},
})
end,
},
'nvim-treesitter/nvim-treesitter',
'MunifTanjim/nui.nvim',
},
init = function()
vim.o.fillchars = [[eob: ,fold: ,foldopen:,foldsep: ,foldclose:]]
vim.o.foldcolumn = "1" -- '0' is not bad
vim.o.foldlevel = 99 -- Using ufo provider need a large value, feel free to decrease the value
vim.o.foldlevelstart = 99
vim.o.foldenable = true
end,
opts = {
open_fold_hl_timeout = 150,
close_fold_kinds_for_ft = { "imports", "comment" },
preview = {
win_config = {
border = { "", "", "", "", "", "", "", "" },
winhighlight = "Normal:Folded",
winblend = 0,
},
mappings = {
scrollU = "<C-u>",
scrollD = "<C-d>",
jumpTop = "[",
jumpBot = "]",
},
},
provider_selector = function(_, _, _) -- bufnr, filetype, buftype
return { "treesitter", "indent" }
end,
fold_virt_text_handler = function(virtText, lnum, endLnum, width, truncate)
local newVirtText = {}
local suffix = (" 󰁂 %d "):format(endLnum - lnum)
local sufWidth = vim.fn.strdisplaywidth(suffix)
local targetWidth = width - sufWidth
local curWidth = 0
for _, chunk in ipairs(virtText) do
local chunkText = chunk[1]
local chunkWidth = vim.fn.strdisplaywidth(chunkText)
if targetWidth > curWidth + chunkWidth then
table.insert(newVirtText, chunk)
else
chunkText = truncate(chunkText, targetWidth - curWidth)
local hlGroup = chunk[2]
table.insert(newVirtText, { chunkText, hlGroup })
chunkWidth = vim.fn.strdisplaywidth(chunkText)
-- str width returned from truncate() may less than 2nd argument, need padding
if curWidth + chunkWidth < targetWidth then
suffix = suffix .. (" "):rep(targetWidth - curWidth - chunkWidth)
end
break
end
curWidth = curWidth + chunkWidth
end
table.insert(newVirtText, { suffix, "MoreMsg" })
return newVirtText
end,
-- automatically show the explainer when the cursor enters a regexp
auto = true,
},
},
-- Indent guides for Neovim
-- https://github.com/lukas-reineke/indent-blankline.nvim
{ "lukas-reineke/indent-blankline.nvim" },
-- Git integration for buffers
-- https://github.com/lewis6991/gitsigns.nvim
{ "lewis6991/gitsigns.nvim" },
-- Close buffer without messing up with the window.
-- https://github.com/famiu/bufdelete.nvim
{ "famiu/bufdelete.nvim" },
-- Neovim plugin for locking a buffer to a window
-- https://github.com/stevearc/stickybuf.nvim
{ "stevearc/stickybuf.nvim", opts = {} },
-- A pretty window for previewing, navigating and editing your LSP locations
-- https://github.com/DNLHC/glance.nvim
{ "dnlhc/glance.nvim" },
-- Clarify and beautify your comments using boxes and lines.
-- https://github.com/LudoPinelli/comment-box.nvim
{
'LudoPinelli/comment-box.nvim',
opts = {},
init = function()
local wk = require 'which-key'
wk.add {
{ '<leader>cb', group = 'CommentBox' },
{ '<Leader>cbt', '<Cmd>CBccbox<CR>', desc = 'CommentBox: Box Title' },
{ '<Leader>cbd', '<Cmd>CBd<CR>', desc = 'Remove a box' },
{ '<Leader>cbl', '<Cmd>CBline<CR>', desc = 'CommentBox: Simple Line' },
{ '<Leader>cbm', '<Cmd>CBllbox14<CR>', desc = 'CommentBox: Marked' },
{ '<Leader>cbt', '<Cmd>CBllline<CR>', desc = 'CommentBox: Titled Line' },
}
end,
},
-- Automatically expand width of the current window.
-- Maximizes and restore it. And all this with nice animations!
-- https://github.com/anuvyklack/windows.nvim
{
"anuvyklack/windows.nvim",
'anuvyklack/windows.nvim',
dependencies = {
"anuvyklack/middleclass",
"anuvyklack/animation.nvim",
'anuvyklack/middleclass',
'anuvyklack/animation.nvim',
},
config = function()
vim.o.winwidth = 15
vim.o.winminwidth = 10
vim.o.equalalways = false
require("windows").setup()
require('windows').setup()
end,
},
}

View File

@@ -0,0 +1,13 @@
#'ve
i/!
i've/!
I've
I
good
#rd
#rd/!
#rd
#rd
#rd/!
#rd
wrd/!