nvim: Docs, simplification, new plugins

This commit is contained in:
2022-12-29 08:46:06 +02:00
parent a605d46294
commit 7b2831ec94
3 changed files with 83 additions and 18 deletions

View File

@@ -123,6 +123,10 @@ vim.o.termguicolors = true
-- Set completeopt to have a better completion experience
vim.o.completeopt = 'menuone,noselect'
-- Configure and disable providers.
vim.g.python3_host_prog = '/opt/homebrew/bin/python3'
vim.g.loaded_ruby_provider = 0
-- [[ Basic Keymaps ]]
-- Set <space> as the leader key
-- See `:help mapleader`
@@ -490,7 +494,12 @@ map('n', '<Space>bw', '<Cmd>BufferOrderByWindowNumber<CR>', opts)
-- :BarbarEnable - enables barbar (enabled by default)
-- :BarbarDisable - very bad command, should never be used
vim.api.nvim_create_autocmd("BufWritePost", { pattern = "plugins.lua", command = "source <afile> | PackerSync" })
vim.api.nvim_create_autocmd("BufRead", { pattern = "*/node_modules/*", command = "lua vim.diagnostic.disable(0)" })
vim.api.nvim_create_autocmd("BufNewFile", { pattern = "*/node_modules/*", command = "lua vim.diagnostic.disable(0)" })
-- Enable spell checking for certain file types
vim.api.nvim_create_autocmd({ "BufRead", "BufNewFile" }, { pattern = { "*.txt", "*.md", "*.tex" },
command = "setlocal spell" })
-- The line beneath this is called `modeline`. See `:help modeline`
-- vim: ts=2 sts=2 sw=2 et

View File

