Rewrote neovim config
This commit is contained in:
35
.config/nvim/lua/boot.lua
Normal file
35
.config/nvim/lua/boot.lua
Normal 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",
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
@ -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,
|
||||
})
|
||||
|
@ -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" })
|
25
.config/nvim/lua/config/keys.lua
Normal file
25
.config/nvim/lua/config/keys.lua
Normal 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" })
|
@ -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",
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
@ -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
|
9
.config/nvim/lua/plugins/autocomplete.lua
Normal file
9
.config/nvim/lua/plugins/autocomplete.lua
Normal file
@ -0,0 +1,9 @@
|
||||
return {
|
||||
"hrsh7th/nvim-cmp",
|
||||
event = "InsertEnter",
|
||||
dependencies = {
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
"hrsh7th/cmp-buffer",
|
||||
"hrsh7th/cmp-path",
|
||||
},
|
||||
}
|
13
.config/nvim/lua/plugins/comment.lua
Normal file
13
.config/nvim/lua/plugins/comment.lua
Normal 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,
|
||||
}
|
@ -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 },
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
return {
|
||||
"nvim-neo-tree/neo-tree.nvim",
|
||||
opts = {
|
||||
filesystem = {
|
||||
filtered_items = {
|
||||
hide_dotfiles = false,
|
||||
},
|
||||
},
|
||||
follow_current_file = {
|
||||
enabled = true,
|
||||
},
|
||||
},
|
||||
}
|
@ -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,
|
||||
}
|
7
.config/nvim/lua/plugins/gitsigns.lua
Normal file
7
.config/nvim/lua/plugins/gitsigns.lua
Normal file
@ -0,0 +1,7 @@
|
||||
return {
|
||||
"lewis6991/gitsigns.nvim",
|
||||
event = "BufReadPre",
|
||||
config = function()
|
||||
require("gitsigns").setup()
|
||||
end,
|
||||
}
|
@ -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,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
24
.config/nvim/lua/plugins/lsp.lua
Normal file
24
.config/nvim/lua/plugins/lsp.lua
Normal 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,
|
||||
}
|
@ -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",
|
||||
},
|
||||
},
|
||||
}
|
7
.config/nvim/lua/plugins/telescope.lua
Normal file
7
.config/nvim/lua/plugins/telescope.lua
Normal file
@ -0,0 +1,7 @@
|
||||
return {
|
||||
"nvim-telescope/telescope.nvim",
|
||||
event = "VeryLazy",
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim"
|
||||
},
|
||||
}
|
@ -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",
|
||||
},
|
||||
},
|
||||
"navarasu/onedark.nvim",
|
||||
event = "VeryLazy",
|
||||
config = function()
|
||||
require('onedark').load()
|
||||
end,
|
||||
}
|
||||
|
18
.config/nvim/lua/plugins/tree.lua
Normal file
18
.config/nvim/lua/plugins/tree.lua
Normal 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,
|
||||
}
|
@ -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,
|
||||
}
|
Reference in New Issue
Block a user