]> git.wincent.com - corpus.git/log
corpus.git
9 months agochore: add .mailmap file main master
Greg Hurrell [Mon, 20 Jun 2022 09:02:18 +0000 (11:02 +0200)] 
chore: add .mailmap file

9 months agofeat: don't sign autocommits
Greg Hurrell [Mon, 20 Jun 2022 08:57:55 +0000 (10:57 +0200)] 
feat: don't sign autocommits

Seems inappropriate to do so unless it is a human being running the `git
commit` command explicitly.

20 months agorefactor: get rid of unnecessary `get_var()` function
Greg Hurrell [Fri, 16 Jul 2021 20:22:01 +0000 (22:22 +0200)] 
refactor: get rid of unnecessary `get_var()` function

20 months agodocs: fix sample config
Greg Hurrell [Fri, 16 Jul 2021 18:12:31 +0000 (20:12 +0200)] 
docs: fix sample config

Was using the wrong variable names.

20 months agofeat: support both Lua global and Vim global for CorpusDirectories
Greg Hurrell [Fri, 16 Jul 2021 18:08:14 +0000 (20:08 +0200)] 
feat: support both Lua global and Vim global for CorpusDirectories

Probably should have been this way from the start. Only really keeping
the Lua global around for backwards compatibility.

20 months agofeat: add `:Corpus!` and `g:CorpusBangCreation`
Greg Hurrell [Fri, 16 Jul 2021 17:51:23 +0000 (19:51 +0200)] 
feat: add `:Corpus!` and `g:CorpusBangCreation`

Closes: https://github.com/wincent/corpus/issues/81
21 months agochore: rename "master" → "main"
Greg Hurrell [Sat, 12 Jun 2021 17:19:03 +0000 (19:19 +0200)] 
chore: rename "master" → "main"

21 months agofix: avoid E874
Greg Hurrell [Tue, 1 Jun 2021 16:16:22 +0000 (18:16 +0200)] 
fix: avoid E874

Seeing this on recent builds, which suggests that maybe the default
regexp implementation has changed lately:

  Error detected while processing function corpus#buf_write_pre[2]..corpus#update_references
  E874: (NFA) Could not pop the stack!

As `:h NFA` explains:

                                    /\%#= two-engines NFA
    Vim includes two regexp engines:
    1. An old, backtracking engine that supports everything.
    2. A new, NFA engine that works much faster on some patterns, possibly slower
       on some patterns.

    Vim will automatically select the right engine for you.  However, if you run
    into a problem or want to specifically select one engine or the other, you can
    prepend one of the following to the pattern:

            \%#=0   Force automatic selection.  Only has an effect when
                    'regexpengine' has been set to a non-zero value.
            \%#=1   Force using the old engine.
            \%#=2   Force using the NFA engine.

    You can also use the 'regexpengine' option to change the default.

                             E864 E868 E874 E875 E876 E877 E878
    If selecting the NFA engine and it runs into something that is not implemented
    the pattern will not match.  This is only useful when debugging Vim.

2 years agofix: change default for g:CorpusPreviewWinhighlight
Greg Hurrell [Fri, 15 Jan 2021 17:06:28 +0000 (18:06 +0100)] 
fix: change default for g:CorpusPreviewWinhighlight

As suggested in:

    https://github.com/wincent/corpus/issues/75#issuecomment-728212340

because:

> Just a nit, but I'd lean toward a different default. VertSplit is
> decoration so colorschemes are not designed with the expectation it
> it will be used to render text. It seems more likely than almost any
> other syntax group to be set up with very low or no contrast between
> fg and bg.

Switched to LineNr, semi-arbitrarily (there is no guaranteed highlight
group that is going to look good with all colorschemes, but this one
should at least not look invisible).

2 years agofeat: add settings for controlling highlights
Greg Hurrell [Sun, 15 Nov 2020 17:31:50 +0000 (18:31 +0100)] 
feat: add settings for controlling highlights

Adds `g:CorpusChooserSelectionHighlight` and
`g:CorpusPreviewWinhighlight`.

Closes: https://github.com/wincent/corpus/issues/75
2 years agorefactor: use terser access method for getting options
Greg Hurrell [Tue, 13 Oct 2020 19:55:31 +0000 (21:55 +0200)] 
refactor: use terser access method for getting options

