Movatterモバイル変換


[0]ホーム

URL:


Quick links:help overview ·quick reference ·user manual toc ·reference manual toc·faq
Go to keyword (shortcut:k)
Site search (shortcut:s)
ft_context.txt  ForVim version 9.2.  Last change: 2026 Feb 14Thisis the documentation for the ConTeXtfiletype plugin.NOTE: theplugin requires+vim9script.==============================================================================CONTENTScontext.vimft-context1. Introductionft-context-intro2. Commandsft-context-commands3. Settingsft-context-settings4. Mappingsft-context-mappings==============================================================================ft-context-introIntroductionConTeXt, similarly to LaTeX,isa macro-based typesetting system built on TeX:https://wiki.contextgarden.nethttps://wiki.contextgarden.net/Input_and_compilation/Text_editors/VimThe ConTeXtplugin providessyntax highlighting, completion and support fortypesetting ConTeXt documents. The recommended way to typeseta documentis touse:ConTeXt, which invokes themtxrunscript thatis found in $PATH.For more fine grainedcontrol over the command and its environment,context.Typeset() can be used directly (orcontext#Typeset() from legacyVim script). For instance, ifa version of ConTeXtis installed in~/context, you may definea function to useit similar to the following:import autoload 'context.vim'var os = "linux"    # Update to match your systemvar arch = "arm64"  # Update to match your systemdef MyConTeXt()  var env = {    'PATH': $'{$HOME}/context/tex/texmf-{os}-{arch}/bin:{$PATH}'  }  context.Typeset("%", env)enddefnnoremap <silent><buffer><leader>t <scriptcmd>MyConTeXt()<cr>This code shouldgo in~/.vim/after/ftplugin/context.vim.context.Typeset() acceptsa third optional argument to specifya customtypesetting command. Thatmust bea function that takesa path and returns thecommandasalist. For example:def ConTeXtCustomCommand(path: string): list<string>  return ['mtxrun', '--script', 'context', '--nonstopmode', path]enddefdef MyContext()    context.Typeset("%", v:none, ConTeXtCustomCommand)enddefLarge projects are often organizedasa root document andvarious chapterfiles. When editinga chapter file,itis convenient to invoke:ConTeXtdirectly on it, rather than having to switch to the root file.A "magic line"can be addedat the beginning of each chapter file, whichspecifies therelative path to the root file. For instance:% !TEX root = ../MyRoot.texVim searches for the magic line in the first ten lines of the current buffer:ifitis found, the document specified by that lineis typeset rather than theone in the current buffer. The root document does not have to be opened inVim.To extend completion andsyntax highlighting, you may generate supportingfiles using ConTeXt and add them to your configuration. If your configurationresides in~/.vim, you may use these commands:mkdir -p ~/.vim/syntax/sharedcd ~/.vim/syntax/sharedmtxrun --script interface --vimThe last command will create the followingsyntax files:-context-data-context.vim;-context-data-interfaces.vim;-context-data-metafun.vim;-context-data-tex.vim.If present, such files will be automatically loaded to enhancesyntaxhighlighting. The same command can be used to update thosesyntax files.ft-context-commandsCommands:ConTeXtStarta backgroundjob to typeset the document in the current buffer. Thecommand accepts an optional buffer's name, if you want to typeseta documentthatis ina different buffer.:ConTeXtLogEdit the log file corresponding to the source in the current buffer.:ConTeXtJobsStatusEcho the number of jobs currently running in the background.:ConTeXtStopJobsStop all the ConTeXt jobs currently running in the background.ft-context-settingsSettings'b:context_ignore_makefile''g:context_ignore_makefile':make can be used to (synchronously) typeseta document. Ifa Makefile existsand this optionis not set, standardmakeis used. If this optionis set,mtxrunis invoked instead, even ifa Makefile exists.g:context_ignore_makefile = 0NOTE: before using:make, ensure that the working directory of the bufferisset to the directory of the file you want to typeset. Additionally, be awarethat:make searches formtxrun in $PATH.'g:context_extra_options'Alist of additionaloptions to pass tomtxrun.g:context_extra_options = []'b:context_include''g:context_include'Dictionary of filetype/GROUP pairs for whichsyntax highlighting should beactivated between \startGROUP and \stopGROUP. The defaultis to highlight XMLbetween\startXML and\stopXML.g:context_include = {'xml': 'XML'}NOTE:Lua and MetaPost are always highlighted within the respective blocks.'g:no_context_maps'When set,do not define any mappings.g:no_context_maps = 0ft-context-mappingsMappingstp"reflow TeXparagraph" (motion).i$"inside inline math block" (textobject selection).a$"around inline math block" (textobject selection).]][count] start of sections forward.[[[count] start of sections backward.][[count]end sections forward.[][count]end of sections backward.]}[count]end of blocks (\stop..., \setup...,\define...) forward.[{[count] begin of blocks (\start..., \setup...,\define...) backward. vim:tw=78:sw=4:ts=8:noet:ft=help:norl:

Quick links:help overview ·quick reference ·user manual toc ·reference manual toc·faq


[8]ページ先頭

©2009-2026 Movatter.jp