|
|
|
@ -2,13 +2,14 @@
|
|
|
|
|
|
|
|
|
|
-- read files correctly
|
|
|
|
|
vim.filetype.add({
|
|
|
|
|
pattern = {
|
|
|
|
|
['.*.lua'] = 'lua',
|
|
|
|
|
['.*.h'] = 'c',
|
|
|
|
|
['.*.html'] = 'html',
|
|
|
|
|
['.*.nim'] = 'nim',
|
|
|
|
|
['.*.py'] = 'python',
|
|
|
|
|
['.*.tex'] = 'tex',
|
|
|
|
|
extension = {
|
|
|
|
|
h = 'c',
|
|
|
|
|
html = 'html',
|
|
|
|
|
java = 'java',
|
|
|
|
|
md = 'markdown',
|
|
|
|
|
nim = 'nim',
|
|
|
|
|
py = 'python',
|
|
|
|
|
tex = 'tex',
|
|
|
|
|
}})
|
|
|
|
|
|
|
|
|
|
-- formatting options
|
|
|
|
@ -27,67 +28,6 @@ vim.api.nvim_create_autocmd({'FileType'},
|
|
|
|
|
command = 'setlocal shiftwidth=2 softtabstop=2',
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
-- formatting programs
|
|
|
|
|
vim.api.nvim_create_autocmd({'FileType'},
|
|
|
|
|
{pattern = {'c'},
|
|
|
|
|
command = 'setlocal formatprg=astyle --mode=c --style=ansi',
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
vim.api.nvim_create_autocmd({'FileType'},
|
|
|
|
|
{pattern = {'c'},
|
|
|
|
|
command = 'noremap <F8> gggqG',
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
vim.api.nvim_create_autocmd({'FileType'},
|
|
|
|
|
{pattern = {'html'},
|
|
|
|
|
command = 'noremap <F8> :silent %!tidy -q -i --show-errors 0 <CR>',
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
vim.api.nvim_create_autocmd({'FileType'},
|
|
|
|
|
{pattern = {'java'},
|
|
|
|
|
command = 'setlocal formatprg=astyle --indent=spaces=2 --style=google',
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
vim.api.nvim_create_autocmd({'FileType'},
|
|
|
|
|
{pattern = {'java'},
|
|
|
|
|
command = 'noremap <F8> gggqG',
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
vim.api.nvim_create_autocmd({'FileType'},
|
|
|
|
|
{pattern = {'markdown'},
|
|
|
|
|
command = 'noremap <F8> :silent %!prettier --stdin-filepath % <CR>',
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
vim.api.nvim_create_autocmd({'FileType'},
|
|
|
|
|
{pattern = {'nim'},
|
|
|
|
|
command = 'noremap <F8> :silent !nimpretty %<CR>',
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
vim.api.nvim_create_autocmd({'FileType'},
|
|
|
|
|
{pattern = {'nim'},
|
|
|
|
|
command = 'noremap <F8> gggqG',
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
vim.api.nvim_create_autocmd({'FileType'},
|
|
|
|
|
{pattern = {'python'},
|
|
|
|
|
command = 'setlocal formatprg=autopep8 "%"',
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
vim.api.nvim_create_autocmd({'FileType'},
|
|
|
|
|
{pattern = {'python'},
|
|
|
|
|
command = 'noremap <F8> gggqG',
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
vim.api.nvim_create_autocmd({'FileType'},
|
|
|
|
|
{pattern = {'tex', 'latex'},
|
|
|
|
|
command = 'setlocal formatprg=latexindent',
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
vim.api.nvim_create_autocmd({'FileType'},
|
|
|
|
|
{pattern = {'tex', 'latex'},
|
|
|
|
|
command = 'noremap <F8> gggqG',
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
-- cleanup certain files after leaving the editor
|
|
|
|
|
vim.api.nvim_create_autocmd({'VimLeave'},
|
|
|
|
|
{pattern = {'*.c'},
|
|
|
|
|