|
|
@ -1,4 +1,17 @@
|
|
|
|
-- autocmd
|
|
|
|
-- read files correctly
|
|
|
|
|
|
|
|
vim.filetype.add({
|
|
|
|
|
|
|
|
extension = {
|
|
|
|
|
|
|
|
c = 'c',
|
|
|
|
|
|
|
|
h = 'c',
|
|
|
|
|
|
|
|
html = 'html',
|
|
|
|
|
|
|
|
java = 'java',
|
|
|
|
|
|
|
|
js = 'javascript',
|
|
|
|
|
|
|
|
lua = 'lua',
|
|
|
|
|
|
|
|
md = 'markdown',
|
|
|
|
|
|
|
|
nim = 'nim',
|
|
|
|
|
|
|
|
py = 'python',
|
|
|
|
|
|
|
|
tex = 'tex',
|
|
|
|
|
|
|
|
}})
|
|
|
|
|
|
|
|
|
|
|
|
-- delete trailing whitespaces on save
|
|
|
|
-- delete trailing whitespaces on save
|
|
|
|
vim.api.nvim_create_autocmd({'BufWritePre'},
|
|
|
|
vim.api.nvim_create_autocmd({'BufWritePre'},
|
|
|
@ -6,67 +19,88 @@ vim.api.nvim_create_autocmd({'BufWritePre'},
|
|
|
|
command = [[%s/\s\+$//e]],
|
|
|
|
command = [[%s/\s\+$//e]],
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
-- formatting options
|
|
|
|
-- c
|
|
|
|
vim.api.nvim_create_autocmd({'FileType'},
|
|
|
|
|
|
|
|
{pattern = {'markdown'},
|
|
|
|
vim.api.nvim_create_autocmd({'VimLeave'},
|
|
|
|
command = 'setlocal shiftwidth=2 softtabstop=2',
|
|
|
|
{pattern = {'c'},
|
|
|
|
|
|
|
|
command = '!cclear'
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vim.api.nvim_create_autocmd({'BufEnter', 'FileType'},
|
|
|
|
|
|
|
|
{pattern = {'c'},
|
|
|
|
|
|
|
|
command = 'set colorcolumn=80'
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- java
|
|
|
|
|
|
|
|
|
|
|
|
vim.api.nvim_create_autocmd({'FileType'},
|
|
|
|
vim.api.nvim_create_autocmd({'FileType'},
|
|
|
|
{pattern = {'java'},
|
|
|
|
{pattern = {'java'},
|
|
|
|
command = 'setlocal shiftwidth=2 softtabstop=2',
|
|
|
|
command = 'setlocal shiftwidth=2 softtabstop=2',
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vim.api.nvim_create_autocmd({'BufEnter', 'FileType'},
|
|
|
|
|
|
|
|
{pattern = {'java'},
|
|
|
|
|
|
|
|
command = 'set colorcolumn=100'
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- javascript
|
|
|
|
|
|
|
|
|
|
|
|
vim.api.nvim_create_autocmd({'FileType'},
|
|
|
|
vim.api.nvim_create_autocmd({'FileType'},
|
|
|
|
{pattern = {'javascript'},
|
|
|
|
{pattern = {'javascript'},
|
|
|
|
command = 'setlocal shiftwidth=2 softtabstop=2',
|
|
|
|
command = 'setlocal shiftwidth=2 softtabstop=2',
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
-- cleanup certain files after leaving the editor
|
|
|
|
-- lua
|
|
|
|
vim.api.nvim_create_autocmd({'VimLeave'},
|
|
|
|
|
|
|
|
{pattern = {'c'},
|
|
|
|
|
|
|
|
command = '!cclear'
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vim.api.nvim_create_autocmd({'VimLeave'},
|
|
|
|
vim.api.nvim_create_autocmd({'FileType'},
|
|
|
|
{pattern = {'tex'},
|
|
|
|
{pattern = {'lua'},
|
|
|
|
command = '!texclear %'
|
|
|
|
command = 'setlocal shiftwidth=2 softtabstop=2',
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
-- highlighting break line
|
|
|
|
|
|
|
|
vim.api.nvim_create_autocmd({'BufEnter', 'FileType'},
|
|
|
|
vim.api.nvim_create_autocmd({'BufEnter', 'FileType'},
|
|
|
|
{pattern = {'c'},
|
|
|
|
{pattern = {'lua'},
|
|
|
|
command = 'set colorcolumn=80'
|
|
|
|
command = 'set colorcolumn=100'
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- markdown
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vim.api.nvim_create_autocmd({'FileType'},
|
|
|
|
|
|
|
|
{pattern = {'markdown'},
|
|
|
|
|
|
|
|
command = 'setlocal shiftwidth=2 softtabstop=2',
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
vim.api.nvim_create_autocmd({'BufEnter', 'FileType'},
|
|
|
|
vim.api.nvim_create_autocmd({'BufEnter', 'FileType'},
|
|
|
|
{pattern = {'java'},
|
|
|
|
{pattern = {'markdown'},
|
|
|
|
command = 'set colorcolumn=100'
|
|
|
|
command = 'set colorcolumn=100'
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
vim.api.nvim_create_autocmd({'BufEnter', 'FileType'},
|
|
|
|
vim.api.nvim_create_autocmd({'BufEnter', 'FileType'},
|
|
|
|
{pattern = {'markdown'},
|
|
|
|
{pattern = {'markdown'},
|
|
|
|
command = 'set colorcolumn=80'
|
|
|
|
command = 'set conceallevel=2'
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- nim
|
|
|
|
|
|
|
|
|
|
|
|
vim.api.nvim_create_autocmd({'BufEnter', 'FileType'},
|
|
|
|
vim.api.nvim_create_autocmd({'BufEnter', 'FileType'},
|
|
|
|
{pattern = {'nim'},
|
|
|
|
{pattern = {'nim'},
|
|
|
|
command = 'set colorcolumn=80'
|
|
|
|
command = 'set colorcolumn=80'
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- python
|
|
|
|
|
|
|
|
|
|
|
|
vim.api.nvim_create_autocmd({'BufEnter', 'FileType'},
|
|
|
|
vim.api.nvim_create_autocmd({'BufEnter', 'FileType'},
|
|
|
|
{pattern = {'python'},
|
|
|
|
{pattern = {'python'},
|
|
|
|
command = 'set colorcolumn=80'
|
|
|
|
command = 'set colorcolumn=80'
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
vim.api.nvim_create_autocmd({'BufEnter', 'FileType'},
|
|
|
|
-- tex
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vim.api.nvim_create_autocmd({'VimLeave'},
|
|
|
|
{pattern = {'tex'},
|
|
|
|
{pattern = {'tex'},
|
|
|
|
command = 'set colorcolumn=80'
|
|
|
|
command = '!texclear %'
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
-- conceallevel
|
|
|
|
|
|
|
|
vim.api.nvim_create_autocmd({'BufEnter', 'FileType'},
|
|
|
|
vim.api.nvim_create_autocmd({'BufEnter', 'FileType'},
|
|
|
|
{pattern = {'markdown'},
|
|
|
|
{pattern = {'tex'},
|
|
|
|
command = 'set conceallevel=2'
|
|
|
|
command = 'set colorcolumn=80'
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|