all repos — dotfiles @ 414bdaa034cc1498dff6590adb5af7473c991fb5

my *nix dotfiles

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.foldenable = false
 19o.conceallevel = 2
 20o.mouse = 'a'
 21o.wildmenu = true
 22o.tabstop = 4
 23o.shiftwidth = 4
 24o.softtabstop = 4
 25o.showmode = true
 26o.cursorline = false
 27o.listchars='tab:│ ,nbsp:␣,trail:·,extends:>,precedes:<'
 28o.hidden = true
 29o.completeopt = { 'menuone', 'noselect', 'noinsert' }
 30o.formatoptions:append('c')
 31o.signcolumn = 'yes:2'
 32o.wildignore = [[
 33.git,.hg,.svn
 34*.aux,*.out,*.toc
 35*.o,*.obj,*.exe,*.dll,*.manifest,*.rbc,*.class
 36*.ai,*.bmp,*.gif,*.ico,*.jpg,*.jpeg,*.png,*.psd,*.webp
 37*.avi,*.divx,*.mp4,*.webm,*.mov,*.m2ts,*.mkv,*.vob,*.mpg,*.mpeg
 38*.mp3,*.oga,*.ogg,*.wav,*.flac
 39*.eot,*.otf,*.ttf,*.woff
 40*.doc,*.pdf,*.cbr,*.cbz
 41*.zip,*.tar.gz,*.tar.bz2,*.rar,*.tar.xz,*.kgb
 42*.swp,.lock,.DS_Store,._*
 43]]
 44
 45cmd('syntax on')
 46cmd('colorscheme plain')
 47autocmd('TextYankPost', {
 48  pattern = '*',
 49  callback = function()
 50    vim.highlight.on_yank{timeout=200}
 51  end,
 52})
 53
 54o.background = 'light'
 55o.termguicolors = true
 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-- keymap files are dts
101autocmd({'BufEnter','BufNewFile','BufRead'}, {
102  pattern = '*.keymap',
103  callback = function()
104    vim.bo.filetype = 'dts'
105  end
106})
107
108-- vim-textobj-quote only in ~/docs/writing
109autocmd({'BufEnter','BufNewFile','BufRead'}, {
110  pattern = '*.md',
111  callback = function()
112    local cwd = vim.fn.expand('%:p')
113    if cwd:find('/home/icy/docs/writing', 1, true) == 1 then
114      vim.fn['textobj#quote#init']()
115      vim.fn['pencil#init']({wrap = 'soft'})
116      vim.keymap.set('i', '--', '', {silent = true})
117      vim.opt.breakindent = false
118      vim.opt.shiftwidth = 4
119      vim.opt.tabstop = 4
120    end
121  end
122})
123
124-- mdx files are markdown
125autocmd({'BufEnter','BufNewFile','BufRead'}, {
126  pattern = '*.mdx',
127  callback = function()
128    vim.bo.filetype = 'markdown'
129  end
130})
131
132-- filetype.nvim
133g.do_filetype_lua = 1
134g.did_load_filetypes = 0
135
136-- disable built-in plugins
137local disabled_built_ins = {
138  'gzip',
139  'shada_plugin',
140  'tarPlugin',
141  'tar',
142  'zipPlugin',
143  'zip',
144}
145
146for i, _ in ipairs(disabled_built_ins) do
147  g['loaded_' .. disabled_built_ins[i]] = 1
148end
149
150-- tmp
151vim.g.gui_font_face = 'Noto Serif'