2 years agofix: update listing and preview when there are no matches
Greg Hurrell [Tue, 13 Oct 2020 19:53:04 +0000 (21:53 +0200)] 
fix: update listing and preview when there are no matches

Because otherwise the last-seen results we had continue to be shown. So
we need, at a minimum, a `vim.cmd('redraw')`, and we also need to clear
out the preview buffer.

2 years agorefactor: avoid repeated calls to preview()
Greg Hurrell [Sun, 13 Sep 2020 21:44:43 +0000 (23:44 +0200)] 
refactor: avoid repeated calls to preview()

We always calls it right after `highlight_selection()`, so let's just
fold it into that function.

2 years agoperf: avoid unnecessary redraw
Greg Hurrell [Sun, 13 Sep 2020 21:40:52 +0000 (23:40 +0200)] 
perf: avoid unnecessary redraw

Don't need to call `redraw()` before calling `preview()` because
`preview()` is going to call it anyway.

2 years agofix: handle edge cases when outside of Corpus directory
Greg Hurrell [Sun, 13 Sep 2020 16:48:43 +0000 (18:48 +0200)] 
fix: handle edge cases when outside of Corpus directory

Example:

  :Corpus <tab>

Expands to:

  :Corpus /

If you hit enter there, we don't want to blindly `cd` to "/". In fact we
never want to `cd` to anything with a slash, unless it is a valid Corpus
directory.

  :Corpus whatever else

should be taken as a cue to open or create the note "whatever else.md"
in the default corpus directory (the first one in the config).

2 years agofix: make symlink resolution work again
Greg Hurrell [Sun, 13 Sep 2020 11:06:08 +0000 (13:06 +0200)] 
fix: make symlink resolution work again

Order matters here:

    resolve('~/thing')

doesn't resolve symlinks because it treats "~" literally. In other words:

    fnamemodify(resolve('~/thing'), ':p')

doesn't work, but:

    resolve(fnamemodify('~/thing', ':p'))

does.

I broke this in c255bc375ea95689c45c5812e4fda94f33d99b86 while fixing
another bug (which required me to remove an `expand()` call).

2 years agodocs: replace static screenshot with demo gif
Greg Hurrell [Sun, 13 Sep 2020 10:43:57 +0000 (12:43 +0200)] 
docs: replace static screenshot with demo gif

2 years agodocs: correct logo URL
Greg Hurrell [Sun, 13 Sep 2020 10:31:18 +0000 (12:31 +0200)] 
docs: correct logo URL

2 years agodocs: add logo
Greg Hurrell [Sun, 13 Sep 2020 10:30:37 +0000 (12:30 +0200)] 
docs: add logo

2 years agofeat: filter autocompletion list outside of Corpus directories
Greg Hurrell [Sun, 13 Sep 2020 00:38:48 +0000 (02:38 +0200)] 
feat: filter autocompletion list outside of Corpus directories

This will probably do the wrong thing if you have spaces in your
directories; will fix that if it comes up, I guess.

2 years agorefactor: get rid of unnecessary expression
Greg Hurrell [Sun, 13 Sep 2020 00:32:17 +0000 (02:32 +0200)] 
refactor: get rid of unnecessary expression

2 years agofix: make tab completion cycling work outside of Corpus directories
Greg Hurrell [Sun, 13 Sep 2020 00:31:02 +0000 (02:31 +0200)] 
fix: make tab completion cycling work outside of Corpus directories

This was getting stuck on second item. Basically, if you call `expand()`
it gets stuck, otherwise it doesn't... (:facepalm:).

So, only call `expand()` if we actually need to (only one place we do
that, which is the ftdetect plug-in).

2 years agofeat: improve completion
Greg Hurrell [Sat, 12 Sep 2020 23:35:35 +0000 (01:35 +0200)] 
feat: improve completion

Now you can tab complete the current selection, if it matches the
prefix.

2 years agodocs: add some initial docs
Greg Hurrell [Sat, 12 Sep 2020 22:35:26 +0000 (00:35 +0200)] 
docs: add some initial docs

Built using:

    (cd ~/code/docvim && bin/docvim ~/code/corpus/doc/corpus.txt ~/code/corpus/README.md -c ~/code/corpus -v)

