Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expand functionality of <CR> mapping #1011

Merged
merged 19 commits into from
Jul 2, 2019
Merged

Expand functionality of <CR> mapping #1011

merged 19 commits into from
Jul 2, 2019

Conversation

PhilRunninger
Copy link
Member

@PhilRunninger PhilRunninger commented Jun 30, 2019

Description of Changes

Closes #551
Closes #631

This change creates a customizable key mapping that can open files or directories in a way that is different from the normal commands. By default, it is set to <CR>, the Enter key, and its action is to do the same thing as the o key. But the key assigned to this action, and the options given to the internal NERDTree open functions, can be changed. The documentation describes the values that can be set in these options.

This pull request addresses two outstanding issues.

#551 - Use Enter to open a file in a new tab. To do this, add the following to your .vimrc.

let NERDTreeCustomOpenArgs = {'file':{'where':'t'}}

#631 - Use Enter to open a file in the current tab, even if open in another one. This requires the reuse flag to be overridden, and is done with this code in your .vimrc.

let NERDTreeCustomOpenArgs = {'file': {'reuse':'currenttab', 'where':'p', 'keepopen':1, 'stay':1}}

Many other such customizations are possible, and are documented in the NERDTree help file.


New Version Info

  • Derive a new version number. Increment the:
    • MAJOR version when you make incompatible API changes,
    • MINOR version when you add functionality in a backwards-compatible manner, and
    • PATCH version when you make backwards-compatible bug fixes.
  • Update version number in autoload/nerdtree.vim
  • Update the ChangeLog, following this format/example:
    MAJOR.MINOR...
    - **.PATCH**: PR Title (Author) #PR Number
    
    ### 5.1...
    - **.1**: Update Changelog and create PR Template (PhilRunninger) #1007
    - **.0**: Too many changes for one patch...
    

Phil Runninger (mac) added 19 commits June 28, 2019 01:47
"Default Open" means to open a file with the Enter key (which of course
can be changed.) The key can be changed in the vimrc, and there is a
variable for specifying the Opener parameters for opening the node. This
lets the user decide whether Enter (or another key) will open a file in
the current tab or a new one, and whether or not to open the file again
in the tab or jump to a window where the file is already open.
<CR> will be defined like all the other keys, in plugin/NERD_tree.vim
Three separate functions handle directories, files, and bookmarks.
@PhilRunninger PhilRunninger merged commit cce6fb3 into master Jul 2, 2019
@PhilRunninger PhilRunninger deleted the 551_and_631 branch July 2, 2019 02:13
@andykog
Copy link

andykog commented Jul 3, 2019

@PhilRunninger, started getting this error on attempt to open my bookmarks:

E121: Undefined variable: node
Error detected while processing function nerdtree#ui_glue#invokeKeyMap[1]..82[43]..81[3]..<SNR>73_customOpenBookmark:

Vim info:

VIM - Vi IMproved 8.1 (2018 May 18, compiled Feb  5 2019 07:31:26)
macOS version
Included patches: 1-873
Compiled by Homebrew
Huge version with MacVim GUI.  Features included (+) or not (-):
+acl               +cmdline_hist      +ex_extra          +jumplist          +mouse_dec         +path_extra        +startuptime       +title             -X11
+arabic            +cmdline_info      +extra_search      +keymap            -mouse_gpm         +perl              +statusline        +toolbar           -xfontset
+autocmd           +comments          +farsi             +lambda            -mouse_jsbterm     +persistent_undo   -sun_workshop      +transparency      +xim
+autochdir         +conceal           +file_in_path      +langmap           +mouse_netterm     +postscript        +syntax            +user_commands     -xpm
-autoservername    +cryptv            +find_in_path      +libcall           +mouse_sgr         +printer           +tag_binary        +vartabs           -xsmp
+balloon_eval      +cscope            +float             +linebreak         -mouse_sysmouse    +profile           +tag_old_static    +vertsplit         -xterm_clipboard
+balloon_eval_term +cursorbind        +folding           +lispindent        +mouse_urxvt       -python            -tag_any_white     +virtualedit       -xterm_save
+browse            +cursorshape       -footer            +listcmds          +mouse_xterm       +python3           +tcl               +visual
++builtin_terms    +dialog_con_gui    +fork()            +localmap          +multi_byte        +quickfix          +termguicolors     +visualextra
+byte_offset       +diff              +fullscreen        +lua               +multi_lang        +reltime           +terminal          +viminfo
+channel           +digraphs          -gettext           +menu              -mzscheme          +rightleft         +terminfo          +vreplace
+cindent           +dnd               -hangul_input      +mksession         +netbeans_intg     +ruby              +termresponse      +wildignore
+clientserver      -ebcdic            +iconv             +modify_fname      +num64             +scrollbind        +textobjects       +wildmenu
+clipboard         +emacs_tags        +insert_expand     +mouse             +odbeditor         +signs             +textprop          +windows
+cmdline_compl     +eval              +job               +mouseshape        +packages          +smartindent       +timers            +writebackup

@PhilRunninger
Copy link
Member Author

@andykog , This was discovered about 4 hours ago, and PR #1014 was submitted. I'll get the fix out soon.

@andykog
Copy link

andykog commented Jul 3, 2019

Cool, thank you very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Same file on multiple tabs support FEATURE REQUEST: Open file in tree in new tab when return
2 participants