├── .gitignore ├── .stylua.toml ├── LICENSE ├── README.md ├── init.lua └── lazy-lock.json /.gitignore: -------------------------------------------------------------------------------- 1 | plugin 2 | -------------------------------------------------------------------------------- /.stylua.toml: -------------------------------------------------------------------------------- 1 | indent_type = "Spaces" 2 | indent_width = 4 3 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Danymat 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Champagne 🥂 2 | 3 | ## Installation 4 | 5 | ```bash 6 | { 7 | git clone https://github.com/danymat/champagne.git ~/.config/nvim 8 | nvim 9 | } 10 | ``` 11 | 12 | ## Update 13 | 14 | ```bash 15 | git -C ~/.config/nvim/ fetch 16 | ``` 17 | -------------------------------------------------------------------------------- /init.lua: -------------------------------------------------------------------------------- 1 | local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" 2 | if not (vim.uv or vim.loop).fs_stat(lazypath) then 3 | vim.fn.system({ 4 | "git", 5 | "clone", 6 | "--filter=blob:none", 7 | "https://github.com/folke/lazy.nvim.git", 8 | "--branch=stable", -- latest stable release 9 | lazypath, 10 | }) 11 | end 12 | vim.opt.rtp:prepend(lazypath) 13 | 14 | -- User options 15 | vim.g.mapleader = " " 16 | vim.o.relativenumber = true 17 | vim.o.number = true 18 | vim.o.undofile = true 19 | vim.o.expandtab = true 20 | vim.o.shiftwidth = 4 21 | vim.o.completeopt = "menu,menuone,noselect" 22 | vim.g.loaded_netrw = 1 23 | vim.g.loaded_netrwPlugin = 1 24 | vim.o.termguicolors = true 25 | vim.o.conceallevel = 2 26 | vim.o.cmdheight = 0 27 | vim.o.foldenable = true 28 | vim.o.mouse = "" 29 | 30 | local map = vim.keymap.set 31 | map("n", "so", ":so %") 32 | map("n", "h", ":wincmd h") 33 | map("n", "j", ":wincmd j") 34 | map("n", "k", ":wincmd k") 35 | map("n", "l", ":wincmd l") 36 | map("n", "fs", vim.lsp.buf.format) 37 | map("n", "K", vim.lsp.buf.hover) 38 | map("n", "r", vim.lsp.buf.rename) 39 | map("n", "", vim.diagnostic.goto_next) 40 | map("n", "", vim.diagnostic.goto_prev) 41 | -- map("i", "", function() if vim.snippet.active() then vim.snippet.expand() end end) 42 | map('i', '', '') -- Force Trigger completion 43 | map('i', '', [[pumvisible() ? "\" : "\"]], { expr = true }) 44 | map('i', '', [[pumvisible() ? "\" : "\"]], { expr = true }) 45 | map({ "n", "v" }, "≠", "zz") 46 | map({ "n", "v" }, "÷", "zz") 47 | map({ "n", "v" }, "", "zz") 48 | map({ "n", "v" }, "", "zz") 49 | map({ "n", "v" }, "µ", "{") 50 | map({ "n", "v" }, "Ù", "}") 51 | map({ "n", "v" }, "÷", "zz") 52 | map("t", "", "") 53 | 54 | 55 | -- export NVIM_WORK=1 at work and it will apply custom keybinds 56 | local at_work = vim.env.NVIM_WORK and true 57 | 58 | if at_work then 59 | map("n", "=", "") 60 | end 61 | 62 | require("lazy").setup({ 63 | { 64 | "stevearc/oil.nvim", 65 | config = function() 66 | require("oil").setup({ 67 | view_options = { 68 | show_hidden = true, 69 | }, 70 | natural_order = true, 71 | 72 | }) 73 | vim.keymap.set("n", at_work and "=" or "-", "Oil --float", { desc = "Open parent directory" }) 74 | end 75 | }, 76 | 77 | { 78 | "danymat/neogen", 79 | dev = true, 80 | config = function() 81 | require("neogen").setup({ 82 | snippet_engine = "luasnip", 83 | -- languages = { 84 | -- python = { template = { annotation_convention = "reST" } }, 85 | -- } 86 | }) 87 | 88 | vim.keymap.set("n", "nf", ":Neogen func") 89 | vim.keymap.set("n", "nc", ":Neogen class") 90 | end 91 | }, 92 | { 93 | "nvim-neorg/neorg", 94 | dev = true 95 | }, 96 | { 97 | "numToStr/Comment.nvim", 98 | config = function() 99 | require("Comment").setup({ 100 | toggler = { 101 | line = "cc", 102 | block = "bc", 103 | }, 104 | opleader = { 105 | line = "c", 106 | block = "b", 107 | }, 108 | extra = { 109 | eol = "ca", 110 | }, 111 | }) 112 | end 113 | }, 114 | { 115 | "ThePrimeagen/harpoon", 116 | config = function() 117 | vim.keymap.set("n", "a", function() require("harpoon.mark").add_file() end) 118 | vim.keymap.set("n", "o", function() require("harpoon.ui").toggle_quick_menu() end) 119 | vim.keymap.set("n", "&", function() require("harpoon.ui").nav_file(1) end) 120 | vim.keymap.set("n", "é", function() require("harpoon.ui").nav_file(2) end) 121 | vim.keymap.set("n", "\"", function() require("harpoon.ui").nav_file(3) end) 122 | vim.keymap.set("n", "'", function() require("harpoon.ui").nav_file(4) end) 123 | end 124 | }, 125 | { 126 | "ggandor/leap.nvim", 127 | config = function() 128 | require('leap').add_default_mappings() 129 | end 130 | }, 131 | { 132 | "nvim-lualine/lualine.nvim", 133 | config = function() 134 | require('lualine').setup { 135 | options = { 136 | icons_enabled = true, 137 | theme = 'auto', 138 | }, 139 | } 140 | end 141 | }, 142 | { 143 | "ray-x/lsp_signature.nvim", 144 | event = "InsertEnter", 145 | opts = { 146 | bind = true, 147 | handler_opts = { 148 | border = "rounded" 149 | } 150 | }, 151 | config = function(_, opts) require 'lsp_signature'.setup(opts) end 152 | }, 153 | { 154 | "neovim/nvim-lspconfig", 155 | config = function() 156 | require("mason").setup() 157 | require("mason-lspconfig").setup() 158 | 159 | require("mason-lspconfig").setup_handlers({ 160 | -- The first entry (without a key) will be the default handler 161 | -- and will be called for each installed server that doesn't have 162 | -- a dedicated handler. 163 | function(server_name) -- default handler (optional) 164 | require("lspconfig")[server_name].setup {} 165 | end, 166 | ["lua_ls"] = function() 167 | require("lspconfig").lua_ls.setup { 168 | settings = { 169 | Lua = { 170 | diagnostics = { 171 | globals = { "vim" } 172 | }, 173 | } 174 | }, 175 | } 176 | end 177 | }) 178 | local cmp = require("cmp") 179 | local luasnip = require("luasnip") 180 | local lspkind = require("lspkind") 181 | local cmp_autopairs = require('nvim-autopairs.completion.cmp') 182 | 183 | cmp.event:on( 184 | 'confirm_done', 185 | cmp_autopairs.on_confirm_done() 186 | ) 187 | 188 | require('luasnip.loaders.from_vscode').lazy_load() 189 | 190 | local cmp_config = { 191 | experimental = { 192 | ghost_text = true 193 | }, 194 | preselect = 'item', 195 | completion = { 196 | completeopt = 'menu,menuone,noinsert' 197 | }, 198 | snippet = { 199 | expand = function(args) 200 | require('luasnip').lsp_expand(args.body) 201 | end, 202 | }, 203 | window = { 204 | completion = cmp.config.window.bordered(), 205 | documentation = cmp.config.window.bordered(), 206 | }, 207 | mapping = cmp.mapping.preset.insert({ 208 | [""] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Select }), 209 | [""] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Select }), 210 | [""] = cmp.mapping.confirm({ 211 | -- this is the important line 212 | behavior = cmp.ConfirmBehavior.Replace, 213 | select = true, 214 | }), 215 | [""] = cmp.mapping(function(fallback) 216 | if luasnip and luasnip.expand_or_jumpable() then 217 | luasnip.expand_or_jump() 218 | else 219 | fallback() 220 | end 221 | end, { "i", "s" }), 222 | [""] = cmp.mapping(function(fallback) 223 | if luasnip and luasnip.jumpable(-1) then 224 | luasnip.jump(-1) 225 | else 226 | fallback() 227 | end 228 | end, { "i", "s" }), 229 | }), 230 | sources = cmp.config.sources({ 231 | 232 | { name = "nvim_lsp" }, 233 | { name = "luasnip" }, -- For luasnip users. 234 | }, { 235 | { name = "buffer" }, 236 | }), 237 | formatting = { 238 | fields = { 239 | cmp.ItemField.Kind, 240 | cmp.ItemField.Abbr, 241 | cmp.ItemField.Menu, 242 | }, 243 | format = lspkind.cmp_format({ 244 | mode = 'symbol', 245 | maxwidth = 40, 246 | ellipsis_char = '...', 247 | symbol_map = { Copilot = "" } 248 | }), 249 | }, 250 | } 251 | cmp.setup(cmp_config) 252 | 253 | require("mason-null-ls").setup({ automatic_setup = true }) 254 | end, 255 | dependencies = { 256 | -- LSP Support 257 | "williamboman/mason.nvim", 258 | "williamboman/mason-lspconfig.nvim", 259 | 260 | -- Autocompletion 261 | "hrsh7th/nvim-cmp", 262 | "hrsh7th/cmp-buffer", 263 | "hrsh7th/cmp-path", 264 | "saadparwaiz1/cmp_luasnip", 265 | "hrsh7th/cmp-nvim-lsp", 266 | "hrsh7th/cmp-nvim-lua", 267 | 268 | -- Snippets 269 | { "L3MON4D3/LuaSnip", version = "v2.*", }, 270 | "rafamadriz/friendly-snippets", 271 | 272 | --null-ls 273 | -- TODO: check here, maybe null-ls is not to be used anymore 274 | "nvimtools/none-ls.nvim", 275 | "jayp0521/mason-null-ls.nvim", 276 | 277 | "onsails/lspkind.nvim", 278 | "ray-x/lsp_signature.nvim", 279 | { 280 | 'windwp/nvim-autopairs', 281 | event = "InsertEnter", 282 | config = true 283 | -- use opts = {} for passing setup options 284 | -- this is equivalent to setup({}) function 285 | } 286 | 287 | }, 288 | }, 289 | { 'kylechui/nvim-surround', config = true }, 290 | { 291 | "nvim-treesitter/nvim-treesitter", 292 | config = function() 293 | local configs = require("nvim-treesitter.configs") 294 | 295 | configs.setup({ 296 | highlight = { 297 | ensure_installed = { "c", "lua", "python", "vim", "vimdoc", "html" }, 298 | enable = true, 299 | additional_vim_regex_highlighting = { "markdown" }, 300 | indent = { enable = true }, 301 | }, 302 | playground = { 303 | enable = true, 304 | } 305 | }) 306 | end 307 | }, 308 | { 309 | "rose-pine/neovim", 310 | name = "rose-pine", 311 | config = function() 312 | require("rose-pine").setup({ 313 | dark_variant = "moon", 314 | disable_background = true, 315 | --extend_background_behind_borders = true, 316 | styles = { transparency = true }, 317 | }) 318 | vim.cmd("colorscheme rose-pine-moon") 319 | end 320 | }, 321 | { 322 | 'nvim-telescope/telescope.nvim', 323 | branch = '0.1.x', 324 | dependencies = { 'nvim-lua/plenary.nvim' }, 325 | config = function() 326 | local telescope = require("telescope") 327 | telescope.load_extension("workspaces") 328 | telescope.setup({ 329 | extensions = { 330 | workspaces = { 331 | -- keep insert mode after selection in the picker, default is false 332 | keep_insert = true, 333 | }, 334 | }, 335 | }) 336 | 337 | vim.keymap.set("n", "", ":Telescope find_files hidden=true") 338 | vim.keymap.set("n", "gg", ":Telescope git_files use_git_root=true show_untracked=true") 339 | vim.keymap.set("n", "ff", ":Telescope live_grep") 340 | vim.keymap.set("n", "fb", ":Telescope buffers") 341 | vim.keymap.set("n", "fh", ":Telescope help_tags") 342 | vim.keymap.set("n", "gr", ":Telescope lsp_references") 343 | vim.keymap.set("n", "gd", ":Telescope lsp_definitions") 344 | vim.keymap.set("n", "ds", ":Telescope lsp_document_symbols symbols=func,function,class") 345 | vim.keymap.set("n", "", ":lua vim.lsp.buf.code-action()") 346 | vim.keymap.set("n", "p", ":Telescope workspaces") 347 | end 348 | }, 349 | { 350 | "natecraddock/workspaces.nvim", 351 | config = function() 352 | require("workspaces").setup({ 353 | hooks = { 354 | open = { "Telescope find_files hidden=true" }, 355 | } 356 | }) 357 | end 358 | }, 359 | -- { 360 | -- "zk-org/zk-nvim", 361 | -- enabled = false, 362 | -- config = function() 363 | -- local zk = require("zk") 364 | -- local commands = require("zk.commands") 365 | -- 366 | -- zk.setup({ 367 | -- picker = "telescope", 368 | -- }) 369 | -- 370 | -- commands.add("ZkStart", function() 371 | -- zk.edit({ matchStrategy = "re", match = { "§§" } }, { title = "Starting Points" }) 372 | -- end) 373 | -- 374 | -- vim.keymap.set("n", "za", ":ZkStart", { desc = "Open Starting Point Notes" }) 375 | -- vim.keymap.set("n", "zf", "ZkNotes {sort = {'modified'}}", { desc = "Open Zk Notes" }) 376 | -- vim.keymap.set("n", "zt", ":ZkTags {sort= {'note-count'} }", { desc = "Open Zk Notes" }) 377 | -- vim.keymap.set("n", "zn", 378 | -- "ZkNew { dir = vim.fn.expand('%:p:h'), title = vim.fn.input('Title: ') }") 379 | -- end 380 | -- }, 381 | { 382 | "obsidian-nvim/obsidian.nvim", 383 | version = "*", -- recommended, use latest release instead of latest commit 384 | -- ft = "markdown", 385 | -- Replace the above line with this if you only want to load obsidian.nvim for markdown files in your vault: 386 | -- event = { 387 | -- -- If you want to use the home shortcut '~' here you need to call 'vim.fn.expand'. 388 | -- -- E.g. "BufReadPre " .. vim.fn.expand "~" .. "/my-vault/*.md" 389 | -- -- refer to `:h file-pattern` for more examples 390 | -- "BufReadPre path/to/my-vault/*.md", 391 | -- "BufNewFile path/to/my-vault/*.md", 392 | -- }, 393 | dependencies = { 394 | -- Required. 395 | "nvim-lua/plenary.nvim", 396 | 397 | -- see below for full list of optional dependencies 👇 398 | }, 399 | config = function() 400 | require("obsidian").setup { 401 | workspaces = { 402 | { 403 | name = "personal", 404 | path = "~/Developer/Brain", 405 | }, 406 | }, 407 | daily_notes = { 408 | folder = "Daily", 409 | }, 410 | wiki_link_func = "use_alias_only", 411 | preferred_link_style = "markdown", 412 | disable_frontmatter = true, 413 | note_id_func = function() 414 | return tostring(os.date("%Y%m%d%H%M")) 415 | end, 416 | } 417 | vim.keymap.set("n", "za", ":ObsidianSearch §§") 418 | vim.keymap.set("n", "zb", ":ObsidianBacklinks") 419 | vim.keymap.set("n", "zf", ":ObsidianSearch") 420 | vim.keymap.set("n", "fz", ":ObsidianQuickSwitch") 421 | vim.keymap.set("n", "zn", ":ObsidianNew") 422 | vim.keymap.set("n", "zt", ":ObsidianTags") 423 | end 424 | }, 425 | { 426 | "nvimtools/none-ls.nvim", 427 | config = function() 428 | local null_ls = require("null-ls") 429 | 430 | null_ls.setup({ 431 | sources = { 432 | null_ls.builtins.formatting.black, 433 | }, 434 | }) 435 | end 436 | }, 437 | "sindrets/diffview.nvim", 438 | "nvim-treesitter/nvim-treesitter-context", 439 | { 440 | "folke/zen-mode.nvim", 441 | config = function() 442 | require("zen-mode").setup { 443 | plugins = { 444 | wezterm = { 445 | enabled = true, 446 | -- can be either an absolute font size or the number of incremental steps 447 | font = "+4", -- (10% increase per step) 448 | }, 449 | } 450 | } 451 | vim.keymap.set("n", "zz", ":ZenMode") 452 | end 453 | } 454 | }, { 455 | dev = { 456 | path = "~/Developer/", 457 | fallback = true 458 | } 459 | }) 460 | -------------------------------------------------------------------------------- /lazy-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "Comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" }, 3 | "LuaSnip": { "branch": "master", "commit": "03c8e67eb7293c404845b3982db895d59c0d1538" }, 4 | "cmp-buffer": { "branch": "main", "commit": "b74fab3656eea9de20a9b8116afa3cfc4ec09657" }, 5 | "cmp-nvim-lsp": { "branch": "main", "commit": "a8912b88ce488f411177fc8aed358b04dc246d7b" }, 6 | "cmp-nvim-lua": { "branch": "main", "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" }, 7 | "cmp-path": { "branch": "main", "commit": "c6635aae33a50d6010bf1aa756ac2398a2d54c32" }, 8 | "cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" }, 9 | "diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" }, 10 | "friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" }, 11 | "harpoon": { "branch": "master", "commit": "1bc17e3e42ea3c46b33c0bbad6a880792692a1b3" }, 12 | "lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" }, 13 | "leap.nvim": { "branch": "main", "commit": "2b68ddc0802bd295e64c9e2e75f18f755e50dbcc" }, 14 | "lsp_signature.nvim": { "branch": "master", "commit": "a793d02b6a5e639fa9d3f2a89a839fa688ab2d0a" }, 15 | "lspkind.nvim": { "branch": "master", "commit": "d79a1c3299ad0ef94e255d045bed9fa26025dab6" }, 16 | "lua-utils.nvim": { "branch": "main", "commit": "e565749421f4bbb5d2e85e37c3cef9d56553d8bd" }, 17 | "lualine.nvim": { "branch": "master", "commit": "15884cee63a8c205334ab13ab1c891cd4d27101a" }, 18 | "mason-lspconfig.nvim": { "branch": "main", "commit": "1a31f824b9cd5bc6f342fc29e9a53b60d74af245" }, 19 | "mason-null-ls.nvim": { "branch": "main", "commit": "de19726de7260c68d94691afb057fa73d3cc53e7" }, 20 | "mason.nvim": { "branch": "main", "commit": "fc98833b6da5de5a9c5b1446ac541577059555be" }, 21 | "none-ls.nvim": { "branch": "main", "commit": "b3dfc91b58f24b5496c46217101179e55a32364a" }, 22 | "nvim-autopairs": { "branch": "master", "commit": "4d74e75913832866aa7de35e4202463ddf6efd1b" }, 23 | "nvim-cmp": { "branch": "main", "commit": "b5311ab3ed9c846b585c0c15b7559be131ec4be9" }, 24 | "nvim-lspconfig": { "branch": "master", "commit": "94d0fec9135719e046903bbbbf8f39e3d3436d4e" }, 25 | "nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" }, 26 | "nvim-surround": { "branch": "main", "commit": "0e62500b98f4513feaaf7425c135472457ea5b7d" }, 27 | "nvim-treesitter": { "branch": "master", "commit": "94ea4f436d2b59c80f02e293466c374584f03b8c" }, 28 | "nvim-treesitter-context": { "branch": "master", "commit": "6daca3ad780f045550b820f262002f35175a6c04" }, 29 | "obsidian.nvim": { "branch": "main", "commit": "e0eb92c5afcacf5bf11e4735079a538fd1486ea9" }, 30 | "oil.nvim": { "branch": "master", "commit": "685cdb4ffa74473d75a1b97451f8654ceeab0f4a" }, 31 | "pathlib.nvim": { "branch": "main", "commit": "57e5598af6fe253761c1b48e0b59b7cd6699e2c1" }, 32 | "plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" }, 33 | "rose-pine": { "branch": "main", "commit": "96ff3993a67356ee85d1cdab9be652cdc1c5d1ac" }, 34 | "telescope.nvim": { "branch": "0.1.x", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" }, 35 | "workspaces.nvim": { "branch": "master", "commit": "55a1eb6f5b72e07ee8333898254e113e927180ca" }, 36 | "zen-mode.nvim": { "branch": "main", "commit": "863f150ca321b3dd8aa1a2b69b5f411a220e144f" } 37 | } 38 | --------------------------------------------------------------------------------