config/nvim/lua/settings.lua (view raw)
1local u = require('utils')
2
3local o = vim.opt
4local autocmd = vim.api.nvim_create_autocmd
5local g = vim.g
6local cmd = vim.cmd
7
8-- global options
9o.swapfile = true
10o.dir = '/tmp'
11o.smartcase = true
12o.laststatus = 2
13o.hlsearch = true
14o.incsearch = true
15o.ignorecase = true
16o.scrolloff = 12
17o.timeoutlen = 3000
18o.ttimeoutlen = 100
19o.undodir = '~/.cache/nvim/undodir'
20o.cursorline = false
21o.foldenable = false
22o.conceallevel = 2
23o.mouse = 'a'
24o.wildmenu = true
25o.tabstop = 4
26o.shiftwidth = 4
27o.softtabstop = 4
28o.showmode = true
29o.listchars='tab:│ ,nbsp:␣,trail:·,extends:>,precedes:<'
30o.hidden = true
31o.completeopt = { 'menuone', 'noselect', 'noinsert' }
32o.formatoptions:append('c')
33o.signcolumn = 'yes:2'
34o.wildignore = [[
35.git,.hg,.svn
36*.aux,*.out,*.toc
37*.o,*.obj,*.exe,*.dll,*.manifest,*.rbc,*.class
38*.ai,*.bmp,*.gif,*.ico,*.jpg,*.jpeg,*.png,*.psd,*.webp
39*.avi,*.divx,*.mp4,*.webm,*.mov,*.m2ts,*.mkv,*.vob,*.mpg,*.mpeg
40*.mp3,*.oga,*.ogg,*.wav,*.flac
41*.eot,*.otf,*.ttf,*.woff
42*.doc,*.pdf,*.cbr,*.cbz
43*.zip,*.tar.gz,*.tar.bz2,*.rar,*.tar.xz,*.kgb
44*.swp,.lock,.DS_Store,._*
45]]
46
47cmd('syntax on')
48cmd('colorscheme plain')
49autocmd('TextYankPost', {
50 pattern = '*',
51 callback = function()
52 vim.highlight.on_yank{timeout=200}
53 end,
54})
55
56o.background = 'light'
57
58-- gitgutter options
59g.gitgutter_override_sign_column_highlight = 0
60g.gitgutter_sign_added = '+'
61g.gitgutter_sign_modified = '±'
62g.gitgutter_sign_removed = '-'
63g.gitgutter_sign_removed_first_line = '^'
64g.gitgutter_sign_modified_removed = '#'
65
66-- window-local options
67o.number = false
68o.list = true
69o.wrap = false
70
71-- buffer-local options
72o.expandtab = true
73
74-- set statusline
75stl = require('statusline.line')
76o.statusline = '%!luaeval("stl.statusline()")'
77
78-- u.create_augroup({
79-- { 'BufRead,BufNewFile', '/tmp/nail-*', 'setlocal', 'ft=mail' },
80-- { 'BufRead,BufNewFile', '*s-nail-*', 'setlocal', 'ft=mail' },
81-- }, 'ftmail')
82
83-- restore cursor
84autocmd('BufReadPost', {
85 pattern = '*',
86 callback = function()
87 vim.fn.setpos(".", vim.fn.getpos("'\""))
88 end,
89})
90
91-- unknown files are 'text'
92autocmd('BufNewFile,BufRead', {
93 pattern = '*',
94 callback = function()
95 if vim.bo.filetype == "" then
96 vim.bo.filetype = 'text'
97 end
98 end,
99})
100
101-- coq.nvim
102g.coq_settings = {
103 auto_start = 'shut-up',
104 xdg = true,
105 clients = {
106 snippets = { warn = {} }
107 },
108 display = {
109 icons = {
110 mode = 'none'
111 },
112 preview = {
113 border = 'rounded',
114 },
115 },
116}
117
118-- filetype.nvim
119g.do_filetype_lua = 1
120g.did_load_filetypes = 0
121
122-- disable built-in plugins
123local disabled_built_ins = {
124 'gzip',
125 'shada_plugin',
126 'tarPlugin',
127 'tar',
128 'zipPlugin',
129 'zip',
130}
131
132for i = 1, 6 do
133 g['loaded_' .. disabled_built_ins[i]] = 1
134end