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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
|
local g = vim.g -- global variables
local cmd = vim.cmd -- execute Vim commands
local opt = vim.opt -- vim options
local exec = vim.api.nvim_exec -- execute Vimscript
g.vscode_style = "dark"
g.vscode_transparent = 1
g.vscode_italic_comment = 1
g.vscode_disable_nvimtree_bg = true
g.tex_flavor = "latex";
-- global options
local options = {
termguicolors = true, -- Enable GUI colors for the terminal to get truecolor
list = false, -- show whitespace
listchars = {
nbsp = '⦸', -- CIRCLED REVERSE SOLIDUS (U+29B8, UTF-8: E2 A6 B8)
extends = '»', -- RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK (U+00BB, UTF-8: C2 BB)
precedes = '«', -- LEFT-POINTING DOUBLE ANGLE QUOTATION MARK (U+00AB, UTF-8: C2 AB)
tab = '▷─', -- WHITE RIGHT-POINTING TRIANGLE (U+25B7, UTF-8: E2 96 B7) + BOX DRAWINGS HEAVY TRIPLE DASH HORIZONTAL (U+2505, UTF-8: E2 94 85)
trail = '•', -- BULLET (U+2022, UTF-8: E2 80 A2)
space = ' '
},
fillchars = {
diff = '∙', -- BULLET OPERATOR (U+2219, UTF-8: E2 88 99)
eob = ' ', -- NO-BREAK SPACE (U+00A0, UTF-8: C2 A0) to suppress ~ at EndOfBuffer
fold = '·', -- MIDDLE DOT (U+00B7, UTF-8: C2 B7)
vert = ' ' -- remove ugly vertical lines on window division
},
undofile = true,
undodir = vim.fn.stdpath("config") .. "/undo",
clipboard = opt.clipboard + "unnamedplus", -- copy & paste
shortmess = opt.shortmess + "c"
wrap = false, -- don't automatically wrap on load
showmatch = true, -- show the matching part of the pair for [] {} and ()
cursorline = true, -- highlight current line
number = true, -- show line numbers
relativenumber = true, -- show relative line number
incsearch = true, -- incremental search
hlsearch = true, -- highlighted search results
ignorecase = true, -- ignore case sensetive while searching
smartcase = true,
scrolloff = 1, -- when scrolling, keep cursor 1 lines away from screen border
sidescrolloff = 2, -- keep 30 columns visible left and right of the cursor at all times
backspace = 'indent,start,eol', -- make backspace behave like normal again
mouse = "a", -- turn on mouse interaction
updatetime = 500, -- CursorHold interval
expandtab = true,
softtabstop = 4,
et.textwidth = 100,
shiftwidth = 4, -- spaces per tab (when shifting), when using the >> or << commands, shift lines by 4 spaces
tabstop = 4, -- spaces per tab
smarttab = true, -- <tab>/<BS> indent/dedent in leading whitespace
autoindent = true, -- maintain indent of current line
shiftround = true,
splitbelow = true, -- open horizontal splits below current window
splitright = true, -- open vertical splits to the right of the current window
laststatus = 2, -- always show status line
colorcolumn = "100", -- vertical word limit line
hidden = true, -- allows you to hide buffers with unsaved changes without being prompted
inccommand = 'split', -- live preview of :s results
shell = 'zsh', -- shell to use for `!`, `:!`, `system()` etc.
wildignore = opt.wildignore + '*.o,*.rej,*.so',
lazyredraw = true,
completeopt = 'menuone,noselect,noinsert',
}
for k, v in pairs(options) do
vim.opt[k] = v
end
-- highlight on yank
exec([[
augroup YankHighlight
autocmd!
autocmd TextYankPost * silent! lua vim.highlight.on_yank{higroup="IncSearch", timeout=500, on_visual=true}
augroup end
]], false)
-- to Show whitespace, MUST be inserted BEFORE the colorscheme command
cmd 'autocmd ColorScheme * highlight ExtraWhitespace ctermbg=red guibg=grey'
-- set colorscheme
cmd 'colorscheme vscode'
-- jump to the last position when reopening a file
cmd [[
if has("autocmd")
au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") | exe "normal! g`\"" | endif
endif
]]
-- remove whitespace on save
cmd [[au BufWritePre * :%s/\s\+$//e]]
-- don't auto commenting new lines
cmd [[au BufEnter * set fo-=c fo-=r fo-=o]]
-- 2 spaces for selected filetypes
cmd [[ autocmd FileType xml,html,xhtml,css,scss,javascript,lua,dart setlocal shiftwidth=2 tabstop=2 ]]
-- json
cmd [[ au BufEnter *.json set ai expandtab shiftwidth=2 tabstop=2 sta fo=croql ]]
--- latex
cmd [[ autocmd FileType latex,tex,plaintex set wrap linebreak ]]
-- markdown
cmd [[ autocmd BufNewFile,BufRead *.mdx set filetype=markdown ]]
|