Rewrote neovim config

This commit is contained in:
Eduard Urbach 2023-08-19 19:22:56 +02:00
parent 0c4b569ab5
commit d07a82fff2
Signed by: akyoto
GPG Key ID: C874F672B1AF20C0
23 changed files with 177 additions and 196 deletions

View File

@ -1,8 +0,0 @@
tt.*
.tests
doc/tags
debug
.repro
foo.*
*.log
data

View File

@ -1,2 +1,4 @@
-- bootstrap lazy.nvim, LazyVim and your plugins
require("config.lazy")
require("config.settings")
require("config.keys")
require("boot")
require("config.autocmds")

View File

@ -1,48 +1,16 @@
{
"LazyVim": { "branch": "main", "commit": "aa1cccf230a01bd85d5173f7d87f782fd83caa88" },
"LuaSnip": { "branch": "master", "commit": "c4d6298347f7707e9757351b2ee03d0c00da5c20" },
"alpha-nvim": { "branch": "main", "commit": "7a6b9487dba044a43fde534bf5036f0fda5b6b23" },
"catppuccin": { "branch": "main", "commit": "490078b1593c6609e6a50ad5001e7902ea601824" },
"Comment.nvim": { "branch": "master", "commit": "0236521ea582747b58869cb72f70ccfa967d2e89" },
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
"cmp-nvim-lsp": { "branch": "main", "commit": "44b16d11215dce86f253ce0c30949813c0a90765" },
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
"cmp_luasnip": { "branch": "master", "commit": "18095520391186d634a0045dacaa346291096566" },
"dressing.nvim": { "branch": "master", "commit": "6bde51adabba06f7fd4a469885a85f36d78a5f52" },
"flash.nvim": { "branch": "main", "commit": "967117690bd677cb7b6a87f0bc0077d2c0be3a27" },
"friendly-snippets": { "branch": "main", "commit": "377d45475b49e37460a902d6d569d2093d4037d0" },
"gitsigns.nvim": { "branch": "main", "commit": "5a2b1205841bc06ffb15719b14d54987e17b22ae" },
"indent-blankline.nvim": { "branch": "master", "commit": "4541d690816cb99a7fc248f1486aa87f3abce91c" },
"lazy.nvim": { "branch": "main", "commit": "3ad55ae678876516156cca2f361c51f7952a924b" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "e86a4c84ff35240639643ffed56ee1c4d55f538e" },
"mason.nvim": { "branch": "main", "commit": "b5bb138312dbd3f7729197ca659cbe5221d36a03" },
"mini.ai": { "branch": "main", "commit": "7ae226f331885e6f30e9a8229e113debc59308ae" },
"mini.bufremove": { "branch": "main", "commit": "7821606e35c1ac931b56d8e3155f45ffe76ee7e5" },
"mini.comment": { "branch": "main", "commit": "877acea5b2a32ff55f808fc0ebe9aa898648318c" },
"mini.indentscope": { "branch": "main", "commit": "f60e9b51a6214c73a170ffc5445ce91560981031" },
"mini.pairs": { "branch": "main", "commit": "dfa9f6e2576bb8853be277d96b735af59d9be7c2" },
"mini.surround": { "branch": "main", "commit": "9d1956b576d7051da3a483b251dfc778121c60db" },
"neo-tree.nvim": { "branch": "v3.x", "commit": "cac2e1bfa1ecd5bd0ce7ae29e12efb3ba5a7347d" },
"neodev.nvim": { "branch": "main", "commit": "47dacc6d8f74936f7719351b025421df740c789b" },
"noice.nvim": { "branch": "main", "commit": "894db25ec726d32047799d4d0a982b701bec453b" },
"nui.nvim": { "branch": "main", "commit": "9e3916e784660f55f47daa6f26053ad044db5d6a" },
"null-ls.nvim": { "branch": "main", "commit": "0010ea927ab7c09ef0ce9bf28c2b573fc302f5a7" },
"gitsigns.nvim": { "branch": "main", "commit": "749267aaa863c30d721c9913699c5d94e0c07dd3" },
"lazy.nvim": { "branch": "main", "commit": "dac844ed617dda4f9ec85eb88e9629ad2add5e05" },
"nvim-cmp": { "branch": "main", "commit": "51f1e11a89ec701221877532ee1a23557d291dd5" },
"nvim-lspconfig": { "branch": "master", "commit": "0d29cad8de3b2c654315203fc1fe12fde722a18a" },
"nvim-navic": { "branch": "master", "commit": "9c89730da6a05acfeb6a197e212dfadf5aa60ca0" },
"nvim-notify": { "branch": "master", "commit": "ea9c8ce7a37f2238f934e087c255758659948e0f" },
"nvim-spectre": { "branch": "master", "commit": "5b39919a2947b1266b3aa34d0b0b14c35523bc69" },
"nvim-treesitter": { "branch": "master", "commit": "add1864bbf2d3b8e789ec6b4715bb5a4073e3b60" },
"nvim-treesitter-textobjects": { "branch": "master", "commit": "56272167a6dead91c47c02dbdbfe1ae5643c59f5" },
"nvim-ts-context-commentstring": { "branch": "main", "commit": "9bff161dfece6ecf3459e6e46ca42e49f9ed939f" },
"nvim-lspconfig": { "branch": "master", "commit": "67f151e84daddc86cc65f5d935e592f76b9f4496" },
"nvim-tree.lua": { "branch": "master", "commit": "dea82ae2071a8d6412ca31e8fc48da5accad1a1d" },
"nvim-treesitter": { "branch": "master", "commit": "8fa7ce35afe88b8294e6ced757aa14ec98414568" },
"nvim-web-devicons": { "branch": "master", "commit": "cfc8824cc1db316a276b36517f093baccb8e799a" },
"onedark.nvim": { "branch": "master", "commit": "09b71d84bd2524438e48c0aa5b54d855cc72af32" },
"persistence.nvim": { "branch": "main", "commit": "4b8051c01f696d8849a5cb8afa9767be8db16e40" },
"plenary.nvim": { "branch": "master", "commit": "267282a9ce242bbb0c5dc31445b6d353bed978bb" },
"project.nvim": { "branch": "main", "commit": "8c6bad7d22eef1b71144b401c9f74ed01526a4fb" },
"telescope.nvim": { "branch": "master", "commit": "2d92125620417fbea82ec30303823e3cd69e90e8" },
"tokyonight.nvim": { "branch": "main", "commit": "1ee11019f8a81dac989ae1db1a013e3d582e2033" },
"trouble.nvim": { "branch": "main", "commit": "40aad004f53ae1d1ba91bcc5c29d59f07c5f01d3" },
"vim-illuminate": { "branch": "master", "commit": "76f28e858f1caae87bfa45fb4fd09e4b053fc45b" },
"vim-startuptime": { "branch": "master", "commit": "454b3de856b7bd298700de33d79774ca9b9e3875" },
"which-key.nvim": { "branch": "main", "commit": "7ccf476ebe0445a741b64e36c78a682c1c6118b7" }
"telescope.nvim": { "branch": "master", "commit": "2d92125620417fbea82ec30303823e3cd69e90e8" }
}

