Rewrote neovim config

This commit is contained in:
2023-08-19 19:22:56 +02:00
parent 0c4b569ab5
commit d07a82fff2
23 changed files with 177 additions and 196 deletions

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