Files
dotfiles/nvim/init.lua
T
2026-06-15 01:01:59 -07:00

109 lines
4.9 KiB
Lua

----- Plugins -------------------------------------------------------------
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)
require("lazy").setup({
spec = {
{
"folke/todo-comments.nvim",
dependencies = { "nvim-lua/plenary.nvim" },
opts = { signs = false }
},
{
'numToStr/Comment.nvim',
opts = { }
},
{
'lewis6991/gitsigns.nvim',
},
{
'nvim-telescope/telescope.nvim', version = '*',
dependencies = {
'nvim-lua/plenary.nvim',
{ 'nvim-telescope/telescope-fzf-native.nvim', build = 'make' },
}
},
{
'Vonr/align.nvim',
branch = "v2",
lazy = true,
init = function()
-- mappings here...
end
},
},
install = { colorscheme = { "habamax" } },
checker = { enabled = false }, -- automatic updates
})
----- Settings ------------------------------------------------------------
vim.cmd("filetype plugin indent on")
vim.cmd("colorscheme habamax") -- or wildchart
vim.opt.backup = false
vim.opt.writebackup = false
vim.opt.swapfile = false
vim.opt.number = true
vim.opt.tabstop = 8
vim.opt.shiftwidth = 4
vim.opt.softtabstop = 4
vim.opt.expandtab = true
vim.opt.autoindent = true
vim.opt.smarttab = true
vim.opt.mouse = "a"
vim.opt.laststatus = 2
vim.opt.scrolloff = 5
vim.opt.ignorecase = true
vim.opt.hlsearch = true
vim.opt.incsearch = true
vim.opt.wrap = false
vim.opt.timeoutlen = 1000
vim.opt.ttimeoutlen = 0
vim.opt.hidden = true
vim.opt.wildmenu = true
vim.opt.clipboard = "unnamed,unnamedplus"
vim.opt.colorcolumn = "75"
-- vim.opt.backspace = { "indent", "eol", "start" }
vim.opt.updatetime = 100
vim.opt.signcolumn = "auto"
vim.g.mapleader = " "
vim.g.maplocalleader = "\\"
----- Keybinds ------------------------------------------------------------
local map = vim.keymap.set
local NS = { noremap = true, silent = true }
map("n", "K", "<Nop>", NS)
map("v", ">", ">gv", NS)
map("v", "<", "<gv", NS)
map("v", "J", ":m '>+1<CR>gv=gv", NS)
map("v", "K", ":m '<-2<CR>gv=gv", NS)
map("n", "H", ":bnext<CR>zz", NS)
map("n", "L", ":bprev<CR>zz", NS)
map("n", ",", ":copen<CR>", NS)
map("n", ">", ":cn<CR>", NS)
map("n", "<", ":cp<CR>", NS)
map("n", "\\", ":noh<CR>", NS)
map("n", "E", ":Ex<CR>", NS)
map("n", "<space>z", ":set relativenumber<CR>", NS)
map("n", "<space>x", ":set norelativenumber<CR>", NS)
map("n", "gb", ":make<CR>", NS)
map("n", "gs", ":w<CR>", NS)
map("n", "ghp", ":Gitsigns preview_hunk_inline<CR>", NS)
map("n", "gs", ":w<CR>", NS)
map('n', '<leader>ff', function() require('telescope.builtin').find_files() end, NS)
map('n', '<leader>fg', function() require('telescope.builtin').live_grep() end, NS)
map('x', '<leader>ga', function() require('align').align_to_string({ preview = true, regex = false }) end, NS)