From 8abb5dc6dfcbf67534f9fd521f1576c7e163c6e4 Mon Sep 17 00:00:00 2001 From: Vitor Gonçalves Date: Sat, 3 Feb 2024 11:04:08 -0300 Subject: nvim: major refactor it's basically the same config but refactored --- .config/nvim/init.lua | 61 +--------------------------- .config/nvim/lazy-lock.json | 4 ++ .config/nvim/lua/config/init.lua | 10 +++++ .config/nvim/lua/config/map.lua | 14 +++++++ .config/nvim/lua/config/opt.lua | 27 ++++++++++++ .config/nvim/lua/config/plg.lua | 19 +++++++++ .config/nvim/pack/plugins/start/emmet-vim | 1 - .config/nvim/pack/plugins/start/gruvbox.nvim | 1 - .config/nvim/pack/plugins/start/vim-polyglot | 1 - 9 files changed, 75 insertions(+), 63 deletions(-) create mode 100644 .config/nvim/lazy-lock.json create mode 100644 .config/nvim/lua/config/init.lua create mode 100644 .config/nvim/lua/config/map.lua create mode 100644 .config/nvim/lua/config/opt.lua create mode 100644 .config/nvim/lua/config/plg.lua delete mode 160000 .config/nvim/pack/plugins/start/emmet-vim delete mode 160000 .config/nvim/pack/plugins/start/gruvbox.nvim delete mode 160000 .config/nvim/pack/plugins/start/vim-polyglot diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua index f0de3b7..dbc863e 100644 --- a/.config/nvim/init.lua +++ b/.config/nvim/init.lua @@ -1,60 +1 @@ -local opt = vim.opt -local var = vim.g -local key = vim.keymap - --- tabs -opt.tabstop = 4 -opt.softtabstop = 4 -opt.shiftwidth = 4 -opt.expandtab = true -opt.smartindent = true - --- search -opt.showmatch = true -opt.ignorecase = true -opt.smartcase = true - -opt.swapfile = false -- noswapfile - -opt.clipboard = "unnamedplus" - -opt.undofile = true -- persistent undo - -vim.cmd("syntax on") -opt.termguicolors = true - -opt.number = true -opt.relativenumber = true -opt.numberwidth = 2 -opt.cursorline = true - -opt.background = "dark" -require('gruvbox').setup({ transparent_mode = true, dim_inactive = true, }) -vim.cmd("colorscheme gruvbox") - - --- keybindings -var.mapleader = " " -var.localleader = " " - --- splits -key.set("n", "h", "h") -key.set("n", "j", "j") -key.set("n", "k", "k") -key.set("n", "l", "l") -key.set("n", "L", ":vs") -key.set("n", "J", ":sp") -opt.splitright = true -opt.splitbelow = true - -key.set("n", "", ":nohlsearch", { silent = true }) -key.set("n", "w", ":w!") -key.set("n", "W", ":wq!") - -key.set("t", [[]]) - -vim.api.nvim_create_autocmd("FileType", { pattern=[[html,css]], command = "EmmetInstall" }) -var.user_emmet_mode = "n" -var.user_emmet_install_global = 0 -var.user_emmet_leader_key = "," - +require("config") diff --git a/.config/nvim/lazy-lock.json b/.config/nvim/lazy-lock.json new file mode 100644 index 0000000..712e221 --- /dev/null +++ b/.config/nvim/lazy-lock.json @@ -0,0 +1,4 @@ +{ + "gruvbox.nvim": { "branch": "main", "commit": "6e4027ae957cddf7b193adfaec4a8f9e03b4555f" }, + "lazy.nvim": { "branch": "main", "commit": "28126922c9b54e35a192ac415788f202c3944c9f" } +} \ No newline at end of file diff --git a/.config/nvim/lua/config/init.lua b/.config/nvim/lua/config/init.lua new file mode 100644 index 0000000..c14e595 --- /dev/null +++ b/.config/nvim/lua/config/init.lua @@ -0,0 +1,10 @@ +require("config.map") +require("config.opt") +require("config.plg") + +-- Colorscheme configuration +require("gruvbox").setup({ + italic = { strings = false, emphasis = false, comments = false }, + transparent_mode = true +}) +vim.cmd("colorscheme gruvbox") diff --git a/.config/nvim/lua/config/map.lua b/.config/nvim/lua/config/map.lua new file mode 100644 index 0000000..24a286f --- /dev/null +++ b/.config/nvim/lua/config/map.lua @@ -0,0 +1,14 @@ +local key = vim.keymap + +vim.g.mapleader = " " +vim.g.localleader = " " + +-- movement between splits +key.set("n", "", "h") +key.set("n", "", "j") +key.set("n", "", "k") +key.set("n", "", "l") +key.set("n", "", ":vs") +key.set("n", "", ":sp") + +key.set("n", "", ":nohlsearch", { silent = true }) diff --git a/.config/nvim/lua/config/opt.lua b/.config/nvim/lua/config/opt.lua new file mode 100644 index 0000000..ab65cd5 --- /dev/null +++ b/.config/nvim/lua/config/opt.lua @@ -0,0 +1,27 @@ +local opt = vim.opt + +-- tabs +opt.tabstop = 4 +opt.softtabstop = 4 +opt.shiftwidth = 4 +opt.expandtab = true +opt.smartindent = true + +-- search +opt.showmatch = true +opt.ignorecase = true +opt.smartcase = true + +opt.swapfile = false -- noswapfile +opt.undofile = true -- persistent undo + +vim.cmd("syntax on") +opt.termguicolors = true + +opt.number = true +opt.relativenumber = true +opt.numberwidth = 2 +opt.cursorline = true + +opt.splitright = true +opt.splitbelow = true diff --git a/.config/nvim/lua/config/plg.lua b/.config/nvim/lua/config/plg.lua new file mode 100644 index 0000000..c08d99c --- /dev/null +++ b/.config/nvim/lua/config/plg.lua @@ -0,0 +1,19 @@ +-- Initialize 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) + +local plugins = { + { "ellisonleao/gruvbox.nvim", priority = 1000 , config = true, opts = ...} +} + +require("lazy").setup(plugins, {}) diff --git a/.config/nvim/pack/plugins/start/emmet-vim b/.config/nvim/pack/plugins/start/emmet-vim deleted file mode 160000 index def5d57..0000000 --- a/.config/nvim/pack/plugins/start/emmet-vim +++ /dev/null @@ -1 +0,0 @@ -Subproject commit def5d57a1ae5afb1b96ebe83c4652d1c03640f4d diff --git a/.config/nvim/pack/plugins/start/gruvbox.nvim b/.config/nvim/pack/plugins/start/gruvbox.nvim deleted file mode 160000 index 4176b0b..0000000 --- a/.config/nvim/pack/plugins/start/gruvbox.nvim +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 4176b0b720db0c90ab4030e5c1b4893faf41fd51 diff --git a/.config/nvim/pack/plugins/start/vim-polyglot b/.config/nvim/pack/plugins/start/vim-polyglot deleted file mode 160000 index bc8a81d..0000000 --- a/.config/nvim/pack/plugins/start/vim-polyglot +++ /dev/null @@ -1 +0,0 @@ -Subproject commit bc8a81d3592dab86334f27d1d43c080ebf680d42 -- cgit 1.4.1-2-gfad0