diff options
author | Squibid <me@zacharyscheiman.com> | 2024-08-09 02:45:31 -0400 |
---|---|---|
committer | Squibid <me@zacharyscheiman.com> | 2024-08-09 02:45:31 -0400 |
commit | c489d393695e90d424f9ae51e35c4d42358e6a71 (patch) | |
tree | 12ea97ec4684fd82cd6b73dd127d0137b115837b /after/ftplugin/norg.lua | |
parent | ad76983d969c318e6e234bc82384b4b025d70447 (diff) | |
download | nvim-c489d393695e90d424f9ae51e35c4d42358e6a71.tar.gz nvim-c489d393695e90d424f9ae51e35c4d42358e6a71.tar.bz2 nvim-c489d393695e90d424f9ae51e35c4d42358e6a71.zip |
yes there's a bit of java in my nvim config why do you ask?
Diffstat (limited to '')
-rw-r--r-- | after/ftplugin/norg.lua | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/after/ftplugin/norg.lua b/after/ftplugin/norg.lua index 851228e..fc69be9 100644 --- a/after/ftplugin/norg.lua +++ b/after/ftplugin/norg.lua @@ -1,3 +1,28 @@ +local misc = require('core.misc') + +-- make sure norg parsers are installed before opening a norg file, currently +-- there are two parsers: norg, and norg_meta +local found = {} +found[0] = 0 -- used to store the number of elements in the table + +-- check for the parsers +misc.loopf(vim.fn.stdpath("data").."/site/pack/deps/opt/nvim-treesitter/parser", + function(file) + if string.find(file, "norg") then + found[file] = true + found[0] = found[0] + 1 + end +end, "so") + +-- if the parsers don't exist download them +if found[0] < 2 and + (not found["norg.so"] or not found["norg_meta.so"]) then + vim.cmd("Neorg sync-parsers") +end + +-- set colorcolumn in norg buffers +vim.opt_local.colorcolumn = { 80 } + +-- make text wrap at the colorcolumn automatically vim.api.nvim_set_option_value("textwidth", tonumber(vim.api.nvim_get_option_value("colorcolumn", {})), { buf = 0 }) -vim.api.nvim_win_set_option(0, 'colorcolumn', '0') |