35
.config/nvim/lua/boot.lua Normal file
View File

@ -0,0 +1,35 @@
-- Bootstrap 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",
lazypath,
})
end
vim.opt.rtp:prepend(lazypath)
-- Setup package manager
require("lazy").setup("plugins", {
defaults = {
lazy = true,
},
change_detection = {
notify = false,
},
performance = {
rtp = {
disabled_plugins = {
"gzip",
"netrwPlugin",
"tarPlugin",
"tohtml",
"tutor",
"zipPlugin",
},
},
},
})

View File

@ -1,16 +1,7 @@
-- Autocmds are automatically loaded on the VeryLazy event
-- Default autocmds that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/autocmds.lua
-- Add any additional autocmds here
local on = vim.api.nvim_create_autocmd
-- Disable spell checking
vim.api.nvim_clear_autocmds({
group = "lazyvim_wrap_spell",
})
-- Enable wrapping
vim.api.nvim_create_autocmd("FileType", {
pattern = { "gitcommit", "markdown" },
on("VimEnter", {
callback = function()
vim.opt_local.wrap = true
require("nvim-tree.api").tree.toggle({ focus = false })
end,
})

View File

@ -1,6 +0,0 @@
-- Keymaps are automatically loaded on the VeryLazy event
-- Default keymaps that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/keymaps.lua
-- Add any additional keymaps here
vim.keymap.set("n", "U", "<cmd>redo<cr>", { desc = "Redo" })
vim.keymap.set("n", "<C-r>", ":%s/<C-R><C-W>//g<Left><Left>", { desc = "Replace word under cursor" })

View File

@ -0,0 +1,25 @@
local map = vim.keymap.set
-- Normal mode
map("n", "<C-n>", "<cmd>enew<cr>", { desc = "New File" })
map("n", "<C-b>", "<cmd>NvimTreeToggle<cr>", { desc = "Toggle file explorer" })
map("n", "<C-q>", "<cmd>qa<cr>", { desc = "Quit all" })
map("n", "<leader>l", "<cmd>Lazy<cr>", { desc = "Lazy" })
map("n", "<leader>f", "<cmd>Telescope find_files<cr>", { desc = "Find files" })
map("n", "<leader>r", "<cmd>Telescope oldfiles<cr>", { desc = "Recent files" })
map("n", "<leader>s", "<cmd>Telescope symbols<cr>", { desc = "Symbols" })
map("n", "<leader>cf", vim.lsp.buf.format, { desc = "Format" })
map("n", "gd", vim.lsp.buf.definition, { desc = "Go to definition" })
map("n", "gr", vim.lsp.buf.references, { desc = "Go to references" })
-- Visual mode
map("v", "<", "<gv")
map("v", ">", ">gv")
-- Mixed modes
map({ "i", "n" }, "<esc>", "<cmd>noh<cr><esc>", { desc = "Clear search" })
map({ "i", "v", "n", "s" }, "<C-s>", "<cmd>w<cr><esc>", { desc = "Save file" })
-- Toggle comment
map("n", "<leader>/", "<cmd>lua require('Comment.api').toggle.linewise.current()<cr>", { desc = "Toggle comment" })
map("v", "<leader>/", "<esc><cmd>lua require('Comment.api').toggle.linewise(vim.fn.visualmode())<cr>", { desc = "Toggle comment" })

View File

@ -1,31 +0,0 @@
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
-- stylua: ignore
vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", "--branch=stable", lazypath })
end
vim.opt.rtp:prepend(vim.env.LAZY or lazypath)
require("lazy").setup({
spec = {
{ "LazyVim/LazyVim", import = "lazyvim.plugins" },
{ import = "lazyvim.plugins.extras.util.project" },
{ import = "plugins" },
},
defaults = {
lazy = false,
version = false,
},
install = { colorscheme = { "onedark" } },
checker = { enabled = true },
performance = {
rtp = {
disabled_plugins = {
"gzip",
"tarPlugin",
"tohtml",
"tutor",
"zipPlugin",
},
},
},
})

View File

@ -1,8 +1,9 @@
-- Options are automatically loaded before lazy.nvim startup
-- Default options that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/options.lua
-- Add any additional options here
local opt = vim.opt
local g = vim.g
g.mapleader = " "
g.loaded_netrw = 1
g.loaded_netrwPlugin = 1
local opt = vim.opt
opt.autowrite = false
opt.expandtab = false
opt.shiftwidth = 4
@ -13,5 +14,12 @@ opt.smartindent = true
opt.spell = false
opt.conceallevel = 0
opt.ignorecase = false
opt.number = true
opt.relativenumber = false
--opt.cursorlineopt = "number"
opt.cursorline = true
opt.cursorlineopt = "both"
opt.termguicolors = true
opt.signcolumn = "yes"
opt.laststatus = 0
opt.showmode = false
opt.ruler = false

View File

@ -0,0 +1,9 @@
return {
"hrsh7th/nvim-cmp",
event = "InsertEnter",
dependencies = {
"hrsh7th/cmp-nvim-lsp",
"hrsh7th/cmp-buffer",
"hrsh7th/cmp-path",
},
}

View File

@ -0,0 +1,13 @@
return {
"numToStr/Comment.nvim",
event = "VeryLazy",
opts = {
mappings = {
basic = false,
extra = false,
},
},
config = function(_, opts)
require("Comment").setup(opts)
end,
}

View File

@ -1,6 +0,0 @@
return {
{ "akinsho/bufferline.nvim", enabled = false },
{ "nvim-lualine/lualine.nvim", enabled = false },
{ "folke/todo-comments.nvim", enabled = false },
{ "folke/neoconf.nvim", enabled = false },
}

View File

@ -1,13 +0,0 @@
return {
"nvim-neo-tree/neo-tree.nvim",
opts = {
filesystem = {
filtered_items = {
hide_dotfiles = false,
},
},
follow_current_file = {
enabled = true,
},
},
}

View File

@ -1,13 +0,0 @@
return {
"jose-elias-alvarez/null-ls.nvim",
opts = function()
local nls = require("null-ls")
return {
sources = {
nls.builtins.formatting.prettierd,
nls.builtins.formatting.shfmt,
nls.builtins.formatting.stylua,
},
}
end,
}

View File

@ -0,0 +1,7 @@
return {
"lewis6991/gitsigns.nvim",
event = "BufReadPre",
config = function()
require("gitsigns").setup()
end,
}

View File

@ -1,24 +0,0 @@
return {
"neovim/nvim-lspconfig",
opts = {
servers = {
lua_ls = {},
-- web dev
cssls = {},
html = {},
jsonls = {},
tsserver = {},
svelte = {},
-- go
gopls = {
settings = {
gopls = {
gofumpt = false,
},
},
},
},
},
}

View File

@ -0,0 +1,24 @@
return {
"neovim/nvim-lspconfig",
event = { "BufReadPre", "BufNewFile" },
opts = {
servers = {
lua_ls = {},
gopls = {},
-- web dev
--cssls = {},
--html = {},
--jsonls = {},
--tsserver = {},
--svelte = {},
},
},
config = function(_, opts)
local servers = opts.servers
for server, server_opts in pairs(servers) do
require("lspconfig")[server].setup(server_opts)
end
end,
}

View File

@ -1,15 +0,0 @@
return {
"williamboman/mason.nvim",
opts = {
ensure_installed = {
-- Go
"gofumpt",
-- HTML, CSS, JS, TS, JSON, Markdown, YAML
"prettierd",
-- Bash
"shfmt",
-- Lua
"stylua",
},
},
}

View File

@ -0,0 +1,7 @@
return {
"nvim-telescope/telescope.nvim",
event = "VeryLazy",
dependencies = {
"nvim-lua/plenary.nvim"
},
}

View File

@ -1,21 +1,7 @@
return {
{
"navarasu/onedark.nvim",
opts = {
style = "dark",
--transparent = true,
},
},
{
"rcarriga/nvim-notify",
opts = {
--background_colour = "#000000",
},
},
{
"LazyVim/LazyVim",
opts = {
colorscheme = "onedark",
},
},
event = "VeryLazy",
config = function()
require('onedark').load()
end,
}

View File

@ -0,0 +1,18 @@
return {
"nvim-tree/nvim-tree.lua",
event = "VeryLazy",
dependencies = {
"nvim-tree/nvim-web-devicons",
"navarasu/onedark.nvim",
},
config = function()
require("nvim-tree").setup({
view = {
width = 35,
},
renderer = {
root_folder_label = false
},
})
end,
}

View File

@ -1,5 +1,7 @@
return {
"nvim-treesitter/nvim-treesitter",
event = { "BufReadPost", "BufNewFile" },
build = ":TSUpdate",
opts = {
ensure_installed = {
-- basics
@ -24,5 +26,10 @@ return {
"gowork",
"gosum",
},
highlight = { enable = true },
indent = { enable = true },
},
config = function(_, opts)
require("nvim-treesitter.configs").setup(opts)
end,
}

View File

@ -1,3 +0,0 @@
indent_type = "Tabs"
indent_width = 4
column_width = 120