1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- local augroup = vim.api.nvim_create_augroup
- local autocmd = vim.api.nvim_create_autocmd
- -- Highlight on yank
- augroup('YankHighlight', { clear = true })
- autocmd('TextYankPost', {
- group = 'YankHighlight',
- callback = function()
- vim.highlight.on_yank({ higroup = 'IncSearch', timeout = '1000' })
- end
- })
- -- Remove whitespace on save
- autocmd('BufWritePre', {
- pattern = '*',
- command = ":%s/\\s\\+$//e"
- })
- -- disable ftplugin formatoptions
- autocmd('BufEnter', {
- pattern = '*',
- command = 'setlocal formatoptions-=ro'
- })
- -- Settings for filetypes:
- -- Help window
- autocmd('FileType', {
- pattern = 'help',
- command = 'nnoremap <buffer> q :helpclose<CR>'
- })
- -- Disable line length marker
- augroup('setLineLength', { clear = true })
- autocmd('Filetype', {
- group = 'setLineLength',
- pattern = { 'text', 'markdown', 'html', 'xhtml', 'javascript', 'typescript' },
- command = 'setlocal cc=0'
- })
- -- Set indentation to 4 spaces
- augroup('setIndent', { clear = true })
- autocmd('Filetype', {
- group = 'setIndent',
- pattern = { 'python', 'makefile' },
- command = 'setlocal shiftwidth=4 tabstop=4 expandtab'
- })
|