123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- -- apply default terminal settings
- vim.api.nvim_create_autocmd('TermOpen', {
- callback = function()
- vim.bo.scrollback = 10000
- vim.opt_local.number = false
- vim.opt_local.relativenumber = false
- end
- })
- -- leave insert when terminal process exits
- -- this prevents the window from closing
- vim.api.nvim_create_autocmd('TermClose', {
- command = 'stopinsert',
- })
- -- automatically enter/leave terminal mode
- vim.api.nvim_create_autocmd('TermOpen', { command = 'startinsert' })
- vim.api.nvim_create_autocmd({'WinEnter','BufWinEnter'}, {
- pattern = 'term://*',
- command = 'startinsert',
- })
- vim.api.nvim_create_autocmd('BufLeave', {
- pattern = 'term://*',
- command = 'stopinsert',
- })
- -- strip trailing whitespace
- vim.api.nvim_create_autocmd('BufWritePre', { command = '%s/\\s\\+$//e' })
- -- filetype specific options
- vim.api.nvim_create_autocmd('FileType', {
- pattern = 'markdown',
- callback = function()
- vim.bo.textwidth = 80
- end,
- })
- vim.api.nvim_create_autocmd('FileType', {
- pattern = 'typescript',
- callback = function()
- -- disable default indentation as it's pretty broken for jsdoc
- vim.opt_local.indentexpr = nil
- vim.opt_local.formatexpr = nil
- end,
- })
|