Check if your *.tex file is recognized as a context file and not a plaintex file. 

I’ve struggelled a lot with macvim before I got what I want.

I recommend following places learning everything in vim and many nice plugins that helps a lot.

If you want I can provide my .vimrc as an inspiration and starting point. Se below.

https://wiki.contextgarden.net/Vim

https://vim.fandom.com/wiki/Mapping_keys_in_Vim_-_Tutorial_(Part_1)

https://devhints.io/vim a cheatsheet


In the MacVim application it took some time to figure out why my *.tex files never recognizes as context files and the hardcoded solution was to comment out the following in

/Applications/MacVim.app/Contents/Resources/vim/runtime/filetype.vim

" TeX
"au BufNewFile,BufRead *.latex,*.sty,*.dtx,*.ltx,*.bbl setf tex
"au BufNewFile,BufRead *.tex call dist#ft#FTtex()

and instead adding

" ConTeXt
au BufNewFile,BufRead *.tex,*.ctx,*.mkii,*.mkiv,*.mkvi,*.mkxl,*.mklx   setf context

It works for Me who only using context as a typesetting engine.

Normally you do not need to do this but it seems that my own filetype.vim on upstart never reads.

Here is my .vimrc if you find it useful, enjoy. 

set lines=68
set columns=140
set guifont=Monaco:h16

" Install vim-plug
if empty(glob('~/.vim/autoload/plug.vim'))
  silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
    \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
  "autocmd VimEnter * PlugInstall
  "autocmd VimEnter * PlugInstall | source $MYVIMRC
endif

call plug#begin()
" Better Syntax Support
Plug 'sheerun/vim-polyglot'
" File Explorer
Plug 'scrooloose/NERDTree'
" Auto pairs for '(' '[' '{'"call plug#begin('~/.config/nvim/autoload/plugged')
Plug 'jiangmiao/auto-pairs'
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'SirVer/ultisnips'
Plug 'honza/vim-snippets'
Plug '907th/vim-auto-save'
call plug#end()

" Settings for Ultisnips
let g:UltiSnipsExpandTrigger="<tab>"
let g:UltiSnipsJumpForwardTrigger="<tab>"
let g:UltiSnipsJumpBackwardTrigger="<c-z>"

" If you want :UltiSnipsEdit to split your window.
let g:UltiSnipsEditSplit="vertical"

" set leader key
let g:mapleader = "\<Space>"
" enable AutoSave on Vim startup
let g:auto_save = 1
set number                              " Line numbers
set cmdheight=2                         " More space for displaying messages
set cursorline                          " Enable highlighting of the current line

set clipboard=unnamed

syntax enable                           " Enables syntax highlighing

let g:AutoPairsShortcutFastWrap = "<C-f>"


" Better nav for omnicomplete
" inoremap <expr> <c-j> ("\<C-n>")
" inoremap <expr> <c-k> ("\<C-p>")

" Use alt + hjkl to resize windows
nnoremap <M-j>    :resize -2<CR>
nnoremap <M-k>    :resize +2<CR>
nnoremap <M-h>    :vertical resize -2<CR>
nnoremap <M-l>    :vertical resize +2<CR>

" I hate escape more than anything else
inoremap jk <Esc>
inoremap kj <Esc>

" Easy CAPS
inoremap <c-u> <ESC>viwUi
nnoremap <c-u> viwU<Esc>

" TAB in general mode will move to text buffer
nnoremap <TAB> :bnext<CR>

" SHIFT-TAB will go back
nnoremap <S-TAB> :bprevious<CR>

" Alternate way to save
nnoremap <C-s> :w<CR>

" Alternate way to quit
nnoremap <C-Q> :wq!<CR>

" Use control-c instead of escape
nnoremap <C-c> <Esc>


" Better window navigation
nnoremap <C-h> <C-w>h
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-l> <C-w>l

nnoremap <Leader>o o<Esc>^Da
nnoremap <Leader>O O<Esc>^Da

nnoremap <F9> :NERDTreeToggle $HOME

Regards

Jan-Erik


14 dec. 2021 kl. 15:37 skrev Jeong Dal via ntg-context <ntg-context@ntg.nl>:

