-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Jonathan Hines
committed
Mar 12, 2024
1 parent
7218cf2
commit 5b0d1e3
Showing
27 changed files
with
1,276 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
require("jonchines.plugins-setup") | ||
require("jonchines.core.options") | ||
require("jonchines.core.keymaps") | ||
require("jonchines.core.colorscheme") | ||
require("jonchines.plugins.toggleterm") | ||
require("jonchines.plugins.comment") | ||
require("jonchines.plugins.nvim-tree") | ||
require("jonchines.plugins.lualine") | ||
-- require("jonchines.plugins.bufferline") | ||
require("jonchines.plugins.telescope") | ||
require("jonchines.plugins.nvim-cmp") | ||
require("jonchines.plugins.lsp.mason") | ||
require("jonchines.plugins.lsp.lspsaga") | ||
require("jonchines.plugins.lsp.lspconfig") | ||
require("jonchines.plugins.lsp.null-ls") | ||
require("jonchines.plugins.autopairs") | ||
require("jonchines.plugins.treesitter") | ||
require("jonchines.plugins.gitsigns") | ||
require("jonchines.plugins.harpoon") | ||
-- require("jonchines.plugins.fugitive") | ||
require("jonchines.plugins.git") | ||
require("jonchines.plugins.which-key") | ||
require("jonchines.plugins.surround") | ||
require("jonchines.plugins.ansible-vim") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
-- set colorscheme to nightfly with protected call | ||
-- in case it isn't installed | ||
local status, _ = pcall(vim.cmd, "colorscheme moonfly") | ||
if not status then | ||
print("Colorscheme not found!") -- print error if colorscheme not installed | ||
return | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
-- To be concise | ||
local keymap = vim.keymap | ||
local g = vim.g | ||
|
||
-- set leader key to space | ||
g.mapleader = " " | ||
|
||
--------------------- | ||
-- General Keymaps | ||
--------------------- | ||
|
||
-- use jk to exit insert mode | ||
keymap.set("i", "jk", "<ESC>") | ||
|
||
-- Move text up and down | ||
keymap.set("i", "<A-j>", "<Esc>:m .+1<CR>==gi") | ||
keymap.set("i", "<A-k>", "<Esc>:m .-2<CR>==gi") | ||
keymap.set("n", "<A-j>", "<Esc>:m .+1<CR>==") | ||
keymap.set("n", "<A-k>", "<Esc>:m .-2<CR>==") | ||
keymap.set("v", "<A-j>", ":m '>+1<CR>gv=gv") | ||
keymap.set("v", "<A-k>", ":m '<-2<CR>gv=gv") | ||
|
||
-- Set half-page motion to center on screen (zz) or center to top (zt) | ||
keymap.set("n", "<C-d>", "<C-d>zz") | ||
keymap.set("n", "<C-u>", "<C-u>zz") | ||
-- keymap.set("n", "<C-d>", "<C-d>zt") | ||
-- keymap.set("n", "<C-u>", "<C-u>zt") | ||
|
||
-- Set recursive search (n/N) to center on the screen (zz) | ||
keymap.set("n", "n", "nzzzv") | ||
keymap.set("n", "N", "Nzzzv") | ||
|
||
-- When pasting move the deleted text into the black hole register | ||
keymap.set("x", "<leader>p", '"_dP') | ||
-- Similarly normal and visual mode delete to black hole register | ||
keymap.set("n", "<leader>d", '"_d') | ||
keymap.set("v", "<leader>d", '"_d') | ||
-- Delete single character to black hole register | ||
keymap.set("n", "x", '"_x') | ||
|
||
-- Yank to system clipboard | ||
vim.keymap.set("n", "<leader>y", '"+y') | ||
vim.keymap.set("v", "<leader>y", '"+y') | ||
vim.keymap.set("n", "<leader>Y", '"+Y') | ||
|
||
-- Replace word at cursor position | ||
-- vim.keymap.set("n", "<leader>s", ":%s/\\<<C-r><C-w>\\>/<C-r><C-w>/gI<Left><Left><Left>") | ||
|
||
-- Set file to executable without leaving nvim | ||
vim.keymap.set("n", "<leader>x", "<cmd>!chmod +x %<CR>", { silent = true }) | ||
|
||
-- buffer management | ||
keymap.set("n", "<leader>bd", ":new<BAR>bd#<BAR>bp<CR>") -- delete current buffer leaving split | ||
|
||
-- window management | ||
keymap.set("n", "<leader>wv", "<C-w>v") -- split window vertically | ||
keymap.set("n", "<leader>wh", "<C-w>s") -- split window horizontally | ||
keymap.set("n", "<leader>we", "<C-w>=") -- make split windows equal width & height | ||
keymap.set("n", "<leader>wr", "<C-w>r") -- make split windows rotate | ||
keymap.set("n", "<leader>wc", ":close<CR>") -- close current split window | ||
keymap.set("n", "<leader>wm", ":MaximizerToggle<CR>") -- toggle split window maximization USES vim-maximizer | ||
|
||
-- tab management | ||
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 | ||
|
||
---------------------- | ||
-- Plugin Keybinds | ||
---------------------- | ||
|
||
-- nvim-tree | ||
keymap.set("n", "<leader>e", ":NvimTreeToggle<CR>", { silent = true }) -- toggle file explorer | ||
|
||
-- telescope | ||
keymap.set("n", "<leader>ff", "<cmd>Telescope find_files<cr>") -- find files within current working directory, respects .gitignore | ||
keymap.set("n", "<leader>fs", "<cmd>Telescope live_grep<cr>") -- find string in current working directory as you type | ||
keymap.set("n", "<leader>fc", "<cmd>Telescope grep_string<cr>") -- find string under cursor in current working directory | ||
keymap.set("n", "<leader>fb", "<cmd>Telescope buffers<cr>") -- list open buffers in current neovim instance | ||
keymap.set("n", "<leader>fh", "<cmd>Telescope help_tags<cr>") -- list available help tags | ||
|
||
-- telescope git commands | ||
-- keymap.set("n", "<leader>gc", "<cmd>Telescope git_commits<cr>") -- list all git commits (use <cr> to checkout) ["gc" for git commits] | ||
-- keymap.set("n", "<leader>gfc", "<cmd>Telescope git_bcommits<cr>") -- list git commits for current file/buffer (use <cr> to checkout) ["gfc" for git file commits] | ||
-- keymap.set("n", "<leader>gb", "<cmd>Telescope git_branches<cr>") -- list git branches (use <cr> to checkout) ["gb" for git branch] | ||
-- keymap.set("n", "<leader>gs", "<cmd>Telescope git_status<cr>") -- list current changes per file with diff preview ["gs" for git status] | ||
|
||
-- restart lsp server | ||
keymap.set("n", "<leader>rs", ":LspRestart<CR>") -- mapping to restart lsp if necessary |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
local opt = vim.opt -- for conciseness | ||
local indent = 2 | ||
|
||
-- default encoding | ||
opt.fileencoding = "utf-8" | ||
|
||
-- open and maintain multiple buffers | ||
opt.hidden = true | ||
|
||
-- line numbers | ||
opt.relativenumber = true -- show relative line numbers | ||
opt.number = true -- shows absolute line number on cursor line (when relative number is on) | ||
|
||
-- tabs & indentation | ||
opt.tabstop = indent -- spaces for tabs (prettier default) | ||
opt.shiftwidth = indent -- spaces for indent width | ||
opt.expandtab = true -- expand tab to spaces | ||
opt.autoindent = true -- copy indent from current line when starting new one | ||
opt.smartindent = true | ||
|
||
-- line wrapping | ||
opt.wrap = false -- disable line wrapping | ||
|
||
-- search settings | ||
opt.ignorecase = true -- ignore case when searching | ||
opt.smartcase = true -- if you include mixed case in your search, assumes you want case-sensitive | ||
|
||
-- cursor position | ||
opt.cursorline = true -- highlight the current cursor line | ||
opt.cursorcolumn = true -- highlight the current cursor column | ||
|
||
-- appearance | ||
opt.termguicolors = true | ||
opt.background = "dark" -- colorschemes that can be light or dark will be made dark | ||
opt.scrolloff = 10 -- don't allow scrolling within 10 lines of top or bottom | ||
opt.sidescrolloff = 10 -- don't allow scrolling within 10 characters of left or right | ||
opt.signcolumn = "yes:1" -- show sign column so that text doesn't shift | ||
opt.colorcolumn = "120" -- place a veritical line at a good place to start a new line | ||
|
||
-- backspace | ||
opt.backspace = "indent,eol,start" -- allow backspace on indent, end of line or insert mode start position | ||
|
||
-- split windows | ||
opt.splitright = true -- split vertical window to the right | ||
opt.splitbelow = true -- split horizontal window to the bottom |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,132 @@ | ||
-- 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("nvim-lua/plenary.nvim") -- lua functions that many plugins use | ||
|
||
-- use("bluz71/vim-nightfly-guicolors") -- preferred colorscheme | ||
use("bluz71/vim-moonfly-colors") -- preferred colorscheme | ||
-- use("fenetikm/falcon") -- preferred colorscheme | ||
|
||
use("akinsho/toggleterm.nvim") | ||
|
||
use("christoomey/vim-tmux-navigator") -- tmux & split window navigation | ||
|
||
use("szw/vim-maximizer") -- maximizes and restores current window | ||
|
||
-- essential plugins | ||
-- use("tpope/vim-surround") -- add, delete, change surroundings (it's awesome) | ||
use({ "kylechui/nvim-surround", tag = "*" }) | ||
-- use("inkarkat/vim-ReplaceWithRegister") -- replace with register contents using motion (gr + motion) | ||
|
||
-- commenting with gc | ||
use("numToStr/Comment.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") | ||
|
||
-- buffer line | ||
use({ "akinsho/bufferline.nvim", tag = "v4.*", requires = "nvim-tree/nvim-web-devicons" }) | ||
|
||
-- fuzzy finding w/ telescope | ||
use({ "nvim-telescope/telescope-fzf-native.nvim", run = "make" }) -- dependency for better sorting performance | ||
use({ "nvim-telescope/telescope.nvim", branch = "0.1.x" }) -- fuzzy finder | ||
|
||
-- buffer management | ||
use("theprimeagen/harpoon") | ||
|
||
-- autocompletion | ||
use("hrsh7th/nvim-cmp") -- completion plugin | ||
use("hrsh7th/cmp-buffer") -- source for text in buffer | ||
use("hrsh7th/cmp-path") -- source for file system paths | ||
|
||
-- snippets | ||
use("L3MON4D3/LuaSnip") -- snippet engine | ||
use("saadparwaiz1/cmp_luasnip") -- for autocompletion | ||
use("rafamadriz/friendly-snippets") -- useful snippets | ||
|
||
-- managing & installing lsp servers, linters & formatters | ||
use("williamboman/mason.nvim") -- in charge of managing lsp servers, linters & formatters | ||
use("williamboman/mason-lspconfig.nvim") -- bridges gap b/w mason & lspconfig | ||
|
||
-- configuring lsp servers | ||
use("neovim/nvim-lspconfig") -- easily configure language servers | ||
use("hrsh7th/cmp-nvim-lsp") -- for autocompletion | ||
use("hrsh7th/cmp-nvim-lua") | ||
use({ "glepnir/lspsaga.nvim", branch = "main" }) -- enhanced lsp uis | ||
use("jose-elias-alvarez/typescript.nvim") -- additional functionality for typescript server (e.g. rename file & update imports) | ||
use("onsails/lspkind.nvim") -- vs-code like icons for autocompletion | ||
|
||
-- formatting & linting | ||
use("jose-elias-alvarez/null-ls.nvim") -- configure formatters & linters | ||
use("jayp0521/mason-null-ls.nvim") -- bridges gap b/w mason & null-ls | ||
use("pearofducks/ansible-vim") -- helps distinguish between Ansible and normal yaml | ||
|
||
-- treesitter configuration | ||
use("nvim-treesitter/nvim-treesitter", { run = ":TSUpdate" }) | ||
use({ | ||
"nvim-treesitter/nvim-treesitter-textobjects", | ||
after = "nvim-treesitter", | ||
requires = "nvim-treesitter/nvim-treesitter", | ||
}) | ||
|
||
-- indention guide lines | ||
use("lukas-reineke/indent-blankline.nvim") | ||
|
||
-- auto closing | ||
use("windwp/nvim-autopairs") -- autoclose parens, brackets, quotes, etc... | ||
use({ "windwp/nvim-ts-autotag", after = "nvim-treesitter" }) -- autoclose tags | ||
|
||
-- git integration | ||
-- use("tpope/vim-fugitive") | ||
-- Switch to using Lua version of Vim-Fugitive | ||
use("dinhhuy258/git.nvim") | ||
use("lewis6991/gitsigns.nvim") -- show line modifications on left hand side | ||
|
||
-- DB integration | ||
use("tpope/vim-dadbod") | ||
use("kristijanhusak/vim-dadbod-ui") | ||
use("kristijanhusak/vim-dadbod-completion") | ||
|
||
-- which-key | ||
use("folke/which-key.nvim") | ||
|
||
if packer_bootstrap then | ||
require("packer").sync() | ||
end | ||
end) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
-- import nvim-surround plugin safely | ||
local setup, ansible_vim = pcall(require, "ansible-vim") | ||
if not setup then | ||
return | ||
end | ||
|
||
-- enable ansible-vim | ||
ansible_vim.setup() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
-- import nvim-autopairs safely | ||
local autopairs_setup, autopairs = pcall(require, "nvim-autopairs") | ||
if not autopairs_setup then | ||
return | ||
end | ||
|
||
-- configure autopairs | ||
autopairs.setup({ | ||
check_ts = true, -- enable treesitter | ||
ts_config = { | ||
lua = { "string" }, -- don't add pairs in lua string treesitter nodes | ||
javascript = { "template_string" }, -- don't add pairs in javscript template_string treesitter nodes | ||
java = false, -- don't check treesitter on java | ||
}, | ||
}) | ||
|
||
-- import nvim-autopairs completion functionality safely | ||
local cmp_autopairs_setup, cmp_autopairs = pcall(require, "nvim-autopairs.completion.cmp") | ||
if not cmp_autopairs_setup then | ||
return | ||
end | ||
|
||
-- import nvim-cmp plugin safely (completions plugin) | ||
local cmp_setup, cmp = pcall(require, "cmp") | ||
if not cmp_setup then | ||
return | ||
end | ||
|
||
-- make autopairs and completion work together | ||
cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
-- import bufferline plugin safely | ||
local setup, bufferline = pcall(require, "bufferline") | ||
if not setup then | ||
return | ||
end | ||
|
||
-- enable bufferline | ||
bufferline.setup() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
-- import comment plugin safely | ||
local setup, comment = pcall(require, "Comment") | ||
if not setup then | ||
return | ||
end | ||
|
||
-- enable comment | ||
comment.setup() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
vim.keymap.set("n", "<leader>gs", vim.cmd.Git) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
-- import git plugin safely | ||
local setup, git = pcall(require, "git") | ||
if not setup then | ||
return | ||
end | ||
|
||
-- configure/enable gitsigns | ||
git.setup() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
-- import gitsigns plugin safely | ||
local setup, gitsigns = pcall(require, "gitsigns") | ||
if not setup then | ||
return | ||
end | ||
|
||
-- configure/enable gitsigns | ||
gitsigns.setup() |
Oops, something went wrong.