diff --git a/stow/.config/nvim/lazy-lock.json b/stow/.config/nvim/lazy-lock.json index 3317892..3b8a0ce 100644 --- a/stow/.config/nvim/lazy-lock.json +++ b/stow/.config/nvim/lazy-lock.json @@ -1,23 +1,28 @@ { - "blink.cmp": { "branch": "main", "commit": "327fff91fe6af358e990be7be1ec8b78037d2138" }, + "LuaSnip": { "branch": "master", "commit": "faf3c94a44508cec1b961406d36cc65113ff3b98" }, + "bullets.vim": { "branch": "master", "commit": "8f3259e807c40b91d247f612823295ab99777a65" }, + "cmp-buffer": { "branch": "main", "commit": "b74fab3656eea9de20a9b8116afa3cfc4ec09657" }, + "cmp-cmdline": { "branch": "main", "commit": "d126061b624e0af6c3a556428712dd4d4194ec6d" }, + "cmp-nvim-lsp": { "branch": "main", "commit": "a8912b88ce488f411177fc8aed358b04dc246d7b" }, + "cmp-path": { "branch": "main", "commit": "c6635aae33a50d6010bf1aa756ac2398a2d54c32" }, + "cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" }, "diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" }, - "fidget.nvim": { "branch": "main", "commit": "3f5475949679953af6d78654db29b944fa826e6a" }, - "friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" }, - "fzf-lua": { "branch": "main", "commit": "db3ccffe79480543d8e0f7b0cac0d9b220f9486e" }, - "gitsigns.nvim": { "branch": "main", "commit": "1ee5c1fd068c81f9dd06483e639c2aa4587dc197" }, - "lazy-lsp.nvim": { "branch": "master", "commit": "5ea87155f84629b0bd90853a0d035422d7acd3a5" }, - "lazy.nvim": { "branch": "main", "commit": "1ea3c4085785f460fb0e46d2fe1ee895f5f9e7c1" }, - "lualine.nvim": { "branch": "master", "commit": "b8c23159c0161f4b89196f74ee3a6d02cdc3a955" }, - "mini.icons": { "branch": "main", "commit": "284798619aed9f4c1ac1b9417b9a5e3b4b85ef3a" }, - "mini.pick": { "branch": "main", "commit": "96ee37d07043aeed90ae6ae32733b2d0db8f1c13" }, - "neogit": { "branch": "master", "commit": "0f48491ae0046796841aaa97d439267982fe72db" }, - "nvim-lspconfig": { "branch": "master", "commit": "ac98db2f9f06a56498ec890a96928774eae412c3" }, - "nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" }, - "nvim-web-devicons": { "branch": "master", "commit": "b8221e42cf7287c4dcde81f232f58d7b947c210d" }, - "oil.nvim": { "branch": "master", "commit": "919e155fdf38e9148cdb5304faaaf53c20d703ea" }, - "plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" }, - "render-markdown.nvim": { "branch": "main", "commit": "d53856423be5ef3c267d26ee261b0981b372f718" }, + "fidget.nvim": { "branch": "main", "commit": "d9ba6b7bfe29b3119a610892af67602641da778e" }, + "fzf-lua": { "branch": "main", "commit": "8adf950093af5361621cf52208d64995b1af78b5" }, + "gitsigns.nvim": { "branch": "main", "commit": "8b729e489f1475615dc6c9737da917b3bc163605" }, + "headlines.nvim": { "branch": "master", "commit": "bf17c96a836ea27c0a7a2650ba385a7783ed322e" }, + "image.nvim": { "branch": "master", "commit": "4c51d6202628b3b51e368152c053c3fb5c5f76f2" }, + "lazy-lsp.nvim": { "branch": "master", "commit": "701893d2d60c7eff894324748073f682065999a2" }, + "lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" }, + "lualine.nvim": { "branch": "master", "commit": "0c6cca9f2c63dadeb9225c45bc92bb95a151d4af" }, + "mini.pick": { "branch": "main", "commit": "f02e64580a547346128799ba667dfc0e29737532" }, + "neogit": { "branch": "master", "commit": "7cec58c9272d61da5d77fe5869e3956b8a91f1eb" }, + "nvim-cmp": { "branch": "main", "commit": "b5311ab3ed9c846b585c0c15b7559be131ec4be9" }, + "nvim-lspconfig": { "branch": "master", "commit": "f610208989e9c03561f9f601db3133f6ae398fcd" }, + "nvim-treesitter": { "branch": "master", "commit": "066fd6505377e3fd4aa219e61ce94c2b8bdb0b79" }, + "nvim-web-devicons": { "branch": "master", "commit": "1fb58cca9aebbc4fd32b086cb413548ce132c127" }, + "oil.nvim": { "branch": "master", "commit": "685cdb4ffa74473d75a1b97451f8654ceeab0f4a" }, + "plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" }, "telescope.nvim": { "branch": "master", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" }, - "tokyonight.nvim": { "branch": "main", "commit": "d14614cbfc63b6037bfccd48bb982d2ad2003352" }, - "which-key.nvim": { "branch": "main", "commit": "b4177e3eaf15fe5eb8357ebac2286d488be1ed00" } + "tokyonight.nvim": { "branch": "main", "commit": "057ef5d260c1931f1dffd0f052c685dcd14100a3" } } diff --git a/stow/.config/nvim/lua/nico/lazy/blink.lua b/stow/.config/nvim/lua/nico/lazy/blink.lua deleted file mode 100644 index 29c79a9..0000000 --- a/stow/.config/nvim/lua/nico/lazy/blink.lua +++ /dev/null @@ -1,29 +0,0 @@ -return { - 'saghen/blink.cmp', - dependencies = { 'rafamadriz/friendly-snippets' }, - - -- use a release tag to download pre-built binaries - version = '1.*', - -- AND/OR build from source, requires nightly: https://rust-lang.github.io/rustup/concepts/channels.html#working-with-nightly-rust - -- build = 'cargo build --release', - -- If you use nix, you can build from source using latest nightly rust with: - -- build = 'nix run .#build-plugin', - - opts = { - keymap = { preset = 'default' }, - - appearance = { - nerd_font_variant = 'mono' - }, - - -- (Default) Only show the documentation popup when manually triggered - completion = { documentation = { auto_show = false } }, - - sources = { - default = { 'lsp', 'path', 'snippets', 'buffer' }, - }, - - fuzzy = { implementation = "prefer_rust_with_warning" } - }, - opts_extend = { "sources.default" } -} diff --git a/stow/.config/nvim/lua/nico/lazy/bullets.lua b/stow/.config/nvim/lua/nico/lazy/bullets.lua new file mode 100644 index 0000000..476a27f --- /dev/null +++ b/stow/.config/nvim/lua/nico/lazy/bullets.lua @@ -0,0 +1,3 @@ +return { + "bullets-vim/bullets.vim", +} diff --git a/stow/.config/nvim/lua/nico/lazy/headlines.lua b/stow/.config/nvim/lua/nico/lazy/headlines.lua new file mode 100644 index 0000000..9a30354 --- /dev/null +++ b/stow/.config/nvim/lua/nico/lazy/headlines.lua @@ -0,0 +1,5 @@ +return { + "lukas-reineke/headlines.nvim", + dependencies = "nvim-treesitter/nvim-treesitter", + config = true +} diff --git a/stow/.config/nvim/lua/nico/lazy/image.lua b/stow/.config/nvim/lua/nico/lazy/image.lua new file mode 100644 index 0000000..eb568a5 --- /dev/null +++ b/stow/.config/nvim/lua/nico/lazy/image.lua @@ -0,0 +1,43 @@ +return { + "3rd/image.nvim", + build = false, + config = function() + require("image").setup({ + backend = "kitty", + processor = "magick_cli", -- or "magick_rock" + integrations = { + markdown = { + enabled = true, + clear_in_insert_mode = false, + download_remote_images = true, + only_render_image_at_cursor = false, + floating_windows = false, -- if true, images will be rendered in floating markdown windows + filetypes = { "markdown", "vimwiki" }, -- markdown extensions (ie. quarto) can go here + }, + neorg = { + enabled = true, + filetypes = { "norg" }, + }, + typst = { + enabled = true, + filetypes = { "typst" }, + }, + html = { + enabled = false, + }, + css = { + enabled = false, + }, + }, + max_width = nil, + max_height = nil, + max_width_window_percentage = nil, + max_height_window_percentage = 50, + window_overlap_clear_enabled = true, -- toggles images when windows are overlapped + window_overlap_clear_ft_ignore = { "cmp_menu", "cmp_docs", "" }, + editor_only_render_when_focused = true, -- auto show/hide images when the editor gains/looses focus + tmux_show_only_in_active_window = true, -- auto show/hide images in the correct Tmux window (needs visual-activity off) + hijack_file_patterns = { "*.png", "*.jpg", "*.jpeg", "*.gif", "*.webp", "*.avif" }, -- render image files as images when opened + }) + end +} diff --git a/stow/.config/nvim/lua/nico/lazy/lsp.lua b/stow/.config/nvim/lua/nico/lazy/lsp.lua index 314905b..6947078 100644 --- a/stow/.config/nvim/lua/nico/lazy/lsp.lua +++ b/stow/.config/nvim/lua/nico/lazy/lsp.lua @@ -1,22 +1,102 @@ return { - "neovim/nvim-lspconfig", - dependencies = { - "j-hui/fidget.nvim", -- lsp status - "dundalek/lazy-lsp.nvim", -- load LSPs from nix - }, - config = function() - require("fidget").setup {} - require("lazy-lsp").setup {} + "neovim/nvim-lspconfig", + dependencies = { + "hrsh7th/cmp-nvim-lsp", + "hrsh7th/cmp-buffer", + "hrsh7th/cmp-path", + "hrsh7th/cmp-cmdline", + "hrsh7th/nvim-cmp", + "L3MON4D3/LuaSnip", + "saadparwaiz1/cmp_luasnip", + "j-hui/fidget.nvim", + "dundalek/lazy-lsp.nvim", + }, - vim.lsp.enable({ - 'gopls', -- go - 'pyright', -- python - 'lua_ls', -- lua - 'rust-analyzer', -- rust - 'nil_ls', -- nix - 'bashls', -- bash - 'html', -- html - 'cssls', -- css - }) - end, + config = function() + local cmp = require('cmp') + local cmp_lsp = require("cmp_nvim_lsp") + local capabilities = vim.tbl_deep_extend( + "force", + {}, + vim.lsp.protocol.make_client_capabilities(), + cmp_lsp.default_capabilities()) + + require("fidget").setup({}) + + require("lazy-lsp").setup { + -- By default all available servers are set up. Exclude unwanted or misbehaving servers. + excluded_servers = { + "ccls", "zk", "bufls", "ruff_lsp" + }, + -- Alternatively specify preferred servers for a filetype (others will be ignored). + preferred_servers = { + markdown = {}, + python = { "pyright" }, + nix = { "nil_ls" }, + rust = { "rust_analyzer" }, + go = { "gopls" }, + c = { "clangd" }, + }, + prefer_local = true, -- Prefer locally installed servers over nix-shell + -- Default config passed to all servers to specify on_attach callback and other options. + default_config = { + flags = { + debounce_text_changes = 150, + }, + -- on_attach = on_attach, + -- capabilities = capabilities, + }, + -- Override config for specific servers that will passed down to lspconfig setup. + -- Note that the default_config will be merged with this specific configuration so you don't need to specify everything twice. + configs = { + lua_ls = { + settings = { + Lua = { + diagnostics = { + -- Get the language server to recognize the `vim` global + globals = { "vim" }, + }, + }, + }, + }, + }, + } + + + local cmp_select = { behavior = cmp.SelectBehavior.Select } + + cmp.setup({ + snippet = { + expand = function(args) + require('luasnip').lsp_expand(args.body) -- For `luasnip` users. + end, + }, + mapping = cmp.mapping.preset.insert({ + [''] = cmp.mapping.select_prev_item(cmp_select), + [''] = cmp.mapping.select_next_item(cmp_select), + [''] = cmp.mapping.confirm({ select = true }), + [""] = cmp.mapping.complete(), + [''] = cmp.mapping.scroll_docs(-4), + [''] = cmp.mapping.scroll_docs(4), + }), + sources = cmp.config.sources({ + { name = 'nvim_lsp' }, + { name = 'luasnip' }, -- For luasnip users. + }, { + { name = 'buffer' }, + }) + }) + + vim.diagnostic.config({ + -- update_in_insert = true, + float = { + focusable = false, + style = "minimal", + border = "rounded", + source = "always", + header = "", + prefix = "", + }, + }) + end } diff --git a/stow/.config/nvim/lua/nico/lazy/render-markdown.lua b/stow/.config/nvim/lua/nico/lazy/render-markdown.lua deleted file mode 100644 index 4a2769d..0000000 --- a/stow/.config/nvim/lua/nico/lazy/render-markdown.lua +++ /dev/null @@ -1,8 +0,0 @@ -return { - 'MeanderingProgrammer/render-markdown.nvim', - dependencies = { 'nvim-treesitter/nvim-treesitter', 'nvim-mini/mini.icons' }, -- if you use standalone mini plugins - -- dependencies = { 'nvim-treesitter/nvim-treesitter', 'nvim-tree/nvim-web-devicons' }, -- if you prefer nvim-web-devicons - ---@module 'render-markdown' - ---@type render.md.UserConfig - opts = {}, -} diff --git a/stow/.config/nvim/lua/nico/lazy/which-key.lua b/stow/.config/nvim/lua/nico/lazy/which-key.lua deleted file mode 100644 index 9fadb97..0000000 --- a/stow/.config/nvim/lua/nico/lazy/which-key.lua +++ /dev/null @@ -1,18 +0,0 @@ -return { - "folke/which-key.nvim", - event = "VeryLazy", - opts = { - -- your configuration comes here - -- or leave it empty to use the default settings - -- refer to the configuration section below - }, - keys = { - { - "?", - function() - require("which-key").show({ global = false }) - end, - desc = "Buffer Local Keymaps (which-key)", - }, - }, -} diff --git a/stow/.config/nvim/lua/nico/opts.lua b/stow/.config/nvim/lua/nico/opts.lua index 5708e44..665a425 100644 --- a/stow/.config/nvim/lua/nico/opts.lua +++ b/stow/.config/nvim/lua/nico/opts.lua @@ -1,5 +1,4 @@ vim.opt.termguicolors = true -vim.o.winborder = 'rounded' vim.opt.number = true vim.opt.relativenumber = true diff --git a/stow/.config/nvim/lua/nico/txt/enter.lua b/stow/.config/nvim/lua/nico/txt/enter.lua new file mode 100644 index 0000000..f181d9c --- /dev/null +++ b/stow/.config/nvim/lua/nico/txt/enter.lua @@ -0,0 +1,21 @@ +-- opts +vim.opt.wrap = true +vim.opt.linebreak = true +vim.opt.textwidth = 80 +vim.opt.formatoptions:append("t") + +-- ai slop that gets the job done +-- redo formatting when leaving the insert mode +vim.api.nvim_create_augroup("FormatText", { clear = true }) + +vim.api.nvim_create_autocmd("FileType", { + pattern = { "markdown", "txt" }, + callback = function() + vim.api.nvim_create_autocmd("InsertLeave", { + buffer = 0, + callback = function() + vim.cmd("normal! gggqG") + end, + }) + end, +}) diff --git a/stow/.config/nvim/lua/nico/txt/init.lua b/stow/.config/nvim/lua/nico/txt/init.lua new file mode 100644 index 0000000..f83ccec --- /dev/null +++ b/stow/.config/nvim/lua/nico/txt/init.lua @@ -0,0 +1,16 @@ +-- another slopination by ai +vim.api.nvim_create_augroup("LoadLuaOnMarkdownOrTxt", { clear = true }) +vim.api.nvim_create_autocmd({"BufRead", "BufNewFile"}, { + pattern = {"*.md", "*.txt"}, + callback = function() + require("nico.txt.enter") + end +}) + +vim.api.nvim_create_autocmd("BufLeave", { + pattern = {"*.md", "*.txt"}, + callback = function() + require("nico.txt.leave") + require("nico.opts") + end +}) diff --git a/stow/.config/nvim/lua/nico/txt/leave.lua b/stow/.config/nvim/lua/nico/txt/leave.lua new file mode 100644 index 0000000..e2bc41d --- /dev/null +++ b/stow/.config/nvim/lua/nico/txt/leave.lua @@ -0,0 +1,10 @@ +-- opts +-- neovim defaults +vim.opt.wrap = true +vim.opt.linebreak = false +vim.opt.textwidth = 0 +vim.opt.formatoptions = "tcqj" + +-- ai slop that gets the job done +-- disables redo formatting when leaving the insert mode +vim.api.nvim_create_augroup("FormatText", { clear = true })