Skip to content

Commit

Permalink
Add the / mark
Browse files Browse the repository at this point in the history
  • Loading branch information
lydell committed Oct 2, 2016
1 parent d4b3d29 commit 3c64fa2
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 8 deletions.
19 changes: 14 additions & 5 deletions documentation/commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,14 +148,23 @@ letter to associate the current scroll position with that letter. For example,
press `ma` to save the position into mark _a._ Then you can return to that
position by pressing `'` followed by the same letter, e.g. `'a`.

One mark is special: `'`. Pressing `''` takes you to the scroll position before
the last `gg`, `G`, `0`, `$`, `/`, `n`, `N` or `'`. (You can change this mark
using the [`scroll.last_position_mark`] option.)

Note: Firefox has a `'` shortcut by default. It opens the Quick Find bar. VimFx
provides the `g/` shortcut instead.

[`scroll.last_position_mark`]: options.md#scroll.last_position_mark
#### Special marks

Just like Vim, VimFx has a few special marks. These are set automatically.

- `'`: Pressing `''` takes you to the scroll position before the last `gg`, `G`,
`0`, `$`, `/`, `a/`, `g/`, `n`, `N` or `'`.

- `/`: Pressing `'/` takes you to the scroll position before the last `/`, `a/`
or `g/`.

(You can change these marks by using the [`scroll.last_position_mark` and
`scroll.last_find_mark`][mark-options] options.)

[mark-options]: options.md#scroll.last_position_mark-and-scroll.last_find_mark

#### Minor notes

Expand Down
7 changes: 4 additions & 3 deletions documentation/options.md
Original file line number Diff line number Diff line change
Expand Up @@ -498,11 +498,12 @@ different page scrolling commands.
- `scroll.full_page_adjustment`: `<space>, `<s-space>`
- `scroll.half_page_adjustment`: `d`, `u`

#### `scroll.last_position_mark`
#### `scroll.last_position_mark` and `scroll.last_find_mark`

The special mark for the [`'`][scroll-to-mark] command that takes you to the
last position.
These options allow you to customize the [special marks] for the
[`'`][scroll-to-mark] command.

[special marks]: commands.md#special-marks
[scroll-to-mark]: commands.md#marks-m-and-

### `pattern_selector`
Expand Down
5 changes: 5 additions & 0 deletions extension/lib/commands.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -808,6 +808,11 @@ helper_find = ({highlight, linksOnly = false}, {vim}) ->
vim._enterMode('find')

helper_mark_last_scroll_position(vim)
vim._run('mark_scroll_position', {
keyStr: vim.options['scroll.last_find_mark']
notify: false
})

helper_find_from_top_of_viewport(vim, FORWARD, ->
return unless vim.mode == 'find'
findBar = vim.window.gBrowser.getFindBar()
Expand Down
1 change: 1 addition & 0 deletions extension/lib/defaults.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ advanced_options =
'scroll.full_page_adjustment': 40
'scroll.half_page_adjustment': 20
'scroll.last_position_mark': "'"
'scroll.last_find_mark': '/'
'pattern_selector': ':-moz-any(
a, button, input[type="button"]
):not([role="menu"]):not([role="tab"])'
Expand Down

0 comments on commit 3c64fa2

Please sign in to comment.