]> git.wincent.com - loupe.git/log
loupe.git
18 months agochore: add .mailmap main master
Greg Hurrell [Fri, 3 Dec 2021 10:28:32 +0000 (11:28 +0100)] 
chore: add .mailmap

Because I just foolishly pushed a commit from my work machine without
first having run `git config user.email` for this repo.

18 months agofix: also work with long forms of `:v` (`:vg` ... `:vglobal`)
Greg Hurrell [Fri, 3 Dec 2021 10:23:19 +0000 (11:23 +0100)] 
fix: also work with long forms of `:v` (`:vg` ... `:vglobal`)

Don't know what I was thinking, but I didn't ship the complete fix in
a0057f55c0e8c3067811c4e1ce4e2f1eb2ea8e57. This commit adds this missing
forms of the `:v` command.

18 months agofix: make `:g!` work as a command
Greg Hurrell [Thu, 2 Dec 2021 21:47:43 +0000 (22:47 +0100)] 
fix: make `:g!` work as a command

This is a little bit subtle, but I tried to explain it in the comments.
Turns out that `:g!` (and `:gl!`, `:glo!` ... `:global!`) is a command,
equivalent to `:v`, and Vim _does not_ treat the `!` as a slash
delimiter. This means that the old behavior was wrong; we would see `!`
after the `:g`, assume it was a delimiter, and append `!\v`. Instead,
what we need to do, is leave it unexpanded and wait for the user to
input a slash (or other delimiter).

Summarizing - standard usage with a slash:

- `:g/foo/d` means "delete all lines matching foo".
- `:v/foo/d` means "delete all lines not matching foo".
- `:s/foo/bar/` means "replace foo with bar".

And you can use lots of other symbols in lieu of slash, like "#":

- `:g#foo#d` means "delete all lines matching foo".
- `:v#foo#d` means "delete all lines not matching foo".
- `:s#foo#bar#` means "replace foo with bar".

But "!" is special, because sometimes it indicates a bang form of a
command and other times it can stand in for slash:

- `:g!/foo/d` means "delete all lines not matching foo"
  (ie. Vim treats this as a valid bang command).
- `:v!foo!d` is an error, because there is no `:v!` command
  (ie. Vim rejects this as an invalid bang command).
- `:s!foo!bar!` means "replace foo with bar"
  (ie. Vim does _not_ consider this a bang command, and treats "!" as a
  delimiter).
- `:g!!foo!d` means "delete all lines not matching foo"
  (ie. Vim treats this as a valid bang command _and_ treats the second
  and third "!" as delimiters).

Makes sense?

I thought so...

Updated docs with:

    bin/docvim -c ~/code/loupe ~/code/loupe/doc/loupe.txt ~/code/loupe/README.md -v

Closes: https://github.com/wincent/loupe/issues/20
18 months agorefactor: edit some code comments in the name of precision
Greg Hurrell [Thu, 2 Dec 2021 21:26:30 +0000 (22:26 +0100)] 
refactor: edit some code comments in the name of precision

We're using "slash" in an abstract sense here to mean "delimiter" (in
fact, as I write this, I wonder whether we should just use that word...
🤔), so we shouldn't use a literal "/" in the comments.

18 months agofix: make `g:LoupeVeryMagic` work with `:su`, `:sub`, `:subs` etc
Greg Hurrell [Thu, 2 Dec 2021 21:20:53 +0000 (22:20 +0100)] 
fix: make `g:LoupeVeryMagic` work with `:su`, `:sub`, `:subs` etc

Previously we were only looking for `:s`, `:g` and `:v`, but we should
actually work for all the non-abbreviated forms too.

Noticed while investigating:

    https://github.com/wincent/loupe/issues/20

Seeing as I've blown away my Haskell-based docvim install
on this machine (my personal laptop) while working on the
new-but-not-yet-feature-complete Rust-powered version, I
needed to set up a new install in order to update the docs:

    git clone $REPO_URL docvim-haskell
    cd docvim-haskell
    bin/build
    bin/docvim -c ~/code/loupe ~/code/loupe/doc/loupe.txt ~/code/loupe/README.md -v

23 months agochore: move "master" → "main"
Greg Hurrell [Sat, 12 Jun 2021 17:29:07 +0000 (19:29 +0200)] 
chore: move "master" â†’ "main"

2 years agodocs: fix broken heading rendering
Greg Hurrell [Sat, 12 Sep 2020 16:54:54 +0000 (18:54 +0200)] 
docs: fix broken heading rendering

