summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan DeMasi <jrdemasi@gmail.com>2023-06-29 21:08:40 -0600
committerJonathan DeMasi <jrdemasi@gmail.com>2023-06-29 21:08:40 -0600
commitb11874e3806f97a721e962125e64848c85b74fc0 (patch)
tree61c567e61c70bf2b3b7a18f6413bcb5891feae58
parent6f8635b0797353da01134e4598cf05640213d597 (diff)
downloadconfigs-b11874e3806f97a721e962125e64848c85b74fc0.tar
configs-b11874e3806f97a721e962125e64848c85b74fc0.tar.gz
configs-b11874e3806f97a721e962125e64848c85b74fc0.tar.bz2
configs-b11874e3806f97a721e962125e64848c85b74fc0.tar.lz
configs-b11874e3806f97a721e962125e64848c85b74fc0.tar.xz
configs-b11874e3806f97a721e962125e64848c85b74fc0.tar.zst
configs-b11874e3806f97a721e962125e64848c85b74fc0.zip
add nvim config
-rw-r--r--nvim/init.lua5
-rw-r--r--nvim/lua/jonathan/core/colorscheme.lua5
-rw-r--r--nvim/lua/jonathan/core/keymaps.lua0
-rw-r--r--nvim/lua/jonathan/core/options.lua30
-rw-r--r--nvim/lua/jonathan/plugins-setup.lua38
-rw-r--r--nvim/lua/jonathan/plugins/nvim-tree.lua53
6 files changed, 131 insertions, 0 deletions
diff --git a/nvim/init.lua b/nvim/init.lua
new file mode 100644
index 0000000..3c57d0f
--- /dev/null
+++ b/nvim/init.lua
@@ -0,0 +1,5 @@
+require("jonathan.plugins-setup")
+require("jonathan.core.options")
+require("jonathan.core.keymaps")
+require("jonathan.core.colorscheme")
+require("jonathan.plugins.nvim-tree")
diff --git a/nvim/lua/jonathan/core/colorscheme.lua b/nvim/lua/jonathan/core/colorscheme.lua
new file mode 100644
index 0000000..9faed16
--- /dev/null
+++ b/nvim/lua/jonathan/core/colorscheme.lua
@@ -0,0 +1,5 @@
+local status, _ = pcall(vim.cmd, "colorscheme elflord")
+if not status then
+ print("Colorscheme not found!")
+ return
+end
diff --git a/nvim/lua/jonathan/core/keymaps.lua b/nvim/lua/jonathan/core/keymaps.lua
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/nvim/lua/jonathan/core/keymaps.lua
diff --git a/nvim/lua/jonathan/core/options.lua b/nvim/lua/jonathan/core/options.lua
new file mode 100644
index 0000000..dc50863
--- /dev/null
+++ b/nvim/lua/jonathan/core/options.lua
@@ -0,0 +1,30 @@
+local opt = vim.opt
+
+-- line numbers
+-- opt.relativenumber = true
+-- opt.numer = true
+
+
+-- tab & indent
+opt.tabstop = 4
+opt.shiftwidth = 4
+opt.expandtab = true
+opt.autoindent = false
+
+-- line wrapping
+opt.wrap = false
+
+
+-- search settings
+opt.ignorecase = true
+opt.smartcase = true
+
+
+--opt.termguicolors = true
+opt.background = "dark"
+
+-- jthan, plz
+opt.backspace = "indent,eol,start"
+-- opt.clipboard:append("unnamedplus")
+
+opt.mouse = ""
diff --git a/nvim/lua/jonathan/plugins-setup.lua b/nvim/lua/jonathan/plugins-setup.lua
new file mode 100644
index 0000000..400b1d8
--- /dev/null
+++ b/nvim/lua/jonathan/plugins-setup.lua
@@ -0,0 +1,38 @@
+-- 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("bluz71/vim-nightfly-guicolors") -- preferred colorscheme
+ use("nvim-tree/nvim-tree.lua")
+
+ if packer_bootstrap then
+ require("packer").sync()
+ end
+end)
diff --git a/nvim/lua/jonathan/plugins/nvim-tree.lua b/nvim/lua/jonathan/plugins/nvim-tree.lua
new file mode 100644
index 0000000..fc551e1
--- /dev/null
+++ b/nvim/lua/jonathan/plugins/nvim-tree.lua
@@ -0,0 +1,53 @@
+-- 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({
+ -- disable window_picker for
+ -- explorer to work well with
+ -- window splits
+ actions = {
+ open_file = {
+ window_picker = {
+ enable = false,
+ },
+ },
+ },
+ -- git = {
+ -- ignore = false,
+ -- },
+})
+
+-- open nvim-tree on setup
+
+local function open_nvim_tree(data)
+ -- buffer is a [No Name]
+ local no_name = data.file == "" and vim.bo[data.buf].buftype == ""
+
+ -- buffer is a directory
+ local directory = vim.fn.isdirectory(data.file) == 1
+
+ if not no_name and not directory then
+ return
+ end
+
+ -- change to the directory
+ if directory then
+ vim.cmd.cd(data.file)
+ end
+
+ -- open the tree
+ require("nvim-tree.api").tree.open()
+end
+
+vim.api.nvim_create_autocmd({ "VimEnter" }, { callback = open_nvim_tree })