mirror of https://github.com/tiyn/dotfiles
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
73 lines
1.5 KiB
73 lines
1.5 KiB
2 years ago
|
-- autocmd
|
||
2 years ago
|
|
||
2 years ago
|
-- delete trailing whitespaces on save
|
||
|
vim.api.nvim_create_autocmd({'BufWritePre'},
|
||
|
{pattern = {'*'},
|
||
|
command = [[%s/\s\+$//e]],
|
||
|
})
|
||
2 years ago
|
|
||
|
-- formatting options
|
||
|
vim.api.nvim_create_autocmd({'FileType'},
|
||
|
{pattern = {'markdown'},
|
||
|
command = 'setlocal shiftwidth=2 softtabstop=2',
|
||
|
})
|
||
|
|
||
|
vim.api.nvim_create_autocmd({'FileType'},
|
||
|
{pattern = {'java'},
|
||
|
command = 'setlocal shiftwidth=2 softtabstop=2',
|
||
|
})
|
||
|
|
||
|
vim.api.nvim_create_autocmd({'FileType'},
|
||
|
{pattern = {'javascript'},
|
||
|
command = 'setlocal shiftwidth=2 softtabstop=2',
|
||
|
})
|
||
|
|
||
|
-- cleanup certain files after leaving the editor
|
||
|
vim.api.nvim_create_autocmd({'VimLeave'},
|
||
|
{pattern = {'*.c'},
|
||
|
command = '!cclear'
|
||
|
})
|
||
|
|
||
|
vim.api.nvim_create_autocmd({'VimLeave'},
|
||
|
{pattern = {'*.tex'},
|
||
|
command = '!texclear %'
|
||
|
})
|
||
|
|
||
|
-- highlighting break line
|
||
|
vim.api.nvim_create_autocmd({'BufEnter', 'FileType'},
|
||
|
{pattern = {'c'},
|
||
|
command = 'set colorcolumn=80'
|
||
|
})
|
||
|
|
||
|
vim.api.nvim_create_autocmd({'BufEnter', 'FileType'},
|
||
|
{pattern = {'java'},
|
||
|
command = 'set colorcolumn=100'
|
||
|
})
|
||
|
|
||
|
vim.api.nvim_create_autocmd({'BufEnter', 'FileType'},
|
||
|
{pattern = {'markdown'},
|
||
|
command = 'set colorcolumn=80'
|
||
|
})
|
||
|
|
||
|
vim.api.nvim_create_autocmd({'BufEnter', 'FileType'},
|
||
|
{pattern = {'nim'},
|
||
|
command = 'set colorcolumn=80'
|
||
|
})
|
||
|
|
||
|
vim.api.nvim_create_autocmd({'BufEnter', 'FileType'},
|
||
|
{pattern = {'python'},
|
||
|
command = 'set colorcolumn=80'
|
||
|
})
|
||
|
|
||
|
vim.api.nvim_create_autocmd({'BufEnter', 'FileType'},
|
||
|
{pattern = {'tex'},
|
||
|
command = 'set colorcolumn=80'
|
||
|
})
|
||
|
|
||
|
-- conceallevel
|
||
|
vim.api.nvim_create_autocmd({'BufEnter', 'FileType'},
|
||
|
{pattern = {'markdown'},
|
||
|
command = 'set conceallevel=2'
|
||
|
})
|
||
|
|