By using latest docvim:

    https://github.com/wincent/docvim/commit/8f9d1f00d494b753fd212a1baf42ad00a3c9e286

Built using:

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

2 years agodoc: work around GitHub Markdown formatting quirk
Greg Hurrell [Tue, 1 Sep 2020 18:15:49 +0000 (20:15 +0200)] 
doc: work around GitHub Markdown formatting quirk

By regenerating with this commit applied:

https://github.com/wincent/docvim/commit/929ccc20b70a712918a06308a10ac493e65a91f2

2 years agodoc: try to make overrides section "headings" stand out a bit more
Greg Hurrell [Tue, 1 Sep 2020 17:47:56 +0000 (19:47 +0200)] 
doc: try to make overrides section "headings" stand out a bit more

2 years agofeat: add g:LoupeCaseSettingsAlways
Greg Hurrell [Tue, 1 Sep 2020 17:32:12 +0000 (19:32 +0200)] 
feat: add g:LoupeCaseSettingsAlways

Fixes an annoyance I've long had with `*`, `#` etc; it doesn't respect
'ignorecase' and 'smartcase' settings. It behaves as if 'ignorecase' and
'nosmartcase' were always in effect, unlike `/` and `?`.

In this commit we add a new setting, on by default, that makes all of
the search mappings behave the same, respecting the value of
'ignorecase' and 'smartcase'.

Also as noted in the comments, we take the opportunity to enhance a very
edge-casey thing: that if you have a special char like "\" in your
'iskeyword' setting, then `*` won't work when the cursor is on a `cword`
like "foo\bar". We can fix that with some escaping, seeing as we're
bypassing the whole `*`/`#` mechanism anyway.

Freshened the docs with the following (because my Haskell environment is
horrendously broken on this machine):

dist-newstyle/build/x86_64-osx/ghc-8.4.4/docvim-0.3.2.1/x/docvim/build/docvim/docvim \
  -c ~/code/loupe -v \
  ~/code/loupe/doc/loupe.txt ~/code/loupe/README.md

4 years agodoc: rebuild with tweaked docvim to make function heading stand out
Greg Hurrell [Tue, 4 Dec 2018 14:03:57 +0000 (15:03 +0100)] 
doc: rebuild with tweaked docvim to make function heading stand out

4 years agoPrepare for v1.2.2 release 1.2.2
Greg Hurrell [Tue, 7 Aug 2018 08:10:04 +0000 (10:10 +0200)] 
Prepare for v1.2.2 release

4 years agoEnsure E802|E803 is caught regardless of 'iskeyword'
Adam P. Regasz-Rethy [Fri, 3 Aug 2018 03:12:57 +0000 (20:12 -0700)] 
Ensure E802|E803 is caught regardless of 'iskeyword'

5 years agoRegen documentation
Greg Hurrell [Wed, 30 Aug 2017 04:09:52 +0000 (21:09 -0700)] 
Regen documentation

To pacify GitHub's new Markdown parser, regen the documentation using a
newer version of docvim; specifically, we need this commit:

https://github.com/wincent/docvim/commit/4c855ae060f37c775527df3d93ee0f18a9ffef79

5 years agoDon't allow bad search patterns to print ugly errors
Greg Hurrell [Fri, 18 Aug 2017 02:45:17 +0000 (19:45 -0700)] 
Don't allow bad search patterns to print ugly errors

This will stop Vim from freaking out when we end the user searches with
`/\v*` and we end up passing a pattern like `\c\%#\v*` to `matchadd()`.

Closes: https://github.com/wincent/loupe/issues/13
6 years agoAdd empty .watchmanconfig
Greg Hurrell [Wed, 12 Oct 2016 01:07:02 +0000 (18:07 -0700)] 
Add empty .watchmanconfig

Allows a Watchman instance configured with `enforce_root_files` to watch
this directory even if `root_files` does not contain any of the files in
the directory. (Necessary to get around undesired corporate
`/etc/watchman.json` config.)

6 years agoPrepare for 1.2.1 release 1.2.1
Greg Hurrell [Thu, 14 Jul 2016 01:46:25 +0000 (18:46 -0700)] 
Prepare for 1.2.1 release

6 years agoOpen folds when jumping to a match
Greg Hurrell [Mon, 11 Jul 2016 15:45:01 +0000 (08:45 -0700)] 
Open folds when jumping to a match