Dear Nicola, Jan-Erik, and John,

Although you have explained about the way out of my problem,
I am still in the problem.

I need to learn more about vim.
I’ll do more try following your advice and  the explanation in wiki.

Thank you again for your help.

Best regards,

Dalyoung

2021. 12. 14. 오전 8:56, ntg-context-request@ntg.nl 작성:

Send ntg-context mailing list submissions to
ntg-context@ntg.nl

To subscribe or unsubscribe via the World Wide Web, visit
https://mailman.ntg.nl/mailman/listinfo/ntg-context
or, via email, send a message with subject or body 'help' to
ntg-context-request@ntg.nl

You can reach the person managing the list at
ntg-context-owner@ntg.nl

When replying, please edit your Subject line so it is more specific
than "Re: Contents of ntg-context digest..."


Today's Topics:

 1. Re: how to setup path of ConTeXtLMTX for MacVim?
    (Jan-Erik Hägglöf)
 2. Re: circuitikz module seems broken (Hans Hagen)
 3. Re: TeXWorks and synctex SOLVED (Bruce Horrocks)


----------------------------------------------------------------------

Message: 1
Date: Tue, 14 Dec 2021 00:48:25 +0100
From: Jan-Erik Hägglöf <skrantajanneman@gmail.com>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: [NTG-context] how to setup path of ConTeXtLMTX for
MacVim?
Message-ID: <32566C08-2359-48DF-B24C-2AA2E3D02488@gmail.com>
Content-Type: text/plain; charset="utf-8"

let g:context_mtxrun = 'PATH=$HOME/context/context-osx-64/tex/texmf-osx-64/bin:$PATH mtxrun'

nnoremap <leader>å :ConTeXt<CR>
nnoremap <silent><buffer> <leader>ö :<c-u>call tex#preview()<cr>
nnoremap <silent><buffer> <leader>ä
  \ :<c-u>call tex#goto_texshop(expand("%:p"), line('.'), col('.'), 1, 1)<cr>

Here is my snippet from my personal context.vim file

I see that you have :! and that means that you instruct vim to execute a shell command.

Just write :ConTeXt<CR> and it should work fine

13 dec. 2021 kl. 14:30 skrev Jeong Dal via ntg-context <ntg-context@ntg.nl>:

Dear John, Nicola,

I created a file context.vim under the folder ~/.vim/after/ftplugin/ which contains

map <C-h>><Esc> :w<CR>:!ConTeXt<CR>
let g:context_mtxrun = 'PATH=$HOME/ConTeXtLM/tex/texmf-osx-64/bin:$PATH mtxrun'
let g:tex_flavor = "context"

The result is
1. using “:ConTeXt”   issued an error message:  “E492: not an editor command: ConTeXt
2. using “make” issued an error message: "No targets specified and no makefile found. …"
Pressing C-h, compiling started and succesfully ended. However, it use /usr/local/texlive/… not LMTX tex folder.

Without context.vim, “:ConTeXt" and “:make" worked fine.

I’ll do more test.

Thank you.
Best regards,

Dalyoung

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ntg.nl/pipermail/ntg-context/attachments/20211214/d4e3531d/attachment-0001.htm>

------------------------------

Message: 2
Date: Tue, 14 Dec 2021 00:54:44 +0100
From: Hans Hagen <j.hagen@xs4all.nl>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>, Aditya
Mahajan <adityam@umich.edu>
Subject: Re: [NTG-context] circuitikz module seems broken
Message-ID: <41f06234-caab-6576-aa5e-8396c8ee34db@xs4all.nl>
Content-Type: text/plain; charset="utf-8"; Format="flowed"

Hi,

This works here:

\usemodule[circuitikz]

\starttext
   \startcircuitikz
       \draw (0,2) to[I] (2,2);
   \stopcircuitikz
   \startcircuitikz
       \draw (0,2) to[I] (2,2);
   \stopcircuitikz
\stoptext

with the attached. Make sure to put it in the regular context base path
and run mtxrun --generate.

Aditya: can you check if we load enough? We really need to get rid of
all these (kind of strange) t-* modules that somehow ended up in tikz
and it's way easier and robust to occasionally add something needed to
m-tikz than to try to catch hard-to-locate-and-fix stuff in the tikz
distribution. If needed we can apply runtime patches too.

