moved ftplugins, and fixed some plugins

This commit is contained in:
Jeremie Fraeys 2024-09-15 11:21:15 -04:00
parent 3a09e91ad6
commit 8c56556c86
23 changed files with 578 additions and 244 deletions

View file

@ -1,10 +1,10 @@
-- Auto-format on save
vim.cmd [[
vim.cmd([[
augroup FormatOnSave
autocmd!
autocmd BufWritePre * lua vim.lsp.buf.format({ async = false })
augroup END
]]
]])
-- Augroup for Highlight on yank
vim.cmd([[
@ -63,30 +63,3 @@ vim.cmd([[
autocmd TermOpen * normal! G
autocmd TermOpen * tnoremap <Esc> <C-\><C-n>
]])
-- Open PDF in the background when a .tex file is opened
vim.api.nvim_create_autocmd("BufEnter", {
pattern = "*.tex",
callback = function()
-- Construct an absolute path to the PDF file
local pdf_path = vim.fn.expand('%:p:h') .. "/output/" .. vim.fn.expand('%:t:r') .. '.pdf'
if vim.fn.filereadable(pdf_path) == 1 then
-- Start Zathura asynchronously in the background with an absolute path
vim.fn.jobstart({ 'nohup', 'zathura', pdf_path, '>/dev/null', '2>&1', '&' }, { detach = true })
else
print("PDF file not found: " .. pdf_path)
end
end,
})
-- Close Zathura gracefully when leaving Neovim
vim.api.nvim_create_autocmd("VimLeavePre", {
callback = function()
-- Attempt to terminate Zathura gracefully with a grace period
vim.fn.system({ 'pkill', '-TERM', '-f', 'zathura' })
vim.defer_fn(function()
vim.fn.system({ 'pkill', '-KILL', '-f', 'zathura' })
end, 2000) -- Wait for 2 seconds before force killing if necessary
end,
})

View file

@ -6,6 +6,7 @@ local utils = require('config.utils')
vim.keymap.set({ 'n', 'v' }, '<Space>', '<Nop>', { silent = true })
-- vim.keymap.set('n', '<leader>pv', vim.cmd.Ex, { desc = "[P]roject [V]iew" })
vim.keymap.set('n', '<C-c>', '<ESC><ESC>', { silent = true })
vim.keymap.set('n', '<Esc>', '<cmd>nohlsearch<CR>', { silent = true })
-- Remap for dealing with word wrap
vim.keymap.set('n', 'k', "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true })
@ -21,8 +22,8 @@ vim.keymap.set('n', '<', '<gv', { silent = true })
vim.keymap.set('n', 'J', 'mzj`z')
vim.keymap.set('n', '<c-d>', '<C-d>zz', { desc = 'Half Page Jumping Up' })
vim.keymap.set('n', '<c-u>', '<C-u>zz', { desc = 'Half Page Jumping Down' })
vim.keymap.set('n', 'n', 'nzzzv', { silent = true })
vim.keymap.set('n', 'N', 'Nzzzv', { silent = true })
vim.keymap.set('n', 'n', 'nzzzv', { noremap = true, silent = true })
vim.keymap.set('n', 'N', 'Nzzzv', { noremap = true, silent = true })
vim.api.nvim_set_keymap('n', 'gp', '<Nop>', { noremap = true, silent = true })
vim.keymap.set('n', '<C-k>', '<cmd>cnext<CR>zz')
vim.keymap.set('n', '<C-j>', '<cmd>cprev<CR>zz')
@ -133,4 +134,3 @@ vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = 'Go to next diagnos
-- { noremap = true, silent = true, expr = false, desc = "Extract Block" })
-- vim.keymap.set({ "n" }, "<leader>rbf", [[<Esc><Cmd>lua require('refactoring').refactor('Extract Block To File')<CR>]],
-- { noremap = true, silent = true, expr = false, desc = "Extract Block To File" })

View file

@ -54,6 +54,15 @@ local opts = {
termguicolors = true,
scrolloff = 10,
pyxversion = 3,
-- Sets how neovim will display certain whitespace characters in the editor.
-- See :help 'list'
-- and :help 'listchars'
list = true,
listchars = { tab = ' ', trail = '·', nbsp = '' },
-- Preview substitutions live, as you type!
inccommand = 'split',
}
for k, v in pairs(opts) do
@ -116,12 +125,11 @@ end
opt.formatoptions = 'l'
opt.formatoptions = opt.formatoptions
- 'a' -- Auto formatting is BAD.
- 't' -- Don't auto format my code. I got linters for that.
+ 'c' -- In general, I like it when comments respect textwidth
- 'o' -- O and o, don't continue comments
+ 'r' -- But do continue when pressing enter.
+ 'n' -- Indent past the formatlistpat, not underneath it.
+ 'j' -- Auto-remove comments if possible.
- '2' -- I'm not in gradeschool anymore
- 'a' -- Auto formatting is BAD.
- 't' -- Don't auto format my code. I got linters for that.
+ 'c' -- In general, I like it when comments respect textwidth
- 'o' -- O and o, don't continue comments
+ 'r' -- But do continue when pressing enter.
+ 'n' -- Indent past the formatlistpat, not underneath it.
+ 'j' -- Auto-remove comments if possible.
- '2' -- I'm not in gradeschool anymore