narrow something.
Code navigation tool inspired by unite.vim, emacs-helm.
More information on wiki
search files in project ), you can filter items by query to narrow down further.ag search result on narrow-editor then apply changes to real-file ).narrow-editor or narrow-ui: filter items by query and render items.narrow-provider: Provide items to narrow.You can check GIFs for all bundled provider here.
I use scan, search, git-diff-all, symbols in daily-basis, for other providers I don't use much.
scan: Scan current editor.search: Search by ag( you need to install ag by yourself).atom-scan: Similar to search but use Atom's atom.workspace.scan.fold: Provide fold-starting rows as item.git-diff-all: Show all modified state file across project.symbols: Provide symbols for current file.project-symbols: Provide project-wide symbols information by reading tags file.To follow this quick-tour, you don't need custom keymap.
narrow:scanNarrow Scan.narrow-editor opened, Initial items are each lines on editor. As you type, you can narrow items.apple as query. all apple matching items are listed.up, down(or j, k in read-only mode) key to quick-preview items.enter to confirm. When confirmed, narrow-editor closed.The read-only mode is enabled by default.
narrow-editor.Narrow Scan.narrow-editor opened. As you type, you can narrow items.narrow-editor.ctrl-cmd-n to move to next-item, ctrl-cmd-p to move to previous-item.tab and shift-tab.narrow-editor by ctrl-g( no need to focus narrow-editor ).narrow-editorctrl-cmd-f( narrow:focus ) to focus narrow-editor.ctrl-cmd-i( narrow:focus-prompt ) to directly focus narrow-editor's query prompt row.search, fold etc).Direct-edit is "edit on narrow-editor then save to real-file" feature.
Available for following providers.
scansearchatom-scanhelloNarrow Search By Current Word.hello matching items are shows up on narrow-editor.hello. Then ctrl-cmd-g(find-and-replace:select-all), then type world.Narrow Ui: Update Real File from command-palette.Narrow Ui: Update Real File.Search.startByDoubleClick to true from settings-view.narrow:focus: ( ctrl-cmd-f ) Focus to narrow-editor, if executed in narrow-editor, it re-focus to original editor.narrow:focus-prompt: ( ctrl-cmd-i ) Focus to narrow-editor's query input prompt, if executed in narrow-editor, it re-focus to original editor.narrow:refresh: Manually refresh items in narrow-editor.narrow:close: ( ctrl-g ) Close currently opened narrow-editor one at a time.narrow:next-item: ( ctrl-cmd-n ) Move cursor to position of next-item.narrow:previous-item: ( ctrl-cmd-p ) Move cursor to position of previous-item.narrow:reopen: ( no default keymap ) Reopen closed narrow editor up to 10 recent closed.narrow:query-current-word: ( ctrl-cmd-e ) Replace active narrow-editor's query with cursor word.narrow:previous-query-history: ( ctrl-cmd-[ ) Replace active narrow-editor's query with previous history entry.narrow:next-query-history: ( ctrl-cmd-] ) Replace active narrow-editor's query with next history entry.No keymaps are provided
narrow:scannarrow:scan-by-current-wordnarrow:foldnarrow:fold-by-current-wordnarrow:search: ag search. need install by your self.narrow:search-by-current-wordnarrow:search-current-projectnarrow:search-current-project-by-current-wordnarrow:atom-scannarrow:atom-scan-by-current-wordnarrow:symbolsnarrow:symbols-by-current-wordnarrow:project-symbols:narrow:project-symbols-by-current-word:narrow:git-diff-allThe !vmp followed by keymap means "which keymap is not available for vim-mode-plus user".
If you want use these keymap with vim-mode-plus, set it by yourself.
See Wiki
core:confirm: ( enter ) Close narrow-editornarrow-ui:confirm-keep-open: keep open narrow-editornarrow-ui:open-here: Open item at same pane of UI's pane.narrow-ui:preview-item: Preview currently selected item manually( you don't need in most case ).narrow-ui:preview-next-item: ( tab ) Preview next-item without moving cursor from narrow-editor's query prompt.narrow-ui:preview-previous-item: ( shift-tab ) Preview next-item without moving cursor from narrow-editor's query prompt.narrow-ui:toggle-auto-preview: ( ctrl-r for non-vim-mode-plus user) Disable/enable auto-preview for this narrow-editor.narrow-ui:move-to-prompt: ctrl-cmd-inarrow-ui:stop-insert: escapenarrow-ui:update-real-file: Apply changes made in narrow-editor to real-file.( edit in narrow-editor then save it to real file. )narrow-ui:protect: No keymap by default, Protect narrow-editor from being destroyed by narrow:close( ctrl-g ).narrow-ui:exclude-file: backspace, Exclude items which matches filePath of currently selected item's.narrow-ui:clear-excluded-files: ctrl-backspace, Clear excluded files list.narrow-ui:select-files: cmd-backspace, interactively select which filePath's items to appear on narrow-editor.narrow-ui:toggle-search-whole-word: alt-cmd-wnarrow-ui:toggle-search-ignore-case: alt-cmd-cnarrow-ui:toggle-search-use-regex: alt-cmd-/narrow-ui:start-insert: I(!vmp), a(!vmp)narrow-ui:move-to-next-file-item: n(!vmp)narrow-ui:move-to-previous-file-item: p(!vmp)narrow-ui:relocate: No keymap by default, Switch location where ui opened between center workspace and bottom dock.No keymap to invoke narrow provider(e.g narrow:scan).
Start it from command-palette or set keymap in keymap.cson.
config.cson narrow:
SelectFiles:
rememberQuery: true
confirmOnUpdateRealFile: falsekeymap.csonExplanation of my keymap.
cmd-f: To focus to narrow-editor AND focus-back to original-editorcmd-i: To focus to narrow-editor's prompt AND focus-back to original-editorcmd-e:
narrow-edior on workspace: start narrow:search-by-current-word.narrow-edior: query-current-word( by default keymap).
narrow-edior's query with cursor-word.cmd-[: narrow:previous-query-history Recall previous historycmd-]: narrow:next-query-history, Recall next historyctrl-g: Close narrow-editor from wherever.tab, shift-tab: to move to next/previous item.;: confirm current-item without closing narrow-editor, I can close narrow-editor by ctrl-g.# From outside of narrow-editor
# -------------------------
# `cmd-e` start `search-by-current-word` only when workspace does NOT have `narrow-editor`.
# NOTE: When workspace.has-narrow, `cmd-e` is mapped to `query-current-word` by default.
'atom-workspace:not(.has-narrow) atom-text-editor.vim-mode-plus:not(.insert-mode)':
'cmd-e': 'narrow:search-by-current-word'
'atom-text-editor.vim-mode-plus:not(.insert-mode)':
'ctrl-z': 'narrow:reopen'
'space f': 'narrow:fold'
'cmd-o': 'narrow:symbols-by-current-word'
'cmd-shift-o': 'narrow:project-symbols-by-current-word'
'cmd-r': 'narrow:symbols' # Override default cmd-r
'cmd-shift-r': 'narrow:project-symbols' # Override default cmd-shift-r
'space l': 'narrow:scan'
'cmd-l': 'narrow:scan-by-current-word'
'space s': 'narrow:search'
'space G': 'narrow:git-diff-all'
# When workspace has narrow-editor
'atom-workspace.has-narrow atom-text-editor.vim-mode-plus.normal-mode':
'cmd-f': 'narrow:focus' # focus to narrow-editor
'cmd-i': 'narrow:focus-prompt' # focus to prompt of narrow-editor
# Following three command have ctrl- prefixed by default to avoid conflicts.
# But I don' care conflict, prefer more accessible keymap.
'cmd-[': 'narrow:previous-query-history'
'cmd-]': 'narrow:next-query-history'
'cmd-e': 'narrow:query-current-word'
# narrow-editor regardless of mode of vim
'atom-text-editor.narrow.narrow-editor[data-grammar="source narrow"]':
'cmd-f': 'narrow:focus'
'cmd-i': 'narrow:focus-prompt' # cmd-i to return to calling editor.
# Danger: apply change on narrow-editor to real file by `cmd-s`.
'cmd-s': 'narrow-ui:update-real-file'
# Move ui in between bottom dock and center workspace.
'cmd-t': 'narrow-ui:relocate'
'atom-workspace.has-narrow atom-text-editor.vim-mode-plus.normal-mode,
atom-workspace.has-narrow atom-text-editor.vim-mode-plus.visual-mode':
'cmd-e': 'narrow:query-current-word' # set current word as query of active ui.
'atom-text-editor.narrow.narrow-editor.vim-mode-plus.normal-mode':
'g g': 'narrow-ui:move-to-prompt'
's': 'narrow-ui:select-files'
';': 'narrow-ui:confirm-keep-open'
'n': 'narrow-ui:move-to-next-file-item'
'p': 'narrow-ui:move-to-previous-file-item'"*":
"autocomplete-plus":
suppressActivationForEditorClasses: [
# snip
"narrow"
]
# snip
"vim-mode-plus":
highlightSearchExcludeScopes: [
"narrow"
]vim-mode-plus.automaticallyEscapeInsertModeOnActivePaneItemChangesearch provider cause mode-change from insert-mode to normal-mode.Learn keymap available as default.
e.g. You can move to next or previous item by tab, shift-tab(for this to work, you need vim-mode-plus v0.81.0 or later).
If you are vim-mode-plus user.
Following command are available from vim-mode-plus's search(/ or ?) mini-editor.
vim-mode-plus-user:narrow:scanvim-mode-plus-user:narrow:searchvim-mode-plus-user:narrow:search-current-projectvim-mode-plus-user:narrow:atom-scani, a in normal-mode move cursor to prompt line.direct-edit and update-real-file use other key to enter insert-mode.I is intentionally mapped to vim-mode-plus:activate-insert-mode which is normally mapped to i.
I.I, you can start insert-mode by A, c etc..In daily editing, I use.
scan, search, git-diff-all, symbols.
Why I'm not using others? reason is here.
fold: Since it similar to symbols.atom-scan: it is provided for windows user who can't use search(need ag or rg).narrow-editor by normal cmd-w(core:close). Why I need narrow:close? What's the difference?The biggest difference is narrow:close restore editor state(scrollTop, fold, active pane item) if user did only preview from startup.
narrow:close: Close narrow-editor and restore editor state when it appropriate. Also can close narrow-editor regardless of current active-editor.core:close: Just destroy narrow-editor.Use whichever you want accordingly.
I normally use narrow:close and occasionally use core:close such like when I want to focus next-pane-item of narrow-editor(so don't want to restore focus to narrow initiated editor).
narrow:searchbackspace on itembackspace to exclude particular file from result.ctrl-backspace clear excluded file list and refreshnarrow-editor and you are in read-only-modeselect-files providerselect-files by cmd-backspace or clicking folder-icon on control-bar.editor by narrow:search, you see lots of editor mached itemsselect-files, all file paths are listed as item.md on query, you see markdown filepath that macheed md.!, now your query is md!, this is treated as all files not matching md.enter to confirm.select-files.spec folder, you can add spec/! as query..js file only, you can set query to .js.next-file, previous-filen, p in read-only mode.narrow:symbols always shows up at right-most pane and don't want to close.narrow:symbols( or maybe you want to use narrow:fold )narrow-editor by drag and drop to the place where you want.Narrow Ui: Protect. Now narrow-editor protected.narrow-editor is not closed by ctrl-g( narrow:close ), and not closed by confirm by enter.cmd-w or close button on tab.