summaryrefslogtreecommitdiff
path: root/dot_config/nvim/lua/ibrahim/set.lua.tmpl
blob: f8f67ba585258196ff8fd63502affb822dfcd344 (plain)
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
-- vim:ft=lua
---@diagnostic disable: undefined-global

local opt = vim.opt

-- Set default shell
{{- if eq .chezmoi.os "windows" }}
opt.shell = "pwsh"
{{ else }}
opt.shell = "zsh"
{{ end }}

-- Begin searching as I type a search string instead of waiting for me to press Enter
opt.incsearch = true

-- Make line numbers default
opt.number = true
opt.relativenumber = true

-- Highlight only the line number for the current line.
-- Disable the second line here to highlight the entire line where the
-- cursor is.
opt.cursorline = true
opt.cursorlineopt = "number"

-- Try to keep this many lines visible above and below the cursor.
-- This makes the window scroll sooner if mashing j / k.
opt.scrolloff = 8

-- Folds
vim.o.foldtext = ''

-- Don't fold absolutely everything when opening a new file
opt.foldlevelstart = 1

-- Enable mouse mode
opt.mouse = "a"

-- Set the conceal level (mainly for obsidian md formatting)
opt.conceallevel = 2

-- Tab settings
opt.tabstop = 4
opt.softtabstop = 4
opt.shiftwidth = 0
opt.expandtab = true

-- Automatically set the same indent level on a new line
opt.autoindent = true

-- Increase or decrease indent based on braces or language keywords
opt.smartindent = true

-- Enable break indent
opt.breakindent = true

-- Don't make local backup files. Instead, write undo history to disk.
-- This works especially well with the undotree plugin.
opt.swapfile = false
opt.backup = false
opt.undodir = vim.fn.expand("~/.vim/undodir")
opt.undofile = true

-- Case insensitive searching UNLESS /C or capital in search
opt.ignorecase = true
opt.smartcase = true

-- Decrease update time
opt.updatetime = 250

-- Enable signcolumn (used for diagnostics and gitsigns)
opt.signcolumn = "yes"

-- Colored columns at 72 and 88 are for line lengths, and are based on
-- Python conventions. Docstrings in Python should terminate at 72
-- characters, and 88 is the max line length for the Black formatter.
opt.colorcolumn = { 72, 88 }

-- Set completeopt to have a better completion experience
opt.completeopt = "menuone,noselect"

-- Highlight when yanking text
vim.api.nvim_create_autocmd('TextYankPost', {
    desc = 'Highlight when yanking text',
    group = vim.api.nvim_create_augroup('IbrahimHighlightYank', { clear = true }),
    callback = function()
        vim.highlight.on_yank()
    end,
})