From 3c64fa23142340109b3decdf106109b7d1ae74ce Mon Sep 17 00:00:00 2001 From: Simon Lydell Date: Sun, 2 Oct 2016 10:10:07 +0200 Subject: [PATCH] Add the `/` mark --- documentation/commands.md | 19 ++++++++++++++----- documentation/options.md | 7 ++++--- extension/lib/commands.coffee | 5 +++++ extension/lib/defaults.coffee | 1 + 4 files changed, 24 insertions(+), 8 deletions(-) diff --git a/documentation/commands.md b/documentation/commands.md index ccabf30..ee4edf8 100644 --- a/documentation/commands.md +++ b/documentation/commands.md @@ -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 diff --git a/documentation/options.md b/documentation/options.md index 31e8c2c..d14d3ad 100644 --- a/documentation/options.md +++ b/documentation/options.md @@ -498,11 +498,12 @@ different page scrolling commands. - `scroll.full_page_adjustment`: `, `` - `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` diff --git a/extension/lib/commands.coffee b/extension/lib/commands.coffee index dff86e2..364625c 100644 --- a/extension/lib/commands.coffee +++ b/extension/lib/commands.coffee @@ -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() diff --git a/extension/lib/defaults.coffee b/extension/lib/defaults.coffee index f84753d..3f2394f 100644 --- a/extension/lib/defaults.coffee +++ b/extension/lib/defaults.coffee @@ -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"])' -- 2.39.3