April 18, 2023

.vimrc file of a writer (not a programmer)

I use Vim as my default editor. Most of my work is done writing and editing in Markdown. Occasionally, I edit scripts or configuration files, but my main usage of Vim remains writing and editing text.

" highlight search term as I type characters /
set incsearch

" Mark folds of Markdown headers 
function! MarkdownFolds()
    let thisline = getline(v:lnum)
    if match(thisline, '^###') >= 0
        return ">3"
    elseif match(thisline, '^##') >= 0
        return ">2"
    elseif match(thisline, '^#') >= 0
        return ">1"
        return "="
setlocal foldmethod=expr
setlocal foldexpr=MarkdownFolds()

I do not use plugins.

I tried but oftentimes plugins came with more functionalities that I needed. I found that the layer of functionalities plugins were introducing was preventing me from understand and learning how Vim functions.

For instance, for a while, I used a Markdown’ plugin that modified Vim by adding a layer of modifications which someone using Markdown would want.
Many of these features were unnecessary to me though, all I wanted was to mark folds of Markdown headers automatically, that is it. Plus the plugin was overriding a native Vim command which I would have liked to use. Eventually, I removed the plugin and looked for a script which only job is to mark folds.

vim personal computing gnu linux trisquel

No affiliate links, no analytics, no tracking, no cookies. © 2016-2023 yctct.com. Content is licensed under CC BY-NC-SA 4.0 .