all repos — dotfiles @ 5c1af21a950dca74ae4d5cef119cfa78abecf97c

my *nix dotfiles

config/nvim/lua/settings.lua (view raw)

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