this post was submitted on 15 Jul 2023
3 points (100.0% liked)

Neovim

1726 readers
1 users here now

Neovim is a modal text editor forked off of Vim in 2014. Being modal means that you do not simply type text on screen, but the behavior and functionality of the editor changes entirely depending on the mode.

The most common and most used mode, the "normal mode" for Neovim is to essentially turn your keyboard in to hotkeys with which you can navigate and manipulate text. Several modes exist, but two other most common ones are "insert mode" where you type in text directly as if it was a traditional text editor, and "visual mode" where you select text.

Neovim seeks to enable further community participation in its development and to make drastic changes without turning it in to something that is "not Vim". Neovim also seeks to enable embedding the editor within GUI applications.

The Neovim logo by Jason Long is licensed under the Creative Commons Attribution 3.0 Unported License.

founded 3 years ago
MODERATORS
 

Hi everyone long time vim/neovim user, currently for my latex I have in ~/.config/nvim/after/ftplugin.lua the following line:

vim.opt_local.makeprg="pdflatex -output-format pdf -output-directory /tmp %"

I am now working in a latex project that has a makefile, is it possible to create something in the lines of:

if ! makefile_exists then
  vim.opt_local.makeprg="pdflatex -output-format pdf -output-directory /tmp %"
end

Ended up with this and it seems to work fine:

~/.config/nvim/after/ftplugin/tex.lua

local makefile_exists = vim.fs.find('makefile', {
  upward = true,
  stop = vim.uv.os_homedir(),
  path = vim.fs.dirname(vim.api.nvim_buf_get_name(0)),
})

if #makefile_exists == 0 then
	vim.opt_local.makeprg = "pdflatex -output-format pdf -output-directory /tmp %"
end
you are viewing a single comment's thread
view the rest of the comments
[โ€“] [email protected] 2 points 1 year ago (1 children)

what about autocmd on DirChanged or VimEnter that sets the option?

[โ€“] [email protected] 1 points 1 year ago

Thanks for the comment, but I ended up finding a solution. Added tto the main comment