2 years agofix: handle filenames split across I/O chunks
Greg Hurrell [Fri, 11 Sep 2020 23:00:46 +0000 (01:00 +0200)] 
fix: handle filenames split across I/O chunks

In my initial testing, never saw split names, but I have now, so fixing
it.

2 years agorefactor: inline cancel function
Greg Hurrell [Fri, 11 Sep 2020 17:01:29 +0000 (19:01 +0200)] 
refactor: inline cancel function

No value in it being declared separately; it just adds vertical space
for no benefit.

2 years agorefactor: drop unused pid binding
Greg Hurrell [Fri, 11 Sep 2020 17:01:17 +0000 (19:01 +0200)] 
refactor: drop unused pid binding

2 years agofeat: run listing and search as async jobs
Greg Hurrell [Fri, 11 Sep 2020 16:49:56 +0000 (18:49 +0200)] 
feat: run listing and search as async jobs

This means you can hold down a key in the command line and it won't get
laggy. Instead of kicking of blocking serial jobs one after the other,
we cancel the previous job and start a new one. This makes things super
responsive.

2 years agofix: do nothing unless on Neovim
Greg Hurrell [Fri, 11 Sep 2020 14:30:36 +0000 (16:30 +0200)] 
fix: do nothing unless on Neovim

To avoid things blowing up when we try to do Lua stuff on Vim.

2 years agofix: make padding work on wide screens
Greg Hurrell [Fri, 11 Sep 2020 09:26:27 +0000 (11:26 +0200)] 
fix: make padding work on wide screens

2 years agofix: don't let people create files with untrimmed whitespace
Greg Hurrell [Thu, 10 Sep 2020 22:39:00 +0000 (00:39 +0200)] 
fix: don't let people create files with untrimmed whitespace

2 years agofix: restore cursor positioning
Greg Hurrell [Thu, 10 Sep 2020 22:30:19 +0000 (00:30 +0200)] 
fix: restore cursor positioning

Forgot that I needed this (even though the cursor is not visible) in
order to scroll the selection into view, if necessary.

2 years agochore: port corpus#choose()
Greg Hurrell [Thu, 10 Sep 2020 21:57:18 +0000 (23:57 +0200)] 
chore: port corpus#choose()

2 years agochore: add some TODO comments
Greg Hurrell [Thu, 10 Sep 2020 21:34:06 +0000 (23:34 +0200)] 
chore: add some TODO comments

2 years agoperf: avoid eagerly loading Corpus
Greg Hurrell [Thu, 10 Sep 2020 21:32:37 +0000 (23:32 +0200)] 
perf: avoid eagerly loading Corpus

Of course, it will load as soon as you do _anything_ in the commandline,
but at least it won't hurt startup time in the common case.

2 years agofix: show selection on initial load/search
Greg Hurrell [Thu, 10 Sep 2020 20:55:28 +0000 (22:55 +0200)] 
fix: show selection on initial load/search

2 years agofix: pad buffer with empty lines to extend foldcolumn
Greg Hurrell [Thu, 10 Sep 2020 20:45:55 +0000 (22:45 +0200)] 
fix: pad buffer with empty lines to extend foldcolumn

2 years agofix: stop numbers from showing up in foldcolumn
Greg Hurrell [Thu, 10 Sep 2020 19:31:09 +0000 (21:31 +0200)] 
fix: stop numbers from showing up in foldcolumn

2 years agofeat: make selection extend all the way across in chooser window
Greg Hurrell [Thu, 10 Sep 2020 19:30:46 +0000 (21:30 +0200)] 
feat: make selection extend all the way across in chooser window

2 years agofeat: use foldcolumn to make pane separation more obvious
Greg Hurrell [Thu, 10 Sep 2020 19:17:23 +0000 (21:17 +0200)] 
feat: use foldcolumn to make pane separation more obvious

Or rather than "more", "at all".

2 years agofix: make matching non-greedy anything
Greg Hurrell [Thu, 10 Sep 2020 19:16:55 +0000 (21:16 +0200)] 
fix: make matching non-greedy anything

Means we can actually search for multiple words again.

2 years agofeat: add highlighting of selected row
Greg Hurrell [Thu, 10 Sep 2020 13:51:30 +0000 (15:51 +0200)] 
feat: add highlighting of selected row