@@ -1,25 +1,36 @@
return function(use)
use({
"folke/which-key.nvim",
config = function()
require("which-key").setup({})
end
})
-- catppuccin theme
-- 💥 Create key bindings that stick.
-- WhichKey is a lua plugin that displays a popup with
-- possible keybindings of the command you started typing.
use({ "folke/which-key.nvim", config = function() require("which-key").setup({}) end })
-- 🍨 Soothing pastel theme for (Neo)vim
-- https://github.com/catppuccin/nvim
use { "catppuccin/nvim", as = "catppuccin" }
vim.cmd.colorscheme('catppuccin-latte')
-- markdown preview plugin for (neo)vim
-- https://github.com/iamcco/markdown-preview.nvim
use({
"iamcco/markdown-preview.nvim",
use({ "iamcco/markdown-preview.nvim",
run = function() vim.fn["mkdp#util#install"]() end,
})
-- The neovim tabline plugin.
-- https://github.com/romgrk/barbar.nvim
use 'nvim-tree/nvim-web-devicons'
use {'romgrk/barbar.nvim', wants = 'nvim-web-devicons'}
use { 'romgrk/barbar.nvim', wants = 'nvim-web-devicons' }
-- Pretty UI
use 'stevearc/dressing.nvim' -- Neovim plugin to improve the default vim.ui interfaces
use 'rcarriga/nvim-notify' -- A fancy, configurable, notification manager for NeoVim
use 'vigoux/notifier.nvim' -- Non-intrusive notification system for neovim
use { 'folke/todo-comments.nvim', -- ✅ Highlight, list and search todo comments in your projects
requires = 'nvim-lua/plenary.nvim',
config = function() require('todo-comments').setup {} end,
}
-- The Refactoring library based off the Refactoring book by Martin Fowler
-- https://github.com/ThePrimeagen/refactoring.nvim
use {
"ThePrimeagen/refactoring.nvim",
@@ -28,17 +39,32 @@ return function(use)
{"nvim-treesitter/nvim-treesitter"}
}
}
-- An asynchronous linter plugin for Neovim complementary to the built-in Language Server Protocol support.
-- https://github.com/mfussenegger/nvim-lint
use 'mfussenegger/nvim-lint'
vim.api.nvim_create_autocmd({ "BufWritePost" }, {
callback = function() require("lint").try_lint() end,
})
-- Remaps for the refactoring operations currently offered by the plugin
vim.api.nvim_set_keymap("v", "<leader>re", [[ <Esc><Cmd>lua require('refactoring').refactor('Extract Function')<CR>]], {noremap = true, silent = true, expr = false})
vim.api.nvim_set_keymap("v", "<leader>rf", [[ <Esc><Cmd>lua require('refactoring').refactor('Extract Function To File')<CR>]], {noremap = true, silent = true, expr = false})
vim.api.nvim_set_keymap("v", "<leader>rv", [[ <Esc><Cmd>lua require('refactoring').refactor('Extract Variable')<CR>]], {noremap = true, silent = true, expr = false})
vim.api.nvim_set_keymap("v", "<leader>ri", [[ <Esc><Cmd>lua require('refactoring').refactor('Inline Variable')<CR>]], {noremap = true, silent = true, expr = false})
local map = vim.api.nvim_set_keymap
local refactoring_opts = { noremap = true, silent = true, expr = false }
map("v", "<leader>re", [[ <Esc><Cmd>lua require('refactoring').refactor('Extract Function')<CR>]], refactoring_opts)
map("v", "<leader>rf", [[ <Esc><Cmd>lua require('refactoring').refactor('Extract Function To File')<CR>]], refactoring_opts)
map("v", "<leader>rv", [[ <Esc><Cmd>lua require('refactoring').refactor('Extract Variable')<CR>]], refactoring_opts)
map("v", "<leader>ri", [[ <Esc><Cmd>lua require('refactoring').refactor('Inline Variable')<CR>]], refactoring_opts)
-- Extract block doesn't need visual mode
vim.api.nvim_set_keymap("n", "<leader>rb", [[ <Cmd>lua require('refactoring').refactor('Extract Block')<CR>]], {noremap = true, silent = true, expr = false})
vim.api.nvim_set_keymap("n", "<leader>rbf", [[ <Cmd>lua require('refactoring').refactor('Extract Block To File')<CR>]], {noremap = true, silent = true, expr = false})
map("n", "<leader>rb", [[ <Cmd>lua require('refactoring').refactor('Extract Block')<CR>]], refactoring_opts)
map("n", "<leader>rbf", [[ <Cmd>lua require('refactoring').refactor('Extract Block To File')<CR>]], refactoring_opts)
-- Inline variable can also pick up the identifier currently under the cursor without visual mode
vim.api.nvim_set_keymap("n", "<leader>ri", [[ <Cmd>lua require('refactoring').refactor('Inline Variable')<CR>]], {noremap = true, silent = true, expr = false})
map("n", "<leader>ri", [[ <Cmd>lua require('refactoring').refactor('Inline Variable')<CR>]],refactoring_opts)
-- prompt for a refactor to apply when the remap is triggered
map("v", "<leader>rr", ":lua require('refactoring').select_refactor()<CR>", refactoring_opts)
end

View File

@@ -105,6 +105,11 @@ _G.packer_plugins = {
path = "/Users/ivuorinen/.local/share/nvim/site/pack/packer/start/cmp_luasnip",
url = "https://github.com/saadparwaiz1/cmp_luasnip"
},
["dressing.nvim"] = {
loaded = true,
path = "/Users/ivuorinen/.local/share/nvim/site/pack/packer/start/dressing.nvim",
url = "https://github.com/stevearc/dressing.nvim"
},
["fidget.nvim"] = {
loaded = true,
path = "/Users/ivuorinen/.local/share/nvim/site/pack/packer/start/fidget.nvim",
@@ -140,16 +145,31 @@ _G.packer_plugins = {
path = "/Users/ivuorinen/.local/share/nvim/site/pack/packer/start/mason.nvim",
url = "https://github.com/williamboman/mason.nvim"
},
["notifier.nvim"] = {
loaded = true,
path = "/Users/ivuorinen/.local/share/nvim/site/pack/packer/start/notifier.nvim",
url = "https://github.com/vigoux/notifier.nvim"
},
["nvim-cmp"] = {
loaded = true,
path = "/Users/ivuorinen/.local/share/nvim/site/pack/packer/start/nvim-cmp",
url = "https://github.com/hrsh7th/nvim-cmp"
},
["nvim-lint"] = {
loaded = true,
path = "/Users/ivuorinen/.local/share/nvim/site/pack/packer/start/nvim-lint",
url = "https://github.com/mfussenegger/nvim-lint"
},
["nvim-lspconfig"] = {
loaded = true,
path = "/Users/ivuorinen/.local/share/nvim/site/pack/packer/start/nvim-lspconfig",
url = "https://github.com/neovim/nvim-lspconfig"
},
["nvim-notify"] = {
loaded = true,
path = "/Users/ivuorinen/.local/share/nvim/site/pack/packer/start/nvim-notify",
url = "https://github.com/rcarriga/nvim-notify"
},
["nvim-treesitter"] = {
loaded = true,
path = "/Users/ivuorinen/.local/share/nvim/site/pack/packer/start/nvim-treesitter",
@@ -200,6 +220,12 @@ _G.packer_plugins = {
path = "/Users/ivuorinen/.local/share/nvim/site/pack/packer/start/telescope.nvim",
url = "https://github.com/nvim-telescope/telescope.nvim"
},
["todo-comments.nvim"] = {
config = { "\27LJ\2\n?\0\0\3\0\3\0\a6\0\0\0'\2\1\0B\0\2\0029\0\2\0004\2\0\0B\0\2\1K\0\1\0\nsetup\18todo-comments\frequire\0" },
loaded = true,
path = "/Users/ivuorinen/.local/share/nvim/site/pack/packer/start/todo-comments.nvim",
url = "https://github.com/folke/todo-comments.nvim"
},
["vim-fugitive"] = {
loaded = true,
path = "/Users/ivuorinen/.local/share/nvim/site/pack/packer/start/vim-fugitive",
@@ -224,6 +250,10 @@ _G.packer_plugins = {
}
time([[Defining packer_plugins]], false)
-- Config for: todo-comments.nvim
time([[Config for todo-comments.nvim]], true)
try_loadstring("\27LJ\2\n?\0\0\3\0\3\0\a6\0\0\0'\2\1\0B\0\2\0029\0\2\0004\2\0\0B\0\2\1K\0\1\0\nsetup\18todo-comments\frequire\0", "config", "todo-comments.nvim")
time([[Config for todo-comments.nvim]], false)
-- Config for: which-key.nvim
time([[Config for which-key.nvim]], true)
try_loadstring("\27LJ\2\n;\0\0\3\0\3\0\a6\0\0\0'\2\1\0B\0\2\0029\0\2\0004\2\0\0B\0\2\1K\0\1\0\nsetup\14which-key\frequire\0", "config", "which-key.nvim")