jones-nvim-config/lua/options.lua

64 lines
2.0 KiB
Lua
Raw Normal View History

2024-04-07 03:14:14 +00:00
local opt = vim.opt
local api = vim.api
local global = vim.g
2024-04-08 14:46:05 +00:00
local formatter = require("config.conform")
2024-04-07 03:14:14 +00:00
-- Hint: use `:h <option>` to figure out the meaning if needed
opt.clipboard = "unnamedplus" -- use system clipboard
opt.completeopt = { "menu", "menuone", "noselect" }
2024-04-28 19:10:40 +00:00
opt.mouse = "a" -- allow the mouse to be used in Nvim
2024-04-07 03:14:14 +00:00
-- General
opt.wrap = false
global.loaded_netrw = 1
global.loaded_netrwPlugin = 1
global.mapleader = " "
-- Navigation
opt.cursorline = true
opt.backspace = "indent,eol,start"
-- Tab
2024-04-28 19:10:40 +00:00
opt.tabstop = 2 -- number of visual spaces per TAB
opt.softtabstop = 2 -- number of spacesin tab when editing
opt.shiftwidth = 2 -- insert 4 spaces on a tab
2024-04-07 03:14:14 +00:00
opt.expandtab = true -- tabs are spaces, mainly because of python
-- UI config
2024-04-28 19:10:40 +00:00
opt.number = true -- show absolute number
2024-04-07 03:14:14 +00:00
-- opt.relativenumber = true -- add numbers to each line on the left side
2024-04-28 19:10:40 +00:00
opt.cursorline = true -- highlight cursor line underneath the cursor horizontally
opt.splitbelow = true -- open new vertical split bottom
opt.splitright = true -- open new horizontal splits right
2024-04-07 03:14:14 +00:00
opt.termguicolors = true -- enabl 24-bit RGB color in the TUI
-- Searching
2024-04-28 19:10:40 +00:00
opt.incsearch = true -- search as characters are entered
opt.hlsearch = false -- do not highlight matches
2024-04-07 03:14:14 +00:00
opt.ignorecase = true -- ignore case in searches by default
2024-04-28 19:10:40 +00:00
opt.smartcase = true -- but make it case sensitive if an uppercase is entered
2024-04-07 03:14:14 +00:00
-- History
opt.undofile = true
opt.undodir = os.getenv("HOME") .. "/.local/share/nvim/undo"
-- Whitespace
2024-04-07 03:14:14 +00:00
api.nvim_set_option("list", true)
api.nvim_set_option("listchars", "eol:$,nbsp:_,tab:>-,trail:~,extends:>,precedes:<")
api.nvim_create_autocmd({ "BufWritePre" }, {
2024-04-28 19:10:40 +00:00
pattern = { "*" },
command = [[if &filetype !~# 'lsp' | %s/\s\+$//e | endif]],
2024-04-07 03:14:14 +00:00
})
2024-04-07 22:35:46 +00:00
2024-04-08 14:46:05 +00:00
-- Formatting
vim.api.nvim_create_autocmd("BufWritePre", {
2024-04-28 19:10:40 +00:00
pattern = "*",
callback = function()
formatter.format(nil)
end,
2024-04-08 14:46:05 +00:00
})
2024-05-05 12:55:15 +00:00
-- Logging --
-- opt.verbosefile = '~/.config/nvim/nvim_log' -- Set the location for the log file
-- opt.verbose = 15 -- Set the verbosity level