2 years agofeat: improve appearance by using `'winhl'`
Greg Hurrell [Thu, 10 Sep 2020 13:35:17 +0000 (15:35 +0200)] 
feat: improve appearance by using `'winhl'`

2 years agorefactor: port preview_next and preview_previous to Lua
Greg Hurrell [Thu, 10 Sep 2020 12:54:40 +0000 (14:54 +0200)] 
refactor: port preview_next and preview_previous to Lua

2 years agorefactor: implement preview
Greg Hurrell [Thu, 10 Sep 2020 11:27:43 +0000 (13:27 +0200)] 
refactor: implement preview

Doesn't update when you move yet, because I haven't wired up those
bindings, but it shows correctly on first render and when you change the
command line query.

2 years agorefactor: start building out chooser window with Lua
Greg Hurrell [Wed, 9 Sep 2020 23:34:18 +0000 (01:34 +0200)] 
refactor: start building out chooser window with Lua

2 years agorefactor: replace some home-made stuff with Neovim built-ins
Greg Hurrell [Wed, 9 Sep 2020 20:07:57 +0000 (22:07 +0200)] 
refactor: replace some home-made stuff with Neovim built-ins

2 years agofeat: add util.list.push
Greg Hurrell [Wed, 9 Sep 2020 20:02:17 +0000 (22:02 +0200)] 
feat: add util.list.push

2 years agofeat: auto-init Git repo if needed
Greg Hurrell [Wed, 9 Sep 2020 06:38:18 +0000 (08:38 +0200)] 
feat: auto-init Git repo if needed

Some refactoring included here along the way in making this work, and
some TODOs noted inline.

2 years agofix: invert sense of smartcase check
Greg Hurrell [Tue, 8 Sep 2020 07:41:35 +0000 (09:41 +0200)] 
fix: invert sense of smartcase check

This was mis-ported from the Vimscript version in e24661d3.

Meant that "smartcase" queries (ie. containing uppercase) were
case-insensitive, and non-smartcase queries (ie. all lowercase) were the
opposite.

2 years agoperf: lazy-load utility modules
Greg Hurrell [Tue, 8 Sep 2020 11:07:48 +0000 (13:07 +0200)] 
perf: lazy-load utility modules

2 years agorefactor: prefer v:lua over luaeval
Greg Hurrell [Mon, 7 Sep 2020 23:44:19 +0000 (01:44 +0200)] 
refactor: prefer v:lua over luaeval

It's terser, and this is why I made "corpus" a global in the first
place.

2 years agofix: make sure Lua module loaded whenany autoloaded function runs
Greg Hurrell [Mon, 7 Sep 2020 23:37:19 +0000 (01:37 +0200)] 
fix: make sure Lua module loaded whenany autoloaded function runs

2 years agorefactor: extract "util" functions
Greg Hurrell [Mon, 7 Sep 2020 23:31:05 +0000 (01:31 +0200)] 
refactor: extract "util" functions

This might be my JS developer mentality coming through here but I really
want to have clear APIs for dealing with "list"-like tables and
"dict"-like ones, so that's where I'm starting here.

2 years agofix: port and fix corpus#commit() to Lua
Greg Hurrell [Mon, 7 Sep 2020 22:53:24 +0000 (00:53 +0200)] 
fix: port and fix corpus#commit() to Lua

We were failing to commit new files because we passed "file" instead of
"file.md" (due to the ":r" modifier).

2 years agorefactor: continue Lua port
Greg Hurrell [Mon, 7 Sep 2020 22:10:54 +0000 (00:10 +0200)] 
refactor: continue Lua port

Arbitrary cut-off point here. Trying to keep this working at each
incremental step.

2 years agorefactor: start porting to Lua
Greg Hurrell [Sun, 6 Sep 2020 23:52:05 +0000 (01:52 +0200)] 
refactor: start porting to Lua

Experimental. Just want to see if it is any faster.

There is some sketchy quoting and concatenation going on here in the
Vimscript, but that's temporary and will go away as the associated code
gets ported.

2 years agofeat: allow ".md" extension when creating new files
Greg Hurrell [Tue, 21 Jul 2020 19:03:57 +0000 (21:03 +0200)] 
feat: allow ".md" extension when creating new files

