dotfiles/nvim/lua/config/options.lua
henryEto 7c9e23beb3 ??
2025-08-30 11:33:00 -06:00

119 lines
3.0 KiB
Lua
Executable File

-- [[ Setting options ]]
-- See `:help vim.opt`
-- For more options, you can see `:help option-list`
local opt = vim.opt
vim.g.mapleader = " "
vim.g.maplocalleader = " "
-- Tabs
opt.expandtab = true -- Convert tabs to spaces
opt.shiftwidth = 2 -- Amount to indent with << and >>
opt.tabstop = 2 -- How many spaces are shown per Tab
opt.softtabstop = 2 -- How many spaces are applied when pressing Tab
opt.autoindent = true
opt.backspace = "indent,eol,start"
-- Set to true if you have a Nerd Font installed and selected in the terminal
vim.g.have_nerd_font = true
-- Make line numbers default
opt.number = true
opt.relativenumber = true
-- Enable mouse mode, can be useful for resizing splits for example!
opt.mouse = "a"
-- Don't show the mode, since it's already in the status line
opt.showmode = false
-- Sync clipboard between OS and Neovim.
vim.schedule(function()
vim.opt.clipboard = "unnamedplus"
end)
-- Enable break indent
opt.breakindent = true
-- default to rounded borders
vim.o.winborder = "rounded"
-- Save undo history
opt.undofile = true
-- Case-insensitive searching UNLESS \C or one or more capital letters in the search term
opt.ignorecase = true
opt.smartcase = true
-- Keep signcolumn on by default
opt.signcolumn = "yes"
-- Decrease update time
opt.updatetime = 250
-- Decrease mapped sequence wait time
-- opt.timeoutlen = 300
-- Configure how new splits should be opened
opt.splitright = true
opt.splitbelow = true
-- Sets how neovim will display certain whitespace characters in the editor.
opt.list = true
opt.listchars = { tab = "» ", trail = "·", nbsp = "" }
-- Preview substitutions live, as you type!
opt.inccommand = "split"
-- Show which line your cursor is on
opt.cursorline = true
-- Minimal number of screen lines to keep above and below the cursor.
opt.scrolloff = 10
opt.wrap = true
opt.termguicolors = true
vim.diagnostic.config({
float = { border = "rounded" }, -- add border to diagnostic popups
})
-- Consider - as part of keyword
opt.iskeyword:append("-")
-- if performing an operation that would fail due to unsaved changes in the buffer (like `:q`),
-- instead raise a dialog asking if you wish to save the current file(s)
-- opt.confirm = true
-- [[ Basic Autocommands ]]
-- See `:help lua-guide-autocommands`
-- Highlight when yanking (copying) text
-- See `:help vim.highlight.on_yank()`
vim.api.nvim_create_autocmd("TextYankPost", {
desc = "Highlight when yanking (copying) text",
group = vim.api.nvim_create_augroup("kickstart-highlight-yank", { clear = true }),
callback = function()
vim.highlight.on_yank()
end,
})
-- -- Open directories with oil floating window
-- vim.api.nvim_create_autocmd({ "VimEnter" }, {
-- pattern = { "*" },
-- callback = function()
-- args = vim.v.argv
-- for i, arg in ipairs(args) do
-- print(arg)
-- isDirectory = vim.fn.isdirectory(arg)
--
-- if isDirectory == 1 then
-- vim.cmd("bd")
-- vim.cmd("Oil --float " .. arg)
-- break
-- end
--
-- end
--
-- end,
-- })