--[[ File: settings.lua Description: Base settings for neovim Info: Use and to open and close foldings ]] require "helpers/globals" g.autochdir = true -- Set associating between turned on plugins and filetype cmd[[filetype plugin on]] -- Disable comments on pressing Enter cmd[[autocmd FileType * setlocal formatoptions-=cro]] -- Tabs {{{ opt.expandtab = true -- Use spaces by default opt.shiftwidth = 4 -- Set amount of space characters, when we press "<" or ">" opt.tabstop = 4 -- 1 tab equal 2 spaces opt.smartindent = true -- Turn on smart indentation. See in the docs for more info opt.softtabstop = -1 -- }}} -- Clipboard {{{ opt.clipboard = 'unnamedplus' -- Use system clipboard opt.fixeol = false -- Turn off appending new line in the end of a file -- }}} -- Folding {{{ opt.foldmethod = "expr" opt.foldexpr = "v:lua.vim.treesitter.foldexpr()" -- }}} -- Search {{{ opt.ignorecase = true -- Ignore case if all characters in lower case opt.joinspaces = false -- Join multiple spaces in search opt.smartcase = true -- When there is a one capital letter search for exact match opt.showmatch = true -- Highlight search instances -- }}} -- Window {{{ opt.splitbelow = true -- Put new windows below current opt.splitright = true -- Put new vertical splits to right -- }}} -- Wild Menu {{{ opt.wildmenu = true opt.wildmode = "longest:full,full" -- }}} opt.number = true opt.relativenumber = true opt.breakindent = true opt.numberwidth = 2 opt.cmdheight = 0 opt.colorcolumn = '+0' -- Align text at 'textwidth' opt.showtabline = 0 -- Always show the tabs line opt.helpheight = 0 -- Disable help window resizing opt.winwidth = 30 -- Minimum width for active window opt.winheight = 1 -- Minimum height for active window opt.winminheight = 1 -- Minimum height for inactive window opt.showbreak = '⤷ ' -- ↪ ⤷ opt.listchars = { tab = ' ', extends = '⟫', precedes = '⟪', conceal = '', nbsp = '␣', trail = '·' } opt.fillchars = { foldopen = '', --  󰅀 foldclose = '', --  󰅂 fold = ' ', -- ⸱ foldsep = ' ', diff = '╱', eob = ' ', horiz = '━', horizup = '┻', horizdown = '┳', vert = '┃', vertleft = '┫', vertright = '┣', verthoriz = '╋', } opt.scrolloff = 3 opt.history = 500 opt.undofile = true opt.signcolumn = "yes:1" opt.colorcolumn = "150" opt.foldlevel = 999 opt.lazyredraw = false g.elite_mode = true g.autoformat = true -- Default Plugins {{{ local disabled_built_ins = { "netrw", "netrwPlugin", "netrwSettings", "netrwFileHandlers", "gzip", "zip", "zipPlugin", "tar", "tarPlugin", "getscript", "getscriptPlugin", "vimball", "vimballPlugin", "2html_plugin", "logipat", "rrhelper", "spellfile_plugin", "matchit" } for _, plugin in pairs(disabled_built_ins) do g["loaded_" .. plugin] = 1 end -- }}} local diagnostic = vim.diagnostic local api = vim.api local defaults = require("defaults") -- global config for diagnostic diagnostic.config { underline = true, virtual_text = { severity = { min = vim.diagnostic.severity.WARN, max = vim.diagnostic.severity.ERROR }, source = "if_many", spacing = 0, prefix = "●", }, update_in_insert = true, virtual_lines = true, signs = { text = { [diagnostic.severity.ERROR] = "🆇", [diagnostic.severity.WARN] = "⚠️", [diagnostic.severity.INFO] = "ℹ️", [diagnostic.severity.HINT] = "", }, }, severity_sort = true, float = { --nvim_open_win() options relative = "cursor", -- "single": A single line box. -- "double": A double line box. -- "rounded": Like "single", but with rounded corners "╭" -- "solid": Adds padding by a single whitespace cell. -- "shadow": A drop shadow effect by blending with the -- "none": No border (default). border = "shadow", -- vim.lsp.util.open_floating_preview() max_width = math.floor(vim.o.columns * 0.84), max_height = math.floor(vim.o.lines * 0.6), close_events = { "BufLeave", "CursorMoved", "InsertEnter", "FocusLost", }, focusable = false, zindex = 3, focus = false, -- vim.diagnostic.open_float() source = "if_many", severity_sort = true, } } -- :h highlight-args and :h cterm-colors vim.api.nvim_set_hl(0, "Search", { ctermfg = 0, ctermbg = 11, cterm = { bold = true }, bg = "Blue", fg = "Magenta", standout = true, underdotted = true, }) local augroup = function(name) return vim.api.nvim_create_augroup(name, { clear = true }) end local autocmd = vim.api.nvim_create_autocmd -- create autocmd autocmd("TextYankPost", { group = augroup("highlight_yank"), callback = function() vim.hl.on_yank() end, }) -- resize splits if window got resized autocmd({ "VimResized" }, { group = augroup("resize_splits"), callback = function() vim.cmd("wincmd =") vim.cmd("tabdo wincmd =") end, }) -- vim: tabstop=2 shiftwidth=2 expandtab syntax=lua foldmethod=marker foldlevelstart=1