Folds aren't opening due to some unknown Vim quirk; perhaps there is some
conditional logic in there that prevents the default behavior from happening in
the context of a mapping. Whatever the case, adding an explicit `zv` gives us
the same effect as the default behavior.

Fixes: https://github.com/wincent/loupe/issues/9
Thanks to @adriaanzon for the report and for suggesting the fix.

6 years agoUpdate docs for 1.2 release next 1.2
Greg Hurrell [Mon, 27 Jun 2016 14:19:18 +0000 (07:19 -0700)] 
Update docs for 1.2 release

6 years agoDRY up :noh overrides
Greg Hurrell [Mon, 27 Jun 2016 06:59:41 +0000 (23:59 -0700)] 
DRY up :noh overrides

Tested every which way and seems to work pretty well.

6 years agoMake fix even better
Greg Hurrell [Sun, 26 Jun 2016 08:26:48 +0000 (01:26 -0700)] 
Make fix even better

Gets rid of unwanted rightwards movement.

6 years agoImprove the :noh<space> fix
Greg Hurrell [Sun, 26 Jun 2016 08:25:25 +0000 (01:25 -0700)] 
Improve the :noh<space> fix

I had it written like this initially but didn't like it
because of some unwanted space movement behavior which
I couldn't seem to overcome with <Left>, so I tried the
version shipped in the last commit. Turns out this is
better, even if it is not perfect. Moves the cursor to
the right on each run, instead of to the second column.
Still sucks, but it is less jarring.

6 years agoSlightly improve behavior of ":noh<space>"
Greg Hurrell [Sun, 26 Jun 2016 08:01:15 +0000 (01:01 -0700)] 
Slightly improve behavior of ":noh<space>"

If you hit ":noh<CR>" you get ideal behavior.
If you hit ":noh<Space>" before this commit, you got nothing until you hit space
again.
With this commit, ":noh<Space>" behaves like ":noh<CR>" (triggers side-effect).

This still isn't ideal, but it is better than it was before.

Warts:

- This is a hack: all we really want is the ability to run a callback when the
  real `:noh` is called.
- Hitting <Space> and have it trigger a side-effect is a smell.
- We still get undesired cursor movement: <CR> moves to the start of the current
  line in the buffer, and then we get a one-char bump the right, even if I
  attempt compensatory cursor movements.

6 years agoSuppress unwanted cursor movement on `:noh<cr>`
Greg Hurrell [Sat, 25 Jun 2016 05:57:16 +0000 (22:57 -0700)] 
Suppress unwanted cursor movement on `:noh<cr>`

I noticed that given:

    :cabbrev foo echo "foo"

That `:foo<space>` would produce `:echo "foo" ` (note the trailing space) but
`:foo<cr>` would not, and nor would it trigger any unwanted cursor movement in
the current buffer.

With this change, we get that same behaviour: `:noh<space>` will act a bit
weird, but who uses that? At least `:noh<CR>` does the right thing.

6 years agoSwitch from cabbrev to more conservative cnoreabbrev
Greg Hurrell [Sat, 25 Jun 2016 05:53:23 +0000 (22:53 -0700)] 
Switch from cabbrev to more conservative cnoreabbrev

Seems safer.

6 years agoAvoid unwanted cabbrev
Greg Hurrell [Sat, 25 Jun 2016 05:42:42 +0000 (22:42 -0700)] 
Avoid unwanted cabbrev

Our mapping ends up expanding `:nohlsearch<CR>` thanks to `:cabbrev` as follows:

    cabbrev <silent> <expr> nohlsearch
    (getcmdtype() == ':' && getcmdpos() == 11 ?
    'nohlsearch <bar> call loupe#private#clear_highlight()<CR>' : 'nohlsearch')

This has two undesired effects:

- It means `loupe#private#clear_highlight()` gets called twice.
- It inserts an unwanted `<CR>` due to this behavior noted in the help (`:h
  abbreviations`):

> The non-keyword character which ends the abbreviation is inserted
> after the expanded abbreviation.

ie. the cursor moves whenever I hit `<leader>n`. Ugh.

Fix that by using `<bar>` and avoiding the expansion of the abbreviation.

6 years agoAdd missing heading formatting
Greg Hurrell [Wed, 22 Jun 2016 16:38:12 +0000 (09:38 -0700)] 
Add missing heading formatting

6 years agoRegenerate docs with docvim 0.3.2.0
Greg Hurrell [Wed, 22 Jun 2016 16:35:48 +0000 (09:35 -0700)] 
Regenerate docs with docvim 0.3.2.0