Just say you want to create a file "foo.md" but you already have one
called "food.md"; you can't just type "foo" and hit enter because that
will just open the existing file. If we weren't in the terminal, and we
could actually distinguish between enter and, say, control-enter, then
we could use that as a cue to create the file. But we are in the
terminal, so we instead allow you to type "foo.md". That won't match
"food.md" unless you happen to have that string inside it (unlikely), so
in this way you can add an extension, optionally, as a way of forcing a
unique match and thus creating a new file. Subtle, but useful.

2 years agochore: add standard Vim plug-in boilerplate
Greg Hurrell [Mon, 20 Jul 2020 13:44:09 +0000 (15:44 +0200)] 
chore: add standard Vim plug-in boilerplate

2 years agochore: add license headers to individual files
Greg Hurrell [Mon, 20 Jul 2020 13:40:32 +0000 (15:40 +0200)] 
chore: add license headers to individual files

2 years agodocs: add LICENSE.md
Greg Hurrell [Mon, 20 Jul 2020 13:37:01 +0000 (15:37 +0200)] 
docs: add LICENSE.md

This existed in a former incarnation of this branch (added in
abda4ad505a0f208), so just resurrect it here.

2 years agodocs: tweak README again for clarity
Greg Hurrell [Mon, 20 Jul 2020 13:35:02 +0000 (15:35 +0200)] 
docs: tweak README again for clarity

Mention transition to Vim earlier on, and add a screenshot to make it
more obvious.

2 years agodocs: update README to reflect current status
Greg Hurrell [Sun, 19 Jul 2020 23:30:42 +0000 (01:30 +0200)] 
docs: update README to reflect current status

This notes that the Vim plug-in version is now the "official" Corpus
line of development; the code for the JS-powered version can still be
found in the repo history, obviously.

Really, the entire document needs to be rewritten, but I'll have to
tackle that later.

2 years agodocs: bring README.md across from old "master" branch
Greg Hurrell [Sun, 19 Jul 2020 23:28:01 +0000 (01:28 +0200)] 
docs: bring README.md across from old "master" branch

As of: 47821885da24509998720feaf4c52c9801dc5647

2 years agochore: ignore "media" worktree
Greg Hurrell [Sun, 19 Jul 2020 23:25:59 +0000 (01:25 +0200)] 
chore: ignore "media" worktree

2 years agoMerge branch 'vim'
Greg Hurrell [Sun, 19 Jul 2020 23:04:58 +0000 (01:04 +0200)] 
Merge branch 'vim'

Similar to what we did in 3933f06f97aa537e28a67615211e1d21d930b186, this
is a "trick" merge to replace the "master" branch with the contents of
the "vim" branch, preserving the history of both in the DAG.

First, up, got ready to extract the "vim" branch from my dotfiles repo
as of this commit:

    https://github.com/wincent/wincent/commit/612f9512ec5ef43c9861b4e4049b05e0c050d352

Steps:

    git checkout --detach 612f9512ec5ef43c9861b4e4049b05e0c050d352

    git filter-branch --prune-empty --index-filter '
        # On macOS, need to brew install grep gnu-sed findutils first
        git ls-files -z | gegrep -zv  "\.vim/pack/bundle/opt/corpus" |
            gxargs -0 -r git rm --cached -q
        # Move files to root directory
        git ls-files -s | gsed -e "s-\t.\+vim/pack/bundle/opt/corpus/-\t-" |
            GIT_INDEX_FILE=$GIT_INDEX_FILE.new \
            git update-index --index-info &&
            ( test ! -f "$GIT_INDEX_FILE.new" \
                || mv -f "$GIT_INDEX_FILE.new" "$GIT_INDEX_FILE" )
    '

ie. using trick described here:

    https://stackoverflow.com/a/14764368/2103996

To rewrite history of "corpus" directory, which has been renamed twice,
to appear as though it were all at the repo root:

- roles/dotfiles/files/.vim/pack/bundle/opt/corpus
- aspects/dotfiles/files/.vim/pack/bundle/opt/corpus
- aspects/vim/files/.vim/pack/bundle/opt/corpus

End result was c9ecd780e261d1b9411782d8afd6f02507ccdea0, so:

    # Name the branch
    git branch scratch c9ecd780e261d1b9411782d8afd6f02507ccdea0

    # Restore master
    git checkout master

    # (Later on, can throw away scratch branch with this...)
    git branch -D scratch