(nyw, it looks like tikz creates empty pfg files during a run but that's
probbably has a reason)

Hans

-----------------------------------------------------------------
                                         Hans Hagen | PRAGMA ADE
             Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
      tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------
-------------- next part --------------
%D \module
%D   [       file=m-tikz,
%D        version=2021.07.12,
%D          title=\CONTEXT\ Extra Modules,
%D       subtitle=TIKZ support,
%D         author=Hans Hagen,
%D           date=\currentdate,
%D      copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
%C
%C This module is part of the \CONTEXT\ macro||package and is
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.

%D A fixed variant of the t-tikz module distributed with tikz. For practical reasons
%D per 2021 we split the module for \MKIV\ and \LMTX. (Maybe some day I'll optimize
%D TIKZ a bit.)
%D
%D All these t-* modules in the tikz distribution make no sense as we can just load
%D them here which is way cleaner. There is also some mkii filename mapping going on
%D that is not needed on todays systems (windows has no 8.3 limitation and on unix
%D tds finally adopted a case insensitive approach.)

%D Just in case someone does a hard input ...

\ifdefined\pgfdefined    \endinput \fi
\ifdefined\pgfcoredefined\endinput \fi

%D ... but normally we end up here:

\startmodule[tikz]

\ifdefined\pdflastxpos \else
  \unprotect
      \frozen\overloaded\protected\def\pdflastxpos{\numexpr\clf_lastxpos\relax}
      \frozen\overloaded\protected\def\pdflastypos{\numexpr\clf_lastypos\relax}
  \protect
\fi

\permanent\protected\def\starttikzinput
{\pushoverloadmode
 \pushcatcodetable
 \setcatcodetable\texcatcodes
 \catcode`\@=11
 \catcode`\|=12
 \catcode`\!=12
 \autoparagraphmode\zerocount}

\permanent\protected\def\stoptikzinput
{\autoparagraphmode\plusone
 \popcatcodetable
 \popoverloadmode}

\permanent\protected\def\tikzinputfile#1%
{\starttikzinput
 \input{#1}\relax
 \stoptikzinput}

\permanent\protected\def\tikzerrormessage#1#2#3%
{\writestatus{#1}{#2}}

% For now we need this but we need to educate the user to wrap settings in the
% wrappers. So some day the next line will go. I need to check what commands are
% possible outside a picture.

\overloadmode\zerocount

\permanent\protected\def\starttikzsettings
{\pushoverloadmode
 \autoparagraphmode\zerocount}

\permanent\protected\def\stoptikzsettings
{\autoparagraphmode\plusone
 \popoverloadmode}

\permanent\protected\def\starttikzpicture
{\dontleavehmode
 \hcontainer\bgroup
 \autoparagraphmode\zerocount
% \pushoverloadmode
 \ifdefined\PackageError\else \let\PackageError\tikzerrormessage \fi
 \tikzpicture}

\permanent\protected\def\stoptikzpicture
{\endtikzpicture
% \popoverloadmode
 \egroup}

\let\pgfdefined    \relax
\let\pgfcoredefined\relax

\tikzinputfile{pgfutil-common.tex}
\tikzinputfile{pgfutil-context.def}
\tikzinputfile{pgfrcs.code.tex}
\tikzinputfile{pgfsys.code.tex}
\tikzinputfile{pgfkeys.code.tex}
\tikzinputfile{pgfsyssoftpath.code.tex}
\tikzinputfile{pgfsysprotocol.code.tex}
\tikzinputfile{pgfcore.code.tex}
\tikzinputfile{pgffor.code.tex}
\tikzinputfile{pgfmoduleplot.code.tex}
\tikzinputfile{tikz.code.tex}

\let\startpgfpicture             \pgfpicture              \let\stoppgfpicture            \endpgfpicture
\let\startpgfscope               \pgfscope                \let\stoppgfscope              \endpgfscope
\let\startpgflowlevelscope       \pgflowlevelscope        \let\stoppgflowlevelscope      \endpgflowlevelscope
\let\startpgfinterruptpath       \pgfinterruptpath        \let\stoppgfinterruptpath      \endpgfinterruptpath
\let\startpgfinterruptpicture    \pgfinterruptpicture     \let\stoppgfinterruptpicture   \endpgfinterruptpicture
\let\startpgfinterruptboundingbox\pgfinterruptboundinbox  \let\stoppgfinterruptboudingbox\endpgfinterruptboundingbox

\let\normalusepgfmodule\usepgfmodule
\let\normalusepgflibrary\usepgflibrary

\tolerant\protected\def\usepgfmodule[#1]#;#2% somehow both variants are used
{\starttikzinput
 \normalusepgfmodule[#1#2]%
 \stoptikzinput}

\tolerant\protected\def\usepgflibrary[#1]#;#2% somehow both variants are used
{\starttikzinput
 \normalusepgflibrary[#1#2]%
 \stoptikzinput}

\usepgfmodule[shapes]
\usepgfmodule[plot]
\usepgfmodule[matrix]
\usepgfmodule[decorations]

\stopmodule
-------------- next part --------------
%D \module
%D   [       file=m-circuitikz,
%D        version=2021.12.03,
%D          title=\CONTEXT\ Extra Modules,
%D       subtitle=CURCUITIKZ support,
%D         author=Hans Hagen,
%D           date=\currentdate,
%D      copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
%C
%C This module is part of the \CONTEXT\ macro||package and is
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.

%D A fixed variant of the t-curcuitikz module distributed with tikz. This one
%D is for \LMTX.

\usemodule[m][tikz]

\startmodule[circuitikz]

\def\pgfcircversion     {1.4.4}
\def\pgfcircversiondate {2021/10/31}

\usetikzlibrary[calc]
\usetikzlibrary[arrows.meta]
\usetikzlibrary[bending]
\usetikzlibrary[fpu] % may be needed for use fpu reciprocal (v1.0.1)

\tikzinputfile{pgfcirc.defines.tex}
\tikzinputfile{pgfcircutils.tex}
\tikzinputfile{pgfcircpath.tex}

\tikzinputfile{pgfcircshapes.tex}
\tikzinputfile{pgfcircmonopoles.tex}
\tikzinputfile{pgfcircbipoles.tex}
\tikzinputfile{pgfcirctripoles.tex}
\tikzinputfile{pgfcircquadpoles.tex}
\tikzinputfile{pgfcircmultipoles.tex}

\tikzinputfile{pgfcirclabel.tex}
\tikzinputfile{pgfcircvoltage.tex}
\tikzinputfile{pgfcirccurrent.tex}
\tikzinputfile{pgfcircflow.tex}

% defaults

\setupmodule
[current=european,
 voltage=european,
 resistor=american,
 inductor=cute,
 logic=american,
 siunitx=true,
 arrowmos=false]

% can be done nicer ... todo

\processaction
[\currentmoduleparameter{voltage}]
[european=>\ctikzset{voltage=european},
 american=>\ctikzset{voltage=american}]

\processaction
[\currentmoduleparameter{current}]
[european=>\ctikzset{ current=european},
 american=>\ctikzset{ current=american}]

\processaction
[\currentmoduleparameter{label}]
[straight=>\ctikzset{label/align = straight},
 align=>\ctikzset{label/align = rotate},
 smart=>\ctikzset{label/align = smart}]

\processaction
[\currentmoduleparameter{resistor}]
[european=>\ctikzset{ resistor=european},
 american=>\ctikzset{ resistor=american}]

\processaction
[\currentmoduleparameter{inductor}]
[european=>\ctikzset{ inductor=european},
 american=>\ctikzset{ inductor=american},
 cute=>\ctikzset{ inductor=cute}]

\processaction
[\currentmoduleparameter{diode}]
[full=>\ctikzset{ diode=full},
 empty=>\ctikzset{ diode=empty}]

\processaction
[\currentmoduleparameter{logic}]
[european=>\ctikzset{ logic ports=european},
 american=>\ctikzset{ logic ports=american}]

% hm, we have units built in and in mkii one can load the units module
% ... always been so ...

\processaction
[\currentmoduleparameter{siunitx}]
[true=>\def\SI    #1#2{#1\,#2}
       \def\ampere    {\rm{A}}
       \def\volt      {\rm{V}}
       \def\ohm       {\Omega}
       \def\siemens   {\rm{S}}
       \def\farad     {\rm{F}}
       \def\henry     {\rm{H}}
       \def\second    {\rm{s}}
       \def\coulomb   {\rm{C}}
       \def\siemens   {\rm{S}}
       \def\radians   {\rm{rad}}
       \def\milli     {\rm{m}}
       \def\micro     {\mu}
       \def\nano      {\rm{n}}
       \def\pico      {\rm{p}}
       \def\kilo      {\rm{k}}
       \def\mega      {\rm{M}}
       \def\giga      {\rm{G}}
       \def\tera      {\rm{T}}]

\unprotect

\processaction
[\currentmoduleparameter{arrowmos}]
[true=>\pgf@circuit@mos@arrowstrue,
 false=>\pgf@circuit@mos@arrowsfalse]

\protect

\ctikzset{tripoles/op amp/font/.initial=\switchtobodyfont[small]}

\aliased\let\stopcircuitikz\relax

\permanent\protected\def\startcircuitikz#1\stopcircuitikz
{\starttikzpicture#1\stoptikzpicture}

\stopmodule

\endinput

------------------------------

Message: 3
Date: Mon, 13 Dec 2021 23:56:42 +0000
From: Bruce Horrocks <ntg@scorecrow.com>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: [NTG-context] TeXWorks and synctex SOLVED
Message-ID: <119632CF-08D9-4A73-922C-9C59D7EB3FD5@scorecrow.com>
Content-Type: text/plain; charset=utf-8

For those searching in future, the minimum needed to make synctex work with ConTeXt and TeXShop on macOS Monterey is:

1) Reasonably new LMTX. I have version 2021.12.10 11:41. (It might well work going back a few versions but not too far.)

2) TeXShop version 4.68

3) TeXShop -> Preferences -> Engines -> Alternate path *must* be set to your LMTX installation.
 For me on an Intel Mac that is: /Users/bruce/Applications/context-osx-64/tex/texmf-osx-64/bin

TeXShop uses this path to launch the program it needs to convert a synctex location into a file name
and line number. If this path is wrong then the editor just does nothing.

4) These two lines at the top of each source file you want to sync to/from:

% !TEX useAlternatePath
% !TEX useConTeXtSyncParser

5) Either --synctex="1" on the command line in the .engine file or \setupsynctex [state=start, method=max]
somewhere in your source (which can be in the current file or in an environment file).

6) Most times you will need to quit and restart TeXShop when you change any of the above.


You *do not* need:

1) You do not need the "ConTeXt2021.engine" file: you can use your own engine file as long as it invokes your local LMTX. So, for me, the two key commands in the .engine file are:

set path=(/Users/bruce/Applications/context-osx-64/tex/texmf-osx-64/bin $path /Library/TeX/texbin /usr/texbin /usr/local/bin)
mtxrun --script context --autogenerate "$1"

2) You do not need the following magic line:

% !TEX TS-program = ConTeXt2021

If you do include it then it will override the engine you select from the drop down.


Hopefully this answer will help others with this problem:- at least until the version of ConTeXt shipped with TexShop is new enough to support the new synctex and then there won't be any need to configure anything.


On 13 Dec 2021, at 09:45, Bruce Horrocks via ntg-context <ntg-context@ntg.nl> wrote:

I'm having trouble getting the new synctex to work on a Mac. I've completely re-installed MacTeX and TeXWorks and synctex works fine for LaTeX documents. But for ConTeXt no combination of magic lines etc will work for me. The symptoms are... nothing - no errors but no synching, either way.

Q1: is there a log file created somewhere or a debugging flag that can be turned on which will tell me what is happening when I try to jump from PDF to editor or vice versa?

Q2: Is this the same error as reported at the bottom of https://wiki.contextgarden.net/SyncTeX ? Or has that been fixed?

PS: \enabletrackers[system.synctex.visualize] works as expected - i.e. the .synctex file seems to be correct.


Bruce Horrocks
Hampshire, UK



------------------------------

Subject: Digest Footer

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


------------------------------

End of ntg-context Digest, Vol 210, Issue 34
********************************************

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________