6 years agoRegenerate docs
Greg Hurrell [Tue, 21 Jun 2016 14:19:51 +0000 (07:19 -0700)] 
Regenerate docs

6 years agoMake loupe#private#hlmatch not private
Greg Hurrell [Tue, 21 Jun 2016 02:19:43 +0000 (19:19 -0700)] 
Make loupe#private#hlmatch not private

So that people can compose this to make custom mappings of their own. See:

  https://github.com/wincent/loupe/issues/7

Not sure this is the sort of API that I really want to commit to supporting
forever (hence why it was previously private), but Â¯\_(ツ)_/¯

6 years agoMake it possible to suppress *, #, n, N, g*, g# mappings
Greg Hurrell [Tue, 21 Jun 2016 02:12:25 +0000 (19:12 -0700)] 
Make it possible to suppress *, #, n, N, g*, g# mappings

Part of addressing:

  https://github.com/wincent/loupe/issues/7

6 years agoIntroduce s:map()
Greg Hurrell [Tue, 21 Jun 2016 01:44:52 +0000 (18:44 -0700)] 
Introduce s:map()

Wrapping this inside a function so that I can address:

https://github.com/wincent/loupe/issues/7

in exactly one place.

6 years agoPrepare for 1.1 release 1.1
Greg Hurrell [Thu, 16 Jun 2016 01:39:27 +0000 (18:39 -0700)] 
Prepare for 1.1 release

6 years agoMake compatible with older Vim (missing v:hlsearch)
Greg Hurrell [Thu, 16 Jun 2016 01:37:44 +0000 (18:37 -0700)] 
Make compatible with older Vim (missing v:hlsearch)

Addresses:

  https://github.com/wincent/loupe/issues/6

Of the two possible fixes to apply when `v:hlsearch` is not available:

- Clear unconditionally.
- Never clear.

went with the former as it feels like a better user experience. You can always
get the highlight back by hitting "n" or "N".

6 years agoAdd support for non-/ delimiters
Greg Hurrell [Wed, 15 Jun 2016 17:26:08 +0000 (10:26 -0700)] 
Add support for non-/ delimiters

Fixes bug noted in: https://youtu.be/Ipkn3tXKrrA

6 years agodoc: Make overriding overrides instructions more obvious
Greg Hurrell [Wed, 15 Jun 2016 06:40:27 +0000 (23:40 -0700)] 
doc: Make overriding overrides instructions more obvious

In response to:

https://github.com/wincent/loupe/issues/5

I had documentation in here already, but it is not very obvious, so let's make
it stand out with a heading.

6 years agodoc: Move footer content down to footer
Greg Hurrell [Mon, 13 Jun 2016 14:26:44 +0000 (07:26 -0700)] 
doc: Move footer content down to footer

6 years agoAdd docvim-generated documentation
Greg Hurrell [Mon, 13 Jun 2016 14:24:05 +0000 (07:24 -0700)] 
Add docvim-generated documentation

6 years agoPrepare source code for documentation generation via docvim
Greg Hurrell [Mon, 13 Jun 2016 14:17:15 +0000 (07:17 -0700)] 
Prepare source code for documentation generation via docvim

7 years agoTweak README headings to avoid repetition
Greg Hurrell [Wed, 1 Jun 2016 05:17:32 +0000 (22:17 -0700)] 
Tweak README headings to avoid repetition

7 years agoReplace plaintext README with Markdown
Greg Hurrell [Wed, 1 Jun 2016 05:16:10 +0000 (22:16 -0700)] 
Replace plaintext README with Markdown

7 years agodoc: add DEVELOPMENT section 1.0
Greg Hurrell [Sun, 27 Dec 2015 08:47:44 +0000 (09:47 +0100)] 
doc: add DEVELOPMENT section

This is a copy-pasta from Ferret, and the same as I have in Terminus.

7 years agoUpdate docs for 1.0 release
Greg Hurrell [Sun, 27 Dec 2015 08:44:09 +0000 (09:44 +0100)] 
Update docs for 1.0 release

I think we're stable at this point so we might as well call this 1.0.

7 years agoMerge branch 'pull/3'
Greg Hurrell [Thu, 24 Sep 2015 00:27:07 +0000 (17:27 -0700)] 
Merge branch 'pull/3'

Originally submitted at: https://github.com/wincent/loupe/pull/3

* pull/3:
  Avoid E802