In this repo:

    git add local path-to-dotfiles
    git fresh # an alias to fetch all remotes; ie. git remote update --prune
    git show local/scratch # sanity check
    git branch vim local/scratch # name branch here too
    git checkout vim
    git merge -s ours --allow-unrelated-histories master
    git commit --amend (to fix message)

Note that to get real history in here, reading it in with:

    :read !git log --oneline --no-decorate local/scratch

Finally, will twiddle the branches to point at the right commits (ie.
"master" needs to point at "vim").

* vim:
  fix(corpus): make sure we autocommit changes to new files
  refactor(corpus): scope command-line mappings more tightly
  fix(vim): avoid error on /usr/bin/vim startup
  feat(corpus): make it possible to create new files from search
  fix(corpus): actually detect backticks
  fix(corpus): fix bad fence detection pattern
  fix(corpus): remove errant logging
  fix(corpus): abort link detection if you run into an adjacent link
  refactor(corpus): remove unnecessary "repo" config
  refactor(corpus): clean up a code comment
  fix(corpus): work around unexpected `git-grep -z` behavior
  fix(corpus): store labels case insensitively
  style(corpus): fix code formatting
  fix(corpus): make sure preview redraws
  perf(corpus): make synthetic preview window
  perf(corpus): debounce previews
  refactor(corpus): remove dead code
  fix(corpus): work around for ftdetect not running on first
  feat(corpus): approach feature-completeness for initial version
  feat(corpus): preview when switching via c-j, c-k
  feat(corpus): prototype of typeahead search
  fix(corpus): make sure we actually get config when trying to jump
  chore(corpus): give up on fancy search/navigation for now
  refactor(corpus): lame attempt at making previewing faster
  refactor(corpus): revisit preview windows etc
  fix(corpus): fix bad deletebufline() call
  feat(corpus): support visual mode
  feat(corpus): make <C-]> navigate to a link target (or linkify)
  feat(corpus): partially sort link reference definitions
  feat(corpus): implement crude target transform
  feat(corpus): get autolinking working
  test(corpus): add some stub tests
  feat(corpus): don't manage titles automatically unless autotitle is set
  refactor(corpus): deduplicate some logic
  feat(corpus): update tags when auto-updating metadata
  feat(corpus): update title metadata on save
  feat(corpus): add multi-directory configuration
  refactor(corpus): start preparing minimal version of Corpus experiment
  chore(corpus): enable Corpus experiment but turn it into a no-op
  feat: use up/down to move among quickfix results
  feat: integrate quickfix list and proper search
  feat: use Git to search inside files
  feat: add initial experimentation with previews

2 years agofix(corpus): make sure we autocommit changes to new files vim
Greg Hurrell [Thu, 11 Jun 2020 10:10:03 +0000 (12:10 +0200)] 
fix(corpus): make sure we autocommit changes to new files

2 years agorefactor(corpus): scope command-line mappings more tightly
Greg Hurrell [Fri, 8 May 2020 20:10:27 +0000 (22:10 +0200)] 
refactor(corpus): scope command-line mappings more tightly

Although, as noted in the comments, could do this a little more
conservatively. I think I'll just provide settings to override the
mappings so that you suppress them if you want.

2 years agodocs: remove errant hyphen
Greg Hurrell [Fri, 8 May 2020 19:28:19 +0000 (21:28 +0200)] 
docs: remove errant hyphen

2 years agodocs: link to Vim-based Corpus screencast
Greg Hurrell [Fri, 8 May 2020 19:26:44 +0000 (21:26 +0200)] 
docs: link to Vim-based Corpus screencast

2 years agofix(vim): avoid error on /usr/bin/vim startup
Greg Hurrell [Sat, 2 May 2020 15:34:29 +0000 (17:34 +0200)] 
fix(vim): avoid error on /usr/bin/vim startup

2 years agofeat(corpus): make it possible to create new files from search
Greg Hurrell [Wed, 15 Apr 2020 21:35:32 +0000 (23:35 +0200)] 
feat(corpus): make it possible to create new files from search

2 years agofix(corpus): actually detect backticks
Greg Hurrell [Tue, 14 Apr 2020 17:05:37 +0000 (19:05 +0200)] 
fix(corpus): actually detect backticks

