diff options
Diffstat (limited to 'docs/posts/2021-10-02/vim-difference-between-autocmd-bufwrite-and-bufwritepre/index.html')
| -rw-r--r-- | docs/posts/2021-10-02/vim-difference-between-autocmd-bufwrite-and-bufwritepre/index.html | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/docs/posts/2021-10-02/vim-difference-between-autocmd-bufwrite-and-bufwritepre/index.html b/docs/posts/2021-10-02/vim-difference-between-autocmd-bufwrite-and-bufwritepre/index.html index 30b03ba..91708ad 100644 --- a/docs/posts/2021-10-02/vim-difference-between-autocmd-bufwrite-and-bufwritepre/index.html +++ b/docs/posts/2021-10-02/vim-difference-between-autocmd-bufwrite-and-bufwritepre/index.html @@ -15,7 +15,7 @@ <link href="https://blog.nsfisis.dev/custom.css" rel="stylesheet"> <link rel="icon" href="https://blog.nsfisis.dev/favicon.svg"> - <meta name="generator" content="Hugo 0.88.1" /> + <meta name="generator" content="Hugo 0.102.1" /> </head> @@ -67,26 +67,26 @@ <h2 id="vim-のソースコード">vim のソースコード</h2> <p>以下は、autocmd events の名前と内部で使われている整数値とのマッピングを定義している箇所である。見ての通り、上でエイリアスではないかと述べた3組には、それぞれ同じ内部値が使われている。</p> <p><a href="https://github.com/vim/vim/blob/8e6be34338f13a6a625f19bcef82019c9adc65f2/src/autocmd.c#L85-L86">https://github.com/vim/vim/blob/8e6be34338f13a6a625f19bcef82019c9adc65f2/src/autocmd.c#L85-L86</a></p> -<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-c" data-lang="c"> {<span style="color:#e6db74">"BufAdd"</span>, EVENT_BUFADD}, - {<span style="color:#e6db74">"BufCreate"</span>, EVENT_BUFADD}, -</code></pre></div><p><a href="https://github.com/vim/vim/blob/8e6be34338f13a6a625f19bcef82019c9adc65f2/src/autocmd.c#L95-L97">https://github.com/vim/vim/blob/8e6be34338f13a6a625f19bcef82019c9adc65f2/src/autocmd.c#L95-L97</a></p> -<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-c" data-lang="c"> {<span style="color:#e6db74">"BufRead"</span>, EVENT_BUFREADPOST}, - {<span style="color:#e6db74">"BufReadCmd"</span>, EVENT_BUFREADCMD}, - {<span style="color:#e6db74">"BufReadPost"</span>, EVENT_BUFREADPOST}, -</code></pre></div><p><a href="https://github.com/vim/vim/blob/8e6be34338f13a6a625f19bcef82019c9adc65f2/src/autocmd.c#L103-L105">https://github.com/vim/vim/blob/8e6be34338f13a6a625f19bcef82019c9adc65f2/src/autocmd.c#L103-L105</a></p> -<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-c" data-lang="c"> {<span style="color:#e6db74">"BufWrite"</span>, EVENT_BUFWRITEPRE}, - {<span style="color:#e6db74">"BufWritePost"</span>, EVENT_BUFWRITEPOST}, - {<span style="color:#e6db74">"BufWritePre"</span>, EVENT_BUFWRITEPRE}, -</code></pre></div><h2 id="neovim-のソースコード">neovim のソースコード</h2> +<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-c" data-lang="c"><span style="display:flex;"><span> {<span style="color:#e6db74">"BufAdd"</span>, EVENT_BUFADD}, +</span></span><span style="display:flex;"><span> {<span style="color:#e6db74">"BufCreate"</span>, EVENT_BUFADD}, +</span></span></code></pre></div><p><a href="https://github.com/vim/vim/blob/8e6be34338f13a6a625f19bcef82019c9adc65f2/src/autocmd.c#L95-L97">https://github.com/vim/vim/blob/8e6be34338f13a6a625f19bcef82019c9adc65f2/src/autocmd.c#L95-L97</a></p> +<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-c" data-lang="c"><span style="display:flex;"><span> {<span style="color:#e6db74">"BufRead"</span>, EVENT_BUFREADPOST}, +</span></span><span style="display:flex;"><span> {<span style="color:#e6db74">"BufReadCmd"</span>, EVENT_BUFREADCMD}, +</span></span><span style="display:flex;"><span> {<span style="color:#e6db74">"BufReadPost"</span>, EVENT_BUFREADPOST}, +</span></span></code></pre></div><p><a href="https://github.com/vim/vim/blob/8e6be34338f13a6a625f19bcef82019c9adc65f2/src/autocmd.c#L103-L105">https://github.com/vim/vim/blob/8e6be34338f13a6a625f19bcef82019c9adc65f2/src/autocmd.c#L103-L105</a></p> +<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-c" data-lang="c"><span style="display:flex;"><span> {<span style="color:#e6db74">"BufWrite"</span>, EVENT_BUFWRITEPRE}, +</span></span><span style="display:flex;"><span> {<span style="color:#e6db74">"BufWritePost"</span>, EVENT_BUFWRITEPOST}, +</span></span><span style="display:flex;"><span> {<span style="color:#e6db74">"BufWritePre"</span>, EVENT_BUFWRITEPRE}, +</span></span></code></pre></div><h2 id="neovim-のソースコード">neovim のソースコード</h2> <p>neovim の場合でも同様のマッピングが定義されているが、こちらの場合は Lua で書かれている。以下にある通り、はっきり <code>aliases</code> と書かれている。</p> <p><a href="https://github.com/neovim/neovim/blob/71d4f5851f068eeb432af34850dddda8cc1c71e3/src/nvim/auevents.lua#L119-L124">https://github.com/neovim/neovim/blob/71d4f5851f068eeb432af34850dddda8cc1c71e3/src/nvim/auevents.lua#L119-L124</a></p> -<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-lua" data-lang="lua"> aliases <span style="color:#f92672">=</span> { - BufCreate <span style="color:#f92672">=</span> <span style="color:#e6db74">'BufAdd'</span>, - BufRead <span style="color:#f92672">=</span> <span style="color:#e6db74">'BufReadPost'</span>, - BufWrite <span style="color:#f92672">=</span> <span style="color:#e6db74">'BufWritePre'</span>, - FileEncoding <span style="color:#f92672">=</span> <span style="color:#e6db74">'EncodingChanged'</span>, - }, -</code></pre></div><p>ところで、上では取り上げなかった <code>FileEncoding</code> だが、これは <code>:help FileEncoding</code> にしっかりと書いてある。</p> +<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-lua" data-lang="lua"><span style="display:flex;"><span> aliases <span style="color:#f92672">=</span> { +</span></span><span style="display:flex;"><span> BufCreate <span style="color:#f92672">=</span> <span style="color:#e6db74">'BufAdd'</span>, +</span></span><span style="display:flex;"><span> BufRead <span style="color:#f92672">=</span> <span style="color:#e6db74">'BufReadPost'</span>, +</span></span><span style="display:flex;"><span> BufWrite <span style="color:#f92672">=</span> <span style="color:#e6db74">'BufWritePre'</span>, +</span></span><span style="display:flex;"><span> FileEncoding <span style="color:#f92672">=</span> <span style="color:#e6db74">'EncodingChanged'</span>, +</span></span><span style="display:flex;"><span> }, +</span></span></code></pre></div><p>ところで、上では取り上げなかった <code>FileEncoding</code> だが、これは <code>:help FileEncoding</code> にしっかりと書いてある。</p> <pre tabindex="0"><code> *FileEncoding* FileEncoding Obsolete. It still works and is equivalent to |EncodingChanged|. |
