init
This commit is contained in:
7
config/nvim/init.lua
Normal file
7
config/nvim/init.lua
Normal file
@@ -0,0 +1,7 @@
|
||||
require("config.plugins-setup")
|
||||
require("config.core.options")
|
||||
require("config.core.keymaps")
|
||||
require("config.core.colorscheme")
|
||||
require("config.plugins.nvim-tree")
|
||||
require("config.plugins.lualine")
|
||||
require("config.plugins.colorizer")
|
11
config/nvim/lua/config/core/colorscheme.lua
Normal file
11
config/nvim/lua/config/core/colorscheme.lua
Normal file
@@ -0,0 +1,11 @@
|
||||
local status, _ = pcall(vim.cmd, "colorscheme onedark")
|
||||
if not status then
|
||||
print("Colorscheme not found!") -- print error if colorscheme not installed
|
||||
return
|
||||
end
|
||||
|
||||
require('onedark').setup {
|
||||
style = 'darker',
|
||||
transparent = true
|
||||
}
|
||||
require('onedark').load()
|
19
config/nvim/lua/config/core/keymaps.lua
Normal file
19
config/nvim/lua/config/core/keymaps.lua
Normal file
@@ -0,0 +1,19 @@
|
||||
vim.g.mapleader = " "
|
||||
|
||||
local keymap = vim.keymap -- haz las cosas facil..
|
||||
|
||||
-- General Keymaps
|
||||
|
||||
-- window management
|
||||
keymap.set("n", "<leader>sv", "<C-w>v") -- split window vertically
|
||||
keymap.set("n", "<leader>sh", "<C-w>s") -- split window horizontally
|
||||
keymap.set("n", "<leader>se", "<C-w>=") -- make split windows equal width & height
|
||||
keymap.set("n", "<leader>sx", ":close<CR>") -- close current split window
|
||||
|
||||
keymap.set("n", "<leader>to", ":tabnew<CR>") -- open new tab
|
||||
keymap.set("n", "<leader>tx", ":tabclose<CR>") -- close current tab
|
||||
keymap.set("n", "<leader>tn", ":tabn<CR>") -- go to next tab
|
||||
keymap.set("n", "<leader>tp", ":tabp<CR>") -- go to previous tab
|
||||
|
||||
-- nvim-tree
|
||||
keymap.set("n", "<leader>e", ":NvimTreeToggle<CR>") -- toggle file explorer
|
38
config/nvim/lua/config/core/options.lua
Normal file
38
config/nvim/lua/config/core/options.lua
Normal file
@@ -0,0 +1,38 @@
|
||||
local opt = vim.opt -- for conciseness
|
||||
|
||||
-- Numeracion de las lineas
|
||||
opt.relativenumber = true
|
||||
opt.number = true
|
||||
|
||||
-- tabs & indentation
|
||||
opt.tabstop = 4
|
||||
opt.shiftwidth = 4
|
||||
opt.expandtab = true
|
||||
opt.autoindent = true
|
||||
|
||||
-- Line wrapping
|
||||
opt.wrap = false
|
||||
|
||||
-- Search setting
|
||||
opt.ignorecase = true
|
||||
opt.smartcase = true
|
||||
|
||||
-- Cursor line
|
||||
opt.cursorline = true
|
||||
|
||||
-- appearance
|
||||
opt.termguicolors = true
|
||||
opt.background = "dark"
|
||||
opt.signcolumn = "yes"
|
||||
|
||||
-- Backspace
|
||||
opt.backspace = "indent,eol,start"
|
||||
|
||||
-- Clipboard
|
||||
opt.clipboard:append("unnamedplus")
|
||||
|
||||
-- Splitt Windows
|
||||
opt.splitright = true
|
||||
opt.splitbelow = true
|
||||
|
||||
opt.iskeyword:append("-")
|
52
config/nvim/lua/config/plugins-setup.lua
Normal file
52
config/nvim/lua/config/plugins-setup.lua
Normal file
@@ -0,0 +1,52 @@
|
||||
-- auto install packer if not installed
|
||||
local ensure_packer = function()
|
||||
local fn = vim.fn
|
||||
local install_path = fn.stdpath("data") .. "/site/pack/packer/start/packer.nvim"
|
||||
if fn.empty(fn.glob(install_path)) > 0 then
|
||||
fn.system({ "git", "clone", "--depth", "1", "https://github.com/wbthomason/packer.nvim", install_path })
|
||||
vim.cmd([[packadd packer.nvim]])
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
local packer_bootstrap = ensure_packer() -- true if packer was just installed
|
||||
|
||||
-- autocommand that reloads neovim and installs/updates/removes plugins
|
||||
-- when file is saved
|
||||
vim.cmd([[
|
||||
augroup packer_user_config
|
||||
autocmd!
|
||||
autocmd BufWritePost plugins-setup.lua source <afile> | PackerSync
|
||||
augroup end
|
||||
]])
|
||||
|
||||
-- import packer safely
|
||||
local status, packer = pcall(require, "packer")
|
||||
if not status then
|
||||
return
|
||||
end
|
||||
|
||||
-- add list of plugins to install
|
||||
return packer.startup(function(use)
|
||||
-- packer can manage itself
|
||||
use("wbthomason/packer.nvim")
|
||||
|
||||
use("navarasu/onedark.nvim")
|
||||
|
||||
-- file explorer
|
||||
use("nvim-tree/nvim-tree.lua")
|
||||
|
||||
-- vs-code like icons
|
||||
use("nvim-tree/nvim-web-devicons")
|
||||
|
||||
-- statusline
|
||||
use("nvim-lualine/lualine.nvim")
|
||||
|
||||
-- Colorizer
|
||||
use("norcalli/nvim-colorizer.lua")
|
||||
|
||||
|
||||
if packer_bootstrap then
|
||||
require("packer").sync()
|
||||
end
|
||||
end)
|
12
config/nvim/lua/config/plugins/colorizer.lua
Normal file
12
config/nvim/lua/config/plugins/colorizer.lua
Normal file
@@ -0,0 +1,12 @@
|
||||
require'colorizer'.setup(
|
||||
{'*';},
|
||||
{
|
||||
RGB = true; -- #RGB hex codes
|
||||
RRGGBB = true; -- #RRGGBB hex codes
|
||||
names = true; -- "Name" codes like Blue
|
||||
RRGGBBAA = true; -- #RRGGBBAA hex codes
|
||||
rgb_fn = true; -- CSS rgb() and rgba() functions
|
||||
hsl_fn = true; -- CSS hsl() and hsla() functions
|
||||
css = true; -- Enable all CSS features: rgb_fn, hsl_fn, names, RGB, RRGGBB
|
||||
css_fn = true; -- Enable all CSS *functions*: rgb_fn, hsl_fn
|
||||
})
|
36
config/nvim/lua/config/plugins/lualine.lua
Normal file
36
config/nvim/lua/config/plugins/lualine.lua
Normal file
@@ -0,0 +1,36 @@
|
||||
-- import lualine plugin safely
|
||||
local status, lualine = pcall(require, "lualine")
|
||||
if not status then
|
||||
return
|
||||
end
|
||||
|
||||
-- get lualine nightfly theme
|
||||
local lualine_onedark = require("lualine.themes.onedark")
|
||||
|
||||
-- new colors for theme
|
||||
local new_colors = {
|
||||
blue = "#65D1FF",
|
||||
green = "#3EFFDC",
|
||||
violet = "#FF61EF",
|
||||
yellow = "#FFDA7B",
|
||||
black = "#000000",
|
||||
}
|
||||
|
||||
-- change nightlfy theme colors
|
||||
lualine_onedark.normal.a.bg = new_colors.blue
|
||||
lualine_onedark.insert.a.bg = new_colors.green
|
||||
lualine_onedark.visual.a.bg = new_colors.violet
|
||||
lualine_onedark.command = {
|
||||
a = {
|
||||
gui = "bold",
|
||||
bg = new_colors.yellow,
|
||||
fg = new_colors.black, -- black
|
||||
},
|
||||
}
|
||||
|
||||
-- configure lualine with modified theme
|
||||
lualine.setup({
|
||||
options = {
|
||||
theme = lualine_onedark,
|
||||
},
|
||||
})
|
40
config/nvim/lua/config/plugins/nvim-tree.lua
Normal file
40
config/nvim/lua/config/plugins/nvim-tree.lua
Normal file
@@ -0,0 +1,40 @@
|
||||
-- import nvim-tree plugin safely
|
||||
local setup, nvimtree = pcall(require, "nvim-tree")
|
||||
if not setup then
|
||||
return
|
||||
end
|
||||
|
||||
-- recommended settings from nvim-tree documentation
|
||||
vim.g.loaded_netrw = 1
|
||||
vim.g.loaded_netrwPlugin = 1
|
||||
|
||||
-- change color for arrows in tree to light blue
|
||||
vim.cmd([[ highlight NvimTreeIndentMarker guifg=#3FC5FF ]])
|
||||
|
||||
-- configure nvim-tree
|
||||
nvimtree.setup({
|
||||
-- change folder arrow icons
|
||||
renderer = {
|
||||
icons = {
|
||||
glyphs = {
|
||||
folder = {
|
||||
arrow_closed = "", -- arrow when folder is closed
|
||||
arrow_open = "", -- arrow when folder is open
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
-- disable window_picker for
|
||||
-- explorer to work well with
|
||||
-- window splits
|
||||
actions = {
|
||||
open_file = {
|
||||
window_picker = {
|
||||
enable = false,
|
||||
},
|
||||
},
|
||||
},
|
||||
-- git = {
|
||||
-- ignore = false,
|
||||
-- },
|
||||
})
|
Reference in New Issue
Block a user