Given:

   foo `bar` baz

On finding first backtick, intent was to find second one, but we just
found the same one again due to our failure to add one to the index.
This broke code span detection, cause this to get improperly treated as
a shortcut link:

    foo `baz [bar] boom`

Same problem doesn't occur with links:

    foo [bar] baz

Because when we are at "[" and scan ahead looking for "]", there is no
possibility of finding "]" at "[" even without the index increment,
because they obviously don't match.

2 years agofix(corpus): fix bad fence detection pattern
Greg Hurrell [Tue, 14 Apr 2020 16:54:22 +0000 (18:54 +0200)] 
fix(corpus): fix bad fence detection pattern

Was preventing fenced code blocks from being detected.

2 years agofix(corpus): remove errant logging
Greg Hurrell [Tue, 14 Apr 2020 16:54:08 +0000 (18:54 +0200)] 
fix(corpus): remove errant logging

2 years agofix(corpus): abort link detection if you run into an adjacent link
Greg Hurrell [Tue, 14 Apr 2020 00:42:56 +0000 (02:42 +0200)] 
fix(corpus): abort link detection if you run into an adjacent link

Otherwise, if cursor is on "foo" in:

    This [is a link] and foo is before [another link].

Then we'll end up thinking that we found one big (and invalid) link:

         [is a link] and foo is before [another link]

instead of linking foo:

    This [is a link] and [foo] is before [another link].

2 years agorefactor(corpus): remove unnecessary "repo" config
Greg Hurrell [Mon, 13 Apr 2020 23:56:50 +0000 (01:56 +0200)] 
refactor(corpus): remove unnecessary "repo" config

2 years agorefactor(corpus): clean up a code comment
Greg Hurrell [Mon, 13 Apr 2020 21:57:27 +0000 (23:57 +0200)] 
refactor(corpus): clean up a code comment

2 years agofix(corpus): work around unexpected `git-grep -z` behavior
Greg Hurrell [Mon, 13 Apr 2020 19:15:33 +0000 (21:15 +0200)] 
fix(corpus): work around unexpected `git-grep -z` behavior

It does not behave like `git-ls-files -z`, which emits paths as-is.
Rather, it will omit paths like those noted in the comments.

2 years agofix(corpus): store labels case insensitively
Greg Hurrell [Mon, 13 Apr 2020 18:54:30 +0000 (20:54 +0200)] 
fix(corpus): store labels case insensitively

So as to avoid creating duplicate link reference definitions given input
like:

    [Open source] is more than just [open source].

    ie. we want:

    [Open source]: /wiki/Open_source

    not:

    [Open source]: /wiki/Open_source
    [open source]: /wiki/open_source

2 years agostyle(corpus): fix code formatting
Greg Hurrell [Mon, 13 Apr 2020 16:41:44 +0000 (18:41 +0200)] 
style(corpus): fix code formatting

2 years agofix(corpus): make sure preview redraws
Greg Hurrell [Mon, 13 Apr 2020 16:26:25 +0000 (18:26 +0200)] 
fix(corpus): make sure preview redraws

2 years agoperf(corpus): make synthetic preview window
Greg Hurrell [Mon, 13 Apr 2020 16:02:51 +0000 (18:02 +0200)] 
perf(corpus): make synthetic preview window

Because it might be faster.

2 years agoperf(corpus): debounce previews
Greg Hurrell [Mon, 13 Apr 2020 15:49:57 +0000 (17:49 +0200)] 
perf(corpus): debounce previews

Because they are super slow.

2 years agorefactor(corpus): remove dead code
Greg Hurrell [Mon, 13 Apr 2020 00:29:59 +0000 (02:29 +0200)] 
refactor(corpus): remove dead code

2 years agofix(corpus): work around for ftdetect not running on first
Greg Hurrell [Mon, 13 Apr 2020 00:28:44 +0000 (02:28 +0200)] 
fix(corpus): work around for ftdetect not running on first

2 years agofeat(corpus): approach feature-completeness for initial version
Greg Hurrell [Sun, 12 Apr 2020 23:32:04 +0000 (01:32 +0200)] 
feat(corpus): approach feature-completeness for initial version

