caio.co/de/dotfiles


Keep every fold open unless manually closed 💬 by Caio a year ago (log)
Otherwise this acts weird with lsp-based fold: start with
everythingg open -> load lsp -> jump to some other file -> jump
back. Now all folds are closed

Blob config/nvim/init.lua

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
-- Settings {{{
local opt, g = vim.o, vim.g

opt.shortmess = "at"
opt.showmatch = true
opt.ignorecase = true
opt.hidden = true
opt.scrolloff = 3
opt.shada = "'1000,f1,<500,:1000,/1000,h"
opt.history = 500
opt.backspace = "indent,eol,start"
opt.errorbells = false
opt.visualbell = false
opt.completeopt = "menuone,noselect,preview"
opt.showbreak = "↪"
opt.virtualedit = "block"
opt.foldlevelstart = 99
opt.shiftround = true
opt.wildmode = "list:longest"
opt.mouse = "n"

opt.wrap = false
opt.list = true
opt.listchars = [[tab:▸ ,trail:·,precedes:…,extends:…,nbsp:‗]]
opt.cursorline = true
opt.foldmethod = "marker"
opt.shiftwidth = 4
opt.textwidth = 79
opt.expandtab = true
opt.softtabstop = 4
opt.formatoptions = "qrn1"
opt.undofile = true
opt.swapfile = false
opt.smartcase = true

g.mapleader = ' '
-- A way less "in your face" netrw
g.netrw_sizestyle="h"
g.netrw_banner=0
g.netrw_list_style=3
g.netrw_list_hide = [[\(^\|\s\s\)\zs\.\S\+]]

vim.diagnostic.config({
    virtual_text = {
        severity = {
            -- TODO ability to cycle this `min` setting since I do like
            --      warnings in my face after prototyping is done
            min = vim.diagnostic.severity.ERROR,
            max = vim.diagnostic.severity.ERROR,
        },
        spacing = 2,
        source = "if_many",
    },
})
-- }}}

vim.g.zenbones_darkness = "stark" -- warm/undef
vim.g.zenbones_lightness = "bright" -- dim/undef
vim.opt.termguicolors = true
vim.opt.background = "light"
vim.cmd("colorscheme zenbones")

-- Configure general-purpose mappings
-- Plugin-related ones are managed along with the plugins
require('mappings')
require("config.lsp")

-- Load plugins via `packer`
-- If the packer installation is not found, no plugins
-- will be configured.
local fn, cmd = vim.fn, vim.cmd
local packer_path = fn.stdpath('data')..'/site/pack/packer/start/packer.nvim'

if fn.empty(fn.glob(packer_path)) > 0 then

    function packer_bootstrap()
        cmd [[echo "Cloning packer.nvim..."]]
        fn.system({'git', 'clone','--depth=1', 'https://github.com/wbthomason/packer.nvim', packer_path})
        vim.api.nvim_command('packadd packer.nvim')
        require('plugins')
        vim.cmd('autocmd User PackerComplete quitall!')
        vim.api.nvim_command('PackerSync')
    end

    cmd [[command! BootstrapPacker lua packer_bootstrap() ]]
    cmd [[echo "Plugins disabled! Run :BootstrapPacker to install and exit"]]
else
    require('plugins')
end

-- Don't leave preview windows hanging
cmd("autocmd CursorMovedI * if pumvisible() == 0|pclose|endif")
cmd("autocmd InsertLeave * if pumvisible() == 0|pclose|endif")

cmd("autocmd BufReadPost * lua require('custom').jump_to_last_position()")