Files
.dotfiles/nvim/.config/nvim/init.lua

105 lines
2.4 KiB
Lua

local g = vim.g
local o = vim.o
local keymap = vim.keymap.set
local cmd = vim.cmd
local api = vim.api
-- Leader Key
g.mapleader = " "
-- Disable netrw for Nvim Tree
g.loaded_netrw = 1
g.loaded_netrwPlugin = 1
-- Numbers
o.number = true
o.relativenumber = true
o.numberwidth = 1
-- Clipboard
cmd[[set clipboard+=unnamedplus]]
-- Files
o.swapfile = false
o.backup = false
-- Scroll Offset
o.scrolloff = 15
-- Cursor & Column Lines
o.colorcolumn = "80"
o.cursorline = true
-- Mouse
o.mouse = "a"
-- Spacing
o.tabstop = 2
o.shiftwidth = 2
o.expandtab = true
-- Update Time
o.updatetime = 50
-- Hide Highlighting
cmd[[set nohlsearch]]
-- Indent
keymap("n", "<S-Tab>", "<<")
keymap("n", "<Tab>", ">>")
keymap("v", "<S-Tab>", "<<")
keymap("v", "<Tab>", ">>")
keymap("i", "<S-Tab>", "<BS>")
-- Move Between Panels
keymap("", "<C-h>", ":wincmd h<CR>")
keymap("", "<C-j>", ":wincmd j<CR>")
keymap("", "<C-k>", ":wincmd k<CR>")
keymap("", "<C-l>", ":wincmd l<CR>")
-- Jump Up/Down A Half Page
keymap("n", "<C-d>", "<C-d>zz")
keymap("n", "<C-u>", "<C-u>zz")
-- Keep Copy/Paste Value
keymap("x", "<leader>p", "\"_dP")
-- Sort
keymap("v", "<C-s>", ":sort<CR>")
-- Disable F1 in Insert mode
keymap('i', '<F1>', '<nop>')
-- Close Neovim
cmd("command! Qa qa")
-- Remove trailing whitespace when focus is lost or the window is closed,
-- without moving the cursor
api.nvim_exec([[
autocmd FocusLost,WinLeave * if &modifiable | let w:save_cursor = getcurpos() | %s/\s\+$//e | call setpos('.', w:save_cursor) | endif
]], false)
-- Plugins
vim.pack.add({
"https://github.com/ellisonleao/gruvbox.nvim",
"https://github.com/windwp/nvim-autopairs",
"https://github.com/Pocco81/auto-save.nvim",
"https://github.com/lewis6991/gitsigns.nvim",
"https://github.com/lukas-reineke/indent-blankline.nvim",
"https://github.com/nvim-lua/plenary.nvim", -- Dependancy of Telescope
"https://github.com/nvim-telescope/telescope.nvim",
"https://github.com/nvim-tree/nvim-web-devicons", -- Dependancy of Nvim Tree
"https://github.com/nvim-tree/nvim-tree.lua",
"https://github.com/nvim-treesitter/nvim-treesitter",
"https://github.com/neovim/nvim-lspconfig",
"https://github.com/hrsh7th/nvim-cmp",
"https://github.com/hrsh7th/cmp-nvim-lsp",
"https://github.com/hrsh7th/cmp-buffer",
"https://github.com/MeanderingProgrammer/render-markdown.nvim",
"https://github.com/williamboman/mason.nvim",
"https://github.com/williamboman/mason-lspconfig.nvim",
})
-- Plugin Configs
require('plugins');