{{- if eq .chezmoi.os "openbsd" }} local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" if not vim.loop.fs_stat(lazypath) then vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", "--branch=stable", -- latest stable release lazypath, }) end vim.opt.rtp:prepend(lazypath) HOME = os.getenv("HOME") vim.g.mapleader = ' ' vim.g.maplocalleader = '\\' -- Plugins require("lazy").setup("plugins") -- Options local o = vim.opt -- basic settings o.encoding = "utf-8" o.backspace = "indent,eol,start" -- backspace works on every char in insert mode o.completeopt = { 'menu', 'menuone', 'noselect' } o.history = 1000 o.startofline = true o.title = true o.clipboard = 'unnamedplus' -- Mapping waiting time o.timeoutlen = 200 o.ttimeoutlen = 0 -- Spellchecker o.spell = false o.spelllang = { 'en_us' } o.spellfile = HOME .. '/.vim/spell/en.utf8.add' o.thesaurus = HOME .. '/.vim/thesaurus/english.txt' -- Display o.showmatch = true -- show matching brackets o.colorcolumn = '90' o.cursorline = true o.scrolloff = 8 -- always show 3 rows from edge of the screen o.splitbelow = true o.splitright = true o.virtualedit = 'block' o.synmaxcol = 300 -- stop syntax highlight after x lines for performance o.laststatus = 2 -- always show status line o.list = false -- do not display white characters o.termguicolors = true o.background = "dark" o.wrap = false --do not wrap lines even if very long o.eol = false -- show if there's no eol char o.showbreak = '↪' -- character to show when line is broken -- Folding -- o.foldenable = true -- o.foldnestmax = 2 -- o.foldminlines = 10 -- o.foldmethod = "expr" -- o.foldexpr = "nvim_treesitter#foldexpr()" -- workaround for Telescope bug vim.api.nvim_create_autocmd({ "BufEnter" }, { pattern = { "*" }, command = "normal zx", }) -- Sidebar o.number = true -- line number on the left o.relativenumber = true o.numberwidth = 3 -- always reserve 3 spaces for line number o.signcolumn = 'yes' o.modelines = 0 -- Bottombar o.showcmd = true -- display command in bottom bar o.ruler = false o.showmode = false -- Search o.incsearch = true -- starts searching as soon as typing, without enter needed o.hlsearch = true -- highlighting of search matches o.ignorecase = true -- ignore letter case when searching o.smartcase = true -- case insentive unless capitals used in search o.wildignorecase = true o.matchtime = 2 -- delay before showing matching paren o.mps = vim.o.mps .. ",<:>" -- White characters o.smartindent = true o.breakindent = true o.tabstop = 4 o.shiftwidth = 4 -- indentation rule o.softtabstop = 4 o.expandtab = true -- expand tab to spaces o.smarttab = true -- Shortmess o.shortmess = o.shortmess + { A = true, -- don't give the "ATTENTION" message when an existing swap file is found. I = true, -- don't give the intro message when starting Vim |:intro|. W = true, -- don't give "written" or "[w]" when writing a file c = true, -- don't give |ins-completion-menu| messages m = true, -- use "[+]" instead of "[Modified]" } -- Format options o.formatoptions = o.formatoptions + { c = false, o = false, -- O and o, don't continue comments r = true, -- Pressing Enter will continue comments } -- Backup files o.hidden = true o.autowrite = true o.autoread = true o.backup = true -- use backup files o.writebackup = false o.swapfile = false -- do not use swap file o.undofile = true o.undodir = HOME .. '/.local/share/nvim/dirs/undo//' -- undo files o.backupdir = HOME .. '/.local/share/nvim/dirs/backup//' -- backups -- Commands mode o.wildmenu = true -- on TAB, complete options for system command o.wildignore = 'deps,.svn,CVS,.git,.hg,*.o,*.a,*.class,*.mo,*.la,*.so,*.obj,*.swp,*.jpg,*.png,*.xpm,*.gif,.DS_Store,*.aux,*.out,*.toc' vim.cmd([[ au BufRead,BufNewFile *.md set tw=80 syntax=markdown ]]) vim.api.nvim_create_user_command('ReloadConfig', 'source $MYVIMRC', {}) local group = vim.api.nvim_create_augroup('user_cmds', { clear = true }) vim.api.nvim_create_autocmd('TextYankPost', { desc = 'Highlight on yank', group = group, callback = function() vim.highlight.on_yank({ higroup = 'Visual', timeout = 200 }) end, }) local map = vim.keymap.set map({ 'n', 'v' }, '', "", { silent = true }) -- Clear search with map({ "i", "n" }, "", "noh", { desc = "Escape and clear hlsearch" }) -- sane regexes map({ 'n', 'v' }, '/', '/\\v', { noremap = true, silent = true }) -- don't jump when using * map('n', '*', '*') -- https://github.com/mhinz/vim-galore#saner-behavior-of-n-and-n map("n", "n", "'Nn'[v:searchforward].'zv'", { expr = true, desc = "Next search result" }) map("x", "n", "'Nn'[v:searchforward]", { expr = true, desc = "Next search result" }) map("o", "n", "'Nn'[v:searchforward]", { expr = true, desc = "Next search result" }) map("n", "N", "'nN'[v:searchforward].'zv'", { expr = true, desc = "Prev search result" }) map("x", "N", "'nN'[v:searchforward]", { expr = true, desc = "Prev search result" }) map("o", "N", "'nN'[v:searchforward]", { expr = true, desc = "Prev search result" }) -- Same when jumping around map('n', 'g;', 'g;zz') -- replace ex mode map and use it for repeating 'q' macro map('n', 'Q', '@q') map('v', 'Q', 'norm @q') -- save file map({ "i", "x", "n", "s" }, "", "w", { desc = "Save file" }) -- better indenting map("v", "<", "", ">gv") -- lazy map("n", "l", "Lazy", { desc = "Lazy" }) map("n", "xl", "lopen", { desc = "Location List" }) map("n", "xq", "copen", { desc = "Quickfix List" }) map("n", "[q", vim.cmd.cprev, { desc = "Previous quickfix" }) map("n", "]q", vim.cmd.cnext, { desc = "Next quickfix" }) -- Shortcut to close quickfix windows map('n', 'a', 'windo lcl|ccl') -- q Closes the current buffer map('n', 'q', 'bdelete') -- Easier in-file navigation with Tab and S-Tab map('n', '', '') map('n', '', '') -- Easy buffer navigation map('n', '', 'h') map('n', '', 'j') map('n', '', 'k') map('n', '', 'l') map('n', '', 'resize -2') map('n', '', 'resize +2') map('n', '', 'vertical resize -2') map('n', '', 'vertical resize +2') -- windows map("n", "ww", "p", { desc = "Other window", remap = true }) map("n", "wd", "c", { desc = "Delete window", remap = true }) map("n", "-", "s", { desc = "Split window below", remap = true }) map("n", "|", "v", { desc = "Split window right", remap = true }) {{ else }} -- bootstrap lazy.nvim, LazyVim and your plugins require("config.lazy") {{ end }}