config/nvim/lua/settings.lua (view raw)
1local u = require('utils')
2
3local o = vim.opt
4local g = vim.g
5local cmd = vim.cmd
6
7-- global options
8o.swapfile = true
9o.dir = '/tmp'
10o.smartcase = true
11o.laststatus = 2
12o.hlsearch = true
13o.incsearch = true
14o.ignorecase = true
15o.scrolloff = 12
16o.timeoutlen = 3000
17o.ttimeoutlen = 100
18o.undodir = '~/.cache/nvim/undodir'
19o.cursorline = false
20o.foldenable = false
21o.conceallevel = 2
22o.mouse = 'a'
23o.wildmenu = true
24o.tabstop = 4
25o.shiftwidth = 4
26o.softtabstop = 4
27o.showmode = true
28o.listchars='tab:│ ,nbsp:␣,trail:·,extends:>,precedes:<'
29o.hidden = true
30o.completeopt = { 'menuone', 'noselect', 'noinsert' }
31o.wildignore = [[
32.git,.hg,.svn
33*.aux,*.out,*.toc
34*.o,*.obj,*.exe,*.dll,*.manifest,*.rbc,*.class
35*.ai,*.bmp,*.gif,*.ico,*.jpg,*.jpeg,*.png,*.psd,*.webp
36*.avi,*.divx,*.mp4,*.webm,*.mov,*.m2ts,*.mkv,*.vob,*.mpg,*.mpeg
37*.mp3,*.oga,*.ogg,*.wav,*.flac
38*.eot,*.otf,*.ttf,*.woff
39*.doc,*.pdf,*.cbr,*.cbz
40*.zip,*.tar.gz,*.tar.bz2,*.rar,*.tar.xz,*.kgb
41*.swp,.lock,.DS_Store,._*
42]]
43
44vim.cmd("syntax on")
45-- i couldn't figure out how to set the colorscheme in lua
46vim.cmd('colorscheme plain')
47
48vim.cmd('au TextYankPost * lua vim.highlight.on_yank{timeout=200}')
49o.background = 'dark'
50
51-- gitgutter options
52g.gitgutter_override_sign_column_highlight = 0
53g.gitgutter_sign_added = '+'
54g.gitgutter_sign_modified = '±'
55g.gitgutter_sign_removed = '-'
56g.gitgutter_sign_removed_first_line = '^'
57g.gitgutter_sign_modified_removed = '#'
58
59-- speed up python
60g.python3_host_prog = '$HOME/.pyenv/versions/3.9.1/bin/python3.9'
61
62-- window-local options
63o.number = false
64o.list = true
65o.wrap = false
66
67-- buffer-local options
68o.expandtab = true
69
70-- set statusline
71stl = require('statusline.line')
72o.statusline = '%!luaeval("stl.statusline()")'
73
74-- augroups don't have an interface yet
75u.create_augroup({
76 { 'BufRead,BufNewFile', '/tmp/nail-*', 'setlocal', 'ft=mail' },
77 { 'BufRead,BufNewFile', '*s-nail-*', 'setlocal', 'ft=mail' },
78}, 'ftmail')
79
80-- restore cursor
81cmd([[ au BufReadPost * call setpos(".", getpos("'\"")) ]])
82
83-- unknown files are 'text'
84cmd('au BufNewFile,BufRead * if &ft == "" | set ft=text | endif')
85
86
87-- completion-nvim
88cmd('au BufEnter * lua require"completion".on_attach()')
89g.completion_chain_complete_list = {
90 default = {
91 { complete_items = { 'lsp' } },
92 { complete_items = { 'buffers' } },
93 { mode = { '<c-p>' } },
94 { mode = { '<c-n>' } }
95 },
96}