Initial Commit
This commit is contained in:
24
lua/config/autocmd.lua
Normal file
24
lua/config/autocmd.lua
Normal file
@@ -0,0 +1,24 @@
|
||||
vim.api.nvim_create_autocmd("InsertEnter", {
|
||||
callback = function()
|
||||
vim.opt.number = false
|
||||
vim.opt.relativenumber = true
|
||||
end,
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd("InsertLeave", {
|
||||
callback = function()
|
||||
vim.opt.number = true
|
||||
vim.opt.relativenumber = false
|
||||
end,
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd({ "BufRead", "BufNewFile" }, {
|
||||
pattern = { os.getenv("HOME") .. "/.local/share/chezmoi/*" },
|
||||
callback = function(ev)
|
||||
local bufnr = ev.buf
|
||||
local edit_watch = function()
|
||||
require("chezmoi.commands.__edit").watch(bufnr)
|
||||
end
|
||||
vim.schedule(edit_watch)
|
||||
end,
|
||||
})
|
||||
35
lua/config/lazy.lua
Normal file
35
lua/config/lazy.lua
Normal file
@@ -0,0 +1,35 @@
|
||||
-- Bootstrap lazy.nvim
|
||||
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||
if not (vim.uv or vim.loop).fs_stat(lazypath) then
|
||||
local lazyrepo = "https://github.com/folke/lazy.nvim.git"
|
||||
local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
|
||||
if vim.v.shell_error ~= 0 then
|
||||
vim.api.nvim_echo({
|
||||
{ "Failed to clone lazy.nvim:\n", "ErrorMsg" },
|
||||
{ out, "WarningMsg" },
|
||||
{ "\nPress any key to exit..." },
|
||||
}, true, {})
|
||||
vim.fn.getchar()
|
||||
os.exit(1)
|
||||
end
|
||||
end
|
||||
vim.opt.rtp:prepend(lazypath)
|
||||
|
||||
-- Make sure to setup `mapleader` and `maplocalleader` before
|
||||
-- loading lazy.nvim so that mappings are correct.
|
||||
-- This is also a good place to setup other settings (vim.opt)
|
||||
vim.g.mapleader = " "
|
||||
vim.g.maplocalleader = "\\"
|
||||
|
||||
-- Setup lazy.nvim
|
||||
require("lazy").setup({
|
||||
spec = {
|
||||
-- import your plugins
|
||||
{ import = "plugins" },
|
||||
},
|
||||
-- Configure any other settings here. See the documentation for more details.
|
||||
-- colorscheme that will be used when installing plugins.
|
||||
install = { colorscheme = { "habamax" } },
|
||||
-- automatically check for plugin updates
|
||||
checker = { enabled = true },
|
||||
})
|
||||
62
lua/config/mappings.lua
Normal file
62
lua/config/mappings.lua
Normal file
@@ -0,0 +1,62 @@
|
||||
local function map(m, k, v)
|
||||
vim.keymap.set(m, k, v, { noremap = true, silent = true})
|
||||
end
|
||||
|
||||
-- Basic File Manip
|
||||
map("n","<leader>w","<Cmd>write<CR>")
|
||||
|
||||
-- Window movement
|
||||
map("n", "<C-h>", "<C-w>h")
|
||||
map("n", "<C-j>", "<C-w>j")
|
||||
map("n", "<C-k>", "<C-w>k")
|
||||
map("n", "<C-l>", "<C-w>l")
|
||||
|
||||
-- Neo-Tree
|
||||
map("n", "<leader>e", "<Cmd>NvimTreeToggle<CR>")
|
||||
|
||||
-- Telescope
|
||||
map("n", "<leader>ff", "<Cmd>Telescope find_files<CR>")
|
||||
map("n", "<leader>fg", "<Cmd>Telescope live_grep<CR>")
|
||||
|
||||
-- Buffer Navigation w/ shift + left/right
|
||||
map("n", "<S-l>", "<Cmd>bnext<CR>")
|
||||
map("n", "<S-h>", "<Cmd>bprevious<CR>")
|
||||
|
||||
-- Close and Force Close Buffer
|
||||
map("n", "<leader>q", "<Cmd>BufferClose<CR>")
|
||||
map("n", "<leader>Q", "<Cmd>BufferClose!<CR>")
|
||||
|
||||
-- Reorder Buffers w/ alt + shift + left/right
|
||||
map('n', '<AS-h>', '<Cmd>BufferMovePrevious<CR>')
|
||||
map('n', '<AS-l>', '<Cmd>BufferMoveNext<CR>')
|
||||
|
||||
-- Jump To Buffer with alt
|
||||
-- TODO!!
|
||||
|
||||
-- Pin Buffer with alt+p
|
||||
map('n', '<A-p>', '<Cmd>BufferPin<CR>')
|
||||
|
||||
-- Open FTerm
|
||||
map('n', '<leader>z', ":lua require('FTerm').open()<CR>")
|
||||
map('t', '<Esc>', '<C-\\><C-n><CMD>lua require("FTerm").close()<CR>') --preserves session
|
||||
|
||||
-- Change Theme
|
||||
map("n", "<leader>p", "<Cmd>Themery<CR>") --cycle themes
|
||||
|
||||
-- LSP
|
||||
map("n", "K", vim.lsp.buf.hover)
|
||||
map("n", "gd", vim.lsp.buf.definition)
|
||||
map("n", "<leader>ca", vim.lsp.buf.code_action)
|
||||
|
||||
-- Formatting
|
||||
map("n", "<leader>gf", vim.lsp.buf.format)
|
||||
|
||||
-- Toggle rel/abs line numbers
|
||||
map("n", "<leader>nn", function()
|
||||
if vim.wo.relativenumber then
|
||||
vim.wo.relativenumber = false
|
||||
vim.wo.number = true
|
||||
else
|
||||
vim.wo.relativenumber = true
|
||||
end
|
||||
end)
|
||||
41
lua/config/options.lua
Normal file
41
lua/config/options.lua
Normal file
@@ -0,0 +1,41 @@
|
||||
local options = {
|
||||
-- Make text not wrap because its annoying
|
||||
wrap = false,
|
||||
|
||||
-- Set nvim to use terminal colors
|
||||
termguicolors = true,
|
||||
|
||||
-- Highlight line cursor is on
|
||||
cursorline = true,
|
||||
|
||||
-- Enable absolute and relative line numbers
|
||||
number = true,
|
||||
relativenumber = true,
|
||||
|
||||
-- Indentation
|
||||
tabstop = 4,
|
||||
shiftwidth = 4,
|
||||
expandtab = true,
|
||||
smartindent = true,
|
||||
|
||||
winborder = "rounded",
|
||||
|
||||
-- Bind yank and put to wl-clipboard
|
||||
clipboard = "unnamedplus",
|
||||
|
||||
updatetime = 250,
|
||||
|
||||
swapfile = false,
|
||||
|
||||
foldmethod = "manual"
|
||||
}
|
||||
|
||||
for k, v in pairs(options) do
|
||||
vim.opt[k] = v
|
||||
end
|
||||
|
||||
-- Diagnostics Setup
|
||||
vim.diagnostic.config({
|
||||
virtual_text = false,
|
||||
virtual_lines = true,
|
||||
})
|
||||
Reference in New Issue
Block a user