1
0
mirror of https://github.com/tiyn/dotfiles.git synced 2025-04-19 16:27:45 +02:00

Compare commits

..

No commits in common. "f2f39c84e8abda0acfcabeb002e2445ab88555e0" and "b6a19ef51e2a3c63ea33b8ed336da421cdcb4683" have entirely different histories.

View File

@ -2,14 +2,13 @@
-- read files correctly -- read files correctly
vim.filetype.add({ vim.filetype.add({
extension = { pattern = {
h = 'c', ['.*.lua'] = 'lua',
html = 'html', ['.*.h'] = 'c',
java = 'java', ['.*.html'] = 'html',
md = 'markdown', ['.*.nim'] = 'nim',
nim = 'nim', ['.*.py'] = 'python',
py = 'python', ['.*.tex'] = 'tex',
tex = 'tex',
}}) }})
-- formatting options -- formatting options
@ -28,6 +27,67 @@ 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'},