.config/nvim: update
parent
45e31c9118
commit
937768b0cc
|
@ -0,0 +1,4 @@
|
||||||
|
-- options ---------------------------------------------------------------------
|
||||||
|
vim.opt.tabstop = 2
|
||||||
|
vim.opt.shiftwidth = 2
|
||||||
|
vim.opt.expandtab = true
|
|
@ -2,4 +2,8 @@
|
||||||
vim.bo.tabstop = 2
|
vim.bo.tabstop = 2
|
||||||
vim.bo.shiftwidth = 2
|
vim.bo.shiftwidth = 2
|
||||||
vim.bo.expandtab = true
|
vim.bo.expandtab = true
|
||||||
vim.bo.textwidth = 72
|
|
||||||
|
-- keymaps ---------------------------------------------------------------------
|
||||||
|
local keymap_set = vim.keymap.set
|
||||||
|
keymap_set("n", "]h", "/\\_^#.*\\ze\\n\\{2}<esc>", {})
|
||||||
|
keymap_set("n", "[h", "?\\_^#.*\\ze\\n\\{2}<esc>", {})
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
-- options ---------------------------------------------------------------------
|
||||||
|
vim.opt.tabstop = 4
|
||||||
|
vim.opt.shiftwidth = 4
|
||||||
|
vim.opt.expandtab = true
|
|
@ -0,0 +1,4 @@
|
||||||
|
-- options ---------------------------------------------------------------------
|
||||||
|
vim.opt.tabstop = 2
|
||||||
|
vim.opt.shiftwidth = 2
|
||||||
|
vim.opt.expandtab = true
|
|
@ -0,0 +1,22 @@
|
||||||
|
if exists("b:current_syntax")
|
||||||
|
unlet! b:current_syntax
|
||||||
|
endif
|
||||||
|
|
||||||
|
" yaml
|
||||||
|
syntax clear markdownYamlHead
|
||||||
|
syntax region markdownYamlHead start="^-\{3}\n\S" end="\S\n\%(-\|\.\)\{3}$" keepend contains=@markdownYamlTop,@Spell
|
||||||
|
|
||||||
|
|
||||||
|
" citation
|
||||||
|
syntax match markdownPCite "\^\@<!\[[^\[\]]\{-}-\{0,1}@[[:alnum:]_][[:digit:][:lower:][:upper:]_:.#$%&\-+?<>~/]*\_.\{-}\]" contains=@markdownInline,markdownCiteKey
|
||||||
|
syn match markdownICite "@[[:alnum:]_][[:digit:][:lower:][:upper:]_:.#$%&\-+?<>~/]*\s\[.\{-1,}\]" contains=markdownCiteKey,@Spell display
|
||||||
|
syn match markdownCiteKey /\(-\=@[[:alnum:]_][[:digit:][:lower:][:upper:]_:.#$%&\-+?<>~/]*\)/ containedin=markdownPCite,markdownICite contains=@NoSpell display
|
||||||
|
|
||||||
|
hi def link markdownPCite Comment
|
||||||
|
hi def link markdownICite Comment
|
||||||
|
hi def link markdownCiteKey markdownLabel
|
||||||
|
hi def link markdownLabel Label
|
||||||
|
|
||||||
|
let b:current_syntax = "markdown"
|
||||||
|
|
||||||
|
" vim:set sw=2:
|
|
@ -87,7 +87,8 @@ local bg_c = black_c
|
||||||
local accent_c = magenta_c
|
local accent_c = magenta_c
|
||||||
local dimmed_c = blue_c
|
local dimmed_c = blue_c
|
||||||
|
|
||||||
local function set_hl(group, def) vim.api.nvim_set_hl(0, group, def) end
|
local nvim_set_hl = vim.api.nvim_set_hl
|
||||||
|
local function set_hl(group, def) nvim_set_hl(0, group, def) end
|
||||||
|
|
||||||
-- normal ----------------------------------------------------------------------
|
-- normal ----------------------------------------------------------------------
|
||||||
local normal_h = {}
|
local normal_h = {}
|
||||||
|
@ -326,5 +327,12 @@ local markdown_delimiter_h = H:new():fg(blue_c)
|
||||||
local markdown_underline_h = H:new():fg(blue_c):attr("underline")
|
local markdown_underline_h = H:new():fg(blue_c):attr("underline")
|
||||||
|
|
||||||
set_hl("markdownLabel", markdown_label_h)
|
set_hl("markdownLabel", markdown_label_h)
|
||||||
set_hl("markdownDelimiter", markdown_delimiter_h)
|
set_hl("markdownHeadingDelimiter", markdown_delimiter_h)
|
||||||
set_hl("markdownUnderlined", markdown_underline_h)
|
set_hl("markdownItalicDelimiter", markdown_delimiter_h)
|
||||||
|
set_hl("markdownBoldDelimiter", markdown_delimiter_h)
|
||||||
|
set_hl("markdownBoldItalicDelimiter", markdown_delimiter_h)
|
||||||
|
set_hl("markdownStrikeDelimiter", markdown_delimiter_h)
|
||||||
|
set_hl("markdownCodeDelimiter", markdown_delimiter_h)
|
||||||
|
|
||||||
|
set_hl("yamlBlockMappingKey", syntax_comment_h)
|
||||||
|
set_hl("yamlPlainScalar", syntax_constant_h)
|
||||||
|
|
|
@ -1,52 +1,59 @@
|
||||||
|
local opt, api, cmd = vim.opt, vim.api, vim.cmd
|
||||||
|
local fn, ui = vim.fn, vim.ui
|
||||||
|
|
||||||
|
cmd.colorscheme("basic")
|
||||||
|
|
||||||
-- options ---------------------------------------------------------------------
|
-- options ---------------------------------------------------------------------
|
||||||
-- colorscheme
|
opt.undofile = true
|
||||||
vim.cmd.colorscheme("basic")
|
opt.backup = false
|
||||||
|
opt.writebackup = false
|
||||||
|
opt.mouse = {}
|
||||||
|
opt.title = true
|
||||||
|
|
||||||
-- leader
|
opt.shortmess:append({ I = true })
|
||||||
vim.g.mapleader = " "
|
opt.number = true
|
||||||
vim.g.maplocalleader = " "
|
opt.relativenumber = true
|
||||||
vim.keymap.set({ "n", "v" }, "<space>", "<nop>", { silent = true })
|
opt.signcolumn = "number"
|
||||||
|
opt.textwidth = 80
|
||||||
|
opt.colorcolumn = "+1"
|
||||||
|
|
||||||
-- general
|
opt.showtabline = 2
|
||||||
vim.opt.undofile = true
|
opt.winbar = "%f%( %h%m%r%y%)"
|
||||||
vim.opt.backup = false
|
opt.laststatus = 3
|
||||||
vim.opt.writebackup = false
|
|
||||||
vim.opt.mouse = {}
|
|
||||||
vim.opt.title = true
|
|
||||||
|
|
||||||
-- appearance
|
local statusline_group = api.nvim_create_augroup("Statusline", {})
|
||||||
vim.opt.shortmess:append({ I = true })
|
local wordcount = fn.wordcount()
|
||||||
vim.opt.number = true
|
api.nvim_create_autocmd({ "TextChanged", "WinEnter", "BufEnter" }, {
|
||||||
vim.opt.relativenumber = true
|
group = statusline_group,
|
||||||
vim.opt.signcolumn = "number"
|
callback = function()
|
||||||
vim.opt.textwidth = 80
|
wordcount = fn.wordcount()
|
||||||
vim.opt.colorcolumn = "+1"
|
end
|
||||||
|
})
|
||||||
|
local cwd = fn.pathshorten(vim.fn.getcwd())
|
||||||
|
api.nvim_create_autocmd({ "DirChanged" }, {
|
||||||
|
group = statusline_group,
|
||||||
|
callback = function()
|
||||||
|
cwd = fn.pathshorten(vim.fn.getcwd())
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
-- tabline, winbar, statusline
|
|
||||||
vim.opt.showtabline = 2
|
|
||||||
vim.opt.winbar = "%f%( %h%m%r%y%)"
|
|
||||||
vim.opt.laststatus = 3
|
|
||||||
function _G.statusline()
|
function _G.statusline()
|
||||||
local col = vim.api.nvim_win_get_cursor(0)[2] + 1
|
|
||||||
local char = vim.api.nvim_get_current_line():sub(col, col):gsub("%%", "%%%1")
|
|
||||||
local wc = vim.fn.wordcount()
|
|
||||||
return table.concat({
|
return table.concat({
|
||||||
vim.fn.pathshorten(vim.fn.getcwd()),
|
cwd,
|
||||||
"%=",
|
" %=",
|
||||||
"<", char, "> %b ",
|
" <%b> ",
|
||||||
wc.visual_chars or wc.cursor_chars, "/", wc.chars, " ",
|
wordcount.visual_chars or wordcount.cursor_chars, "/", wordcount.chars, " ",
|
||||||
wc.visual_words or wc.cursor_words, "/", wc.words
|
wordcount.visual_words or wordcount.cursor_words, "/", wordcount.words
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
vim.opt.statusline = "%!v:lua.statusline()"
|
opt.statusline = "%!v:lua.statusline()"
|
||||||
|
|
||||||
-- behaviour
|
opt.ignorecase = true
|
||||||
vim.opt.ignorecase = true
|
opt.infercase = true
|
||||||
vim.opt.infercase = true
|
opt.smartcase = true
|
||||||
vim.opt.smartcase = true
|
opt.smartindent = true
|
||||||
vim.opt.smartindent = true
|
opt.clipboard = "unnamedplus"
|
||||||
vim.opt.clipboard = "unnamedplus"
|
opt.whichwrap = {
|
||||||
vim.opt.whichwrap = {
|
|
||||||
["b"] = true,
|
["b"] = true,
|
||||||
["s"] = true,
|
["s"] = true,
|
||||||
["h"] = true,
|
["h"] = true,
|
||||||
|
@ -57,121 +64,89 @@ vim.opt.whichwrap = {
|
||||||
["["] = true,
|
["["] = true,
|
||||||
["]"] = true
|
["]"] = true
|
||||||
}
|
}
|
||||||
vim.opt.wildoptions = { "fuzzy" }
|
opt.wildoptions = { "fuzzy" }
|
||||||
vim.opt.wildignorecase = true
|
opt.wildignorecase = true
|
||||||
|
|
||||||
-- path
|
opt.path = ".,,**"
|
||||||
vim.opt.path = ".,,**"
|
|
||||||
-- local root = vim.fs.find({ ".git" }, { upward = true })[1]
|
|
||||||
|
|
||||||
-- completion
|
opt.completeopt = {
|
||||||
vim.opt.completeopt = {
|
|
||||||
"menuone",
|
"menuone",
|
||||||
"preview",
|
"preview",
|
||||||
"noinsert",
|
|
||||||
"noselect"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
local terminal_group = api.nvim_create_augroup("Terminal", {})
|
||||||
|
api.nvim_create_autocmd({ "TermOpen" }, {
|
||||||
|
group = terminal_group,
|
||||||
|
callback = function()
|
||||||
|
local opt_l = vim.opt_local
|
||||||
|
opt_l.number = false
|
||||||
|
opt_l.relativenumber = false
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
-- keymaps ---------------------------------------------------------------------
|
-- keymaps ---------------------------------------------------------------------
|
||||||
-- clear hlsearch
|
local keymap_set = vim.keymap.set
|
||||||
vim.keymap.set( "n", "<esc>", function()
|
|
||||||
vim.cmd.nohlsearch()
|
keymap_set( "n", "<esc>", function()
|
||||||
|
cmd.nohlsearch()
|
||||||
end, { desc = "Stop the highlighting for the 'hlsearch' option" })
|
end, { desc = "Stop the highlighting for the 'hlsearch' option" })
|
||||||
|
|
||||||
-- move cursor with alt in c-mode
|
keymap_set("c", "<m-h>", "<left>", { desc = "Left in c-mode" })
|
||||||
vim.keymap.set("c", "<m-h>", "<left>", { desc = "Left" })
|
keymap_set("c", "<m-l>", "<right>", { desc = "Right in c-mode" })
|
||||||
vim.keymap.set("c", "<m-l>", "<right>", { desc = "Right" })
|
|
||||||
|
|
||||||
-- move cursor with alt in i-mode
|
keymap_set("n", "<leader>f", ":find ", { desc = ":find" })
|
||||||
vim.keymap.set("i", "<m-h>", "<left>", { desc = "Left" })
|
keymap_set("n", "<leader>b", ":buffer ", { desc = ":buffer" })
|
||||||
vim.keymap.set("i", "<m-j>", "<down>", { desc = "Down" })
|
keymap_set("n", "<leader>h", ":help ", { desc = ":help" })
|
||||||
vim.keymap.set("i", "<m-k>", "<up>", { desc = "Up" })
|
|
||||||
vim.keymap.set("i", "<m-l>", "<right>", { desc = "Right" })
|
|
||||||
|
|
||||||
-- move cursor with alt in t-mode
|
keymap_set("n", "<leader>s", function()
|
||||||
vim.keymap.set("t", "<m-h>", "<left>", { desc = "Left" })
|
|
||||||
vim.keymap.set("t", "<m-j>", "<down>", { desc = "Down" })
|
|
||||||
vim.keymap.set("t", "<m-k>", "<up>", { desc = "Up" })
|
|
||||||
vim.keymap.set("t", "<m-l>", "<right>", { desc = "Right" })
|
|
||||||
|
|
||||||
-- navigate windows
|
|
||||||
vim.keymap.set("n", "<c-h>", "<c-w>h", { desc = "Navigate window left"})
|
|
||||||
vim.keymap.set("n", "<c-j>", "<c-w>j", { desc = "Navigate window down"})
|
|
||||||
vim.keymap.set("n", "<c-k>", "<c-w>k", { desc = "Navigate window up"})
|
|
||||||
vim.keymap.set("n", "<c-l>", "<c-w>l", { desc = "Navigate window right"})
|
|
||||||
vim.keymap.set("i", "<c-h>", "<c-\\><c-n><c-w>h", { desc = "Navigate window left"})
|
|
||||||
vim.keymap.set("i", "<c-j>", "<c-\\><c-n><c-w>j", { desc = "Navigate window down"})
|
|
||||||
vim.keymap.set("i", "<c-k>", "<c-\\><c-n><c-w>k", { desc = "Navigate window up"})
|
|
||||||
vim.keymap.set("i", "<c-l>", "<c-\\><c-n><c-w>l", { desc = "Navigate window right"})
|
|
||||||
vim.keymap.set("t", "<c-h>", "<c-\\><c-n><c-w>h", { desc = "Navigate window left"})
|
|
||||||
vim.keymap.set("t", "<c-j>", "<c-\\><c-n><c-w>j", { desc = "Navigate window down"})
|
|
||||||
vim.keymap.set("t", "<c-k>", "<c-\\><c-n><c-w>k", { desc = "Navigate window up"})
|
|
||||||
vim.keymap.set("t", "<c-l>", "<c-\\><c-n><c-w>l", { desc = "Navigate window right"})
|
|
||||||
|
|
||||||
-- navigate buffer
|
|
||||||
vim.keymap.set("n", "<c-d>", "<c-d>zz")
|
|
||||||
vim.keymap.set("n", "<c-u>", "<c-u>zz")
|
|
||||||
|
|
||||||
-- cmdline history navigation
|
|
||||||
vim.keymap.set("c", "<c-p>", "<up>")
|
|
||||||
vim.keymap.set("c", "<c-n>", "<down>")
|
|
||||||
|
|
||||||
-- menus
|
|
||||||
vim.keymap.set("n", "<leader>f", ":find ", { desc = ":find" })
|
|
||||||
vim.keymap.set("n", "<leader>b", ":buffer ", { desc = ":buffer" })
|
|
||||||
vim.keymap.set("n", "<leader>h", ":help ", { desc = ":help" })
|
|
||||||
|
|
||||||
-- spell
|
|
||||||
vim.keymap.set("n", "<leader>s", function()
|
|
||||||
vim.opt_local.spell = not(vim.opt_local.spell:get())
|
vim.opt_local.spell = not(vim.opt_local.spell:get())
|
||||||
end, { desc = "Toggle spell" })
|
end, { desc = "Toggle spell" })
|
||||||
|
|
||||||
-- make
|
keymap_set("n", "<leader>m", "<cmd>make<cr>", { desc = ":make" })
|
||||||
vim.keymap.set("n", "<leader>m", "<cmd>make<cr>", { desc = ":make" })
|
|
||||||
|
|
||||||
-- buffers ---------------------------------------------------------------------
|
keymap_set("n", "<leader>d", "<cmd>enew<cr><cmd>bd #<cr>", { desc = "Delete buffer" })
|
||||||
vim.keymap.set("n", "]b", "<cmd>bnext<cr>", { desc = "Next buffer" })
|
keymap_set("n", "<leader>D", "<cmd>bd<cr>", { desc = "Delete buffer and close window" })
|
||||||
vim.keymap.set("n", "[b", "<cmd>bprev<cr>", { desc = "Previous buffer" })
|
|
||||||
vim.keymap.set("n", "<leader>d", "<cmd>enew<cr><cmd>bd #<cr>", { desc = "Delete buffer" })
|
|
||||||
vim.keymap.set("n", "<leader>D", "<cmd>bd<cr>", { desc = "Delete buffer and close window" })
|
|
||||||
|
|
||||||
-- tabs ------------------------------------------------------------------------
|
keymap_set("n", "]b", "<cmd>bnext<cr>", { desc = "Next buffer" })
|
||||||
vim.keymap.set("n", "]t", "<cmd>tabnext<cr>", { desc = "Next tab" })
|
keymap_set("n", "[b", "<cmd>bprev<cr>", { desc = "Previous buffer" })
|
||||||
vim.keymap.set("n", "[t", "<cmd>tabprevious<cr>", { desc = "Previous tab" })
|
keymap_set("n", "]t", "<cmd>tabnext<cr>", { desc = "Next tab" })
|
||||||
|
keymap_set("n", "[t", "<cmd>tabprevious<cr>", { desc = "Previous tab" })
|
||||||
|
keymap_set("n", "]q", "<cmd>cnext<cr>zz", { desc = "Next quickfix item" })
|
||||||
|
keymap_set("n", "[q", "<cmd>cprev<cr>zz", { desc = "Previous quickfix item" })
|
||||||
|
|
||||||
-- vimgrep ---------------------------------------------------------------------
|
keymap_set("n", "<leader>co", "<cmd>copen<cr>", { desc = "Open quickfix window" })
|
||||||
vim.keymap.set("n", "<leader>g", ":vimgrep / **/*<c-left><c-left>/")
|
keymap_set("n", "<leader>cc", "<cmd>cclose<cr>", { desc = "Close quickfix window" })
|
||||||
|
|
||||||
local vimgrep_group = vim.api.nvim_create_augroup("Vimgrep", {})
|
keymap_set("n", "<leader>g", function()
|
||||||
vim.api.nvim_create_autocmd("QuickfixCmdPost", {
|
local pattern
|
||||||
group = vimgrep_group,
|
ui.input({ prompt = ":vimgrep " }, function(input)
|
||||||
pattern = "vimgrep",
|
if not input then return end
|
||||||
desc = "Open quickfix window after :vimgrep",
|
if input:match("/.+/[gjf]*") then
|
||||||
command = "copen"
|
pattern = input
|
||||||
})
|
else
|
||||||
|
pattern = ("/%s/g"):format(input)
|
||||||
-- quickfix --------------------------------------------------------------------
|
end
|
||||||
vim.keymap.set("n", "co", "<cmd>copen<cr>", { desc = "Open quickfix window" })
|
end)
|
||||||
vim.keymap.set("n", "cc", "<cmd>cclose<cr>", { desc = "Close quickfix window" })
|
if not pattern then return end
|
||||||
vim.keymap.set("n", "]q", "<cmd>cnext<cr>zz", { desc = "Next quickfix item" })
|
local file
|
||||||
vim.keymap.set("n", "[q", "<cmd>cprev<cr>zz", { desc = "Previous quickfix item" })
|
ui.input({
|
||||||
|
prompt = (":vimgrep %s "):format(pattern),
|
||||||
|
default = "**/*"
|
||||||
|
}, function(input)
|
||||||
|
if not input then return end
|
||||||
|
file = input
|
||||||
|
end)
|
||||||
|
if not file then return end
|
||||||
|
cmd.vimgrep(pattern, file)
|
||||||
|
end)
|
||||||
|
|
||||||
-- netrw -----------------------------------------------------------------------
|
-- netrw -----------------------------------------------------------------------
|
||||||
vim.g.netrw_use_errorwindow = 0
|
local g = vim.g
|
||||||
vim.g.netrw_banner = 0
|
|
||||||
vim.g.netrw_bufsettings = "noma nomod nowrap ro nobl"
|
|
||||||
vim.g.netrw_fastbrowse = 0
|
|
||||||
|
|
||||||
vim.keymap.set("n", "<leader>.", "<cmd>Explore .<cr>",
|
g.netrw_use_errorwindow = 0
|
||||||
|
g.netrw_banner = 0
|
||||||
|
g.netrw_bufsettings = "noma nomod nowrap ro nobl"
|
||||||
|
g.netrw_fastbrowse = 0
|
||||||
|
|
||||||
|
keymap_set("n", "<leader>.", "<cmd>Explore .<cr>",
|
||||||
{ desc = "Explore current working directory" })
|
{ desc = "Explore current working directory" })
|
||||||
|
|
||||||
local netrw_group = vim.api.nvim_create_augroup("Netrw", {})
|
|
||||||
vim.api.nvim_create_autocmd("Filetype", {
|
|
||||||
group = netrw_group,
|
|
||||||
pattern = "netrw",
|
|
||||||
desc = "Set keymap netrw buffers",
|
|
||||||
callback = function()
|
|
||||||
vim.keymap.set("n", "<esc>", "<cmd>Rexplore<cr>",
|
|
||||||
{ buffer = true, desc = "Return to/from Explorer" })
|
|
||||||
end
|
|
||||||
})
|
|
||||||
|
|
|
@ -1,112 +0,0 @@
|
||||||
" Vim syntax file
|
|
||||||
" Language: Markdown
|
|
||||||
" Maintainer: urosm <urosm@kompot.si>
|
|
||||||
" Last Change: 2024 Feb 14
|
|
||||||
|
|
||||||
if exists("b:current_syntax")
|
|
||||||
finish
|
|
||||||
endif
|
|
||||||
|
|
||||||
syntax spell toplevel
|
|
||||||
|
|
||||||
" emphasis
|
|
||||||
syn region markdownItalic matchgroup=markdownDelimiter start=/\\\@1<!\(\_^\|\s\|[[:punct:]]\)\@<=\*\S\@=/ skip=/\(\*\*\|__\)/ end=/\*\([[:punct:]]\|\s\|\_$\)\@=/ contains=@Spell
|
|
||||||
syn region markdownItalic matchgroup=markdownDelimiter start=/\\\@1<!\(\_^\|\s\|[[:punct:]]\)\@<=_\S\@=/ skip=/\(\*\*\|__\)/ end=/\S\@1<=_\([[:punct:]]\|\s\|\_$\)\@=/ contains=@Spell
|
|
||||||
|
|
||||||
" bold
|
|
||||||
syn region markdownBold matchgroup=markdownDelimiter start=/\(\\\@<!\*\)\{2}/ end=/\(\\\@<!\*\)\{2}/ contains=@Spell
|
|
||||||
syn region markdownBold matchgroup=markdownDelimiter start=/__/ end=/__/ contains=@Spell
|
|
||||||
|
|
||||||
" bold italic
|
|
||||||
syn region markdownBoldItalic matchgroup=markdownDelimiter start=/\*\{3}\(\S[^*]*\(\*\S\|\n[^*]*\*\S\)\)\@=/ end=/\S\@<=\*\{3}/ contains=@Spell
|
|
||||||
syn region markdownBoldItalic matchgroup=markdownDelimiter start=/\(___\)\S\@=/ end=/\S\@<=___/ contains=@Spell
|
|
||||||
|
|
||||||
syn region markdownBoldInItalic matchgroup=markdownDelimiter start=/\*\*/ end=/\*\*/ contained containedin=markdownItalic contains=@Spell
|
|
||||||
syn region markdownBoldInItalic matchgroup=markdownDelimiter start=/__/ end=/__/ contained containedin=markdownItalic contains=@Spell
|
|
||||||
hi def link markdownBoldInItalic markdownBoldItalic
|
|
||||||
|
|
||||||
syn region markdownItalicInBold matchgroup=markdownDelimiter start=/\\\@1<!\(\_^\|\s\|[[:punct:]]\)\@<=\*\S\@=/ skip=/\(\*\*\|__\)/ end=/\S\@<=\*\([[:punct:]]\|\s\|\_$\)\@=/ contained containedin=markdownBold contains=@Spell
|
|
||||||
syn region markdownItalicInBold matchgroup=markdownDelimiter start=/\\\@<!\(\_^\|\s\|[[:punct:]]\)\@<=_\S\@=/ skip=/\(\*\*\|__\)/ end=/\S\@<=_\([[:punct:]]\|\s\|\_$\)\@=/ contained containedin=markdownBold contains=@Spell
|
|
||||||
hi def link markdownItalicInBold markdownBoldItalic
|
|
||||||
|
|
||||||
" link
|
|
||||||
syn match markdownLink /!\=\[\_.\{-}\](\_.\{-})/ contains=markdownLinkLabel,markdownLinkURL
|
|
||||||
syn match markdownLinkLabel /\[\zs.*\ze\]/ contained
|
|
||||||
hi def link markdownLinkLabel markdownLabel
|
|
||||||
syn match markdownLinkURL /.*(\zs.*\ze)/ contained
|
|
||||||
hi def link markdownLinkURL markdownUnderlined
|
|
||||||
|
|
||||||
" automatic link
|
|
||||||
syn match markdownAutomaticLink /<\(https\{0,1}.\{-}\|[A-Za-z0-9!#$%&'*+\-/=?^_`{|}~.]\{-}@[A-Za-z0-9\-]\{-}\.\w\{-}\)>/
|
|
||||||
hi def link markdownAutomaticLink markdownUnderlined
|
|
||||||
|
|
||||||
" wikilink
|
|
||||||
" NOTE: update to support newlines in titles
|
|
||||||
syn match markdownWikilink /\[\[.*\]\]/ contains=markdownWikilinkLabel,markdownWikilinkURL
|
|
||||||
syn match markdownWikilinkLabel /\[\[\zs.\{-}\ze|.*\]\]/ contained
|
|
||||||
hi def link markdownWikilinkLabel markdownLabel
|
|
||||||
syn match markdownWikilinkURL /\%(\[\[\||\)\zs[^|]*\ze\]\]/ contained
|
|
||||||
hi def link markdownWikilinkURL markdownUnderlined
|
|
||||||
|
|
||||||
" footnote reference
|
|
||||||
syn match markdownFootnoteReference /\[\zs\^.\{-}\ze\]/
|
|
||||||
hi def link markdownFootnoteReference markdownLabel
|
|
||||||
|
|
||||||
" reference key
|
|
||||||
syn match markdownReferenceKey /@[[:alnum:]_][[:digit:][:lower:][:upper:]_:.#$%&-+?<>~\/]*/
|
|
||||||
hi def link markdownReferenceKey markdownLabel
|
|
||||||
|
|
||||||
" html comment
|
|
||||||
syn region markdownHTMLcomment start=/<!--/ end=/-->/ keepend contains=@Spell
|
|
||||||
hi def link markdownHTMLcomment markdownComment
|
|
||||||
|
|
||||||
" yaml
|
|
||||||
syn include @YAML syntax/yaml.vim
|
|
||||||
unlet! b:current_syntax
|
|
||||||
syn region markdownYAMLHeader start=/\%(\%^\|\_^\s*\n\)\@<=\_^-\{3}\ze\n.\+/ end=/^\([-.]\)\1\{2}$/ keepend contains=@YAML containedin=TOP
|
|
||||||
|
|
||||||
" styling
|
|
||||||
hi def link markdownComment Comment
|
|
||||||
hi def link markdownConstant Constant
|
|
||||||
hi def link markdownString String
|
|
||||||
hi def link markdownCharacter Character
|
|
||||||
hi def link markdownNumber Number
|
|
||||||
hi def link markdownBoolean Boolean
|
|
||||||
hi def link markdownFloat Float
|
|
||||||
hi def link markdownIdentifier Identifier
|
|
||||||
hi def link markdownFunction Function
|
|
||||||
hi def link markdownStatement Statement
|
|
||||||
hi def link markdownConditional Conditional
|
|
||||||
hi def link markdownRepeat Repeat
|
|
||||||
hi def link markdownLabel Label
|
|
||||||
hi def link markdownOperator Operator
|
|
||||||
hi def link markdownKeyword Keyword
|
|
||||||
hi def link markdownException Exception
|
|
||||||
hi def link markdownPreProc PreProc
|
|
||||||
hi def link markdownInclude Include
|
|
||||||
hi def link markdownDefine Define
|
|
||||||
hi def link markdownMacro Macro
|
|
||||||
hi def link markdownPreCondit PreCondit
|
|
||||||
hi def link markdownType Type
|
|
||||||
hi def link markdownStorageClass StorageClass
|
|
||||||
hi def link markdownStructure Structure
|
|
||||||
hi def link markdownTypedef Typedef
|
|
||||||
hi def link markdownSpecial Special
|
|
||||||
hi def link markdownSpecialChar SpecialChar
|
|
||||||
hi def link markdownTag Tag
|
|
||||||
hi def link markdownDelimiter Delimiter
|
|
||||||
hi def link markdownSpecialComment SpecialComment
|
|
||||||
hi def link markdownDebug Debug
|
|
||||||
hi def link markdownUnderlined Underlined
|
|
||||||
hi def link markdownIgnore Ignore
|
|
||||||
hi def link markdownError Error
|
|
||||||
|
|
||||||
hi def link markdownItalic Italic
|
|
||||||
hi def link markdownBold Bold
|
|
||||||
hi def link markdownBoldItalic BoldItalic
|
|
||||||
hi def link markdownStrike Strike
|
|
||||||
hi def link markdownTitle Title
|
|
||||||
|
|
||||||
let b:current_syntax = "markdown"
|
|
||||||
|
|
||||||
" vim:set sw=2:
|
|
Loading…
Reference in New Issue