2 years agofeat(corpus): preview when switching via c-j, c-k
Greg Hurrell [Sun, 12 Apr 2020 19:26:41 +0000 (21:26 +0200)] 
feat(corpus): preview when switching via c-j, c-k

2 years agofeat(corpus): prototype of typeahead search
Greg Hurrell [Sun, 12 Apr 2020 19:17:45 +0000 (21:17 +0200)] 
feat(corpus): prototype of typeahead search

2 years agofix(corpus): make sure we actually get config when trying to jump
Greg Hurrell [Sun, 12 Apr 2020 16:50:29 +0000 (18:50 +0200)] 
fix(corpus): make sure we actually get config when trying to jump

2 years agochore(corpus): give up on fancy search/navigation for now
Greg Hurrell [Sun, 12 Apr 2020 16:33:22 +0000 (18:33 +0200)] 
chore(corpus): give up on fancy search/navigation for now

As noted in the comments, navigating via the quickfix listing is too
slow, any we don't want to pollute the stack with junk anyway.

Trouble is we have fast content search (eg. ":Ack") and fast title
search (eg. ":CommandT"), but we don't have a slick preview mechanism
like we do in the graphical Corpus.

We *might* be able to get something to work nicely with `:pedit` if we
hack deeply into Command-T, but I am not sure I want to do that.
Basically, it would consist of running a search powered by `git grep`
at the prompt (debounced), and basically just using Command-T's
MatchWindow, not its search, and plugging in `:pedit`-based preview
(likely debounced). At first blush, I don't think we want to do any of
that, and might be better off just reimplementing the MatchWindow
functionality from scratch using VimScript alone (and maybe some of the
newer functionality, like floating windows).

2 years agorefactor(corpus): lame attempt at making previewing faster
Greg Hurrell [Sun, 12 Apr 2020 16:22:37 +0000 (18:22 +0200)] 
refactor(corpus): lame attempt at making previewing faster

Doesn't work because the "current" quickfix item isn't changing.

2 years agorefactor(corpus): revisit preview windows etc
Greg Hurrell [Sun, 12 Apr 2020 15:32:17 +0000 (17:32 +0200)] 
refactor(corpus): revisit preview windows etc

This is some early POC code that I wrote a while back. Now that I have a
basic version of the auto-linking working, I think it's time to start
looking at the "navigation/search" side of the equation.

2 years agofix(corpus): fix bad deletebufline() call
Greg Hurrell [Sun, 12 Apr 2020 15:29:01 +0000 (17:29 +0200)] 
fix(corpus): fix bad deletebufline() call

"." will match any buffer with a name, so this was causing an E93 "more
than one match" as soon as you had more than one buffer.

2 years agofeat(corpus): support visual mode
Greg Hurrell [Sun, 12 Apr 2020 15:02:16 +0000 (17:02 +0200)] 
feat(corpus): support visual mode

2 years agofeat(corpus): make <C-]> navigate to a link target (or linkify)
Greg Hurrell [Sun, 12 Apr 2020 14:22:08 +0000 (16:22 +0200)] 
feat(corpus): make <C-]> navigate to a link target (or linkify)

2 years agofeat(corpus): partially sort link reference definitions
Greg Hurrell [Sun, 12 Apr 2020 12:23:01 +0000 (14:23 +0200)] 
feat(corpus): partially sort link reference definitions

We don't re-sort existing ones, but we at least make sure that any new
ones that we add get inserted in sorted order relative to each other.

2 years agofeat(corpus): implement crude target transform
Greg Hurrell [Sun, 12 Apr 2020 12:08:40 +0000 (14:08 +0200)] 
feat(corpus): implement crude target transform

To avoid unwanted "%20" in web URLs.

2 years agofeat(corpus): get autolinking working
Greg Hurrell [Sun, 12 Apr 2020 12:01:19 +0000 (14:01 +0200)] 
feat(corpus): get autolinking working

Still need transform though, for the Masochist use case. Because if we
link to a page like "[some page]", the link reference definition will
be:

    [some page]: </wiki/some page>

And the link works, but it takes you to:

    https://wincent.com/wiki/some%20page

instead of:

    https://wincent.com/wiki/some_page

2 years agotest(corpus): add some stub tests
Greg Hurrell [Fri, 10 Apr 2020 19:16:40 +0000 (21:16 +0200)] 
test(corpus): add some stub tests