mirror of
https://github.com/tiyn/dotfiles.git
synced 2025-04-19 08:17:47 +02:00
nvim: correct filetype assignments
This commit is contained in:
parent
e15c732825
commit
b3e902ed66
@ -2,13 +2,14 @@
|
|||||||
|
|
||||||
-- read files correctly
|
-- read files correctly
|
||||||
vim.filetype.add({
|
vim.filetype.add({
|
||||||
pattern = {
|
extension = {
|
||||||
['.*.lua'] = 'lua',
|
h = 'c',
|
||||||
['.*.h'] = 'c',
|
html = 'html',
|
||||||
['.*.html'] = 'html',
|
java = 'java',
|
||||||
['.*.nim'] = 'nim',
|
md = 'markdown',
|
||||||
['.*.py'] = 'python',
|
nim = 'nim',
|
||||||
['.*.tex'] = 'tex',
|
py = 'python',
|
||||||
|
tex = 'tex',
|
||||||
}})
|
}})
|
||||||
|
|
||||||
-- formatting options
|
-- formatting options
|
||||||
@ -27,67 +28,6 @@ vim.api.nvim_create_autocmd({'FileType'},
|
|||||||
command = 'setlocal shiftwidth=2 softtabstop=2',
|
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
|
-- cleanup certain files after leaving the editor
|
||||||
vim.api.nvim_create_autocmd({'VimLeave'},
|
vim.api.nvim_create_autocmd({'VimLeave'},
|
||||||
{pattern = {'*.c'},
|
{pattern = {'*.c'},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user