all repos — dotfiles @ 242877a4483e053762fb546c780bbb84f7943155

my *nix dotfiles

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  display = {
106    icons = {
107      mode = 'none'
108    },
109    preview = {
110      border = 'rounded',
111    },
112  },
113}
114
115-- filetype.nvim
116g.do_filetype_lua = 1
117g.did_load_filetypes = 0
118
119-- disable built-in plugins
120local disabled_built_ins = {
121  'gzip',
122  'shada_plugin',
123  'tarPlugin',
124  'tar',
125  'zipPlugin',
126  'zip',
127}
128
129for i = 1, 6 do
130  g['loaded_' .. disabled_built_ins[i]] = 1
131end