mirror of
https://github.com/neovim/neovim.git
synced 2024-12-19 18:55:14 -07:00
lsp: add custom syntax rules for lsp floating window
This commit is contained in:
parent
0496b572ac
commit
d49177afd9
11
runtime/ftplugin/lsp_markdown.vim
Normal file
11
runtime/ftplugin/lsp_markdown.vim
Normal file
@ -0,0 +1,11 @@
|
||||
" Vim filetype plugin
|
||||
" Language: lsp_markdown
|
||||
" Maintainer: Michael Lingelbach <m.j.lbach@gmail.com>
|
||||
" Last Change: 2021 Mar 09
|
||||
|
||||
if exists("b:did_ftplugin")
|
||||
finish
|
||||
endif
|
||||
|
||||
runtime! ftplugin/markdown.vim
|
||||
" vim:set sw=2:
|
@ -873,8 +873,11 @@ function M.fancy_floating_markdown(contents, opts)
|
||||
-- This is because the syntax command doesn't accept a target.
|
||||
local cwin = vim.api.nvim_get_current_win()
|
||||
vim.api.nvim_set_current_win(winnr)
|
||||
api.nvim_win_set_option(winnr, 'conceallevel', 2)
|
||||
api.nvim_win_set_option(winnr, 'concealcursor', 'n')
|
||||
|
||||
vim.cmd("ownsyntax markdown")
|
||||
vim.cmd("ownsyntax lsp_markdown")
|
||||
vim.cmd("set filetype=lsp_markdown")
|
||||
local idx = 1
|
||||
--@private
|
||||
local function apply_syntax_to_region(ft, start, finish)
|
||||
|
16
runtime/syntax/lsp_markdown.vim
Normal file
16
runtime/syntax/lsp_markdown.vim
Normal file
@ -0,0 +1,16 @@
|
||||
" Vim syntax file
|
||||
" Language: lsp_markdown
|
||||
" Maintainer: Michael Lingelbach <m.j.lbach@gmail.com
|
||||
" URL: http://neovim.io
|
||||
" Remark: Uses markdown syntax file
|
||||
|
||||
runtime! syntax/markdown.vim
|
||||
|
||||
syn cluster mkdNonListItem add=mkdEscape,mkdNbsp
|
||||
syntax region mkdNonListItemBlock start=/\(\%^\(\s*\([-*+]\|\d\+\.\)\s\+\)\@!\|\n\(\_^\_$\|\s\{4,}[^]\|\t+[^\t]\)\@!\)/ end=/^\(\s*\([-*+]\|\d\+\.\)\s\+\)\@=/ contains=@mkdNonListItem
|
||||
|
||||
syntax region mkdEscape matchgroup=mkdEscape start=/\\\ze[\\\x60*{}\[\]()#+\-,.!_>~|"$%&'\/:;<=?@^ ]/ end=/.\zs/ keepend contains=mkdEscapeCh contained oneline concealends
|
||||
syntax match mkdEscapeCh /./ contained
|
||||
syntax match mkdNbsp / / conceal cchar=
|
||||
|
||||
hi def link mkdEscape special
|
Loading…
Reference in New Issue
Block a user