<?xml version="1.0"?>
<rss version="2.0">
  <channel>
    <title><![CDATA[LinLog]]></title>
    <link>https://linlog.skepticats.com/</link>
    <description><![CDATA[Linux, Programming, and Computing in General]]></description>
    <lastBuildDate>2026-03-01T13:58:28+00:00</lastBuildDate>
    <managingEditor>pageer@skepticats.com (Peter Geer)</managingEditor>
    <language>en-US</language>
    <generator>https://lnblog.skepticats.com/?v=2.3.1</generator>
    <item>
      <title><![CDATA[Disabling the terminal in vim-ps1]]></title>
      <link>https://linlog.skepticats.com/entries/2026/03/disabling-the-terminal-in-vim-ps1.php</link>
      <description><![CDATA[<p>This is another one of those "note to myself because I can never remember this" posts.&nbsp;</p>
<p>For quite a while, I've been using the <a href="https://github.com/PProvost/vim-ps1">vim-ps1</a> plugin for Powershell syntax highlighting.&nbsp; It's generally fine, but I have one annoyance with it: When I open a Powershell file, the plugin opens a horizontal split with a Powershell terminal in it.&nbsp; That's...fine, but most of the time I don't want that.&nbsp; And the documentation doesn't say anything about it.</p>
<p>Well, fortunately there's a <a href="https://github.com/PProvost/vim-ps1/issues/45#issuecomment-611047850">resolved Github issue</a> with the answer.&nbsp; Turns out the issue isn't actually with vim-ps1, it's with <a href="https://github.com/coc-extensions/coc-powershell">coc-powershell</a>, which actually does mention this issue in the docs.&nbsp; Why the language server is popping up a terminal window isn't clear to me, but the solution is to add this to your coc-settings.json file:<br /><code>"powershell.integratedConsole.showOnStartup": false</code></p>
<p>Easy fix!&nbsp; Unfortunately, I can't check that into my vim-config Git repo because I have my Intelephense license key in that file, so I need to document it someplace else.&nbsp; Hence this post.</p>
<p>As an aside, before scouring the web for that answer, I tried asking Claude.&nbsp; That didn't go well.&nbsp; It's first answer was to "look at your Vim config" or try disabling plugins, which was not even remotely useful.&nbsp; When I pointed that I knew there was a setting for this, it asked me where I saw it.&nbsp; If I remembered that, I wouldn't need to ask the AI!&nbsp; At that point, I decided it was easier to do this the old-fashioned way and ended up checking the Github issues and found the solution in a couple of minutes.</p>
<p>Things like that make me appreciate William Bernstein's comments in his <a href="https://www.youtube.com/live/rrU5Qp_yOig?si=W2VdxBMMw3wQOs2N">interview with Rob Berger</a>.&nbsp; When asked about using AI in his writing and research, he said that AI is extremely useful, but it's kind of like having a very dumb graduate assistant.&nbsp; That seems about right to me.&nbsp; Even a dumb grad student is still smart enough to get into grad school, so they're capable of doing some very helpful work, but they still have some significant limitations.</p>]]></description>
      <author><![CDATA[pageer@skepticats.com (Peter Geer)]]></author>
      <pubDate>Sun, 01 Mar 2026 13:58:24 +0000</pubDate>
      <category><![CDATA[Note to Self]]></category>
      <category><![CDATA[PowerShell]]></category>
      <category><![CDATA[Vim]]></category>
      <category><![CDATA[AI]]></category>
      <guid isPermalink="true">https://linlog.skepticats.com/entries/2026/03/disabling-the-terminal-in-vim-ps1.php</guid>
      <comments>https://linlog.skepticats.com/entries/2026/03/01_0858/comments/</comments>
    </item>
    <item>
      <title><![CDATA[Vim macro recording is really nice]]></title>
      <link>https://linlog.skepticats.com/entries/2023/01/vim-macro-recording-is-really-nice.php</link>
      <description><![CDATA[<p>This is probably a big "duh" for anyone who's used it before, but Vim's macro recording is pretty handy.&nbsp; It's one of those things I've been vaguely aware of for a long time, but never actually used before.&nbsp; Until now, I really only ever recorded a macro by accident.</p>
<p>But the other night I was playing around with my <a href="https://github.com/pageer/myfinemu">attempt to learn Go by writing a NES emulator</a>.&nbsp; I'm working from a demo of <a href="https://bugzmanov.github.io/nes_ebook/">writing one in Rust</a>, which recommends having highly comprehensive unit tests, so that's what I'm trying to do.&nbsp; The problem I'm running into is that this results in lots of repetitive test cases.&nbsp; The individual test cases are short, usually six to ten lines, and take the form of a struct defining the processor state and expectations.&nbsp; The thing is, there are a <em>lot</em> of them.&nbsp; By that, I mean that so far I've implemented 20 of around 150 opcodes and my unit test file is already pushing 1000 lines, compared to about 250 lines of production code.</p>
<p>Now, a 4:1 test to prod ratio isn't necessarily a&nbsp;<em>bad</em> thing, but it does seem a little high.&nbsp; And the tests are all <em>very</em> similar, so they're kind of hard to read and navigate - unless you know the exact term to search for, they all just blend together.&nbsp; So I really wanted to condense them down, preferably to one line per test case.&nbsp; So I finally decided to make a few functions to extract the common stuff into a template so that I can condense all those structs down into one-liners.&nbsp; Great!&nbsp; But I already have 1000 lines of code to update.&nbsp; Not so great.</p>
<p>Enter the Vim macro reorder.&nbsp; For each opcode, a wrote a function to create the test template.&nbsp; Now I had to take the existing structs and convert those into function calls.&nbsp; Unfortunately, this was too complex for a simple substitution and it was just too tedious to do that many by hand.&nbsp; However, the exact same series of steps could be repeated for each test case, so I decided to look up that macro recorder that I've been accidentally turning on for years.</p>
<p>Turns out it's super simple.&nbsp; You just start recording by using "q" with a register name (e.g. "qa") in command mode, do a bunch of stuff, and then run "q" again to stop.&nbsp; Then you can execute the macro with "@" and the name, e.g. "@a" and repeat that with "@@".&nbsp; By itself, this is not terribly remarkable.&nbsp; But with Vim movements and actions, it's really easy to make a macro that performs a complex manipulation on structurally identical blocks of text.&nbsp; So I was literally able to start recording, just do the manipulation like I normally would, and then stop recording, leaving me with a macro that works perfectly with basically zero extra work.</p>
<p>Like I said, nothing really new or ground-breaking here.&nbsp; Just discovering one of those handy features that I've never really used before.&nbsp; But now I know how to take advantage of that for future use.</p>]]></description>
      <author><![CDATA[pageer@skepticats.com (Peter Geer)]]></author>
      <pubDate>Sat, 07 Jan 2023 23:21:16 +0000</pubDate>
      <category><![CDATA[Vim]]></category>
      <category><![CDATA[Programming]]></category>
      <guid isPermalink="true">https://linlog.skepticats.com/entries/2023/01/vim-macro-recording-is-really-nice.php</guid>
      <comments>https://linlog.skepticats.com/entries/2023/01/07_1821/comments/</comments>
    </item>
    <item>
      <title><![CDATA[Non-standard project setup with CoC and Pyright]]></title>
      <link>https://linlog.skepticats.com/entries/2021/12/non-standard-project-setup-with-coc-and-pyright.php</link>
      <description><![CDATA[<p>Here's a quick little thing that I'll probably need to remember and might be useful to other.</p>
<p>At work, we have a PHP project that has automated integration tests written in Python.&nbsp; The top-level directory of the Git repo is the normal PHP stuff, but the&nbsp;<code>tests/integration/</code> directory is a Python sub-project that uses Poetry and Pytest.</p>
<p>Now, I use Vim as my editor and CoC with Intelliphense and Pyright for my PHp and Pythong language servers.&nbsp; Since the main repo is PHP, Intelliphense works just fine.&nbsp; Hwoever, Pyright needs a little help.&nbsp; In particular, it didn't find the third-party dependencies&nbsp;<em>or</em> the integration test framework packages because it didn't know where to look.</p>
<p>Fortunately, this is easily fixed by creating a&nbsp;<code>pyrightconfig.json</code> file.&nbsp; I was able to create one of those in the top-level directory of the project and add an "execution environment" to tell Pyright where to find the root of the Python project.&nbsp; I set it to the "tests" directory because, while the main dir is <code>tests/integration/</code>,&nbsp; that directory is also a Python module, so using "tests" lets Pyright find the "integration" module.</p>
<p>My particular file looks like this:</p>
<p><code>{<br />&nbsp; &nbsp; "venvPath": "tests/integration",<br />&nbsp; &nbsp; "venv": ".venv",<br />&nbsp; &nbsp; "executionEnvironments": [<br />&nbsp; &nbsp; &nbsp; &nbsp; {<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "root": "tests<br />&nbsp; &nbsp; &nbsp; &nbsp; }<br />&nbsp; &nbsp; ]<br />}</code><code></code><code></code></p>]]></description>
      <author><![CDATA[pageer@skepticats.com (Peter Geer)]]></author>
      <pubDate>Sat, 11 Dec 2021 23:20:15 +0000</pubDate>
      <category><![CDATA[Python]]></category>
      <category><![CDATA[Vim]]></category>
      <category><![CDATA[Programming]]></category>
      <category><![CDATA[Note to Self]]></category>
      <guid isPermalink="true">https://linlog.skepticats.com/entries/2021/12/non-standard-project-setup-with-coc-and-pyright.php</guid>
      <comments>https://linlog.skepticats.com/entries/2021/12/11_1820/comments/</comments>
    </item>
    <item>
      <title><![CDATA[CoC for Vim]]></title>
      <link>https://linlog.skepticats.com/entries/2021/08/coc-for-vim.php</link>
      <description><![CDATA[<p>A few weeks ago, I was looking into Typescript a bit.&nbsp; I've heard lots of good things about it, but never had a chance to play with it.&nbsp; However, I got tasked with some updates to my company's portal site.&nbsp; (While not technically my team's responsibility, the portal team was swamped, so I agreed to make the required updates to support a&nbsp; back-end feature my team added.)&nbsp; And, of course, the portal team uses Typescript.</p>
<p>Naturally, most of the editing recommendations for Typescript are focused on Visual Studio Code.&nbsp; But I like Vim, so I did a quick search and found <a href="https://pragmaticpineapple.com/ultimate-vim-typescript-setup/">this article</a>, which led me to CoC (which I choose to pronounce "coke", like the soda), which stands for the slightly ungrammatical "Conquer of Completion".&nbsp; It's a plugin for NeoVim and Vim that essentially does Intellisense (code completion, context popups, etc.) using language servers.</p>
<p><img style="display: block; margin-left: auto; margin-right: auto;" src="https://linlog.skepticats.com/entries/2021/08/14_1821/html-completion.png" alt="" width="800" /></p>
<p>If you're not familiar, the <a href="https://langserver.org">Language Server Protocol</a> (abbreviated LSP, though that always makes me think of the <a href="https://reflectoring.io/lsp-explained/">Liskov Substitution Principle</a>) was developed by Microsoft for VS Code.&nbsp; It's essentially a way to make Intellisense work without the editor having to implement support for each language.&nbsp; It does this by defining a protocol that "clients" like an editor can use to communicate with a "language server".&nbsp; The language server is a stand-alone program that can provide code intelligence for a particular language, but is not directly tied to any particular editor.&nbsp; The server can then be called by any client that implements the protocol, which means that the editor itself doesn't actually have to know anything about the language to implement advanced editing features - which is <em>huge</em>.</p>
<p><img style="display: block; margin-left: auto; margin-right: auto;" src="https://linlog.skepticats.com/entries/2021/08/14_1821/php-completion.png" alt="" width="800" /></p>
<p>Anyway, CoC is an LSP client for Vim.&nbsp; And I have to say,&nbsp;<em>it's awesome</em>!&nbsp; I've messed with a few code completion and LSP plugins in the past, but I never really got them to work right.&nbsp; They were either difficult to configure, or required Vim to be built with particular non-standard options.&nbsp; But CoC was dead-simple to set up.&nbsp; The only catch is that you have to install the language servers separately, but it turns out that's super-simple as well.&nbsp; (The ones I've used so far can all be installed through NPM.)</p>
<p><img style="display: block; margin-left: auto; margin-right: auto;" src="https://linlog.skepticats.com/entries/2021/08/14_1821/strpos-info.png" alt="" width="800" /></p>
<p>I'm still getting used to it, but having CoC is a game changer for Vim.&nbsp; I'd given up on having this level of intelligence in my editor.&nbsp; I mean, for something that supports as many languages as Vim, building it the old-fashioned way just isn't feasible.&nbsp; But when you can use the same language servers as more modern editors to do the heavy lifting, suddenly it's no longer crazy.</p>
<p>The next step is to look into the available commands and customizations for CoC and see what I can come up with to optimize my experience.&nbsp; So far it's a pretty cool tool and it definitely makes the development experience nicer.&nbsp; I want to see what else I can do with it.</p>
<p>&nbsp;</p>]]></description>
      <author><![CDATA[pageer@skepticats.com (Peter Geer)]]></author>
      <pubDate>Sat, 14 Aug 2021 22:21:37 +0000</pubDate>
      <category><![CDATA[Vim]]></category>
      <category><![CDATA[Software]]></category>
      <category><![CDATA[Programming]]></category>
      <category><![CDATA[Tools]]></category>
      <guid isPermalink="true">https://linlog.skepticats.com/entries/2021/08/coc-for-vim.php</guid>
      <comments>https://linlog.skepticats.com/entries/2021/08/14_1821/comments/</comments>
    </item>
    <item>
      <title><![CDATA[Docblocks in Vim]]></title>
      <link>https://linlog.skepticats.com/entries/2021/07/docblocks-in-vim.php</link>
      <description><![CDATA[<p>As you may or may not know, I've become an avid Vim user.&nbsp; I use it for work and home, having given up on PHPStorm a couple of years ago.</p>
<p>But one of the things that PHPStorm did automatically, which was quite handy, was to add PHPDoc comments to functions automatically.&nbsp; This is kinda nice because, let's face it, unless you're writing a long description, most of a docblock is just typing.&nbsp; You duplicate the parameters and return signature and, if the names and types are pretty obvious (which they should be), then there's not really much to say.&nbsp; But having them is part of the coding standard, so you can't just skip them, even though they don't add much.</p>
<p>Fortunately, Vim has a plugin for that, known as PDV.&nbsp; It will read the declaration of a function (or class, or a few other things) and auto-generate a docblock for you.&nbsp; This is nice, but the extension was a little out of date - it hadn't been updated to support return type annotations.&nbsp; There was a pending pull request to add that, but it hadn't been merged.&nbsp; I'm not sure why - apparently that repo is dead.</p>
<p>So I decided to just <a href="https://github.com/pageer/pdv">create my own fork</a> and merge the outstanding pull requests.&nbsp; Now I have a version that supports modern type annotations, which is nice.&nbsp; While I was at it, I also added an alternative set of templates for <a href="https://www.naturaldocs.org">NaturalDocs</a> doc comments.&nbsp; I use NaturalDocs for <a href="https://lnblog.skepticats.com/">LnBlog</a>, so I figured it would be nice to be able to auto-generate my docblocks there too.&nbsp; All I needed to do as add a line to my <a href="https://github.com/joonty/vim-sauce">Sauce</a> config to change the PDV template path.</p>]]></description>
      <author><![CDATA[pageer@skepticats.com (Peter Geer)]]></author>
      <pubDate>Mon, 12 Jul 2021 01:38:40 +0000</pubDate>
      <category><![CDATA[PHP]]></category>
      <category><![CDATA[Programming]]></category>
      <category><![CDATA[Vim]]></category>
      <guid isPermalink="true">https://linlog.skepticats.com/entries/2021/07/docblocks-in-vim.php</guid>
      <comments>https://linlog.skepticats.com/entries/2021/07/11_2138/comments/</comments>
    </item>
    <item>
      <title><![CDATA[Stupid Vim tricks - putting the time on the status line]]></title>
      <link>https://linlog.skepticats.com/entries/2021/06/stupid-vim-tricks-putting-the-time-on-the-status-line.php</link>
      <description><![CDATA[<p>The other week I realized that I was often moving my mouse for no reason while coding.&nbsp; Well, not <em>no</em> reason - I wanted to see what time it was.&nbsp; You see, I have Windows set to hide the taskbar because I use 13" laptops and want to maximize my vertical screen space.&nbsp; But that means that I have to hit the Windows key or move the mouse down to bring up the clock.</p>
<p>I don't have this problem when browsing the web, because Vivaldi has a setting to put a clock in the lower-right corner of the window.&nbsp;&nbsp;So I thought to myself, "Self, do you think Vim can do that same thing?"</p>
<p><img style="display: block; margin-left: auto; margin-right: auto;" src="https://linlog.skepticats.com/entries/2021/06/12_1821/vim-with-time.png" alt="" /></p>
<p>Well, it turns out it can!&nbsp; In fact, there's even <a href="https://vim.fandom.com/wiki/Display_date-and-time_on_status_line">an article on it</a>.&nbsp; Of course, that's for putting it in the plain-old status line.&nbsp; I'm using the <a href="https://github.com/vim-airline/vim-airline">airline plugin</a>, so I had to tweak it a little.&nbsp; Still, I was able to get the passable looking image above by putting the following in my .vimrc:</p>
<p><code>" Put the current date and time in the status line and keep it updated</code><br /><code>let g:airline_section_z='%p%% %#__accent_bold#%{g:airline_symbols.linenr}%l%#__restore__#%#__accent_bold#/%L%{g:airline_symbols.maxlinenr}%#__restore__#:%v %{strftime("%b %d %I:%M:%S%p")}'</code><br /><code>let status_update_timer = timer_start(1000, 'UpdateStatusBar',{'repeat':-1})</code><br /><code>function! UpdateStatusBar(timer)</code><br /><code>&nbsp; execute 'let &amp;ro = &amp;ro'</code><br /><code>endfunction</code></p>
<p>The timer update the time every second (obviously you can do longer if you want).&nbsp; That's because, otherwise, the time won't update until you&nbsp;<em>do</em> something in the editor window.&nbsp; This way it stays current, even if I'm not actively editing.</p>]]></description>
      <author><![CDATA[pageer@skepticats.com (Peter Geer)]]></author>
      <pubDate>Sat, 12 Jun 2021 22:21:10 +0000</pubDate>
      <category><![CDATA[Vim]]></category>
      <guid isPermalink="true">https://linlog.skepticats.com/entries/2021/06/stupid-vim-tricks-putting-the-time-on-the-status-line.php</guid>
      <comments>https://linlog.skepticats.com/entries/2021/06/12_1821/comments/</comments>
    </item>
    <item>
      <title><![CDATA[Vim emulation in Komodo]]></title>
      <link>https://linlog.skepticats.com/entries/2020/11/Vim_emulation_in_Komodo.php</link>
      <description><![CDATA[<p><em><strong>Authors note:</strong> Here's yet another installment of "From the Archives".&nbsp; Clearly I haven't really felt like coming up with new ideas lately.&nbsp; I blame the pandemic.&nbsp; Seriously - I'm not going to be back in the office until&nbsp;<span style="text-decoration: underline;">at least</span> next summer.&nbsp; Even though restrictions have eased (at least for the time being), lock-down fatigue has definitely long since set in.</em></p>
<p><em>At any rate, this is another one on using Komodo with Vim emulation.&nbsp; This was written on April 16, 2014, just a few days after <a href="../../entries/2020/11/Komodo_and_Vim.php">the last one on the same topic</a>.&nbsp; These days I'm using Vim all the time, so none of this is relevant to me anymore.&nbsp; However, it is a nice example of how it's possible to extend a good IDE to customize your workflow.</em></p>
<p><em>In this case Komodo is (or was) customizable using JavaScript, which is nice - lots of people know JavaScript.&nbsp; The down side is that, to do actually useful thing, you also it also used <a href="https://en.wikipedia.org/wiki/XUL">XUL</a>&nbsp;and SciMoz, the Mozilla <a href="https://www.scintilla.org">Scintilla</a> binding.&nbsp; These are less commonly known, to put it mildly.</em></p>
<p><em>To be fair, Vim isn't much better on this score.&nbsp; While it supports multiple scripting languages, the primary one is, of course, VimScript, which is...not a great language.&nbsp; However, it's also quite old, quite well documented, and there are lots of examples of how to use it.&nbsp; The VimScript API is also pretty stable, as opposed to Komodo, which was in the process of moving away from the XUL-based stuff when I stopped using it.&nbsp; And really, a little VimScript will actually take you farther than you think.</em></p>
<p><em>In any event, I guess the idea is that it's good to know how to customize your editor, at least a little.&nbsp; You know, sharpening the saw, knowing your tools, and all that.&nbsp; Good stuff.&nbsp; Enjoy!</em></p>
<hr />
<p>Since <a href="https://linlog.skepticats.com/entries/2014/03/Finally_upgraded_to_Komodo_IDE.php">upgrading to Komodo IDE</a>, I've been looking a little more at customizing my development environment.&nbsp; This is actually made somewhat easier by Komodo's "sync" feature, which will synchronize things like color schemes, key bindings, etc. between IDE instances via ActiveState's cloud.</p>
<p>Anyway, as part of this I've also been looking more at the Vim keybindings.&nbsp; I've been a casual Vim user for a very long time, but I was never hard-core enough to do things like stop using the arrow keys or give up using ctrl+C and ctrl+V for copy and paste.&nbsp; So now I'm trying to do just that.</p>
<p>Of course, Komodo's VI emulation mode is a pale imitation of what's available in Vim.&nbsp; However, even that pale imitation is actually pretty good.&nbsp; In fact, its even better than Komodo's documentation would lead you to believe.&nbsp; In addition to the basic modal editing stuff, Komodo supports a decent range of movement commands, variants of change and delete commands, etc.&nbsp; Basically, it supports everything I already knew about plus a lot more.&nbsp; So now I'm trying to get that extra stuff into my muscle memory.</p>
<p>In the course of looking at some Vim command guides, I naturally came across some handy looking commands that Komodo didn't support.&nbsp; So I'm going to try to fix that.</p>
<p>The first one is the <code>reg</code> command.&nbsp; Vim's&nbsp;<a href="http://usevim.com/2012/04/13/registers/">registers</a> were something I hadn't really worked with before, but it turns out that they're not only pretty cool, but that Komodo actually has some support for them.&nbsp; I only know this because the documentation mentions the key binding for the "set register" command.&nbsp; However, it doesn't implement the <code>reg</code> command, so you can't actually see what's in any of those registers.</p>
<p>So, long story short, I fixed that with a macro.&nbsp; Just create a new macro named "reg" in your "Vi Commands" folder in your toolbox and add the following code (this requires another macro, executed at start-up, containing the "append_to_command_output_window" function lifted from <a href="http://community.activestate.com/node/9111">here</a>):</p>
<p><code>var viCommandDetails = Components.classes['@activestate.com/koViCommandDetail;1'].</code><br /><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; getService(Components.interfaces.koIViCommandDetail);</code><br /><code>var count = new Object();</code><br /><code>var args = viCommandDetails.getArguments(count);</code><br /><br /><code>append_to_command_output_window('');</code><br /><code>append_to_command_output_window("--- Registers ---");</code><br /><br /><code>for (item in gVimController._registers) {</code><br /><code>&nbsp;&nbsp;&nbsp; if (args.length &gt; 0 &amp;&amp; args.indexOf(item) &lt; 0) {</code><br /><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; continue;</code><br /><code>&nbsp;&nbsp;&nbsp; }</code><br /><code>&nbsp;&nbsp;&nbsp; if (typeof gVimController._registers[item] !== 'undefined') {</code><br /><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; append_to_command_output_window('"' + item + '&nbsp;&nbsp; ' + gVimController._registers[item].trimRight());</code><br /><code>&nbsp;&nbsp;&nbsp; }</code><br /><code>}</code></p>
<p>This allows you to type ":reg" and get a list of the current registers in the "command output" window in the bottom pane.</p>
<p>Another good one:</p>
<p><code>var scimoz = ko.views.manager.currentView.scimoz;</code><br /><code>if (scimoz.selText.length == 0) {</code><br /><code>&nbsp;&nbsp;&nbsp; ko.commands.doCommand('cmd_vim_cancel');</code><br /><code>} else {</code><br /><code>&nbsp;&nbsp;&nbsp; ko.commands.doCommand('cmd_copy');</code><br /><code>}</code></p>
<p>This can be bound to ctrl+C and allow you to keep the default "copy text" behavior when there is text selected, and still work for Vim's "back to normal mode" when nothing is selected.</p>]]></description>
      <author><![CDATA[pageer@skepticats.com (Peter Geer)]]></author>
      <pubDate>Sat, 14 Nov 2020 23:21:36 +0000</pubDate>
      <category><![CDATA[Komodo]]></category>
      <category><![CDATA[Vim]]></category>
      <category><![CDATA[From the Archives]]></category>
      <guid isPermalink="true">https://linlog.skepticats.com/entries/2020/11/Vim_emulation_in_Komodo.php</guid>
      <comments>https://linlog.skepticats.com/entries/2020/11/14_1821/comments/</comments>
    </item>
    <item>
      <title><![CDATA[Komodo and Vim]]></title>
      <link>https://linlog.skepticats.com/entries/2020/11/Komodo_and_Vim.php</link>
      <description><![CDATA[<p><em><strong>Author's Note:</strong></em><em> We're back with another installment of "From the Archives", the blog show where I declare writing bankruptcy and just post an old, half-finished article that's been sitting in my drafts for years.&nbsp; This entry is from April 9, 2014.&nbsp; This was in the midst of my long stint as a Komodo IDE user.&nbsp;</em></p>
<p><em>One of my favorite things about Komodo was that it had pretty good Vim emulation.&nbsp; I started using that because a few years before I'd spent a lot of time going back and forth between a Windows PC and a Macbook Pro.&nbsp; The Macbook keyboard had that weird Apple layout going and it routinely messed with me, so I eventually gave up and decided to use Vim-mode because that's the same on both platforms.</em></p>
<p><em>Of course, things have changed since then.&nbsp; I've become a <a href="../../?action=tags&amp;tag=Vim">full-time Vim user</a>, and have all the fancy faux-IDE stuff set up.&nbsp; I actually like it so much that I stopped using PHPStorm for work and switched to doing all my development in Vim.&nbsp; So this post is no longer relevant to me, but it at least has a few handy links, so enjoy!</em></p>
<hr />
<p>I've been a Vim user more or less since I started using Linux. &nbsp;Mind you, I was never really a&nbsp;<em>hard core</em>&nbsp;Vim user. &nbsp;I still use the arrow keys, for instance, and manage to get by on maybe a couple dozen keybindings and commands. &nbsp;I have no clue how Vim's scripting or configuration systems work. &nbsp;All I know about ctags is that they're a thing that exists. &nbsp;So really, I'm more of a dabbler.</p>
<p>The other part of this is that I like at least a small amount of IDE in my normal working-day editor. &nbsp;I kind of like having some sort of "project view" of my files, a code hierarchy viewer, some form of Intellisense, etc. &nbsp;And while you&nbsp;<em>can</em> get most of the stuff I like in Vim, they're not there out of the box. &nbsp;And even if you can get them, you can't count on having an obvious graphical way to manipulate them. &nbsp;Typically, you just have to read the documentation to find out what the key bindings are to trigger everything.</p>
<p>So the upshot of this is that I use&nbsp;<a href="http://komodoide.com/">Komodo IDE</a>&nbsp;with the Vi emulation setting. &nbsp;This essentially turns on a Vim emulation mode that makes the editor modal and enables a lot of the standard Vim keybindings as well as a small subset of common commands. &nbsp;So I get Vim goodness with all the convenience of a full IDE. &nbsp;I had never really looked closely at just how much of Vim Komodo would emulate, though - I just knew it supported everything I commonly used.</p>
<p>Well, I had some extra time after finishing all my bug fixes the other day, and since <em>really</em> learning Vim has been on my list of things to do for, er, over 10 years, I decided to look up some&nbsp;<a href="https://vim.rtorr.com">Vim</a>&nbsp;<a href="http://www.fprintf.net/vimCheatSheet.html">reference</a>&nbsp;<a href="http://www.viemu.com/vi-vim-cheat-sheet.gif">sheets</a> and see how many of the commands and keybindings actually worked in Komodo.&nbsp; Turns out it was a pretty decent amount.&nbsp;&nbsp;<em>(Note from the future: I didn't write down the details at the time and don't care enough to catalog now that I no longer use Komodo.&nbsp; Suffice it do say that Komodo's Vi emulation was actually pretty good.&nbsp; Maybe not as good as <a href="https://github.com/JetBrains/ideavim">IdeaVim</a>, but pretty good.)</em></p>]]></description>
      <author><![CDATA[pageer@skepticats.com (Peter Geer)]]></author>
      <pubDate>Sat, 07 Nov 2020 23:20:50 +0000</pubDate>
      <category><![CDATA[Komodo]]></category>
      <category><![CDATA[Programming]]></category>
      <category><![CDATA[From the Archives]]></category>
      <category><![CDATA[Vim]]></category>
      <guid isPermalink="true">https://linlog.skepticats.com/entries/2020/11/Komodo_and_Vim.php</guid>
      <comments>https://linlog.skepticats.com/entries/2020/11/07_1820/comments/</comments>
    </item>
    <item>
      <title><![CDATA[Vim and ctags]]></title>
      <link>https://linlog.skepticats.com/entries/2020/05/Vim_and_ctags.php</link>
      <description><![CDATA[<p>Today's post is random Vim trivia, featuring ctags!</p>
<p>If you've used Vim casually or been around the UNIX world for a bit, you may have heard of ctags, but not really been sure what it was good for.&nbsp; Well, <a href="https://en.wikipedia.org/wiki/Ctags">ctags</a> is a code indexing tool.&nbsp; It scans a bunch of source code and creates an index of it.&nbsp; The goal is the same as creating a&nbsp; database index - to allow you to look up specific things quickly.</p>
<p>That's straight-forward enough, right?&nbsp; But what the heck do you do with the index once you create it?&nbsp; Well...nothing.&nbsp; At least, not directly.&nbsp; Sure, you <em>can</em> manually create and query the tag index from the command line, but you wouldn't really want to.&nbsp; Following the UNIX way, ctags is really just one part of the pipeline.&nbsp; It creates the index and it's your editor that queries it and does stuff with the result.</p>
<p>If you want to use Vim for any non-trivial development, then you really want to be using ctags.&nbsp; It provides you with a handy way to jump between definitions of classes, functions, and so forth, much like you get with Visual Studio or PHPStorm.&nbsp; It makes your life significantly easier.</p>
<p>The only problem is that there's a little setup that needs to be done.&nbsp;&nbsp;<em>Reading</em> the ctags index doesn't require anything special if you're using the default "tags" files for the index.&nbsp; However, generating that file takes a little more effort.&nbsp; You can do it manually, but really you want it to happen automatically in the background.&nbsp; Luckily, there's a plugin for that - <a href="https://bolt80.com/gutentags/">Gutentags</a>.&nbsp; This plugin will basically just update your tags file in the background at appropriate intervals.&nbsp; Although it has some options available, there's not really anything you need to configure for it - it just works out of the box.</p>
<p>Once you've got your tags file auto-updating, the next thing is to figure out how you want to browse tags.&nbsp; The workflow that works best depends on your preferences, and I can't claim to have mastered it.&nbsp; <a href="https://vim.fandom.com/wiki/Browsing_programs_with_tags">This page</a> gives a good overview of the different commands and default keybindings that are available for tag browsing.&nbsp; As with everything else in Vim, there are a lot of options available, but you can get by with just a few to start.&nbsp; Personally, I find that just&nbsp;<code>ctrl+]</code> and&nbsp;<code>:tselect</code> work for 80% of my needs, but your mileage may vary.</p>]]></description>
      <author><![CDATA[pageer@skepticats.com (Peter Geer)]]></author>
      <pubDate>Sat, 30 May 2020 22:13:04 +0000</pubDate>
      <category><![CDATA[Vim]]></category>
      <guid isPermalink="true">https://linlog.skepticats.com/entries/2020/05/Vim_and_ctags.php</guid>
      <comments>https://linlog.skepticats.com/entries/2020/05/30_1813/comments/</comments>
    </item>
    <item>
      <title><![CDATA[More Vim-as-IDE pointers]]></title>
      <link>https://linlog.skepticats.com/entries/2020/03/More_Vim-as-IDE_pointers.php</link>
      <description><![CDATA[<p>A while back I came upon this article on <a href="https://thevaluable.dev/vim-php-ide/">using Vim as a PHP IDE</a>.&nbsp; It's got some very good pointers, although the author may have gone a little over the top on trying to mimic the behavior of PHPStorm.&nbsp; I haven't tried all of those plugins, but quite a few of them are in <a href="https://github.com/pageer/vim-config">my Vim config</a>.</p>
<p>If nothing else, the article gives you a good sense for just how powerful Vim is when it comes to extending its behavior.&nbsp; It's actually pretty impressive.</p>
<p><a href="https://pragprog.com/book/tpp20/the-pragmatic-programmer-20th-anniversary-edition"><img style="float: right; margin: 5px;" src="https://linlog.skepticats.com/entries/2020/03/14_1802/tpp-small.jpg" alt="Cover art for The Pragmatic Programmer" /></a>Earlier this year,&nbsp; finally read through&nbsp;<a href="https://pragprog.com/book/tpp20/the-pragmatic-programmer-20th-anniversary-edition"><em>The Pragmatic Programmer</em></a>.&nbsp; It's been sitting on my bookshelf for...at least 15 years now.&nbsp; I'd read parts of it before, but never went through the whole thing.&nbsp; Anyway, it contains a section on choosing an editor, and one of the things they stress is extension.&nbsp; You need to be able to customize your editor to extend its functionality to suit your workflow.&nbsp; The idea is that the editor is one of your primary tools of code-craft and you need to make it truly yours.&nbsp; You need to learn to use it well and completely, to make it an extension of your hand.</p>
<p>So far I'm finding Vim to be a pretty good choice in that regard.&nbsp; Partly this is due to its raw power, but to a large extent it's also due to its age and the ecosystem around it.&nbsp; Vim is a very old tool and it's very mature and stable.&nbsp; This is a very good thing, because it means that there are lots of examples and documentation for how to use and customize it.&nbsp; If you want do do something new with Vim, there's a good change that someone already wrote a plugin to do it.&nbsp; And if not, there are plenty of plugins out there that you can use as examples.&nbsp;</p>
<p>Being mature and stable also means that things are unlikely to change out from underneath you.&nbsp; Sure, new features are still being added, but the basic functionality has been largely unchanged for a while.&nbsp; This is what you want from a good tool.&nbsp; If you're going to invest a lot of time and effort to get good at using a tool, you want that investment to retain its value.&nbsp; You don't want to spend three months every couple of years re-learning because the tool vendor decided to re-architect their product or switch to the latest trendy programming language.</p>
<p>So while Vim may be old and boring, there's something to be said for being old and boring.&nbsp; When was the last time you saw an old, boring person on <em>The Jerry Springer Show</em>?&nbsp; Doesn't happen.&nbsp; New and interesting may be exciting, but there's a reason why telling someone "<a href="https://en.wikipedia.org/wiki/May_you_live_in_interesting_times">may you live in interesting times</a>" is supposed to be a curse.</p>]]></description>
      <author><![CDATA[pageer@skepticats.com (Peter Geer)]]></author>
      <pubDate>Sat, 14 Mar 2020 22:02:46 +0000</pubDate>
      <category><![CDATA[Vim]]></category>
      <category><![CDATA[Software]]></category>
      <category><![CDATA[Tools]]></category>
      <guid isPermalink="true">https://linlog.skepticats.com/entries/2020/03/More_Vim-as-IDE_pointers.php</guid>
      <comments>https://linlog.skepticats.com/entries/2020/03/14_1802/comments/</comments>
    </item>
  </channel>
</rss>