7 years agoAvoid E802
Joe Lencioni [Wed, 23 Sep 2015 17:33:26 +0000 (10:33 -0700)] 
Avoid E802

Similar to 156f62c3, we are not entirely sure why this might happen, but
the cost of guarding against it is low. `:h E802` and `:h E803` bring up
the same section, so the root cause is likely similar or the same.

I decided to use a more verbose regex than necessary to make it easier
to search for this line in the code.

Fixes #1

7 years agodoc: Fix duplicate tags
Greg Hurrell [Wed, 2 Sep 2015 15:12:36 +0000 (08:12 -0700)] 
doc: Fix duplicate tags

The `loupe-history` tag appears twice in the file, which can cause:

> E154: Duplicate tag "loupe-history" in file

Rename the `loupe-history` tag in the OVERRIDES section to
`loupe-history-override` to resolve the clash, and change the other
tags in the section to follow the same `*-override` pattern for
consistency.

Closes: https://github.com/wincent/loupe/issues/2
7 years agoAvoid E803
Greg Hurrell [Thu, 20 Aug 2015 07:13:22 +0000 (00:13 -0700)] 
Avoid E803

We're not sure exactly why this might happen, but the cost of guarding
against it is low.

Should fix https://github.com/wincent/loupe/issues/1

7 years agodoc: Add RELATED section
Greg Hurrell [Thu, 16 Jul 2015 14:52:57 +0000 (07:52 -0700)] 
doc: Add RELATED section

7 years agoUse get() to get optional values with defaults
Greg Hurrell [Thu, 16 Jul 2015 14:44:50 +0000 (07:44 -0700)] 
Use get() to get optional values with defaults

Via Pro-Tip at: https://github.com/wincent/ferret/issues/5

7 years agoAdd LICENSE.txt
Greg Hurrell [Wed, 8 Jul 2015 22:16:25 +0000 (15:16 -0700)] 
Add LICENSE.txt

7 years agodoc: add link target for <Plug>LoupeClearHighlight
Greg Hurrell [Tue, 7 Jul 2015 15:40:00 +0000 (08:40 -0700)] 
doc: add link target for <Plug>LoupeClearHighlight

So that people can still find it if they search for it under the old
name (and they might, because I've linked to it from the HISTORY
section).

7 years agoRename <Plug>LoupeClearHighlight to <Plug>(LoupeClearHighlight)
Greg Hurrell [Tue, 7 Jul 2015 15:37:47 +0000 (08:37 -0700)] 
Rename <Plug>LoupeClearHighlight to <Plug>(LoupeClearHighlight)

Which I just learned to be best practice via:

http://stackoverflow.com/a/13698530/2103996

7 years agoFix tiny misalignment in the help docs
Greg Hurrell [Tue, 7 Jul 2015 15:30:16 +0000 (08:30 -0700)] 
Fix tiny misalignment in the help docs

7 years agoDoc: add missing blank line
Greg Hurrell [Tue, 7 Jul 2015 01:02:17 +0000 (18:02 -0700)] 
Doc: add missing blank line

We use two blank lines at the end of each section.

7 years agoApply style fixes
Greg Hurrell [Mon, 6 Jul 2015 03:56:54 +0000 (20:56 -0700)] 
Apply style fixes

Prefer `let l:foo=1` over `let l:foo = 1`, for consistency with the
style we've pretty much always followed for `set` calls.

7 years agodoc: Correct error in submodule set-up instructions
Greg Hurrell [Sun, 5 Jul 2015 22:44:41 +0000 (15:44 -0700)] 
doc: Correct error in submodule set-up instructions

7 years agoRename loupe.txt to README.txt so that GitHub can find it
Greg Hurrell [Sun, 5 Jul 2015 22:38:31 +0000 (15:38 -0700)] 
Rename loupe.txt to README.txt so that GitHub can find it

7 years agoUpdate docs
Greg Hurrell [Sun, 5 Jul 2015 22:34:27 +0000 (15:34 -0700)] 
Update docs

Note 0.1 release date in HISTORY section.

Add WEBSITE section.

7 years agoAdd top-level .gitignore
Greg Hurrell [Sun, 5 Jul 2015 22:31:19 +0000 (15:31 -0700)] 
Add top-level .gitignore

7 years agoInitial import 0.1
Greg Hurrell [Sun, 5 Jul 2015 22:25:51 +0000 (15:25 -0700)] 
Initial import

From b26099ef7882 in my dotfiles repo
(https://github.com/wincent/wincent).