add neovim config
This commit is contained in:
@@ -0,0 +1,9 @@
|
|||||||
|
-- ~/.config/nvim/init.lua
|
||||||
|
--
|
||||||
|
-- Charles Danesi (https://github.com/cdanesi)
|
||||||
|
|
||||||
|
-- Settings
|
||||||
|
require("plugins-setup")
|
||||||
|
require("core.options")
|
||||||
|
require("core.keymaps")
|
||||||
|
require("core.colorscheme")
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
-- set colorscheme if it's installed
|
||||||
|
local status, _ = pcall(vim.cmd, "colorscheme onenord")
|
||||||
|
if not status then
|
||||||
|
print("Color scheme not found!")
|
||||||
|
return
|
||||||
|
end
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
-- set leader key to space
|
||||||
|
vim.g.mapleader = " "
|
||||||
|
|
||||||
|
local keymap = vim.keymap
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
local opt = vim.opt
|
||||||
|
|
||||||
|
-- line numbers
|
||||||
|
opt.number = true
|
||||||
|
opt.relativenumber = true
|
||||||
|
|
||||||
|
-- tabs & indents
|
||||||
|
opt.tabstop = 3
|
||||||
|
opt.shiftwidth = 3
|
||||||
|
opt.expandtab = true
|
||||||
|
opt.autoindent = true
|
||||||
|
|
||||||
|
-- disable line wrapping
|
||||||
|
opt.wrap = false
|
||||||
|
|
||||||
|
-- search
|
||||||
|
opt.ignorecase = true
|
||||||
|
opt.smartcase = true
|
||||||
|
|
||||||
|
-- cursor line
|
||||||
|
opt.cursorline = true
|
||||||
|
|
||||||
|
-- appearance
|
||||||
|
opt.termguicolors = false
|
||||||
|
opt.background = "dark"
|
||||||
|
opt.signcolumn = "yes"
|
||||||
|
|
||||||
|
-- backspace
|
||||||
|
opt.backspace = "indent,eol,start"
|
||||||
|
|
||||||
|
-- clipboard
|
||||||
|
opt.clipboard:append("unnamedplus") -- use system clipboard as the default register
|
||||||
|
|
||||||
|
-- split windows
|
||||||
|
opt.splitright = true
|
||||||
|
opt.splitbelow = true
|
||||||
|
|
||||||
|
opt.iskeyword:append("-") -- consider string-string as a whole word
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
-- 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()
|
||||||
|
|
||||||
|
-- autoreload
|
||||||
|
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
|
||||||
|
|
||||||
|
-- enable plugins
|
||||||
|
return packer.startup(function(use)
|
||||||
|
use("wbthomason/packer.nvim")
|
||||||
|
use("nvim-lua/plenary.nvim")
|
||||||
|
use("rmehri01/onenord.nvim") -- preferred colorscheme
|
||||||
|
|
||||||
|
if packer_bootstrap then
|
||||||
|
require("packer").sync()
|
||||||
|
end
|
||||||
|
end)
|
||||||
Reference in New Issue
Block a user