-- [[ nvim_options.lua]] local opt = vim.opt -- Convenient local cmd = vim.api.nvim_command -- Convenient -- [[ General ]] vim.o.background = 'dark' -- [[ Context ]] opt.colorcolumn = '100' -- Color Column 100 for easy line-length checking opt.number = true -- Enable line numbers opt.relativenumber = true -- Line numbers relative to the current line opt.scrolloff = 4 -- Allow scrolling up to 4 characters past the end opt.signcolumn = 'yes' -- Extra gutter for diagnostic signs to show up -- [[ Filetypes ]] opt.encoding = 'utf8' -- Assume files are UTF-8 Encoded -- [[ Theme ]] opt.syntax = 'ON' -- Syntax Highlighting opt.termguicolors = true -- Enable colors -- [[ Search ]] opt.ignorecase = true -- Case-insensitive searching opt.smartcase = true opt.incsearch = true -- Search one item at a time, rather than find-all opt.hlsearch = false -- Don't highlight search -- [[ Whitespace ]] opt.expandtab = true -- Change tabs to spaces opt.shiftwidth = 4 -- Make tabs 4 spaces opt.softtabstop = 4 opt.tabstop = 4 vim.opt.list = true -- Make whitespace visible vim.opt.listchars = { tab = "» ", -- tab trail = "·", -- trailing space nbsp = "␣", -- non-breaking space extends = "›", -- line extends past screen precedes = "‹", -- line precedes screen space = "·", -- regular spaces (optional, can be noisy) } vim.keymap.set("n", "w", function() vim.opt.list = not vim.opt.list:get() end, {desc = "Toggle whitespace",}) -- [[ Clipboard ]] opt.clipboard = "unnamedplus" -- [[ Splits ]] opt.splitright = true -- New splits to the right by default opt.splitbelow = true -- New splits below by default -- [[ Folding ]] opt.foldlevelstart = 99 -- Treesitter folding vim.o.foldmethod = 'expr' vim.o.foldexpr = 'nvim_treesitter#foldexpr()' -- Session Manager Options vim.o.sessionoptions = "blank,buffers,curdir,folds,help,tabpages,winsize,winpos,terminal,localoptions" -- Force CRLF for files inside detected Azure DevOps Repos if vim.fn.has('unix') == 1 then vim.api.nvim_create_autocmd({"BufNewFile", "BufReadPost",}, { callback = function() local handle = io.popen("git -C " .. vim.fn.shellescape(vim.fn.expand("%:p:h")) .. " remote get-url origin 2>/dev/null") if handle then local remote = handle:read("*a") or "" handle:close() if remote:match("azure%.com") or remote:match("dev%.azure%.com") then vim.bo.fileformat = "dos" vim.print("Forcing DOS CRLF Line Endings - Detected ADO Repo!") end end end, }) end