Comments (18)
@trev-dev Just fiddling a little bit with this... you can still add a vimscript file under mkdnflow.nvim/syntax/
. I did get a little bit of concealing to work when placed there.
from mkdnflow.nvim.
Update: Actually it looks like it can be placed in lua
. If you have a file called conceal.lua
and load it in the setup function (by adding init.conceal = require('mkdnflow.conceal')
after load_on_ft[ft]
, the above conceals will load properly. They have to be wrapped in lua functions of course:
vim.api.nvim_command("call matchadd('Conceal', '\\[\\ \\]', 0, 11, {'conceal': ''})")
vim.api.nvim_command("call matchadd('Conceal', '\\[x\\]', 0, 12, {'conceal': ''})")
vim.api.nvim_command("highlight Conceal ctermbg=NONE ctermfg=NONE guibg=NONE guifg=NONE")
vim.api.nvim_win_set_option(0, 'conceallevel', 1)
from mkdnflow.nvim.
I am! Would much rather own my original offer to help out than drop it. The collaborative effort has been a really nice touch. Thanks for stepping in with me.
from mkdnflow.nvim.
Added in commit 23c22f1; currently testing in dev branch.
from mkdnflow.nvim.
I agree that the concealing that Vimwiki and others do would be nice, especially since markdown-style links can look overly long. I'll try to look into this soon and will comment again here if/when I have something to be tested.
from mkdnflow.nvim.
Thanks Jake. I would not mind taking a stab at this if you're open to it. I looked up :help conceal
right after posting this and gave myself a big eye-roll. It may be an easy first issue.
from mkdnflow.nvim.
Yeah, go for it! Organizationally, I'm not totally sure where this should go since none of the Lua scripting so far relates to visuals. For easy testing you might want to place it in init.lua and then once you've got it working create a separate module that gets loaded in init.lua if a config option is set. Whatever makes sense to you.
from mkdnflow.nvim.
Hey, apologies. I've taken a stab at this a couple of times in the last couple of weeks. Turns out grasping all the quirks of vim's syntax
system is escaping me. I'm trying to change things with Lua, nothing seems to be happening. I have written syntax with vimscript in the past and it had worked. I have dumbed down the implementation to match a simple string, it won't conceal.
I am losing confidence in my configuration/set-up or perhaps just my ability to help with this in some timely manner.
from mkdnflow.nvim.
No worries! I haven't done anything with conceal before but would like to try to figure it out. I'll share details here if I figure it out just in case it's of interest.
from mkdnflow.nvim.
It should be almost dead simple*
* provided that your syntax configuration is sound and you know your pearl regex.
Its supposed to be a simple match group:
syntax match MkdnflowHideable conceal ”foo"
set conceallevel 1 ; something larger than 0
syntax conceal on
Obviously syntax should be on
. I think my problem is I am not using the ./syntax/markdown.vim path but this is Lua...so...what now?
from mkdnflow.nvim.
I was beating my head against making it work from the lua/
folder as a configuration import in the entrypoint (init.conceal
).
from mkdnflow.nvim.
That would be nice, but yeah, I couldn't get it to work from anywhere in the lua folder. Just in case it's useful, I tried the following checkbox conceals in markdown.vim
inside a new syntax
directory (lifted from a couple of comments in https://www.reddit.com/r/vim/comments/h8pgor/til_conceal_in_vim/):
call matchadd('Conceal', '\[\ \]', 0, 11, {'conceal': ''})
call matchadd('Conceal', '\[x\]', 0, 12, {'conceal': ''})
highlight Conceal ctermbg=NONE ctermfg=NONE guibg=NONE guifg=NONE
setlocal conceallevel=1
from mkdnflow.nvim.
You nailed it.
lua/mkdnflow/conceal.lua:
local cmd = vim.cmd
local conceal = function(pattern)
cmd("call matchadd('Conceal', "..pattern..", 0, 11, {'conceal': ''})")
end
vim.bo.syntax = 'on'
vim.wo.conceallevel = 3
cmd('syntax conceal on')
conceal('"Pandas"')
local M = {}
return M
matchadd
seems to be the key here. The match "Pandas" now magically disappears until my cursor is on that line.
Would you like me to continue from here or are you on a roll?
from mkdnflow.nvim.
If you're interested, you should continue! I probably wouldn't be able to work on this for a few more days. If you get it to the point where you're relatively happy with the conceals, you can submit a PR and I can go ahead and do the configuration to enable/disable the conceals in the user config.
from mkdnflow.nvim.
@trev-dev how goes it on the conceal front?
from mkdnflow.nvim.
Apologies, and thanks for the reminder. I've moved on from using NeoVim for the time being and I lost track of this.
I took another stab at it regardless and pattern matching something like [<stuff has to be here but don't include it>](possible/path/string)
is driving me a bit nuts. I'm going to have to pass the torch back.
from mkdnflow.nvim.
No worries, thanks for the update!
from mkdnflow.nvim.
Would you look at all of that regex soup :) - Well done.
from mkdnflow.nvim.
Related Issues (20)
- Feature: Allow custom URI handler
- Bug: Anchor is lost when opening HTTP links HOT 3
- Feature: Dark-mode friendly logo HOT 2
- Feature: Trigger MkdnUpdateNumbering in numbered list after ctrl d <C-d> ctrl t <C-t>
- Bug: Links created from visual selection containing multi-byte characters are not formatted correctly HOT 4
- Bug: Can't find external file HOT 1
- neovim 0.9.4: Invalid 'event': 'BufEnter, BufWinEnter' HOT 3
- Error disabling bib module HOT 1
- Bug: `:MkdnCreateLink` doesn't work on a visual selection
- Following links does not work outside of the root_tell file HOT 3
- Error with the default "cmp" module in a fresh installation. HOT 3
- Bug: Compatibility module throws error if 'modules' key not in user config HOT 3
- Bug: When jumping to next md-style link, links to URLs containing parentheses are skipped over HOT 2
- Bug: Commit f1e968c broke link following for when you have 2 links on one line HOT 5
- Question: Change `MkdnFollowLink` to not create links
- Bug: Links to external files not working
- Any Mkdn command ends with "Error executing Lua callback:" HOT 2
- Bib-file not found (not on default path, not in root directory) HOT 1
- Relative link does not open respective to the current file
- many problems in cmp autocompletion HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mkdnflow.nvim.