From 768c72a3edf3825e7fd5c64a460b7cd6b7e475d5 Mon Sep 17 00:00:00 2001 From: amix Date: Tue, 8 Dec 2015 10:19:59 -0300 Subject: [PATCH 1/5] Default to Hack font --- vimrcs/basic.vim | 2 +- vimrcs/extended.vim | 6 +++--- vimrcs/plugins_config.vim | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/vimrcs/basic.vim b/vimrcs/basic.vim index f81f3e13..198daa4b 100644 --- a/vimrcs/basic.vim +++ b/vimrcs/basic.vim @@ -229,7 +229,7 @@ map h map l " Close the current buffer -map bd :Bclose +map bd :Bclose:tabclosegT " Close all the buffers map ba :bufdo bd diff --git a/vimrcs/extended.vim b/vimrcs/extended.vim index 255a31cf..9ae020dd 100644 --- a/vimrcs/extended.vim +++ b/vimrcs/extended.vim @@ -10,11 +10,11 @@ """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " Set font according to system if has("mac") || has("macunix") - set gfn=Source\ Code\ Pro:h15,Menlo:h15 + set gfn=Hack:h14,Source\ Code\ Pro:h15,Menlo:h15 elseif has("win16") || has("win32") - set gfn=Source\ Code\ Pro:h12,Bitstream\ Vera\ Sans\ Mono:h11 + set gfn=Hack:h14,Source\ Code\ Pro:h12,Bitstream\ Vera\ Sans\ Mono:h11 elseif has("linux") - set gfn=Source\ Code\ Pro:h12,Bitstream\ Vera\ Sans\ Mono:h11 + set gfn=Hack:h14,Source\ Code\ Pro:h12,Bitstream\ Vera\ Sans\ Mono:h11 elseif has("unix") set gfn=Monospace\ 11 endif diff --git a/vimrcs/plugins_config.vim b/vimrcs/plugins_config.vim index bbff26f5..ab401dc2 100644 --- a/vimrcs/plugins_config.vim +++ b/vimrcs/plugins_config.vim @@ -122,7 +122,7 @@ let g:syntastic_javascript_checkers = ['jshint'] " Custom CoffeeScript SyntasticCheck func! SyntasticCheckCoffeescript() let l:filename = substitute(expand("%:p"), '\(\w\+\)\.coffee', '.coffee.\1.js', '') - execute "e " . l:filename + execute "tabedit " . l:filename execute "SyntasticCheck" execute "Errors" endfunc From 3b37bba6cdecf0f8c13af06d19732e98cc72b089 Mon Sep 17 00:00:00 2001 From: amix Date: Tue, 8 Dec 2015 10:20:04 -0300 Subject: [PATCH 2/5] Updated plugins --- sources_non_forked/ack.vim/autoload/ack.vim | 2 +- sources_non_forked/ag.vim/README.md | 4 +- sources_non_forked/ag.vim/autoload/ag.vim | 22 +- sources_non_forked/ctrlp.vim/readme.md | 3 + sources_non_forked/goyo.vim/autoload/goyo.vim | 15 +- sources_non_forked/nerdtree/CHANGELOG | 153 +++ sources_non_forked/nerdtree/LICENCE | 13 + sources_non_forked/nerdtree/README.markdown | 21 +- .../nerdtree/autoload/nerdtree.vim | 8 +- .../nerdtree/autoload/nerdtree/ui_glue.vim | 70 +- sources_non_forked/nerdtree/doc/NERD_tree.txt | 211 +--- .../nerdtree/lib/nerdtree/bookmark.vim | 57 +- .../nerdtree/lib/nerdtree/creator.vim | 103 +- .../nerdtree/lib/nerdtree/nerdtree.vim | 74 +- .../nerdtree/lib/nerdtree/notifier.vim | 4 +- .../nerdtree/lib/nerdtree/opener.vim | 29 +- .../nerdtree/lib/nerdtree/path.vim | 44 +- .../nerdtree/lib/nerdtree/tree_dir_node.vim | 109 +- .../nerdtree/lib/nerdtree/tree_file_node.vim | 139 +-- .../nerdtree/lib/nerdtree/ui.vim | 141 ++- .../nerdtree_plugin/exec_menuitem.vim | 1 - .../nerdtree/nerdtree_plugin/fs_menu.vim | 77 +- .../nerdtree/plugin/NERD_tree.vim | 17 +- .../nerdtree/syntax/nerdtree.vim | 43 +- sources_non_forked/syntastic/CONTRIBUTING.md | 6 +- sources_non_forked/syntastic/README.markdown | 43 +- .../syntastic/autoload/syntastic/c.vim | 32 +- .../autoload/syntastic/preprocess.vim | 296 ++++-- .../syntastic/autoload/syntastic/util.vim | 112 +- .../syntastic/doc/syntastic.txt | 178 ++-- .../syntastic/plugin/syntastic.vim | 94 +- .../syntastic/plugin/syntastic/checker.vim | 33 +- .../syntastic/plugin/syntastic/loclist.vim | 28 +- .../syntastic/plugin/syntastic/registry.vim | 27 +- .../syntax_checkers/ansible/ansible_lint.vim | 52 + .../{snowcrash.vim => drafter.vim} | 16 +- .../syntastic/syntax_checkers/asm/gcc.vim | 9 +- .../syntastic/syntax_checkers/bro/bro.vim | 8 +- .../syntax_checkers/c/clang_check.vim | 3 + .../syntax_checkers/c/clang_tidy.vim | 3 + .../syntax_checkers/coffee/coffeelint.vim | 9 +- .../syntastic/syntax_checkers/coq/coqtop.vim | 2 +- .../syntax_checkers/cpp/clang_check.vim | 2 - .../syntax_checkers/cpp/clang_tidy.vim | 2 - .../syntax_checkers/cpp/cppcheck.vim | 2 - .../syntastic/syntax_checkers/cpp/oclint.vim | 2 - .../syntastic/syntax_checkers/cpp/pc_lint.vim | 2 - .../syntastic/syntax_checkers/css/phpcs.vim | 2 - .../syntastic/syntax_checkers/css/recess.vim | 2 - .../syntax_checkers/css/stylelint.vim | 43 + .../syntax_checkers/docbk/xmllint.vim | 2 - .../dockerfile/dockerfile_lint.vim | 53 + .../syntastic/syntax_checkers/go/go.vim | 13 +- .../syntax_checkers/go/gometalinter.vim | 53 + .../syntastic/syntax_checkers/go/gotype.vim | 4 +- .../syntastic/syntax_checkers/go/govet.vim | 2 +- .../syntax_checkers/haskell/ghc-mod.vim | 9 +- .../syntax_checkers/haskell/hlint.vim | 1 + .../syntax_checkers/jade/jade_lint.vim | 40 + .../syntax_checkers/java/checkstyle.vim | 36 +- .../syntastic/syntax_checkers/java/javac.vim | 51 +- .../syntax_checkers/javascript/eslint.vim | 32 +- .../syntax_checkers/javascript/jsxhint.vim | 4 + .../syntax_checkers/javascript/standard.vim | 10 +- .../syntastic/syntax_checkers/nix/nix.vim | 9 +- .../syntastic/syntax_checkers/nroff/igor.vim | 2 - .../syntastic/syntax_checkers/objc/oclint.vim | 2 - .../syntax_checkers/objcpp/oclint.vim | 2 - .../syntax_checkers/perl/podchecker.vim | 2 - .../syntastic/syntax_checkers/python/mypy.vim | 5 +- .../syntastic/syntax_checkers/qml/qmllint.vim | 39 + .../syntastic/syntax_checkers/r/lintr.vim | 81 ++ .../syntastic/syntax_checkers/rmd/lintr.vim | 23 + .../syntastic/syntax_checkers/rst/sphinx.vim | 8 +- .../syntastic/syntax_checkers/ruby/flog.vim | 72 ++ .../syntastic/syntax_checkers/scss/sass.vim | 2 - .../syntastic/syntax_checkers/scss/sassc.vim | 2 - .../syntax_checkers/slim/slim_lint.vim | 39 + .../syntastic/syntax_checkers/sql/sqlint.vim | 50 + .../syntax_checkers/stylus/stylint.vim | 43 + .../syntastic/syntax_checkers/text/igor.vim | 2 - .../syntax_checkers/typescript/eslint.vim | 23 + .../syntax_checkers/typescript/tsc.vim | 5 + .../syntax_checkers/typescript/tslint.vim | 6 +- .../syntax_checkers/verilog/iverilog.vim | 38 + .../syntastic/syntax_checkers/vhdl/vcom.vim | 55 + .../syntastic/syntax_checkers/vim/vimlint.vim | 2 + .../syntax_checkers/xhtml/jshint.vim | 2 - .../syntax_checkers/xquery/basex.vim | 51 + .../syntax_checkers/xslt/xmllint.vim | 2 - .../syntastic/syntax_checkers/yaml/jsyaml.vim | 1 + sources_non_forked/tlib/autoload/tlib.vim | 5 +- .../tlib/autoload/tlib/Filter_cnf.vim | 4 +- .../tlib/autoload/tlib/Filter_glob.vim | 8 +- .../tlib/autoload/tlib/Object.vim | 11 +- .../tlib/autoload/tlib/Test.vim | 10 +- .../tlib/autoload/tlib/TestChild.vim | 10 +- .../tlib/autoload/tlib/World.vim | 53 +- .../tlib/autoload/tlib/agent.vim | 74 +- sources_non_forked/tlib/autoload/tlib/arg.vim | 267 ++++- .../tlib/autoload/tlib/assert.vim | 44 + .../tlib/autoload/tlib/balloon.vim | 25 +- .../tlib/autoload/tlib/buffer.vim | 61 +- .../tlib/autoload/tlib/cache.vim | 55 +- .../tlib/autoload/tlib/char.vim | 10 +- sources_non_forked/tlib/autoload/tlib/cmd.vim | 16 +- .../tlib/autoload/tlib/comments.vim | 33 +- .../tlib/autoload/tlib/date.vim | 47 +- .../tlib/autoload/tlib/dictionary.vim | 15 + sources_non_forked/tlib/autoload/tlib/dir.vim | 12 +- .../tlib/autoload/tlib/eval.vim | 35 +- .../tlib/autoload/tlib/file.vim | 117 ++- .../tlib/autoload/tlib/hook.vim | 10 +- .../tlib/autoload/tlib/input.vim | 50 +- .../tlib/autoload/tlib/list.vim | 7 +- .../tlib/autoload/tlib/loclist.vim | 13 + .../tlib/autoload/tlib/notify.vim | 9 +- .../tlib/autoload/tlib/progressbar.vim | 16 +- sources_non_forked/tlib/autoload/tlib/qfl.vim | 314 ++++++ sources_non_forked/tlib/autoload/tlib/rx.vim | 15 +- .../tlib/autoload/tlib/scratch.vim | 13 +- .../tlib/autoload/tlib/string.vim | 18 +- .../tlib/autoload/tlib/syntax.vim | 17 +- sources_non_forked/tlib/autoload/tlib/sys.vim | 170 ++- sources_non_forked/tlib/autoload/tlib/tab.vim | 10 +- sources_non_forked/tlib/autoload/tlib/tag.vim | 10 +- .../tlib/autoload/tlib/time.vim | 29 +- .../tlib/autoload/tlib/trace.vim | 117 +++ .../tlib/autoload/tlib/type.vim | 58 +- sources_non_forked/tlib/autoload/tlib/var.vim | 10 +- sources_non_forked/tlib/autoload/tlib/vcs.vim | 55 +- sources_non_forked/tlib/autoload/tlib/win.vim | 10 +- sources_non_forked/tlib/doc/tlib.txt | 393 ++++++- sources_non_forked/tlib/plugin/02tlib.vim | 70 +- sources_non_forked/vim-airline/README.md | 4 + .../vim-airline/autoload/airline.vim | 3 + .../autoload/airline/extensions.vim | 4 + .../autoload/airline/extensions/capslock.vim | 2 +- .../airline/extensions/tabline/autoshow.vim | 2 +- .../airline/extensions/whitespace.vim | 11 +- .../autoload/airline/extensions/wordcount.vim | 40 + .../autoload/airline/themes/behelit.vim | 1 + .../autoload/airline/themes/term.vim | 92 ++ .../vim-airline/doc/airline.txt | 16 +- .../vim-commentary/README.markdown | 2 +- .../vim-commentary/plugin/commentary.vim | 13 +- sources_non_forked/vim-flake8/LICENSE | 24 + sources_non_forked/vim-flake8/README.mdown | 169 +++ .../vim-flake8/autoload/flake8.vim | 250 +++++ .../vim-flake8/ftplugin/python_flake8.vim | 55 + .../vim-fugitive/doc/fugitive.txt | 42 +- .../vim-fugitive/plugin/fugitive.vim | 196 ++-- sources_non_forked/vim-go/README.md | 107 +- sources_non_forked/vim-go/autoload/go/cmd.vim | 179 ++-- .../vim-go/autoload/go/complete.vim | 12 +- .../vim-go/autoload/go/errcheck.vim | 54 - sources_non_forked/vim-go/autoload/go/fmt.vim | 78 +- .../vim-go/autoload/go/import.vim | 47 +- .../vim-go/autoload/go/lint.vim | 203 +++- .../vim-go/autoload/go/list.vim | 67 ++ .../vim-go/autoload/go/oracle.vim | 124 ++- .../vim-go/autoload/go/package.vim | 3 +- .../vim-go/autoload/go/path.vim | 8 +- .../vim-go/autoload/go/rename.vim | 16 +- .../vim-go/autoload/go/tool.vim | 26 +- .../vim-go/autoload/go/util.vim | 12 +- sources_non_forked/vim-go/compiler/go.vim | 21 +- sources_non_forked/vim-go/doc/vim-go.txt | 218 +++- .../vim-go/ftdetect/gofiletype.vim | 2 +- .../vim-go/ftplugin/go/commands.vim | 78 +- .../vim-go/ftplugin/go/mappings.vim | 52 + sources_non_forked/vim-go/plugin/go.vim | 6 + sources_non_forked/vim-go/syntax/go.vim | 122 ++- .../vim-go/syntax/gotexttmpl.vim | 6 +- .../vim-indent-object/doc/indent-object.txt | 6 + .../plugin/indent-object.vim | 18 +- sources_non_forked/vim-less/ftplugin/less.vim | 2 +- .../vim-markdown/README.markdown | 5 + .../vim-markdown/syntax/markdown.vim | 2 +- .../vim-multiple-cursors/README.md | 14 +- .../doc/multiple_cursors.txt | 2 +- .../plugin/multiple_cursors.vim | 10 +- .../spec/benchmark_spec.rb | 1 + .../vim-snipmate/Contributors.md | 1 + .../vim-snipmate/autoload/snipMate.vim | 23 +- .../vim-snipmate/autoload/snipmate/legacy.vim | 2 +- .../vim-snipmate/doc/snipMate.txt | 25 +- sources_non_forked/vim-snippets/README.md | 19 + .../vim-snippets/UltiSnips/all.snippets | 72 +- .../vim-snippets/UltiSnips/c.snippets | 30 +- ...smine.snippets => coffee-jasmine.snippets} | 0 .../UltiSnips/coffee-react.snippets | 80 ++ .../vim-snippets/UltiSnips/coffee.snippets | 4 + .../vim-snippets/UltiSnips/django.snippets | 385 ++++--- .../vim-snippets/UltiSnips/eruby.snippets | 68 +- .../vim-snippets/UltiSnips/haskell.snippets | 68 -- .../UltiSnips/htmldjango.snippets | 298 +++++- ...r.snippets => javascript-angular.snippets} | 0 ...ber.snippets => javascript-ember.snippets} | 0 ...e.snippets => javascript-jasmine.snippets} | 74 +- ...doc.snippets => javascript-jsdoc.snippets} | 0 .../UltiSnips/javascript-node.snippets | 65 ++ .../UltiSnips/javascript-openui5.snippets | 205 ++++ .../UltiSnips/javascript.snippets | 2 +- .../vim-snippets/UltiSnips/lua.snippets | 59 ++ .../vim-snippets/UltiSnips/pandoc.snippets | 2 +- ..._laravel.snippets => php-laravel.snippets} | 0 ..._phpunit.snippets => php-phpunit.snippets} | 0 ...ymfony2.snippets => php-symfony2.snippets} | 0 .../vim-snippets/UltiSnips/python.snippets | 62 +- .../vim-snippets/UltiSnips/rust.snippets | 6 + .../vim-snippets/UltiSnips/scss.snippets | 57 - .../UltiSnips/supercollider.snippets | 10 + .../UltiSnips/typescript.snippets | 3 + .../vim-snippets/pythonx/vimsnippets.py | 72 ++ .../vim-snippets/snippets/c.snippets | 27 +- .../vim-snippets/snippets/cpp.snippets | 8 + .../vim-snippets/snippets/elixir.snippets | 6 +- .../vim-snippets/snippets/eruby.snippets | 24 +- .../vim-snippets/snippets/haskell.snippets | 47 +- .../vim-snippets/snippets/html.snippets | 126 +-- .../vim-snippets/snippets/htmldjango.snippets | 3 +- .../javascript/javascript.es6.snippets | 22 + .../snippets/javascript/javascript.snippets | 22 +- .../vim-snippets/snippets/perl6.snippets | 116 ++ .../vim-snippets/snippets/php.snippets | 3 +- .../vim-snippets/snippets/puppet.snippets | 2 +- .../vim-snippets/snippets/python.snippets | 6 + .../vim-snippets/snippets/rst.snippets | 31 +- .../vim-snippets/snippets/ruby.snippets | 10 +- .../vim-snippets/snippets/rust.snippets | 6 +- .../vim-snippets/snippets/scss.snippets | 4 +- .../vim-snippets/snippets/simplemvcf.snippets | 122 +++ .../vim-snippets/snippets/stylus.snippets | 994 +++++++++--------- .../snippets/supercollider.snippets | 22 + .../vim-snippets/snippets/tex.snippets | 15 +- sources_non_forked/vim-snippets/tests.sh | 14 +- .../vim-surround/plugin/surround.vim | 8 +- update_plugins.py | 1 + 239 files changed, 8132 insertions(+), 3198 deletions(-) create mode 100644 sources_non_forked/nerdtree/CHANGELOG create mode 100644 sources_non_forked/nerdtree/LICENCE create mode 100644 sources_non_forked/syntastic/syntax_checkers/ansible/ansible_lint.vim rename sources_non_forked/syntastic/syntax_checkers/apiblueprint/{snowcrash.vim => drafter.vim} (82%) create mode 100644 sources_non_forked/syntastic/syntax_checkers/css/stylelint.vim create mode 100644 sources_non_forked/syntastic/syntax_checkers/dockerfile/dockerfile_lint.vim create mode 100644 sources_non_forked/syntastic/syntax_checkers/go/gometalinter.vim create mode 100644 sources_non_forked/syntastic/syntax_checkers/jade/jade_lint.vim create mode 100644 sources_non_forked/syntastic/syntax_checkers/qml/qmllint.vim create mode 100644 sources_non_forked/syntastic/syntax_checkers/r/lintr.vim create mode 100644 sources_non_forked/syntastic/syntax_checkers/rmd/lintr.vim create mode 100644 sources_non_forked/syntastic/syntax_checkers/ruby/flog.vim create mode 100644 sources_non_forked/syntastic/syntax_checkers/slim/slim_lint.vim create mode 100644 sources_non_forked/syntastic/syntax_checkers/sql/sqlint.vim create mode 100644 sources_non_forked/syntastic/syntax_checkers/stylus/stylint.vim create mode 100644 sources_non_forked/syntastic/syntax_checkers/typescript/eslint.vim create mode 100644 sources_non_forked/syntastic/syntax_checkers/verilog/iverilog.vim create mode 100644 sources_non_forked/syntastic/syntax_checkers/vhdl/vcom.vim create mode 100644 sources_non_forked/syntastic/syntax_checkers/xquery/basex.vim create mode 100644 sources_non_forked/tlib/autoload/tlib/assert.vim create mode 100644 sources_non_forked/tlib/autoload/tlib/dictionary.vim create mode 100644 sources_non_forked/tlib/autoload/tlib/loclist.vim create mode 100644 sources_non_forked/tlib/autoload/tlib/qfl.vim create mode 100644 sources_non_forked/tlib/autoload/tlib/trace.vim create mode 100644 sources_non_forked/vim-airline/autoload/airline/extensions/wordcount.vim create mode 100644 sources_non_forked/vim-airline/autoload/airline/themes/term.vim create mode 100644 sources_non_forked/vim-flake8/LICENSE create mode 100644 sources_non_forked/vim-flake8/README.mdown create mode 100644 sources_non_forked/vim-flake8/autoload/flake8.vim create mode 100644 sources_non_forked/vim-flake8/ftplugin/python_flake8.vim delete mode 100644 sources_non_forked/vim-go/autoload/go/errcheck.vim create mode 100644 sources_non_forked/vim-go/autoload/go/list.vim create mode 100644 sources_non_forked/vim-go/ftplugin/go/mappings.vim rename sources_non_forked/vim-snippets/UltiSnips/{coffee_jasmine.snippets => coffee-jasmine.snippets} (100%) create mode 100644 sources_non_forked/vim-snippets/UltiSnips/coffee-react.snippets delete mode 100644 sources_non_forked/vim-snippets/UltiSnips/haskell.snippets rename sources_non_forked/vim-snippets/UltiSnips/{javascript_angular.snippets => javascript-angular.snippets} (100%) rename sources_non_forked/vim-snippets/UltiSnips/{javascript_ember.snippets => javascript-ember.snippets} (100%) rename sources_non_forked/vim-snippets/UltiSnips/{javascript_jasmine.snippets => javascript-jasmine.snippets} (73%) rename sources_non_forked/vim-snippets/UltiSnips/{javascript_jsdoc.snippets => javascript-jsdoc.snippets} (100%) create mode 100644 sources_non_forked/vim-snippets/UltiSnips/javascript-node.snippets create mode 100644 sources_non_forked/vim-snippets/UltiSnips/javascript-openui5.snippets rename sources_non_forked/vim-snippets/UltiSnips/{php_laravel.snippets => php-laravel.snippets} (100%) rename sources_non_forked/vim-snippets/UltiSnips/{php_phpunit.snippets => php-phpunit.snippets} (100%) rename sources_non_forked/vim-snippets/UltiSnips/{php_symfony2.snippets => php-symfony2.snippets} (100%) delete mode 100644 sources_non_forked/vim-snippets/UltiSnips/scss.snippets create mode 100644 sources_non_forked/vim-snippets/UltiSnips/supercollider.snippets create mode 100644 sources_non_forked/vim-snippets/UltiSnips/typescript.snippets create mode 100644 sources_non_forked/vim-snippets/snippets/javascript/javascript.es6.snippets create mode 100644 sources_non_forked/vim-snippets/snippets/perl6.snippets create mode 100644 sources_non_forked/vim-snippets/snippets/simplemvcf.snippets create mode 100644 sources_non_forked/vim-snippets/snippets/supercollider.snippets diff --git a/sources_non_forked/ack.vim/autoload/ack.vim b/sources_non_forked/ack.vim/autoload/ack.vim index 12237e4e..814c533b 100644 --- a/sources_non_forked/ack.vim/autoload/ack.vim +++ b/sources_non_forked/ack.vim/autoload/ack.vim @@ -5,7 +5,7 @@ if exists('g:ack_use_dispatch') endif else let g:ack_use_dispatch = 0 -end +endif "----------------------------------------------------------------------------- " Public API diff --git a/sources_non_forked/ag.vim/README.md b/sources_non_forked/ag.vim/README.md index c0e92cbe..21ea504b 100644 --- a/sources_non_forked/ag.vim/README.md +++ b/sources_non_forked/ag.vim/README.md @@ -21,13 +21,13 @@ Vim has various ways of installing plugins, the standard way is in [the document cd ~/.vim/bundle && git clone https://github.com/rking/ag.vim ag && echo "set runtimepath^=~/.vim/bundle/ag" >> ~/.vimrc ``` - Then open vim and rum `:helptags ~/.vim/bundle/ag/doc`. + Then open vim and run `:helptags ~/.vim/bundle/ag/doc`. ### Configuration ### You can specify a custom ag name and path in your .vimrc like so: - let g:agprg=" --vimgrep" + let g:ag_prg=" --vimgrep" You can configure ag.vim to always start searching from your project root instead of the cwd diff --git a/sources_non_forked/ag.vim/autoload/ag.vim b/sources_non_forked/ag.vim/autoload/ag.vim index 6703396b..432ef444 100644 --- a/sources_non_forked/ag.vim/autoload/ag.vim +++ b/sources_non_forked/ag.vim/autoload/ag.vim @@ -1,17 +1,26 @@ " NOTE: You must, of course, install ag / the_silver_searcher -" FIXME: Delete deprecated options below on or after 15-7 (6 months from when they were changed) {{{ +" FIXME: Delete deprecated options below on or after 2016-4 (6 months from when the deprecation warning was added) {{{ if exists("g:agprg") let g:ag_prg = g:agprg + echohl WarningMsg + call input('g:agprg is deprecated and will be removed. Please use g:ag_prg') + echohl None endif if exists("g:aghighlight") let g:ag_highlight = g:aghighlight + echohl WarningMsg + call input('g:aghighlight is deprecated and will be removed. Please use g:ag_highlight') + echohl None endif if exists("g:agformat") let g:ag_format = g:agformat + echohl WarningMsg + call input('g:agformat is deprecated and will be removed. Please use g:ag_format') + echohl None endif " }}} FIXME: Delete the deprecated options above on or after 15-7 (6 months from when they were changed) @@ -79,6 +88,11 @@ function! ag#Ag(cmd, args) let l:grepargs = a:args . join(a:000, ' ') end + if empty(l:grepargs) + echo "Usage: ':Ag {pattern}' (or just :Ag to search for the word under the cursor). See ':help :Ag' for more information." + return + endif + " Format, used to manage column jump if a:cmd =~# '-g$' let s:ag_format_backup=g:ag_format @@ -169,8 +183,12 @@ function! ag#Ag(cmd, args) echom "ag.vim keys: q=quit /e/t/h/v=enter/edit/tab/split/vsplit go/T/H/gv=preview versions of same" endif endif - else + else " Close the split window automatically: + cclose + lclose + echohl WarningMsg echom 'No matches for "'.a:args.'"' + echohl None endif endfunction diff --git a/sources_non_forked/ctrlp.vim/readme.md b/sources_non_forked/ctrlp.vim/readme.md index bcd07c7f..d495fffb 100644 --- a/sources_non_forked/ctrlp.vim/readme.md +++ b/sources_non_forked/ctrlp.vim/readme.md @@ -1,3 +1,6 @@ +#**This project is unmaintained** +**You should use [this fork](https://github.com/ctrlpvim/ctrlp.vim) instead.** + # ctrlp.vim Full path fuzzy __file__, __buffer__, __mru__, __tag__, __...__ finder for Vim. diff --git a/sources_non_forked/goyo.vim/autoload/goyo.vim b/sources_non_forked/goyo.vim/autoload/goyo.vim index 9d3d1eb5..e66c5c14 100644 --- a/sources_non_forked/goyo.vim/autoload/goyo.vim +++ b/sources_non_forked/goyo.vim/autoload/goyo.vim @@ -269,7 +269,9 @@ function! s:goyo_on(dim) if exists('g:goyo_callbacks[0]') call g:goyo_callbacks[0]() endif - silent! doautocmd User GoyoEnter + if exists('#User#GoyoEnter') + doautocmd User GoyoEnter + endif endfunction function! s:goyo_off() @@ -344,6 +346,9 @@ function! s:goyo_off() if goyo_disabled_airline && !exists("#airline") AirlineToggle + " For some reason, Airline requires two refreshes to avoid display + " artifacts + silent! AirlineRefresh silent! AirlineRefresh endif @@ -363,7 +368,9 @@ function! s:goyo_off() if exists('g:goyo_callbacks[1]') call g:goyo_callbacks[1]() endif - silent! doautocmd User GoyoLeave + if exists('#User#GoyoLeave') + doautocmd User GoyoLeave + endif endfunction function! s:relsz(expr, limit) @@ -414,6 +421,10 @@ function! goyo#execute(bang, dim) if exists('#goyo') == 0 call s:goyo_on(a:dim) elseif !empty(a:dim) + if winnr('$') < 5 + call s:goyo_off() + return goyo#execute(a:bang, a:dim) + endif let dim = s:parse_arg(a:dim) if !empty(dim) let t:goyo_dim = dim diff --git a/sources_non_forked/nerdtree/CHANGELOG b/sources_non_forked/nerdtree/CHANGELOG new file mode 100644 index 00000000..2e08dd2a --- /dev/null +++ b/sources_non_forked/nerdtree/CHANGELOG @@ -0,0 +1,153 @@ +Next + - Rename "primary" and "secondary" trees to "tab" and "window" trees. + - Move a bunch of buffer level variables into the NERDTree and UI classes. + - Display cascading dirs on one line to save vertical/horizontal space (@matt-gardner: brainstorming/testing) + - Remove the old style UI - Remove 'NERDTreeDirArrows' option. + - On windows default to + and ~ for expand/collapse directory symbols. + - Lots more refactoring. Move a bunch of b: level vars into b:NERDTree and friends. + +5.0.0 + - Refactor the code significantly: + * Break the classes out into their own files. + * Make the majority of the code OO - previously large parts were + effectively a tangle of "global" methods. + - Add an API to assign flags to nodes. This allows VCS plugins like + https://github.com/Xuyuanp/nerdtree-git-plugin to exist. Thanks to + Xuyuanp for helping design/test/build said API. + - add 'scope' argument to the key map API see :help NERDTreeAddKeyMap() + - add magic [[dir]] and [[file]] flags to NERDTreeIgnore + - add support for custom path filters. See :help NERDTreeAddPathFilter() + - add path listener API. See :help NERDTreePathListenerAPI. + - expand the fs menu functionality to list file properties (PhilRunninger, + apbarrero, JESii) + - make bookmarks work with `~` home shortcuts (hiberabyss) + - show OSX specific fsmenu options in regular vim on mac (evindor) + - make dir arrow icons configurable (PickRelated) + - optimise node sorting performance when opening large dirs (vtsang) + - make the root note render prettier by truncating it at a path slash (gcmt) + - remove NERDChristmasTree option - its always christmas now + - add "cascade" open and closing for dirs containing only another single + dir. See :help NERDTreeCascadeOpenSingleChildDir (pendulm) + + Many other fixes, doc updates and contributions from: + actionshrimp + SchDen + egalpin + cperl82 - many small fixes + toiffel + WoLpH + handcraftedbits + devmanhinton + xiaodili + zhangoose + gastropoda + mixvin + alvan + lucascaton + kelaban + shanesmith + staeff + pendulm + stephenprater + franksort + agrussellknives + AndrewRadev + Twinside + +4.2.0 + - Add NERDTreeDirArrows option to make the UI use pretty arrow chars + instead of the old +~| chars to define the tree structure (sickill) + - shift the syntax highlighting out into its own syntax file (gnap) + - add some mac specific options to the filesystem menu - for macvim + only (andersonfreitas) + - Add NERDTreeMinimalUI option to remove some non functional parts of the + nerdtree ui (camthompson) + - tweak the behaviour of :NERDTreeFind - see :help :NERDTreeFind for the + new behaviour (benjamingeiger) + - if no name is given to :Bookmark, make it default to the name of the + target file/dir (minyoung) + - use 'file' completion when doing copying, create, and move + operations (EvanDotPro) + - lots of misc bug fixes (paddyoloughlin, sdewald, camthompson, Vitaly + Bogdanov, AndrewRadev, mathias, scottstvnsn, kml, wycats, me RAWR!) + +4.1.0 + features: + - NERDTreeFind to reveal the node for the current buffer in the tree, + see |NERDTreeFind|. This effectively merges the FindInNERDTree plugin (by + Doug McInnes) into the script. + - make NERDTreeQuitOnOpen apply to the t/T keymaps too. Thanks to Stefan + Ritter and Rémi Prévost. + - truncate the root node if wider than the tree window. Thanks to Victor + Gonzalez. + + bugfixes: + - really fix window state restoring + - fix some win32 path escaping issues. Thanks to Stephan Baumeister, Ricky, + jfilip1024, and Chris Chambers + +4.0.0 + - add a new programmable menu system (see :help NERDTreeMenu). + - add new APIs to add menus/menu-items to the menu system as well as + custom key mappings to the NERD tree buffer (see :help NERDTreeAPI). + - removed the old API functions + - added a mapping to maximize/restore the size of nerd tree window, thanks + to Guillaume Duranceau for the patch. See :help NERDTree-A for details. + + - fix a bug where secondary nerd trees (netrw hijacked trees) and + NERDTreeQuitOnOpen didnt play nicely, thanks to Curtis Harvey. + - fix a bug where the script ignored directories whose name ended in a dot, + thanks to Aggelos Orfanakos for the patch. + - fix a bug when using the x mapping on the tree root, thanks to Bryan + Venteicher for the patch. + - fix a bug where the cursor position/window size of the nerd tree buffer + wasnt being stored on closing the window, thanks to Richard Hart. + - fix a bug where NERDTreeMirror would mirror the wrong tree + +3.1.1 + - fix a bug where a non-listed no-name buffer was getting created every + time the tree windows was created, thanks to Derek Wyatt and owen1 + - make behave the same as the 'o' mapping + - some helptag fixes in the doc, thanks strull + - fix a bug when using :set nohidden and opening a file where the previous + buf was modified. Thanks iElectric + - other minor fixes + +3.1.0 + New features: + - add mappings to open files in a vsplit, see :help NERDTree-s and :help + NERDTree-gs + - make the statusline for the nerd tree window default to something + hopefully more useful. See :help 'NERDTreeStatusline' + Bugfixes: + - make the hijack netrw functionality work when vim is started with "vim + " (thanks to Alf Mikula for the patch). + - fix a bug where the CWD wasnt being changed for some operations even when + NERDTreeChDirMode==2 (thanks to Lucas S. Buchala) + - add -bar to all the nerd tree :commands so they can chain with other + :commands (thanks to tpope) + - fix bugs when ignorecase was set (thanks to nach) + - fix a bug with the relative path code (thanks to nach) + - fix a bug where doing a :cd would cause :NERDTreeToggle to fail (thanks nach) + + +3.0.1 + Bugfixes: + - fix bugs with :NERDTreeToggle and :NERDTreeMirror when 'hidden + was not set + - fix a bug where :NERDTree would fail if was relative and + didnt start with a ./ or ../ Thanks to James Kanze. + - make the q mapping work with secondary (:e style) trees, + thanks to jamessan + - fix a bunch of small bugs with secondary trees + + More insane refactoring. + +3.0.0 + - hijack netrw so that doing an :edit will put a NERD tree in + the window rather than a netrw browser. See :help 'NERDTreeHijackNetrw' + - allow sharing of trees across tabs, see :help :NERDTreeMirror + - remove "top" and "bottom" as valid settings for NERDTreeWinPos + - change the '' mapping to 'i' + - change the 'H' mapping to 'I' + - lots of refactoring diff --git a/sources_non_forked/nerdtree/LICENCE b/sources_non_forked/nerdtree/LICENCE new file mode 100644 index 00000000..8b1a9d81 --- /dev/null +++ b/sources_non_forked/nerdtree/LICENCE @@ -0,0 +1,13 @@ + DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE + Version 2, December 2004 + +Copyright (C) 2004 Sam Hocevar + +Everyone is permitted to copy and distribute verbatim or modified +copies of this license document, and changing it is allowed as long +as the name is changed. + + DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. You just DO WHAT THE FUCK YOU WANT TO. diff --git a/sources_non_forked/nerdtree/README.markdown b/sources_non_forked/nerdtree/README.markdown index 0317e624..f4ca8607 100644 --- a/sources_non_forked/nerdtree/README.markdown +++ b/sources_non_forked/nerdtree/README.markdown @@ -55,7 +55,7 @@ The following features and functionality are provided by the NERD tree: Installation ------------ -[pathogen.vim](https://github.com/tpope/vim-pathogen) is the recommended way to install nerdtree. +####[pathogen.vim](https://github.com/tpope/vim-pathogen) cd ~/.vim/bundle git clone https://github.com/scrooloose/nerdtree.git @@ -63,6 +63,12 @@ Installation Then reload vim, run `:Helptags`, and check out `:help NERD_tree.txt`. +####[apt-vim](https://github.com/egalpin/apt-vim) + + apt-vim install -y https://github.com/scrooloose/nerdtree.git + + + Faq --- @@ -85,11 +91,13 @@ Stick this in your vimrc: `autocmd vimenter * NERDTree` > How can I open a NERDTree automatically when vim starts up if no files were specified? -Stick this in your vimrc +Stick this in your vimrc: autocmd StdinReadPre * let s:std_in=1 autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif +Note: Now start vim with plain `vim`, not `vim .` + > How can I map a specific key or shortcut to open NERDTree? Stick this in your vimrc to open NERDTree with `Ctrl+n` (you can set whatever key you want): @@ -100,8 +108,15 @@ Stick this in your vimrc to open NERDTree with `Ctrl+n` (you can set whatever ke Stick this in your vimrc: - autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTreeType") && b:NERDTreeType == "primary") | q | endif + autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif > Can I have different highlighting for different file extensions? See here: https://github.com/scrooloose/nerdtree/issues/433#issuecomment-92590696 + +> How can I change default arrows? + +Use these variables in your vimrc. Note that below are default arrow symbols + + let g:NERDTreeDirArrowExpandable = '▸' + let g:NERDTreeDirArrowCollapsible = '▾' diff --git a/sources_non_forked/nerdtree/autoload/nerdtree.vim b/sources_non_forked/nerdtree/autoload/nerdtree.vim index 37d7d105..3ad2a031 100644 --- a/sources_non_forked/nerdtree/autoload/nerdtree.vim +++ b/sources_non_forked/nerdtree/autoload/nerdtree.vim @@ -4,17 +4,17 @@ endif let g:loaded_nerdtree_autoload = 1 function! nerdtree#version() - return '4.2.0' + return '5.0.0' endfunction " SECTION: General Functions {{{1 "============================================================ "FUNCTION: nerdtree#checkForBrowse(dir) {{{2 -"inits a secondary nerd tree in the current buffer if appropriate +"inits a window tree in the current buffer if appropriate function! nerdtree#checkForBrowse(dir) if a:dir != '' && isdirectory(a:dir) - call g:NERDTreeCreator.CreateSecondary(a:dir) + call g:NERDTreeCreator.CreateWindowTree(a:dir) endif endfunction @@ -94,7 +94,7 @@ endfunction " FUNCTION: nerdtree#postSourceActions() {{{2 function! nerdtree#postSourceActions() - call g:NERDTreeBookmark.CacheBookmarks(0) + call g:NERDTreeBookmark.CacheBookmarks(1) call nerdtree#ui_glue#createDefaultBindings() "load all nerdtree plugins diff --git a/sources_non_forked/nerdtree/autoload/nerdtree/ui_glue.vim b/sources_non_forked/nerdtree/autoload/nerdtree/ui_glue.vim index 1f922df1..05f03c96 100644 --- a/sources_non_forked/nerdtree/autoload/nerdtree/ui_glue.vim +++ b/sources_non_forked/nerdtree/autoload/nerdtree/ui_glue.vim @@ -105,7 +105,7 @@ endfunction "FUNCTION: s:activateBookmark() {{{1 "handle the user activating a bookmark function! s:activateBookmark(bm) - call a:bm.activate(!a:bm.path.isDirectory ? {'where': 'p'} : {}) + call a:bm.activate(b:NERDTree, !a:bm.path.isDirectory ? {'where': 'p'} : {}) endfunction " FUNCTION: nerdtree#ui_glue#bookmarkNode(name) {{{1 @@ -140,9 +140,7 @@ endfunction " FUNCTION: s:chRoot(node) {{{1 " changes the current root to the selected one function! s:chRoot(node) - call a:node.makeRoot() - call b:NERDTree.render() - call b:NERDTreeRoot.putCursorHere(0, 0) + call b:NERDTree.changeRoot(a:node) endfunction " FUNCTION: s:nerdtree#ui_glue#chRootCwd() {{{1 @@ -157,7 +155,7 @@ function! nerdtree#ui_glue#chRootCwd() if cwd.str() == g:NERDTreeFileNode.GetRootForTab().path.str() return endif - call s:chRoot(g:NERDTreeDirNode.New(cwd)) + call s:chRoot(g:NERDTreeDirNode.New(cwd, b:NERDTree)) endfunction " FUNCTION: nnerdtree#ui_glue#clearBookmarks(bookmarks) {{{1 @@ -173,6 +171,7 @@ function! nerdtree#ui_glue#clearBookmarks(bookmarks) call bookmark.delete() endfor endif + call b:NERDTree.root.refresh() call b:NERDTree.render() endfunction @@ -208,8 +207,8 @@ endfunction " FUNCTION: s:closeTreeWindow() {{{1 " close the tree window function! s:closeTreeWindow() - if b:NERDTreeType ==# "secondary" && b:NERDTreePreviousBuf != -1 - exec "buffer " . b:NERDTreePreviousBuf + if b:NERDTree.isWinTree() && b:NERDTree.previousBuf() != -1 + exec "buffer " . b:NERDTree.previousBuf() else if winnr("$") > 1 call g:NERDTree.Close() @@ -227,6 +226,7 @@ function! s:deleteBookmark(bm) if nr2char(getchar()) ==# 'y' try call a:bm.delete() + call b:NERDTree.root.refresh() call b:NERDTree.render() redraw catch /^NERDTree/ @@ -241,7 +241,7 @@ endfunction " FUNCTION: s:displayHelp() {{{1 " toggles the help display function! s:displayHelp() - let b:treeShowHelp = b:treeShowHelp ? 0 : 1 + call b:NERDTree.ui.toggleHelp() call b:NERDTree.render() call b:NERDTree.ui.centerView() endfunction @@ -269,27 +269,29 @@ function! s:findAndRevealPath() endtry if p.isUnder(cwd) - call g:NERDTreeCreator.CreatePrimary(cwd.str()) + call g:NERDTreeCreator.CreateTabTree(cwd.str()) else - call g:NERDTreeCreator.CreatePrimary(p.getParent().str()) + call g:NERDTreeCreator.CreateTabTree(p.getParent().str()) endif else if !p.isUnder(g:NERDTreeFileNode.GetRootForTab().path) if !g:NERDTree.IsOpen() - call g:NERDTreeCreator.TogglePrimary('') + call g:NERDTreeCreator.ToggleTabTree('') else call g:NERDTree.CursorToTreeWin() endif - let b:NERDTreeShowHidden = g:NERDTreeShowHidden - call s:chRoot(g:NERDTreeDirNode.New(p.getParent())) + call b:NERDTree.setShowHidden(g:NERDTreeShowHidden) + call s:chRoot(g:NERDTreeDirNode.New(p.getParent(), b:NERDTree)) else if !g:NERDTree.IsOpen() - call g:NERDTreeCreator.TogglePrimary("") + call g:NERDTreeCreator.ToggleTabTree("") endif endif endif call g:NERDTree.CursorToTreeWin() - call b:NERDTreeRoot.reveal(p) + let node = b:NERDTree.root.reveal(p) + call b:NERDTree.render() + call node.putCursorHere(1,0) if p.isUnixHiddenFile() let g:NERDTreeShowHidden = showhidden @@ -312,7 +314,7 @@ function! s:handleLeftClick() endfor if currentNode.path.isDirectory - if startToCur =~# g:NERDTreeUI.MarkupReg() && startToCur =~# '[+~▾▸] \?$' + if startToCur =~# g:NERDTreeUI.MarkupReg() && startToCur =~# '[+~'.g:NERDTreeDirArrowExpandable.g:NERDTreeDirArrowCollapsible.'] \?$' call currentNode.activate() return endif @@ -409,7 +411,7 @@ endfunction " FUNCTION: s:jumpToRoot() {{{1 " moves the cursor to the root node function! s:jumpToRoot() - call b:NERDTreeRoot.putCursorHere(1, 0) + call b:NERDTree.root.putCursorHere(1, 0) call b:NERDTree.ui.centerView() endfunction @@ -442,13 +444,13 @@ endfunction " put the cursor on the given bookmark and, if its a file, open it function! nerdtree#ui_glue#openBookmark(name) try - let targetNode = g:NERDTreeBookmark.GetNodeForName(a:name, 0) + let targetNode = g:NERDTreeBookmark.GetNodeForName(a:name, 0, b:NERDTree) call targetNode.putCursorHere(0, 1) redraw! catch /^NERDTree.BookmarkedNodeNotFoundError/ call nerdtree#echo("note - target node is not cached") let bookmark = g:NERDTreeBookmark.BookmarkFor(a:name) - let targetNode = g:NERDTreeFileNode.New(bookmark.path) + let targetNode = g:NERDTreeFileNode.New(bookmark.path, b:NERDTree) endtry if targetNode.path.isDirectory call targetNode.openExplorer() @@ -510,7 +512,7 @@ endfunction " put the cursor on the node associate with the given name function! nerdtree#ui_glue#revealBookmark(name) try - let targetNode = g:NERDTreeBookmark.GetNodeForName(a:name, 0) + let targetNode = g:NERDTreeBookmark.GetNodeForName(a:name, 0, b:NERDTree) call targetNode.putCursorHere(0, 1) catch /^NERDTree.BookmarkNotFoundError/ call nerdtree#echo("Bookmark isnt cached under the current root") @@ -522,7 +524,7 @@ endfunction " will be reloaded. function! s:refreshRoot() call nerdtree#echo("Refreshing the root node. This could take a while...") - call b:NERDTreeRoot.refresh() + call b:NERDTree.root.refresh() call b:NERDTree.render() redraw call nerdtree#echo("Refreshing the root node. This could take a while... DONE") @@ -545,10 +547,10 @@ endfunction " FUNCTION: nerdtree#ui_glue#setupCommands() {{{1 function! nerdtree#ui_glue#setupCommands() - command! -n=? -complete=dir -bar NERDTree :call g:NERDTreeCreator.CreatePrimary('') - command! -n=? -complete=dir -bar NERDTreeToggle :call g:NERDTreeCreator.TogglePrimary('') + command! -n=? -complete=dir -bar NERDTree :call g:NERDTreeCreator.CreateTabTree('') + command! -n=? -complete=dir -bar NERDTreeToggle :call g:NERDTreeCreator.ToggleTabTree('') command! -n=0 -bar NERDTreeClose :call g:NERDTree.Close() - command! -n=1 -complete=customlist,nerdtree#completeBookmarks -bar NERDTreeFromBookmark call g:NERDTreeCreator.CreatePrimary('') + command! -n=1 -complete=customlist,nerdtree#completeBookmarks -bar NERDTreeFromBookmark call g:NERDTreeCreator.CreateTabTree('') command! -n=0 -bar NERDTreeMirror call g:NERDTreeCreator.CreateMirror() command! -n=0 -bar NERDTreeFind call s:findAndRevealPath() command! -n=0 -bar NERDTreeFocus call NERDTreeFocus() @@ -602,28 +604,28 @@ endfunction "keepState: 1 if the current root should be left open when the tree is "re-rendered function! nerdtree#ui_glue#upDir(keepState) - let cwd = b:NERDTreeRoot.path.str({'format': 'UI'}) + let cwd = b:NERDTree.root.path.str({'format': 'UI'}) if cwd ==# "/" || cwd =~# '^[^/]..$' call nerdtree#echo("already at top dir") else if !a:keepState - call b:NERDTreeRoot.close() + call b:NERDTree.root.close() endif - let oldRoot = b:NERDTreeRoot + let oldRoot = b:NERDTree.root - if empty(b:NERDTreeRoot.parent) - let path = b:NERDTreeRoot.path.getParent() - let newRoot = g:NERDTreeDirNode.New(path) + if empty(b:NERDTree.root.parent) + let path = b:NERDTree.root.path.getParent() + let newRoot = g:NERDTreeDirNode.New(path, b:NERDTree) call newRoot.open() - call newRoot.transplantChild(b:NERDTreeRoot) - let b:NERDTreeRoot = newRoot + call newRoot.transplantChild(b:NERDTree.root) + let b:NERDTree.root = newRoot else - let b:NERDTreeRoot = b:NERDTreeRoot.parent + let b:NERDTree.root = b:NERDTree.root.parent endif if g:NERDTreeChDirMode ==# 2 - call b:NERDTreeRoot.path.changeToDir() + call b:NERDTree.root.path.changeToDir() endif call b:NERDTree.render() diff --git a/sources_non_forked/nerdtree/doc/NERD_tree.txt b/sources_non_forked/nerdtree/doc/NERD_tree.txt index cfc8ed9b..1ad8e181 100644 --- a/sources_non_forked/nerdtree/doc/NERD_tree.txt +++ b/sources_non_forked/nerdtree/doc/NERD_tree.txt @@ -37,9 +37,7 @@ CONTENTS *NERDTree-contents* 4.3.Menu API..........................|NERDTreeAddPathFilter()| 4.4.Path Listener API.................|NERDTreePathListenerAPI| 5.About...................................|NERDTreeAbout| - 6.Changelog...............................|NERDTreeChangelog| - 7.Credits.................................|NERDTreeCredits| - 8.License.................................|NERDTreeLicense| + 6.License.................................|NERDTreeLicense| ============================================================================== 1. Intro *NERDTree* @@ -673,9 +671,6 @@ NERD tree. These options should be set in your vimrc. |'NERDTreeMinimalUI'| Disables display of the 'Bookmarks' label and 'Press ? for help' text. -|'NERDTreeDirArrows'| Tells the NERD tree to use arrows instead of - + ~ chars when displaying directories. - |'NERDTreeCascadeOpenSingleChildDir'| Cascade open while selected directory has only one child that also is a directory. @@ -778,13 +773,13 @@ Default: 1. If set to 1, doing a > :edit < -will open up a "secondary" NERD tree instead of a netrw in the target window. +will open up a window level NERD tree instead of a netrw in the target window. -Secondary NERD trees behaves slightly different from a regular trees in the +Window level trees behaves slightly different from a regular trees in the following respects: 1. 'o' will open the selected file in the same window as the tree, replacing it. - 2. you can have as many secondary tree as you want in the same tab. + 2. you can have one tree per window - instead of per tab. ------------------------------------------------------------------------------ *'NERDTreeIgnore'* @@ -947,7 +942,7 @@ Other examples: > ------------------------------------------------------------------------------ *'NERDTreeStatusline'* Values: Any valid statusline setting. -Default: %{b:NERDTreeRoot.path.strForOS(0)} +Default: %{b:NERDTree.root.path.strForOS(0)} Tells the script what to use as the |'statusline'| setting for NERD tree windows. @@ -988,19 +983,6 @@ of the following lines to set this option: > let NERDTreeMinimalUI=1 < ------------------------------------------------------------------------------- - *'NERDTreeDirArrows'* -Values: 0 or 1 -Default: 0. - -This option is used to change the default look of directory nodes displayed in -the tree. When set to 0 it shows old-school bars (|), + and ~ chars. If set to -1 it shows right and down arrows. Use one of the follow lines to set this -option: > - let NERDTreeDirArrows=0 - let NERDTreeDirArrows=1 -< - ------------------------------------------------------------------------------ *'NERDTreeCascadeOpenSingleChildDir'* Values: 0 or 1 @@ -1205,7 +1187,7 @@ Use this API if you want to run a callback for events on Path objects. E.G > "This function will be called whenever a Path object is created. "a:event is an object that contains a bunch of relevant info - - "including the path in question. See lib/event.vim for details. + "including the path in question. See lib/nerdtree/event.vim for details. endfunction < Current events supported: @@ -1235,187 +1217,8 @@ The latest stable versions can be found at The latest dev versions are on github http://github.com/scrooloose/nerdtree - ============================================================================== -6. Changelog *NERDTreeChangelog* - -Next - - add 'scope' argument to the key map API - - add NERDTreeCustomIgnoreFilter hook - needs doc - - add magic [[dir]] and [[file]] flags to NERDTreeIgnore - - add support for custom path filters. See :help NERDTreeAddPathFilter() - - add path listener API. See :help NERDTreePathListenerAPI. - -4.2.0 - - Add NERDTreeDirArrows option to make the UI use pretty arrow chars - instead of the old +~| chars to define the tree structure (sickill) - - shift the syntax highlighting out into its own syntax file (gnap) - - add some mac specific options to the filesystem menu - for macvim - only (andersonfreitas) - - Add NERDTreeMinimalUI option to remove some non functional parts of the - nerdtree ui (camthompson) - - tweak the behaviour of :NERDTreeFind - see :help :NERDTreeFind for the - new behaviour (benjamingeiger) - - if no name is given to :Bookmark, make it default to the name of the - target file/dir (minyoung) - - use 'file' completion when doing copying, create, and move - operations (EvanDotPro) - - lots of misc bug fixes (paddyoloughlin, sdewald, camthompson, Vitaly - Bogdanov, AndrewRadev, mathias, scottstvnsn, kml, wycats, me RAWR!) - -4.1.0 - features: - - NERDTreeFind to reveal the node for the current buffer in the tree, - see |NERDTreeFind|. This effectively merges the FindInNERDTree plugin (by - Doug McInnes) into the script. - - make NERDTreeQuitOnOpen apply to the t/T keymaps too. Thanks to Stefan - Ritter and Rémi Prévost. - - truncate the root node if wider than the tree window. Thanks to Victor - Gonzalez. - - bugfixes: - - really fix window state restoring - - fix some win32 path escaping issues. Thanks to Stephan Baumeister, Ricky, - jfilip1024, and Chris Chambers - -4.0.0 - - add a new programmable menu system (see :help NERDTreeMenu). - - add new APIs to add menus/menu-items to the menu system as well as - custom key mappings to the NERD tree buffer (see :help NERDTreeAPI). - - removed the old API functions - - added a mapping to maximize/restore the size of nerd tree window, thanks - to Guillaume Duranceau for the patch. See :help NERDTree-A for details. - - - fix a bug where secondary nerd trees (netrw hijacked trees) and - NERDTreeQuitOnOpen didnt play nicely, thanks to Curtis Harvey. - - fix a bug where the script ignored directories whose name ended in a dot, - thanks to Aggelos Orfanakos for the patch. - - fix a bug when using the x mapping on the tree root, thanks to Bryan - Venteicher for the patch. - - fix a bug where the cursor position/window size of the nerd tree buffer - wasnt being stored on closing the window, thanks to Richard Hart. - - fix a bug where NERDTreeMirror would mirror the wrong tree - -3.1.1 - - fix a bug where a non-listed no-name buffer was getting created every - time the tree windows was created, thanks to Derek Wyatt and owen1 - - make behave the same as the 'o' mapping - - some helptag fixes in the doc, thanks strull - - fix a bug when using :set nohidden and opening a file where the previous - buf was modified. Thanks iElectric - - other minor fixes - -3.1.0 - New features: - - add mappings to open files in a vsplit, see :help NERDTree-s and :help - NERDTree-gs - - make the statusline for the nerd tree window default to something - hopefully more useful. See :help 'NERDTreeStatusline' - Bugfixes: - - make the hijack netrw functionality work when vim is started with "vim - " (thanks to Alf Mikula for the patch). - - fix a bug where the CWD wasnt being changed for some operations even when - NERDTreeChDirMode==2 (thanks to Lucas S. Buchala) - - add -bar to all the nerd tree :commands so they can chain with other - :commands (thanks to tpope) - - fix bugs when ignorecase was set (thanks to nach) - - fix a bug with the relative path code (thanks to nach) - - fix a bug where doing a :cd would cause :NERDTreeToggle to fail (thanks nach) - - -3.0.1 - Bugfixes: - - fix bugs with :NERDTreeToggle and :NERDTreeMirror when 'hidden - was not set - - fix a bug where :NERDTree would fail if was relative and - didnt start with a ./ or ../ Thanks to James Kanze. - - make the q mapping work with secondary (:e style) trees, - thanks to jamessan - - fix a bunch of small bugs with secondary trees - - More insane refactoring. - -3.0.0 - - hijack netrw so that doing an :edit will put a NERD tree in - the window rather than a netrw browser. See :help 'NERDTreeHijackNetrw' - - allow sharing of trees across tabs, see :help :NERDTreeMirror - - remove "top" and "bottom" as valid settings for NERDTreeWinPos - - change the '' mapping to 'i' - - change the 'H' mapping to 'I' - - lots of refactoring - -============================================================================== -7. Credits *NERDTreeCredits* - -Thanks to the following people for testing, bug reports, ideas etc. Without -you I probably would have got bored of the hacking the NERD tree and -just downloaded pr0n instead. - - Tim Carey-Smith (halorgium) - Vigil - Nick Brettell - Thomas Scott Urban - Terrance Cohen - Yegappan Lakshmanan - Jason Mills - Michael Geddes (frogonwheels) - Yu Jun - Michael Madsen - AOYAMA Shotaro - Zhang Weiwu - Niels Aan de Brugh - Olivier Yiptong - Zhang Shuhan - Cory Echols - Piotr Czachur - Yuan Jiang - Matan Nassau - Maxim Kim - Charlton Wang - Matt Wozniski (godlygeek) - knekk - Sean Chou - Ryan Penn - Simon Peter Nicholls - Michael Foobar - Tomasz Chomiuk - Denis Pokataev - Tim Pope (tpope) - James Kanze - James Vega (jamessan) - Frederic Chanal (nach) - Alf Mikula - Lucas S. Buchala - Curtis Harvey - Guillaume Duranceau - Richard Hart (hates) - Doug McInnes - Stefan Ritter - Rémi Prévost - Victor Gonzalez - Stephan Baumeister - Ricky - jfilip1024 - Chris Chambers - Vitaly Bogdanov - Patrick O'Loughlin (paddyoloughlin) - Cam Thompson (camthompson) - Marcin Kulik (sickill) - Steve DeWald (sdewald) - Ivan Necas (iNecas) - George Ang (gnap) - Evan Coury (EvanDotPro) - Andrew Radev (AndrewRadev) - Matt Gauger (mathias) - Scott Stevenson (scottstvnsn) - Anderson Freitas (andersonfreitas) - Kamil K. Lemański (kml) - Yehuda Katz (wycats) - Min-Young Wu (minyoung) - Benjamin Geiger (benjamingeiger) - -============================================================================== -8. License *NERDTreeLicense* +6. License *NERDTreeLicense* The NERD tree is released under the wtfpl. See http://sam.zoy.org/wtfpl/COPYING. diff --git a/sources_non_forked/nerdtree/lib/nerdtree/bookmark.vim b/sources_non_forked/nerdtree/lib/nerdtree/bookmark.vim index 8a94b256..81242605 100644 --- a/sources_non_forked/nerdtree/lib/nerdtree/bookmark.vim +++ b/sources_non_forked/nerdtree/lib/nerdtree/bookmark.vim @@ -3,9 +3,9 @@ let s:Bookmark = {} let g:NERDTreeBookmark = s:Bookmark -" FUNCTION: Bookmark.activate() {{{1 -function! s:Bookmark.activate(...) - call self.open(a:0 ? a:1 : {}) +" FUNCTION: Bookmark.activate(nerdtree) {{{1 +function! s:Bookmark.activate(nerdtree, ...) + call self.open(a:nerdtree, a:0 ? a:1 : {}) endfunction " FUNCTION: Bookmark.AddBookmark(name, path) {{{1 @@ -87,6 +87,7 @@ function! s:Bookmark.CacheBookmarks(silent) let name = substitute(i, '^\(.\{-}\) .*$', '\1', '') let path = substitute(i, '^.\{-} \(.*\)$', '\1', '') + let path = fnamemodify(path, ':p') try let bookmark = s:Bookmark.New(name, g:NERDTreePath.New(path)) @@ -127,26 +128,18 @@ endfunction " Delete this bookmark. If the node for this bookmark is under the current " root, then recache bookmarks for its Path object function! s:Bookmark.delete() - let node = {} - try - let node = self.getNode(1) - catch /^NERDTree.BookmarkedNodeNotFoundError/ - endtry call remove(s:Bookmark.Bookmarks(), index(s:Bookmark.Bookmarks(), self)) - if !empty(node) - call node.path.cacheDisplayString() - endif call s:Bookmark.Write() endfunction -" FUNCTION: Bookmark.getNode(searchFromAbsoluteRoot) {{{1 +" FUNCTION: Bookmark.getNode(nerdtree, searchFromAbsoluteRoot) {{{1 " Gets the treenode for this bookmark " " Args: " searchFromAbsoluteRoot: specifies whether we should search from the current " tree root, or the highest cached node -function! s:Bookmark.getNode(searchFromAbsoluteRoot) - let searchRoot = a:searchFromAbsoluteRoot ? g:NERDTreeDirNode.AbsoluteTreeRoot() : b:NERDTreeRoot +function! s:Bookmark.getNode(nerdtree, searchFromAbsoluteRoot) + let searchRoot = a:searchFromAbsoluteRoot ? a:nerdtree.root.AbsoluteTreeRoot() : a:nerdtree.root let targetNode = searchRoot.findNode(self.path) if empty(targetNode) throw "NERDTree.BookmarkedNodeNotFoundError: no node was found for bookmark: " . self.name @@ -154,12 +147,12 @@ function! s:Bookmark.getNode(searchFromAbsoluteRoot) return targetNode endfunction -" FUNCTION: Bookmark.GetNodeForName(name, searchFromAbsoluteRoot) {{{1 +" FUNCTION: Bookmark.GetNodeForName(name, searchFromAbsoluteRoot, nerdtree) {{{1 " Class method that finds the bookmark with the given name and returns the " treenode for it. -function! s:Bookmark.GetNodeForName(name, searchFromAbsoluteRoot) +function! s:Bookmark.GetNodeForName(name, searchFromAbsoluteRoot, nerdtree) let bookmark = s:Bookmark.BookmarkFor(a:name) - return bookmark.getNode(a:searchFromAbsoluteRoot) + return bookmark.getNode(nerdtree, a:searchFromAbsoluteRoot) endfunction " FUNCTION: Bookmark.GetSelected() {{{1 @@ -209,8 +202,11 @@ function! s:Bookmark.New(name, path) return newBookmark endfunction -" FUNCTION: Bookmark.open([options]) {{{1 +" FUNCTION: Bookmark.open(nerdtree, [options]) {{{1 "Args: +" +"nerdtree: the tree to load open the bookmark in +" "A dictionary containing the following keys (all optional): " 'where': Specifies whether the node should be opened in new split/tab or in " the previous window. Can be either 'v' (vertical split), 'h' @@ -219,11 +215,11 @@ endfunction " 'keepopen': dont close the tree window " 'stay': open the file, but keep the cursor in the tree win " -function! s:Bookmark.open(...) +function! s:Bookmark.open(nerdtree, ...) let opts = a:0 ? a:1 : {} if self.path.isDirectory && !has_key(opts, 'where') - call self.toRoot() + call self.toRoot(a:nerdtree) else let opener = g:NERDTreeOpener.New(self.path, opts) call opener.open(self) @@ -265,26 +261,24 @@ function! s:Bookmark.str() return '>' . self.name . ' ' . pathStr endfunction -" FUNCTION: Bookmark.toRoot() {{{1 +" FUNCTION: Bookmark.toRoot(nerdtree) {{{1 " Make the node for this bookmark the new tree root -function! s:Bookmark.toRoot() +function! s:Bookmark.toRoot(nerdtree) if self.validate() try - let targetNode = self.getNode(1) + let targetNode = self.getNode(a:nerdtree, 1) catch /^NERDTree.BookmarkedNodeNotFoundError/ - let targetNode = g:NERDTreeFileNode.New(s:Bookmark.BookmarkFor(self.name).path) + let targetNode = g:NERDTreeFileNode.New(s:Bookmark.BookmarkFor(self.name).path, a:nerdtree) endtry - call targetNode.makeRoot() - call b:NERDTree.render() - call targetNode.putCursorHere(0, 0) + call a:nerdtree.changeRoot(targetNode) endif endfunction -" FUNCTION: Bookmark.ToRoot(name) {{{1 +" FUNCTION: Bookmark.ToRoot(name, nerdtree) {{{1 " Make the node for this bookmark the new tree root -function! s:Bookmark.ToRoot(name) +function! s:Bookmark.ToRoot(name, nerdtree) let bookmark = s:Bookmark.BookmarkFor(a:name) - call bookmark.toRoot() + call bookmark.toRoot(a:nerdtree) endfunction " FUNCTION: Bookmark.validate() {{{1 @@ -293,7 +287,6 @@ function! s:Bookmark.validate() return 1 else call s:Bookmark.CacheBookmarks(1) - call b:NERDTree.render() call nerdtree#echo(self.name . "now points to an invalid location. See :help NERDTreeInvalidBookmarks for info.") return 0 endif @@ -304,7 +297,7 @@ endfunction function! s:Bookmark.Write() let bookmarkStrings = [] for i in s:Bookmark.Bookmarks() - call add(bookmarkStrings, i.name . ' ' . i.path.str()) + call add(bookmarkStrings, i.name . ' ' . fnamemodify(i.path.str(), ':~')) endfor "add a blank line before the invalid ones diff --git a/sources_non_forked/nerdtree/lib/nerdtree/creator.vim b/sources_non_forked/nerdtree/lib/nerdtree/creator.vim index 2d6a5c2e..9775d31c 100644 --- a/sources_non_forked/nerdtree/lib/nerdtree/creator.vim +++ b/sources_non_forked/nerdtree/lib/nerdtree/creator.vim @@ -1,5 +1,5 @@ "CLASS: Creator -"Creates primary/secondary/mirror nerdtree windows. Sets up all the window and +"Creates tab/window/mirror nerdtree windows. Sets up all the window and "buffer options and key mappings etc. "============================================================ let s:Creator = {} @@ -16,7 +16,7 @@ function! s:Creator._bindMappings() command! -buffer -complete=customlist,nerdtree#completeBookmarks -nargs=1 RevealBookmark :call nerdtree#ui_glue#revealBookmark('') command! -buffer -complete=customlist,nerdtree#completeBookmarks -nargs=1 OpenBookmark :call nerdtree#ui_glue#openBookmark('') command! -buffer -complete=customlist,nerdtree#completeBookmarks -nargs=* ClearBookmarks call nerdtree#ui_glue#clearBookmarks('') - command! -buffer -complete=customlist,nerdtree#completeBookmarks -nargs=+ BookmarkToRoot call g:NERDTreeBookmark.ToRoot('') + command! -buffer -complete=customlist,nerdtree#completeBookmarks -nargs=+ BookmarkToRoot call g:NERDTreeBookmark.ToRoot('', b:NERDTree) command! -buffer -nargs=0 ClearAllBookmarks call g:NERDTreeBookmark.ClearAll() call b:NERDTree.render() command! -buffer -nargs=0 ReadBookmarks call g:NERDTreeBookmark.CacheBookmarks(0) call b:NERDTree.render() command! -buffer -nargs=0 WriteBookmarks call g:NERDTreeBookmark.Write() @@ -32,22 +32,26 @@ function! s:Creator.BufNamePrefix() return 'NERD_tree_' endfunction -"FUNCTION: s:Creator.CreatePrimary(a:name) {{{1 -function! s:Creator.CreatePrimary(name) +"FUNCTION: s:Creator.CreateTabTree(a:name) {{{1 +function! s:Creator.CreateTabTree(name) let creator = s:Creator.New() - call creator.createPrimary(a:name) + call creator.createTabTree(a:name) endfunction -"FUNCTION: s:Creator.createPrimary(a:name) {{{1 +"FUNCTION: s:Creator.createTabTree(a:name) {{{1 "name: the name of a bookmark or a directory -function! s:Creator.createPrimary(name) +function! s:Creator.createTabTree(name) let path = self._pathForString(a:name) - + "abort if exception was thrown (bookmark/dir doesn't exist) if empty(path) return endif + if path == {} + return + endif + "if instructed to, then change the vim CWD to the dir the NERDTree is "inited in if g:NERDTreeChDirMode != 0 @@ -58,32 +62,26 @@ function! s:Creator.createPrimary(name) if g:NERDTree.IsOpen() call g:NERDTree.Close() endif - unlet t:NERDTreeBufName + + call self._removeTreeBufForTab() endif call self._createTreeWin() - call self._createNERDTree(path) - let b:NERDTreeType = "primary" - let b:treeShowHelp = 0 - let b:NERDTreeIgnoreEnabled = 1 - let b:NERDTreeShowFiles = g:NERDTreeShowFiles - let b:NERDTreeShowHidden = g:NERDTreeShowHidden - let b:NERDTreeShowBookmarks = g:NERDTreeShowBookmarks - + call self._createNERDTree(path, "tab") call b:NERDTree.render() - call b:NERDTreeRoot.putCursorHere(0, 0) + call b:NERDTree.root.putCursorHere(0, 0) call self._broadcastInitEvent() endfunction -"FUNCTION: s:Creator.CreateSecondary(dir) {{{1 -function! s:Creator.CreateSecondary(dir) +"FUNCTION: s:Creator.CreateWindowTree(dir) {{{1 +function! s:Creator.CreateWindowTree(dir) let creator = s:Creator.New() - call creator.createSecondary(a:dir) + call creator.createWindowTree(a:dir) endfunction -"FUNCTION: s:Creator.createSecondary(dir) {{{1 -function! s:Creator.createSecondary(dir) +"FUNCTION: s:Creator.createWindowTree(dir) {{{1 +function! s:Creator.createWindowTree(dir) try let path = g:NERDTreePath.New(a:dir) catch /^NERDTree.InvalidArgumentsError/ @@ -96,14 +94,13 @@ function! s:Creator.createSecondary(dir) let previousBuf = expand("#") - "we need a unique name for each secondary tree buffer to ensure they are + "we need a unique name for each window tree buffer to ensure they are "all independent exec "silent edit " . self._nextBufferName() - let b:NERDTreePreviousBuf = bufnr(previousBuf) - call self._createNERDTree(path) + call self._createNERDTree(path, "window") + let b:NERDTree._previousBuf = bufnr(previousBuf) call self._setCommonBufOptions() - let b:NERDTreeType = "secondary" call b:NERDTree.render() @@ -111,8 +108,8 @@ function! s:Creator.createSecondary(dir) endfunction " FUNCTION: s:Creator._createNERDTree(path) {{{1 -function! s:Creator._createNERDTree(path) - let b:NERDTree = g:NERDTree.New(a:path) +function! s:Creator._createNERDTree(path, type) + let b:NERDTree = g:NERDTree.New(a:path, a:type) "TODO: This is kept for compatability only since many things use "b:NERDTreeRoot instead of the new NERDTree.root "Remove this one day @@ -145,7 +142,7 @@ function! s:Creator.createMirror() let i = 0 while i < len(treeBufNames) let bufName = treeBufNames[i] - let treeRoot = getbufvar(bufName, "NERDTreeRoot") + let treeRoot = getbufvar(bufName, "NERDTree").root let options[i+1 . '. ' . treeRoot.path.str() . ' (buf name: ' . bufName . ')'] = bufName let i = i + 1 endwhile @@ -201,6 +198,15 @@ function! s:Creator._createTreeWin() call self._setCommonBufOptions() endfunction +"FUNCTION: s:Creator._isBufHidden(nr) {{{1 +function! s:Creator._isBufHidden(nr) + redir => bufs + silent ls! + redir END + + return bufs =~ a:nr . '..h' +endfunction + "FUNCTION: s:Creator.New() {{{1 function! s:Creator.New() let newCreator = copy(self) @@ -245,7 +251,7 @@ function! s:Creator._pathForString(str) let path = g:NERDTreePath.New(dir) catch /^NERDTree.InvalidArgumentsError/ call nerdtree#echo("No bookmark or directory found for: " . a:str) - return + return {} endtry endif if !path.isDirectory @@ -255,6 +261,23 @@ function! s:Creator._pathForString(str) return path endfunction +" Function: s:Creator._removeTreeBufForTab() {{{1 +function! s:Creator._removeTreeBufForTab() + let buf = bufnr(t:NERDTreeBufName) + + "if &hidden is not set then it will already be gone + if buf != -1 + + "nerdtree buf may be mirrored/displayed elsewhere + if self._isBufHidden(buf) + exec "bwipeout " . buf + endif + + endif + + unlet t:NERDTreeBufName +endfunction + "FUNCTION: s:Creator._setCommonBufOptions() {{{1 function! s:Creator._setCommonBufOptions() "throwaway buffer options @@ -283,12 +306,6 @@ function! s:Creator._setCommonBufOptions() endif call self._setupStatusline() - - let b:treeShowHelp = 0 - let b:NERDTreeIgnoreEnabled = 1 - let b:NERDTreeShowFiles = g:NERDTreeShowFiles - let b:NERDTreeShowHidden = g:NERDTreeShowHidden - let b:NERDTreeShowBookmarks = g:NERDTreeShowBookmarks call self._bindMappings() setlocal filetype=nerdtree endfunction @@ -318,20 +335,20 @@ function! s:Creator._tabpagevar(tabnr, var) return v endfunction -"FUNCTION: s:Creator.TogglePrimary(dir) {{{1 -function! s:Creator.TogglePrimary(dir) +"FUNCTION: s:Creator.ToggleTabTree(dir) {{{1 +function! s:Creator.ToggleTabTree(dir) let creator = s:Creator.New() - call creator.togglePrimary(a:dir) + call creator.toggleTabTree(a:dir) endfunction -"FUNCTION: s:Creator.togglePrimary(dir) {{{1 +"FUNCTION: s:Creator.toggleTabTree(dir) {{{1 "Toggles the NERD tree. I.e the NERD tree is open, it is closed, if it is "closed it is restored or initialized (if it doesnt exist) " "Args: "dir: the full path for the root node (is only used if the NERD tree is being "initialized. -function! s:Creator.togglePrimary(dir) +function! s:Creator.toggleTabTree(dir) if g:NERDTree.ExistsForTab() if !g:NERDTree.IsOpen() call self._createTreeWin() @@ -343,7 +360,7 @@ function! s:Creator.togglePrimary(dir) call g:NERDTree.Close() endif else - call self.createPrimary(a:dir) + call self.createTabTree(a:dir) endif endfunction diff --git a/sources_non_forked/nerdtree/lib/nerdtree/nerdtree.vim b/sources_non_forked/nerdtree/lib/nerdtree/nerdtree.vim index 55f3dd75..73a30f7a 100644 --- a/sources_non_forked/nerdtree/lib/nerdtree/nerdtree.vim +++ b/sources_non_forked/nerdtree/lib/nerdtree/nerdtree.vim @@ -8,8 +8,30 @@ function! s:NERDTree.AddPathFilter(callback) call add(s:NERDTree.PathFilters(), a:callback) endfunction +"FUNCTION: s:NERDTree.changeRoot(node) {{{1 +function! s:NERDTree.changeRoot(node) + if a:node.path.isDirectory + let self.root = a:node + else + call a:node.cacheParent() + let self.root = a:node.parent + endif + + call self.root.open() + + "change dir to the dir of the new root if instructed to + if g:NERDTreeChDirMode ==# 2 + exec "cd " . self.root.path.str({'format': 'Edit'}) + endif + + call self.render() + call self.root.putCursorHere(0, 0) + + silent doautocmd User NERDTreeNewRoot +endfunction + "FUNCTION: s:NERDTree.Close() {{{1 -"Closes the primary NERD tree window for this tab +"Closes the tab tree window for this tab function! s:NERDTree.Close() if !s:NERDTree.IsOpen() return @@ -43,7 +65,7 @@ endfunction "FUNCTION: s:NERDTree.CursorToBookmarkTable(){{{1 "Places the cursor at the top of the bookmarks table function! s:NERDTree.CursorToBookmarkTable() - if !b:NERDTreeShowBookmarks + if !b:NERDTree.ui.getShowBookmarks() throw "NERDTree.IllegalOperationError: cant find bookmark table, bookmarks arent active" endif @@ -73,13 +95,18 @@ endfunction " Function: s:NERDTree.ExistsForBuffer() {{{1 " Returns 1 if a nerd tree root exists in the current buffer function! s:NERDTree.ExistsForBuf() - return exists("b:NERDTreeRoot") + return exists("b:NERDTree") endfunction " Function: s:NERDTree.ExistsForTab() {{{1 " Returns 1 if a nerd tree root exists in the current tab function! s:NERDTree.ExistsForTab() - return exists("t:NERDTreeBufName") + if !exists("t:NERDTreeBufName") + return + end + + "check b:NERDTree is still there and hasn't been e.g. :bdeleted + return !empty(getbufvar(bufnr(t:NERDTreeBufName), 'NERDTree')) endfunction function! s:NERDTree.ForCurrentBuf() @@ -90,14 +117,29 @@ function! s:NERDTree.ForCurrentBuf() endif endfunction +"FUNCTION: s:NERDTree.ForCurrentTab() {{{1 +function! s:NERDTree.ForCurrentTab() + if !s:NERDTree.ExistsForTab() + return + endif + + let bufnr = bufnr(t:NERDTreeBufName) + return getbufvar(bufnr, "NERDTree") +endfunction + +"FUNCTION: s:NERDTree.getRoot() {{{1 +function! s:NERDTree.getRoot() + return self.root +endfunction + "FUNCTION: s:NERDTree.GetWinNum() {{{1 "gets the nerd tree window number for this tab function! s:NERDTree.GetWinNum() if exists("t:NERDTreeBufName") return bufwinnr(t:NERDTreeBufName) - else - return -1 endif + + return -1 endfunction "FUNCTION: s:NERDTree.IsOpen() {{{1 @@ -105,6 +147,16 @@ function! s:NERDTree.IsOpen() return s:NERDTree.GetWinNum() != -1 endfunction +"FUNCTION: s:NERDTree.isTabTree() {{{1 +function! s:NERDTree.isTabTree() + return self._type == "tab" +endfunction + +"FUNCTION: s:NERDTree.isWinTree() {{{1 +function! s:NERDTree.isWinTree() + return self._type == "window" +endfunction + "FUNCTION: s:NERDTree.MustBeOpen() {{{1 function! s:NERDTree.MustBeOpen() if !s:NERDTree.IsOpen() @@ -113,11 +165,11 @@ function! s:NERDTree.MustBeOpen() endfunction "FUNCTION: s:NERDTree.New() {{{1 -function! s:NERDTree.New(path) +function! s:NERDTree.New(path, type) let newObj = copy(self) let newObj.ui = g:NERDTreeUI.New(newObj) - let newObj.root = g:NERDTreeDirNode.New(a:path) - + let newObj.root = g:NERDTreeDirNode.New(a:path, newObj) + let newObj._type = a:type return newObj endfunction @@ -129,6 +181,10 @@ function! s:NERDTree.PathFilters() return s:NERDTree._PathFilters endfunction +"FUNCTION: s:NERDTree.previousBuf() {{{1 +function! s:NERDTree.previousBuf() + return self._previousBuf +endfunction "FUNCTION: s:NERDTree.render() {{{1 "A convenience function - since this is called often diff --git a/sources_non_forked/nerdtree/lib/nerdtree/notifier.vim b/sources_non_forked/nerdtree/lib/nerdtree/notifier.vim index b445f8ad..00041b85 100644 --- a/sources_non_forked/nerdtree/lib/nerdtree/notifier.vim +++ b/sources_non_forked/nerdtree/lib/nerdtree/notifier.vim @@ -11,8 +11,8 @@ function! s:Notifier.AddListener(event, funcname) call add(listeners, a:funcname) endfunction -function! s:Notifier.NotifyListeners(event, path, params) - let event = g:NERDTreeEvent.New(b:NERDTree, a:path, a:event, a:params) +function! s:Notifier.NotifyListeners(event, path, nerdtree, params) + let event = g:NERDTreeEvent.New(a:nerdtree, a:path, a:event, a:params) for listener in s:Notifier.GetListenersForEvent(a:event) call {listener}(event) diff --git a/sources_non_forked/nerdtree/lib/nerdtree/opener.vim b/sources_non_forked/nerdtree/lib/nerdtree/opener.vim index 3a6b3924..00947cdb 100644 --- a/sources_non_forked/nerdtree/lib/nerdtree/opener.vim +++ b/sources_non_forked/nerdtree/lib/nerdtree/opener.vim @@ -64,7 +64,7 @@ endfunction "FUNCTION: Opener._gotoTargetWin() {{{1 function! s:Opener._gotoTargetWin() - if b:NERDTreeType ==# "secondary" + if b:NERDTree.isWinTree() if self._where == 'v' vsplit elseif self._where == 'h' @@ -149,7 +149,7 @@ function! s:Opener.New(path, opts) let newObj._keepopen = nerdtree#has_opt(a:opts, 'keepopen') let newObj._where = has_key(a:opts, 'where') ? a:opts['where'] : '' - let newObj._treetype = b:NERDTreeType + let newObj._nerdtree = b:NERDTree call newObj._saveCursorPos() return newObj @@ -247,34 +247,25 @@ function! s:Opener._openFile() endif call self._gotoTargetWin() - - if self._treetype ==# "secondary" - call self._path.edit() - else - call self._path.edit() - - - if self._stay - call self._restoreCursorPos() - endif + call self._path.edit() + if self._stay + call self._restoreCursorPos() endif endfunction "FUNCTION: Opener._openDirectory(node) {{{1 function! s:Opener._openDirectory(node) - if self._treetype ==# "secondary" + if self._nerdtree.isWinTree() call self._gotoTargetWin() - call g:NERDTreeCreator.CreateSecondary(a:node.path.str()) + call g:NERDTreeCreator.CreateWindow(a:node.path.str()) else call self._gotoTargetWin() if empty(self._where) - call a:node.makeRoot() - call b:NERDTree.render() - call a:node.putCursorHere(0, 0) + call b:NERDTree.changeRoot(a:node) elseif self._where == 't' - call g:NERDTreeCreator.CreatePrimary(a:node.path.str()) + call g:NERDTreeCreator.CreateTabTree(a:node.path.str()) else - call g:NERDTreeCreator.CreateSecondary(a:node.path.str()) + call g:NERDTreeCreator.CreateWindowTree(a:node.path.str()) endif endif diff --git a/sources_non_forked/nerdtree/lib/nerdtree/path.vim b/sources_non_forked/nerdtree/lib/nerdtree/path.vim index 2af07ddb..df18505f 100644 --- a/sources_non_forked/nerdtree/lib/nerdtree/path.vim +++ b/sources_non_forked/nerdtree/lib/nerdtree/path.vim @@ -40,9 +40,7 @@ endfunction "FUNCTION: Path.cacheDisplayString() {{{1 function! s:Path.cacheDisplayString() abort - let self.cachedDisplayString = self.flagSet.renderToString() - - let self.cachedDisplayString .= self.getLastPathComponent(1) + let self.cachedDisplayString = self.getLastPathComponent(1) if self.isExecutable let self.cachedDisplayString = self.cachedDisplayString . '*' @@ -406,11 +404,11 @@ function! s:Path.isUnixHiddenPath() endif endfunction -"FUNCTION: Path.ignore() {{{1 +"FUNCTION: Path.ignore(nerdtree) {{{1 "returns true if this path should be ignored -function! s:Path.ignore() +function! s:Path.ignore(nerdtree) "filter out the user specified paths to ignore - if b:NERDTreeIgnoreEnabled + if a:nerdtree.ui.isIgnoreFilterEnabled() for i in g:NERDTreeIgnore if self._ignorePatternMatches(i) return 1 @@ -418,18 +416,18 @@ function! s:Path.ignore() endfor for callback in g:NERDTree.PathFilters() - if {callback}({'path': self, 'nerdtree': b:NERDTree}) + if {callback}({'path': self, 'nerdtree': a:nerdtree}) return 1 endif endfor endif "dont show hidden files unless instructed to - if b:NERDTreeShowHidden ==# 0 && self.isUnixHiddenFile() + if !a:nerdtree.ui.getShowHidden() && self.isUnixHiddenFile() return 1 endif - if b:NERDTreeShowFiles ==# 0 && self.isDirectory ==# 0 + if a:nerdtree.ui.getShowFiles() ==# 0 && self.isDirectory ==# 0 return 1 endif @@ -455,10 +453,22 @@ function! s:Path._ignorePatternMatches(pattern) return self.getLastPathComponent(0) =~# pat endfunction -"FUNCTION: Path.isUnder(path) {{{1 -"return 1 if this path is somewhere under the given path in the filesystem. +"FUNCTION: Path.isAncestor(path) {{{1 +"return 1 if this path is somewhere above the given path in the filesystem. " "a:path should be a dir +function! s:Path.isAncestor(path) + if !self.isDirectory + return 0 + endif + + let this = self.str() + let that = a:path.str() + return stridx(that, this) == 0 +endfunction + +"FUNCTION: Path.isUnder(path) {{{1 +"return 1 if this path is somewhere under the given path in the filesystem. function! s:Path.isUnder(path) if a:path.isDirectory == 0 return 0 @@ -572,16 +582,16 @@ function! s:Path.readInfoFromDisk(fullpath) endif endfunction -"FUNCTION: Path.refresh() {{{1 -function! s:Path.refresh() +"FUNCTION: Path.refresh(nerdtree) {{{1 +function! s:Path.refresh(nerdtree) call self.readInfoFromDisk(self.str()) - call g:NERDTreePathNotifier.NotifyListeners('refresh', self, {}) + call g:NERDTreePathNotifier.NotifyListeners('refresh', self, a:nerdtree, {}) call self.cacheDisplayString() endfunction -"FUNCTION: Path.refreshFlags() {{{1 -function! s:Path.refreshFlags() - call g:NERDTreePathNotifier.NotifyListeners('refreshFlags', self, {}) +"FUNCTION: Path.refreshFlags(nerdtree) {{{1 +function! s:Path.refreshFlags(nerdtree) + call g:NERDTreePathNotifier.NotifyListeners('refreshFlags', self, a:nerdtree, {}) call self.cacheDisplayString() endfunction diff --git a/sources_non_forked/nerdtree/lib/nerdtree/tree_dir_node.vim b/sources_non_forked/nerdtree/lib/nerdtree/tree_dir_node.vim index 765982df..48e9bda3 100644 --- a/sources_non_forked/nerdtree/lib/nerdtree/tree_dir_node.vim +++ b/sources_non_forked/nerdtree/lib/nerdtree/tree_dir_node.vim @@ -9,7 +9,7 @@ let g:NERDTreeDirNode = s:TreeDirNode "FUNCTION: TreeDirNode.AbsoluteTreeRoot(){{{1 "class method that returns the highest cached ancestor of the current root function! s:TreeDirNode.AbsoluteTreeRoot() - let currentNode = b:NERDTreeRoot + let currentNode = b:NERDTree.root while currentNode.parent != {} let currentNode = currentNode.parent endwhile @@ -21,7 +21,7 @@ unlet s:TreeDirNode.activate function! s:TreeDirNode.activate(...) let opts = a:0 ? a:1 : {} call self.toggleOpen(opts) - call b:NERDTree.render() + call self.getNerdtree().render() call self.putCursorHere(0, 0) endfunction @@ -68,11 +68,27 @@ endfunction "Returns: "the newly created node function! s:TreeDirNode.createChild(path, inOrder) - let newTreeNode = g:NERDTreeFileNode.New(a:path) + let newTreeNode = g:NERDTreeFileNode.New(a:path, self.getNerdtree()) call self.addChild(newTreeNode, a:inOrder) return newTreeNode endfunction +"FUNCTION: TreeDirNode.displayString() {{{1 +unlet s:TreeDirNode.displayString +function! s:TreeDirNode.displayString() + let cascade = self.getCascade() + let rv = "" + for node in cascade + let rv = rv . node.path.displayString() + endfor + + let sym = cascade[-1].isOpen ? g:NERDTreeDirArrowCollapsible : g:NERDTreeDirArrowExpandable + + let flags = cascade[-1].path.flagSet.renderToString() + + return sym . ' ' . flags . rv +endfunction + "FUNCTION: TreeDirNode.findNode(path) {{{1 "Will find one of the children (recursively) that has the given path " @@ -98,6 +114,33 @@ function! s:TreeDirNode.findNode(path) return {} endfunction +"FUNCTION: TreeDirNode.getCascade() {{{1 +"Return an array of dir nodes (starting from self) that can be cascade opened. +function! s:TreeDirNode.getCascade() + + let rv = [self] + let node = self + + while 1 + let vc = node.getVisibleChildren() + if len(vc) != 1 + break + endif + + let visChild = vc[0] + + "TODO: optimize + if !visChild.path.isDirectory + break + endif + + call add(rv, visChild) + let node = visChild + endwhile + + return rv +endfunction + "FUNCTION: TreeDirNode.getChildCount() {{{1 "Returns the number of children this node has function! s:TreeDirNode.getChildCount() @@ -171,6 +214,12 @@ function! s:TreeDirNode.getChildIndex(path) return -1 endfunction +"FUNCTION: TreeDirNode.getDirChildren() {{{1 +"Get all children that are directories +function! s:TreeDirNode.getDirChildren() + return filter(self.children, 'v:val.path.isDirectory == 1') +endfunction + "FUNCTION: TreeDirNode.GetSelected() {{{1 "Returns the current node if it is a dir node, or else returns the current "nodes parent @@ -199,7 +248,7 @@ endfunction function! s:TreeDirNode.getVisibleChildren() let toReturn = [] for i in self.children - if i.path.ignore() ==# 0 + if i.path.ignore(self.getNerdtree()) ==# 0 call add(toReturn, i) endif endfor @@ -212,6 +261,13 @@ function! s:TreeDirNode.hasVisibleChildren() return self.getVisibleChildCount() != 0 endfunction +"FUNCTION: TreeDirNode.isCascadable() {{{1 +"true if this dir has only one visible child - which is also a dir +function! s:TreeDirNode.isCascadable() + let c = self.getVisibleChildren() + return len(c) == 1 && c[0].path.isDirectory +endfunction + "FUNCTION: TreeDirNode._initChildren() {{{1 "Removes all childen from this node and re-reads them " @@ -244,19 +300,15 @@ function! s:TreeDirNode._initChildren(silent) for i in files "filter out the .. and . directories - "Note: we must match .. AND ../ cos sometimes the globpath returns + "Note: we must match .. AND ../ since sometimes the globpath returns "../ for path with strange chars (eg $) -" if i !~# '\/\.\.\/\?$' && i !~# '\/\.\/\?$' -" - " Regular expression is too expensive. Use simply string comparison - " instead - if i[len(i)-3:2] != ".." && i[len(i)-2:2] != ".." && + if i[len(i)-3:2] != ".." && i[len(i)-2:2] != ".." && \ i[len(i)-2:1] != "." && i[len(i)-1] != "." "put the next file in a new node and attach it try let path = g:NERDTreePath.New(i) call self.createChild(path, 0) - call g:NERDTreePathNotifier.NotifyListeners('init', path, {}) + call g:NERDTreePathNotifier.NotifyListeners('init', path, self.getNerdtree(), {}) catch /^NERDTree.\(InvalidArguments\|InvalidFiletype\)Error/ let invalidFilesFound += 1 endtry @@ -275,13 +327,13 @@ function! s:TreeDirNode._initChildren(silent) return self.getChildCount() endfunction -"FUNCTION: TreeDirNode.New(path) {{{1 +"FUNCTION: TreeDirNode.New(path, nerdtree) {{{1 "Returns a new TreeNode object with the given path and parent " "Args: -"path: a path object representing the full filesystem path to the file/dir that the node represents -unlet s:TreeDirNode.New -function! s:TreeDirNode.New(path) +"path: dir that the node represents +"nerdtree: the tree the node belongs to +function! s:TreeDirNode.New(path, nerdtree) if a:path.isDirectory != 1 throw "NERDTree.InvalidArgumentsError: A TreeDirNode object must be instantiated with a directory Path object." endif @@ -293,6 +345,7 @@ function! s:TreeDirNode.New(path) let newTreeNode.children = [] let newTreeNode.parent = {} + let newTreeNode._nerdtree = a:nerdtree return newTreeNode endfunction @@ -356,7 +409,7 @@ endfunction "FUNCTION: TreeDirNode._openInNewTab() {{{1 function! s:TreeDirNode._openInNewTab() tabnew - call g:NERDTreeCreator.CreatePrimary(self.path.str()) + call g:NERDTreeCreator.CreateTabTree(self.path.str()) endfunction "FUNCTION: TreeDirNode.openRecursively() {{{1 @@ -377,7 +430,7 @@ endfunction "Args: "forceOpen: 1 if this node should be opened regardless of file filters function! s:TreeDirNode._openRecursively2(forceOpen) - if self.path.ignore() ==# 0 || a:forceOpen + if self.path.ignore(self.getNerdtree()) ==# 0 || a:forceOpen let self.isOpen = 1 if self.children ==# [] call self._initChildren(1) @@ -394,7 +447,7 @@ endfunction "FUNCTION: TreeDirNode.refresh() {{{1 unlet s:TreeDirNode.refresh function! s:TreeDirNode.refresh() - call self.path.refresh() + call self.path.refresh(self.getNerdtree()) "if this node was ever opened, refresh its children if self.isOpen || !empty(self.children) @@ -425,7 +478,7 @@ function! s:TreeDirNode.refresh() "the node doesnt exist so create it else - let newNode = g:NERDTreeFileNode.New(path) + let newNode = g:NERDTreeFileNode.New(path, self.getNerdtree()) let newNode.parent = self call add(newChildNodes, newNode) endif @@ -450,7 +503,7 @@ endfunction "FUNCTION: TreeDirNode.refreshFlags() {{{1 unlet s:TreeDirNode.refreshFlags function! s:TreeDirNode.refreshFlags() - call self.path.refreshFlags() + call self.path.refreshFlags(self.getNerdtree()) for i in self.children call i.refreshFlags() endfor @@ -458,13 +511,16 @@ endfunction "FUNCTION: TreeDirNode.refreshDirFlags() {{{1 function! s:TreeDirNode.refreshDirFlags() - call self.path.refreshFlags() + call self.path.refreshFlags(self.getNerdtree()) endfunction "FUNCTION: TreeDirNode.reveal(path) {{{1 "reveal the given path, i.e. cache and open all treenodes needed to display it "in the UI -function! s:TreeDirNode.reveal(path) +"Returns the revealed node +function! s:TreeDirNode.reveal(path, ...) + let opts = a:0 ? a:1 : {} + if !a:path.isUnder(self.path) throw "NERDTree.InvalidArgumentsError: " . a:path.str() . " should be under " . self.path.str() endif @@ -473,9 +529,10 @@ function! s:TreeDirNode.reveal(path) if self.path.equals(a:path.getParent()) let n = self.findNode(a:path) - call b:NERDTree.render() - call n.putCursorHere(1,0) - return + if has_key(opts, "open") + call n.open() + endif + return n endif let p = a:path @@ -484,7 +541,7 @@ function! s:TreeDirNode.reveal(path) endwhile let n = self.findNode(p) - call n.reveal(a:path) + return n.reveal(a:path, opts) endfunction "FUNCTION: TreeDirNode.removeChild(treenode) {{{1 diff --git a/sources_non_forked/nerdtree/lib/nerdtree/tree_file_node.vim b/sources_non_forked/nerdtree/lib/nerdtree/tree_file_node.vim index b4924d78..adb0e96b 100644 --- a/sources_non_forked/nerdtree/lib/nerdtree/tree_file_node.vim +++ b/sources_non_forked/nerdtree/lib/nerdtree/tree_file_node.vim @@ -19,7 +19,7 @@ function! s:TreeFileNode.bookmark(name) "it so we can update its display string let oldMarkedNode = {} try - let oldMarkedNode = g:NERDTreeBookmark.GetNodeForName(a:name, 1) + let oldMarkedNode = g:NERDTreeBookmark.GetNodeForName(a:name, 1, self.getNerdtree()) catch /^NERDTree.BookmarkNotFoundError/ catch /^NERDTree.BookmarkedNodeNotFoundError/ endtry @@ -41,7 +41,7 @@ function! s:TreeFileNode.cacheParent() if parentPath.equals(self.path) throw "NERDTree.CannotCacheParentError: already at root" endif - let self.parent = s:TreeFileNode.New(parentPath) + let self.parent = s:TreeFileNode.New(parentPath, self.getNerdtree()) endif endfunction @@ -59,7 +59,7 @@ endfunction function! s:TreeFileNode.copy(dest) call self.path.copy(a:dest) let newPath = g:NERDTreePath.New(a:dest) - let parent = b:NERDTreeRoot.findNode(newPath.getParent()) + let parent = self.getNerdtree().root.findNode(newPath.getParent()) if !empty(parent) call parent.refresh() return parent.findNode(newPath) @@ -83,7 +83,7 @@ endfunction "Return: "a string that can be used in the view to represent this node function! s:TreeFileNode.displayString() - return self.path.displayString() + return self.path.flagSet.renderToString() . self.path.displayString() endfunction "FUNCTION: TreeFileNode.equals(treenode) {{{1 @@ -165,7 +165,7 @@ function! s:TreeFileNode.findSibling(direction) "if the next node is not an ignored node (i.e. wont show up in the "view) then return it - if self.parent.children[siblingIndx].path.ignore() ==# 0 + if self.parent.children[siblingIndx].path.ignore(self.getNerdtree()) ==# 0 return self.parent.children[siblingIndx] endif @@ -178,11 +178,16 @@ function! s:TreeFileNode.findSibling(direction) return {} endfunction +"FUNCTION: TreeFileNode.getNerdtree(){{{1 +function! s:TreeFileNode.getNerdtree() + return self._nerdtree +endfunction + "FUNCTION: TreeFileNode.GetRootForTab(){{{1 "get the root node for this tab function! s:TreeFileNode.GetRootForTab() if g:NERDTree.ExistsForTab() - return getbufvar(t:NERDTreeBufName, 'NERDTreeRoot') + return getbufvar(t:NERDTreeBufName, 'NERDTree').root end return {} endfunction @@ -195,7 +200,7 @@ function! s:TreeFileNode.GetSelected() if path ==# {} return {} endif - return b:NERDTreeRoot.findNode(path) + return b:NERDTree.root.findNode(path) catch /^NERDTree/ return {} endtry @@ -205,51 +210,32 @@ endfunction "returns 1 if this node should be visible according to the tree filters and "hidden file filters (and their on/off status) function! s:TreeFileNode.isVisible() - return !self.path.ignore() + return !self.path.ignore(self.getNerdtree()) endfunction "FUNCTION: TreeFileNode.isRoot() {{{1 -"returns 1 if this node is b:NERDTreeRoot function! s:TreeFileNode.isRoot() if !g:NERDTree.ExistsForBuf() throw "NERDTree.NoTreeError: No tree exists for the current buffer" endif - return self.equals(b:NERDTreeRoot) + return self.equals(self.getNerdtree().root) endfunction -"FUNCTION: TreeFileNode.makeRoot() {{{1 -"Make this node the root of the tree -function! s:TreeFileNode.makeRoot() - if self.path.isDirectory - let b:NERDTreeRoot = self - else - call self.cacheParent() - let b:NERDTreeRoot = self.parent - endif - - call b:NERDTreeRoot.open() - - "change dir to the dir of the new root if instructed to - if g:NERDTreeChDirMode ==# 2 - exec "cd " . b:NERDTreeRoot.path.str({'format': 'Edit'}) - endif - - silent doautocmd User NERDTreeNewRoot -endfunction - -"FUNCTION: TreeFileNode.New(path) {{{1 +"FUNCTION: TreeFileNode.New(path, nerdtree) {{{1 "Returns a new TreeNode object with the given path and parent " "Args: -"path: a path object representing the full filesystem path to the file/dir that the node represents -function! s:TreeFileNode.New(path) +"path: file/dir that the node represents +"nerdtree: the tree the node belongs to +function! s:TreeFileNode.New(path, nerdtree) if a:path.isDirectory - return g:NERDTreeDirNode.New(a:path) + return g:NERDTreeDirNode.New(a:path, a:nerdtree) else let newTreeNode = copy(self) let newTreeNode.path = a:path let newTreeNode.parent = {} + let newTreeNode._nerdtree = a:nerdtree return newTreeNode endif endfunction @@ -289,7 +275,7 @@ endfunction "recurseUpward: try to put the cursor on the parent if the this node isnt "visible function! s:TreeFileNode.putCursorHere(isJump, recurseUpward) - let ln = b:NERDTree.ui.getLineNum(self) + let ln = self.getNerdtree().ui.getLineNum(self) if ln != -1 if a:isJump mark ' @@ -298,11 +284,11 @@ function! s:TreeFileNode.putCursorHere(isJump, recurseUpward) else if a:recurseUpward let node = self - while node != {} && b:NERDTree.ui.getLineNum(node) ==# -1 + while node != {} && self.getNerdtree().ui.getLineNum(node) ==# -1 let node = node.parent call node.open() endwhile - call b:NERDTree.render() + call self._nerdtree.render() call node.putCursorHere(a:isJump, 0) endif endif @@ -310,12 +296,12 @@ endfunction "FUNCTION: TreeFileNode.refresh() {{{1 function! s:TreeFileNode.refresh() - call self.path.refresh() + call self.path.refresh(self.getNerdtree()) endfunction "FUNCTION: TreeFileNode.refreshFlags() {{{1 function! s:TreeFileNode.refreshFlags() - call self.path.refreshFlags() + call self.path.refreshFlags(self.getNerdtree()) endfunction "FUNCTION: TreeFileNode.rename() {{{1 @@ -326,7 +312,7 @@ function! s:TreeFileNode.rename(newName) call self.parent.removeChild(self) let parentPath = self.path.getParent() - let newParent = b:NERDTreeRoot.findNode(parentPath) + let newParent = self.getNerdtree().root.findNode(parentPath) if newParent != {} call newParent.createChild(self.path, 1) @@ -337,70 +323,24 @@ endfunction "FUNCTION: TreeFileNode.renderToString {{{1 "returns a string representation for this tree to be rendered in the view function! s:TreeFileNode.renderToString() - return self._renderToString(0, 0, [], self.getChildCount() ==# 1) + return self._renderToString(0, 0) endfunction "Args: "depth: the current depth in the tree for this call "drawText: 1 if we should actually draw the line for this node (if 0 then the "child nodes are rendered only) -"vertMap: a binary array that indicates whether a vertical bar should be draw "for each depth in the tree -"isLastChild:true if this curNode is the last child of its parent -function! s:TreeFileNode._renderToString(depth, drawText, vertMap, isLastChild) +function! s:TreeFileNode._renderToString(depth, drawText) let output = "" if a:drawText ==# 1 - let treeParts = '' + let treeParts = repeat(' ', a:depth - 1) - "get all the leading spaces and vertical tree parts for this line - if a:depth > 1 - for j in a:vertMap[0:-2] - if g:NERDTreeDirArrows - let treeParts = treeParts . ' ' - else - if j ==# 1 - let treeParts = treeParts . '| ' - else - let treeParts = treeParts . ' ' - endif - endif - endfor + if !self.path.isDirectory + let treeParts = treeParts . ' ' endif - "get the last vertical tree part for this line which will be different - "if this node is the last child of its parent - if !g:NERDTreeDirArrows - if a:isLastChild - let treeParts = treeParts . '`' - else - let treeParts = treeParts . '|' - endif - endif - - "smack the appropriate dir/file symbol on the line before the file/dir - "name itself - if self.path.isDirectory - if self.isOpen - if g:NERDTreeDirArrows - let treeParts = treeParts . '▾ ' - else - let treeParts = treeParts . '~' - endif - else - if g:NERDTreeDirArrows - let treeParts = treeParts . '▸ ' - else - let treeParts = treeParts . '+' - endif - endif - else - if g:NERDTreeDirArrows - let treeParts = treeParts . ' ' - else - let treeParts = treeParts . '-' - endif - endif let line = treeParts . self.displayString() let output = output . line . "\n" @@ -410,18 +350,15 @@ function! s:TreeFileNode._renderToString(depth, drawText, vertMap, isLastChild) if self.path.isDirectory ==# 1 && self.isOpen ==# 1 let childNodesToDraw = self.getVisibleChildren() - if len(childNodesToDraw) > 0 - "draw all the nodes children except the last - let lastIndx = len(childNodesToDraw)-1 - if lastIndx > 0 - for i in childNodesToDraw[0:lastIndx-1] - let output = output . i._renderToString(a:depth + 1, 1, add(copy(a:vertMap), 1), 0) - endfor - endif + if self.isCascadable() && a:depth > 0 - "draw the last child, indicating that it IS the last - let output = output . childNodesToDraw[lastIndx]._renderToString(a:depth + 1, 1, add(copy(a:vertMap), 0), 1) + let output = output . childNodesToDraw[0]._renderToString(a:depth, 0) + + elseif len(childNodesToDraw) > 0 + for i in childNodesToDraw + let output = output . i._renderToString(a:depth + 1, 1) + endfor endif endif diff --git a/sources_non_forked/nerdtree/lib/nerdtree/ui.vim b/sources_non_forked/nerdtree/lib/nerdtree/ui.vim index 22e450c8..1ad44698 100644 --- a/sources_non_forked/nerdtree/lib/nerdtree/ui.vim +++ b/sources_non_forked/nerdtree/lib/nerdtree/ui.vim @@ -21,18 +21,18 @@ endfunction "prints out the quick help function! s:UI._dumpHelp() let old_h = @h - if b:treeShowHelp ==# 1 + if self.getShowHelp() let @h= "\" NERD tree (" . nerdtree#version() . ") quickhelp~\n" let @h=@h."\" ============================\n" let @h=@h."\" File node mappings~\n" let @h=@h."\" ". (g:NERDTreeMouseMode ==# 3 ? "single" : "double") ."-click,\n" let @h=@h."\" ,\n" - if b:NERDTreeType ==# "primary" + if self.nerdtree.isTabTree() let @h=@h."\" ". g:NERDTreeMapActivateNode .": open in prev window\n" else let @h=@h."\" ". g:NERDTreeMapActivateNode .": open in current window\n" endif - if b:NERDTreeType ==# "primary" + if self.nerdtree.isTabTree() let @h=@h."\" ". g:NERDTreeMapPreview .": preview\n" endif let @h=@h."\" ". g:NERDTreeMapOpenInTab.": open in new tab\n" @@ -87,10 +87,10 @@ function! s:UI._dumpHelp() let @h=@h."\"\n\" ----------------------------\n" let @h=@h."\" Tree filtering mappings~\n" - let @h=@h."\" ". g:NERDTreeMapToggleHidden .": hidden files (" . (b:NERDTreeShowHidden ? "on" : "off") . ")\n" - let @h=@h."\" ". g:NERDTreeMapToggleFilters .": file filters (" . (b:NERDTreeIgnoreEnabled ? "on" : "off") . ")\n" - let @h=@h."\" ". g:NERDTreeMapToggleFiles .": files (" . (b:NERDTreeShowFiles ? "on" : "off") . ")\n" - let @h=@h."\" ". g:NERDTreeMapToggleBookmarks .": bookmarks (" . (b:NERDTreeShowBookmarks ? "on" : "off") . ")\n" + let @h=@h."\" ". g:NERDTreeMapToggleHidden .": hidden files (" . (self.getShowHidden() ? "on" : "off") . ")\n" + let @h=@h."\" ". g:NERDTreeMapToggleFilters .": file filters (" . (self.isIgnoreFilterEnabled() ? "on" : "off") . ")\n" + let @h=@h."\" ". g:NERDTreeMapToggleFiles .": files (" . (self.getShowFiles() ? "on" : "off") . ")\n" + let @h=@h."\" ". g:NERDTreeMapToggleBookmarks .": bookmarks (" . (self.getShowBookmarks() ? "on" : "off") . ")\n" "add quickhelp entries for each custom key map let @h=@h."\"\n\" ----------------------------\n" @@ -116,7 +116,7 @@ function! s:UI._dumpHelp() let @h=@h."\" :ClearBookmarks []\n" let @h=@h."\" :ClearAllBookmarks\n" silent! put h - elseif g:NERDTreeMinimalUI == 0 + elseif !self.isMinimal() let @h="\" Press ". g:NERDTreeMapHelp ." for help\n" silent! put h endif @@ -129,6 +129,12 @@ endfunction function! s:UI.New(nerdtree) let newObj = copy(self) let newObj.nerdtree = a:nerdtree + let newObj._showHelp = 0 + let newObj._ignoreEnabled = 1 + let newObj._showFiles = g:NERDTreeShowFiles + let newObj._showHidden = g:NERDTreeShowHidden + let newObj._showBookmarks = g:NERDTreeShowBookmarks + return newObj endfunction @@ -149,18 +155,11 @@ function! s:UI.getPath(ln) "check to see if we have the root node if a:ln == rootLine - return b:NERDTreeRoot.path - endif - - if !g:NERDTreeDirArrows - " in case called from outside the tree - if line !~# '^ *[|`▸▾ ]' || line =~# '^$' - return {} - endif + return self.nerdtree.root.path endif if line ==# s:UI.UpDirLine() - return b:NERDTreeRoot.path.getParent() + return self.nerdtree.root.path.getParent() endif let indent = self._indentLevelFor(line) @@ -183,7 +182,7 @@ function! s:UI.getPath(ln) "have we reached the top of the tree? if lnum == rootLine - let dir = b:NERDTreeRoot.path.str({'format': 'UI'}) . dir + let dir = self.nerdtree.root.path.str({'format': 'UI'}) . dir break endif if curLineStripped =~# '/$' @@ -196,7 +195,7 @@ function! s:UI.getPath(ln) endif endif endwhile - let curFile = b:NERDTreeRoot.path.drive . dir . curFile + let curFile = self.nerdtree.root.path.drive . dir . curFile let toReturn = g:NERDTreePath.New(curFile) return toReturn endfunction @@ -206,19 +205,19 @@ endfunction function! s:UI.getLineNum(file_node) "if the node is the root then return the root line no. if a:file_node.isRoot() - return b:NERDTree.ui.getRootLineNum() + return self.getRootLineNum() endif let totalLines = line("$") "the path components we have matched so far - let pathcomponents = [substitute(b:NERDTreeRoot.path.str({'format': 'UI'}), '/ *$', '', '')] + let pathcomponents = [substitute(self.nerdtree.root.path.str({'format': 'UI'}), '/ *$', '', '')] "the index of the component we are searching for let curPathComponent = 1 let fullpath = a:file_node.path.str({'format': 'UI'}) - let lnum = b:NERDTree.ui.getRootLineNum() + let lnum = self.getRootLineNum() while lnum > 0 let lnum = lnum + 1 "have we reached the bottom of the tree? @@ -259,15 +258,33 @@ function! s:UI.getRootLineNum() return rootLine endfunction +"FUNCTION: s:UI.getShowBookmarks() {{{1 +function! s:UI.getShowBookmarks() + return self._showBookmarks +endfunction + +"FUNCTION: s:UI.getShowFiles() {{{1 +function! s:UI.getShowFiles() + return self._showFiles +endfunction + +"FUNCTION: s:UI.getShowHelp() {{{1 +function! s:UI.getShowHelp() + return self._showHelp +endfunction + +"FUNCTION: s:UI.getShowHidden() {{{1 +function! s:UI.getShowHidden() + return self._showHidden +endfunction + "FUNCTION: s:UI._indentLevelFor(line) {{{1 function! s:UI._indentLevelFor(line) - let level = match(a:line, '[^ \-+~▸▾`|]') / s:UI.IndentWid() - " check if line includes arrows - if match(a:line, '[▸▾]') > -1 - " decrement level as arrow uses 3 ascii chars - let level = level - 1 - endif - return level + "have to do this work around because match() returns bytes, not chars + let numLeadBytes = match(a:line, '\M\[^ '.g:NERDTreeDirArrowExpandable.g:NERDTreeDirArrowCollapsible.']') + let leadChars = strchars(a:line[0:numLeadBytes-1]) + + return leadChars / s:UI.IndentWid() endfunction "FUNCTION: s:UI.IndentWid() {{{1 @@ -275,19 +292,25 @@ function! s:UI.IndentWid() return 2 endfunction +"FUNCTION: s:UI.isIgnoreFilterEnabled() {{{1 +function! s:UI.isIgnoreFilterEnabled() + return self._ignoreEnabled == 1 +endfunction + +"FUNCTION: s:UI.isMinimal() {{{1 +function! s:UI.isMinimal() + return g:NERDTreeMinimalUI +endfunction + "FUNCTION: s:UI.MarkupReg() {{{1 function! s:UI.MarkupReg() - if g:NERDTreeDirArrows - return '^\([▾▸] \| \+[▾▸] \| \+\)' - endif - - return '^[ `|]*[\-+~]' + return '^\(['.g:NERDTreeDirArrowExpandable.g:NERDTreeDirArrowCollapsible.'] \| \+['.g:NERDTreeDirArrowExpandable.g:NERDTreeDirArrowCollapsible.'] \| \+\)' endfunction "FUNCTION: s:UI._renderBookmarks {{{1 function! s:UI._renderBookmarks() - if g:NERDTreeMinimalUI == 0 + if !self.isMinimal() call setline(line(".")+1, ">----------Bookmarks----------") call cursor(line(".")+1, col(".")) endif @@ -334,6 +357,11 @@ function! s:UI.saveScreenState() call nerdtree#exec(win . "wincmd w") endfunction +"FUNCTION: s:UI.setShowHidden(val) {{{1 +function! s:UI.setShowHidden(val) + let self._showHidden = a:val +endfunction + "FUNCTION: s:UI._stripMarkup(line, removeLeadingSpaces){{{1 "returns the given line with all the tree parts stripped off " @@ -390,29 +418,29 @@ function! s:UI.render() call self._dumpHelp() "delete the blank line before the help and add one after it - if g:NERDTreeMinimalUI == 0 + if !self.isMinimal() call setline(line(".")+1, "") call cursor(line(".")+1, col(".")) endif - if b:NERDTreeShowBookmarks + if self.getShowBookmarks() call self._renderBookmarks() endif "add the 'up a dir' line - if !g:NERDTreeMinimalUI + if !self.isMinimal() call setline(line(".")+1, s:UI.UpDirLine()) call cursor(line(".")+1, col(".")) endif "draw the header line - let header = b:NERDTreeRoot.path.str({'format': 'UI', 'truncateTo': winwidth(0)}) + let header = self.nerdtree.root.path.str({'format': 'UI', 'truncateTo': winwidth(0)}) call setline(line(".")+1, header) call cursor(line(".")+1, col(".")) "draw the tree let old_o = @o - let @o = b:NERDTreeRoot.renderToString() + let @o = self.nerdtree.root.renderToString() silent put o let @o = old_o @@ -443,47 +471,52 @@ function! s:UI.renderViewSavingPosition() let currentNode = currentNode.parent endwhile - call b:NERDTree.render() + call self.render() if currentNode != {} call currentNode.putCursorHere(0, 0) endif endfunction +"FUNCTION: s:UI.toggleHelp() {{{1 +function! s:UI.toggleHelp() + let self._showHelp = !self._showHelp +endfunction + " FUNCTION: s:UI.toggleIgnoreFilter() {{{1 " toggles the use of the NERDTreeIgnore option function! s:UI.toggleIgnoreFilter() - let b:NERDTreeIgnoreEnabled = !b:NERDTreeIgnoreEnabled - call b:NERDTree.ui.renderViewSavingPosition() - call b:NERDTree.ui.centerView() + let self._ignoreEnabled = !self._ignoreEnabled + call self.renderViewSavingPosition() + call self.centerView() endfunction " FUNCTION: s:UI.toggleShowBookmarks() {{{1 " toggles the display of bookmarks function! s:UI.toggleShowBookmarks() - let b:NERDTreeShowBookmarks = !b:NERDTreeShowBookmarks - if b:NERDTreeShowBookmarks - call b:NERDTree.render() + let self._showBookmarks = !self._showBookmarks + if self.getShowBookmarks() + call self.nerdtree.render() call g:NERDTree.CursorToBookmarkTable() else - call b:NERDTree.ui.renderViewSavingPosition() + call self.renderViewSavingPosition() endif - call b:NERDTree.ui.centerView() + call self.centerView() endfunction " FUNCTION: s:UI.toggleShowFiles() {{{1 " toggles the display of hidden files function! s:UI.toggleShowFiles() - let b:NERDTreeShowFiles = !b:NERDTreeShowFiles - call b:NERDTree.ui.renderViewSavingPosition() - call b:NERDTree.ui.centerView() + let self._showFiles = !self._showFiles + call self.renderViewSavingPosition() + call self.centerView() endfunction " FUNCTION: s:UI.toggleShowHidden() {{{1 " toggles the display of hidden files function! s:UI.toggleShowHidden() - let b:NERDTreeShowHidden = !b:NERDTreeShowHidden - call b:NERDTree.ui.renderViewSavingPosition() + let self._showHidden = !self._showHidden + call self.renderViewSavingPosition() call self.centerView() endfunction diff --git a/sources_non_forked/nerdtree/nerdtree_plugin/exec_menuitem.vim b/sources_non_forked/nerdtree/nerdtree_plugin/exec_menuitem.vim index e7a7c532..c53650a5 100644 --- a/sources_non_forked/nerdtree/nerdtree_plugin/exec_menuitem.vim +++ b/sources_non_forked/nerdtree/nerdtree_plugin/exec_menuitem.vim @@ -2,7 +2,6 @@ " File: exec_menuitem.vim " Description: plugin for NERD Tree that provides an execute file menu item " Maintainer: Martin Grenfell -" Last Change: 22 July, 2009 " License: This program is free software. It comes without any warranty, " to the extent permitted by applicable law. You can redistribute " it and/or modify it under the terms of the Do What The Fuck You diff --git a/sources_non_forked/nerdtree/nerdtree_plugin/fs_menu.vim b/sources_non_forked/nerdtree/nerdtree_plugin/fs_menu.vim index e99a85be..20a9fcd3 100644 --- a/sources_non_forked/nerdtree/nerdtree_plugin/fs_menu.vim +++ b/sources_non_forked/nerdtree/nerdtree_plugin/fs_menu.vim @@ -2,7 +2,6 @@ " File: fs_menu.vim " Description: plugin for the NERD Tree that provides a file system menu " Maintainer: Martin Grenfell -" Last Change: 17 July, 2009 " License: This program is free software. It comes without any warranty, " to the extent permitted by applicable law. You can redistribute " it and/or modify it under the terms of the Do What The Fuck You @@ -24,7 +23,7 @@ call NERDTreeAddMenuItem({'text': '(a)dd a childnode', 'shortcut': 'a', 'callbac call NERDTreeAddMenuItem({'text': '(m)ove the current node', 'shortcut': 'm', 'callback': 'NERDTreeMoveNode'}) call NERDTreeAddMenuItem({'text': '(d)elete the current node', 'shortcut': 'd', 'callback': 'NERDTreeDeleteNode'}) -if has("gui_mac") || has("gui_macvim") +if has("gui_mac") || has("gui_macvim") || has("mac") call NERDTreeAddMenuItem({'text': '(r)eveal in Finder the current node', 'shortcut': 'r', 'callback': 'NERDTreeRevealInFinder'}) call NERDTreeAddMenuItem({'text': '(o)pen the current node with system editor', 'shortcut': 'o', 'callback': 'NERDTreeExecuteFile'}) call NERDTreeAddMenuItem({'text': '(q)uicklook the current node', 'shortcut': 'q', 'callback': 'NERDTreeQuickLook'}) @@ -34,18 +33,11 @@ if g:NERDTreePath.CopyingSupported() call NERDTreeAddMenuItem({'text': '(c)opy the current node', 'shortcut': 'c', 'callback': 'NERDTreeCopyNode'}) endif -"FUNCTION: s:echo(msg){{{1 -function! s:echo(msg) - redraw - echomsg "NERDTree: " . a:msg -endfunction - -"FUNCTION: s:echoWarning(msg){{{1 -function! s:echoWarning(msg) - echohl warningmsg - call s:echo(a:msg) - echohl normal -endfunction +if has("unix") || has("osx") + call NERDTreeAddMenuItem({'text': '(l)ist the current node', 'shortcut': 'l', 'callback': 'NERDTreeListNode'}) +else + call NERDTreeAddMenuItem({'text': '(l)ist the current node', 'shortcut': 'l', 'callback': 'NERDTreeListNodeWin32'}) +endif "FUNCTION: s:promptToDelBuffer(bufnum, msg){{{1 "prints out the given msg and, if the user responds by pushing 'y' then the @@ -107,17 +99,17 @@ function! NERDTreeAddNode() \ "", curDirNode.path.str() . g:NERDTreePath.Slash(), "file") if newNodeName ==# '' - call s:echo("Node Creation Aborted.") + call nerdtree#echo("Node Creation Aborted.") return endif try let newPath = g:NERDTreePath.Create(newNodeName) - let parentNode = b:NERDTreeRoot.findNode(newPath.getParent()) + let parentNode = b:NERDTree.root.findNode(newPath.getParent()) - let newTreeNode = g:NERDTreeFileNode.New(newPath) + let newTreeNode = g:NERDTreeFileNode.New(newPath, b:NERDTree) if empty(parentNode) - call b:NERDTreeRoot.refresh() + call b:NERDTree.root.refresh() call b:NERDTree.render() elseif parentNode.isOpen || !empty(parentNode.children) call parentNode.addChild(newTreeNode, 1) @@ -125,7 +117,7 @@ function! NERDTreeAddNode() call newTreeNode.putCursorHere(1, 0) endif catch /^NERDTree/ - call s:echoWarning("Node Not Created.") + call nerdtree#echoWarning("Node Not Created.") endtry endfunction @@ -138,7 +130,7 @@ function! NERDTreeMoveNode() \ "", curNode.path.str(), "file") if newNodePath ==# '' - call s:echo("Node Renaming Aborted.") + call nerdtree#echo("Node Renaming Aborted.") return endif @@ -159,7 +151,7 @@ function! NERDTreeMoveNode() redraw catch /^NERDTree/ - call s:echoWarning("Node Not Renamed.") + call nerdtree#echoWarning("Node Not Renamed.") endtry endfunction @@ -199,10 +191,33 @@ function! NERDTreeDeleteNode() redraw catch /^NERDTree/ - call s:echoWarning("Could not remove node") + call nerdtree#echoWarning("Could not remove node") endtry else - call s:echo("delete aborted") + call nerdtree#echo("delete aborted") + endif + +endfunction + +" FUNCTION: NERDTreeListNode() {{{1 +function! NERDTreeListNode() + let treenode = g:NERDTreeFileNode.GetSelected() + if treenode != {} + let metadata = split(system('ls -ld ' . shellescape(treenode.path.str())), '\n') + call nerdtree#echo(metadata[0]) + else + call nerdtree#echo("No information avaialable") + endif +endfunction + +" FUNCTION: NERDTreeListNodeWin32() {{{1 +function! NERDTreeListNodeWin32() + let treenode = g:NERDTreeFileNode.GetSelected() + if treenode != {} + let metadata = split(system('DIR /Q ' . shellescape(treenode.path.str()) . ' | FINDSTR "^[012][0-9]/[0-3][0-9]/[12][0-9][0-9][0-9]"'), '\n') + call nerdtree#echo(metadata[0]) + else + call nerdtree#echo("No information avaialable") endif endfunction @@ -221,7 +236,7 @@ function! NERDTreeCopyNode() let confirmed = 1 if currentNode.path.copyingWillOverwrite(newNodePath) - call s:echo("Warning: copying may overwrite files! Continue? (yN)") + call nerdtree#echo("Warning: copying may overwrite files! Continue? (yN)") let choice = nr2char(getchar()) let confirmed = choice ==# 'y' endif @@ -230,22 +245,23 @@ function! NERDTreeCopyNode() try let newNode = currentNode.copy(newNodePath) if empty(newNode) - call b:NERDTreeRoot.refresh() + call b:NERDTree.root.refresh() call b:NERDTree.render() else call NERDTreeRender() call newNode.putCursorHere(0, 0) endif catch /^NERDTree/ - call s:echoWarning("Could not copy node") + call nerdtree#echoWarning("Could not copy node") endtry endif else - call s:echo("Copy aborted.") + call nerdtree#echo("Copy aborted.") endif redraw endfunction +" FUNCTION: NERDTreeQuickLook() {{{1 function! NERDTreeQuickLook() let treenode = g:NERDTreeFileNode.GetSelected() if treenode != {} @@ -253,18 +269,19 @@ function! NERDTreeQuickLook() endif endfunction +" FUNCTION: NERDTreeRevealInFinder() {{{1 function! NERDTreeRevealInFinder() let treenode = g:NERDTreeFileNode.GetSelected() if treenode != {} - let x = system("open -R '" . treenode.path.str() . "'") + call system("open -R '" . treenode.path.str() . "'") endif endfunction +" FUNCTION: NERDTreeExecuteFile() {{{1 function! NERDTreeExecuteFile() let treenode = g:NERDTreeFileNode.GetSelected() if treenode != {} - let x = system("open '" . treenode.path.str() . "'") + call system("open '" . treenode.path.str() . "'") endif endfunction - " vim: set sw=4 sts=4 et fdm=marker: diff --git a/sources_non_forked/nerdtree/plugin/NERD_tree.vim b/sources_non_forked/nerdtree/plugin/NERD_tree.vim index 966838c3..bbcc55f6 100644 --- a/sources_non_forked/nerdtree/plugin/NERD_tree.vim +++ b/sources_non_forked/nerdtree/plugin/NERD_tree.vim @@ -1,8 +1,6 @@ " ============================================================================ " File: NERD_tree.vim -" Description: vim global plugin that provides a nice tree explorer " Maintainer: Martin Grenfell -" Last Change: 28 December, 2011 " License: This program is free software. It comes without any warranty, " to the extent permitted by applicable law. You can redistribute " it and/or modify it under the terms of the Do What The Fuck You @@ -67,7 +65,14 @@ call s:initVariable("g:NERDTreeShowFiles", 1) call s:initVariable("g:NERDTreeShowHidden", 0) call s:initVariable("g:NERDTreeShowLineNumbers", 0) call s:initVariable("g:NERDTreeSortDirs", 1) -call s:initVariable("g:NERDTreeDirArrows", !nerdtree#runningWindows()) + +if !nerdtree#runningWindows() + call s:initVariable("g:NERDTreeDirArrowExpandable", "▸") + call s:initVariable("g:NERDTreeDirArrowCollapsible", "▾") +else + call s:initVariable("g:NERDTreeDirArrowExpandable", "+") + call s:initVariable("g:NERDTreeDirArrowCollapsible", "~") +endif call s:initVariable("g:NERDTreeCascadeOpenSingleChildDir", 1) if !exists("g:NERDTreeSortOrder") @@ -83,8 +88,8 @@ if !exists('g:NERDTreeStatusline') "the exists() crap here is a hack to stop vim spazzing out when "loading a session that was created with an open nerd tree. It spazzes - "because it doesnt store b:NERDTreeRoot (its a b: var, and its a hash) - let g:NERDTreeStatusline = "%{exists('b:NERDTreeRoot')?b:NERDTreeRoot.path.str():''}" + "because it doesnt store b:NERDTree(its a b: var, and its a hash) + let g:NERDTreeStatusline = "%{exists('b:NERDTree')?b:NERDTree.root.path.str():''}" endif call s:initVariable("g:NERDTreeWinPos", "left") @@ -188,7 +193,7 @@ function! NERDTreeFocus() if g:NERDTree.IsOpen() call g:NERDTree.CursorToTreeWin() else - call g:NERDTreeCreator.TogglePrimary("") + call g:NERDTreeCreator.ToggleTabTree("") endif endfunction diff --git a/sources_non_forked/nerdtree/syntax/nerdtree.vim b/sources_non_forked/nerdtree/syntax/nerdtree.vim index 5f7b49cc..8a4e4245 100644 --- a/sources_non_forked/nerdtree/syntax/nerdtree.vim +++ b/sources_non_forked/nerdtree/syntax/nerdtree.vim @@ -22,42 +22,19 @@ syn match NERDTreeLinkDir #.*/ ->#me=e-3 containedin=NERDTreeDir "highlighing for directory nodes and file nodes syn match NERDTreeDirSlash #/# containedin=NERDTreeDir -if g:NERDTreeDirArrows - syn match NERDTreeClosable #▾# containedin=NERDTreeDir,NERDTreeFile - syn match NERDTreeOpenable #▸# containedin=NERDTreeDir,NERDTreeFile +exec 'syn match NERDTreeClosable #'.escape(g:NERDTreeDirArrowCollapsible, '~').'# containedin=NERDTreeDir,NERDTreeFile' +exec 'syn match NERDTreeOpenable #'.escape(g:NERDTreeDirArrowExpandable, '~').'# containedin=NERDTreeDir,NERDTreeFile' - syn match NERDTreeDir #[^▾▸ ].*/# - syn match NERDTreeExecFile #^ .*\*\($\| \)# contains=NERDTreeRO,NERDTreeBookmark - syn match NERDTreeFile #^[^"\.▾▸] *[^▾▸]*# contains=NERDTreeLink,NERDTreeRO,NERDTreeBookmark,NERDTreeExecFile +let s:dirArrows = escape(g:NERDTreeDirArrowCollapsible, '~').escape(g:NERDTreeDirArrowExpandable, '~') +exec 'syn match NERDTreeDir #[^'.s:dirArrows.' ].*/#' +syn match NERDTreeExecFile #^ .*\*\($\| \)# contains=NERDTreeRO,NERDTreeBookmark +exec 'syn match NERDTreeFile #^[^"\.'.s:dirArrows.'] *[^'.s:dirArrows.']*# contains=NERDTreeLink,NERDTreeRO,NERDTreeBookmark,NERDTreeExecFile' - "highlighting for readonly files - syn match NERDTreeRO # *\zs.*\ze \[RO\]# contains=NERDTreeIgnore,NERDTreeBookmark,NERDTreeFile +"highlighting for readonly files +syn match NERDTreeRO # *\zs.*\ze \[RO\]# contains=NERDTreeIgnore,NERDTreeBookmark,NERDTreeFile - syn match NERDTreeFlags #^ *\zs\[.\]# containedin=NERDTreeFile - syn match NERDTreeFlags #\[.\]# containedin=NERDTreeDir -else - "highlighting for the ~/+ symbols for the directory nodes - syn match NERDTreeClosable #\~\<# - syn match NERDTreeClosable #\~\.# - syn match NERDTreeOpenable #+\<# - syn match NERDTreeOpenable #+\.#he=e-1 - - "highlighting for the tree structural parts - syn match NERDTreePart #|# - syn match NERDTreePart #`# - syn match NERDTreePartFile #[|`]-#hs=s+1 contains=NERDTreePart - - syn match NERDTreeDir #[^-| `].*/# contains=NERDTreeLink,NERDTreeOpenable,NERDTreeClosable - syn match NERDTreeExecFile #[|` ].*\*\($\| \)# contains=NERDTreeLink,NERDTreePart,NERDTreePartFile,NERDTreeBookmark - syn match NERDTreeFile #|-.*# contains=NERDTreeLink,NERDTreePart,NERDTreePartFile,NERDTreeBookmark,NERDTreeExecFile - syn match NERDTreeFile #`-.*# contains=NERDTreeLink,NERDTreePart,NERDTreePartFile,NERDTreeBookmark,NERDTreeExecFile - - "highlighting for readonly files - syn match NERDTreeRO #|-.*\[RO\]#he=e-5 contains=NERDTreeIgnore,NERDTreeBookmark,NERDTreePart,NERDTreePartFile - - syn match NERDTreeFlags #-\[.\]# containedin=NERDTreeFile,NERDTreePartFile - syn match NERDTreeFlags #[+~]\zs\[.\]# containedin=NERDTreeDir -endif +syn match NERDTreeFlags #^ *\zs\[.\]# containedin=NERDTreeFile,NERDTreeExecFile +syn match NERDTreeFlags #\[.\]# containedin=NERDTreeDir syn match NERDTreeCWD #^[ diff --git a/sources_non_forked/syntastic/README.markdown b/sources_non_forked/syntastic/README.markdown index b9e08c4e..aa5d842f 100644 --- a/sources_non_forked/syntastic/README.markdown +++ b/sources_non_forked/syntastic/README.markdown @@ -35,7 +35,7 @@ 4.8. [How can I pass additional arguments to a checker?](#faqargs) 4.9. [Syntastic supports several checkers for my filetype - how do I tell which one(s) to use?](#faqcheckers) 4.10. [What is the difference between syntax checkers and style checkers?](#faqstyle) -4.11. [I have enabled multiple checkers for the current filetype. How can I display all of the errors from all of the checkers together?](#faqaggregate) +4.11. [I have enabled multiple checkers for the current filetype. How can I display all errors from all checkers together?](#faqaggregate) 4.12. [How can I jump between the different errors without using the location list at the bottom of the window?](#faqlnext) 4.13. [The error window is closed automatically when I :quit the current buffer but not when I :bdelete it?](#faqbdelete) 5. [Resources](#otherresources) @@ -53,22 +53,23 @@ are detected, the user is notified and is happy because they didn't have to compile their code or execute their script to find them. At the time of this writing, syntastic has checking plugins for ActionScript, -Ada, API Blueprint, AppleScript, AsciiDoc, ASM, BEMHTML, Bro, Bourne shell, C, -C++, C#, Cabal, Chef, CoffeeScript, Coco, Coq, CSS, Cucumber, CUDA, D, Dart, -DocBook, Dust, Elixir, Erlang, eRuby, Fortran, Gentoo metadata, GLSL, Go, Haml, -Haskell, Haxe, Handlebars, HSS, HTML, Java, JavaScript, JSON, JSX, LESS, Lex, -Limbo, LISP, LLVM intermediate language, Lua, Markdown, MATLAB, Mercury, NASM, -Nix, Objective-C, Objective-C++, OCaml, Perl, Perl POD, PHP, gettext Portable -Object, OS X and iOS property lists, Puppet, Python, R, Racket, Relax NG, -reStructuredText, RPM spec, Ruby, SASS/SCSS, Scala, Slim, SML, Sphinx, Tcl, -TeX, Texinfo, Twig, TypeScript, Vala, Verilog, VHDL, VimL, xHtml, XML, XSLT, +Ada, Ansible configurations, API Blueprint, AppleScript, AsciiDoc, ASM, +BEMHTML, Bro, Bourne shell, C, C++, C#, Cabal, Chef, CoffeeScript, Coco, Coq, +CSS, Cucumber, CUDA, D, Dart, DocBook, Dockerfile, Dust, Elixir, Erlang, +eRuby, Fortran, Gentoo metadata, GLSL, Go, Haml, Haskell, Haxe, Handlebars, +HSS, HTML, Jade, Java, JavaScript, JSON, JSX, LESS, Lex, Limbo, LISP, LLVM +intermediate language, Lua, Markdown, MATLAB, Mercury, NASM, Nix, Objective-C, +Objective-C++, OCaml, Perl, Perl POD, PHP, gettext Portable Object, OS X and +iOS property lists, Puppet, Python, QML, R, Racket, Relax NG, reStructuredText, +RPM spec, Ruby, SASS/SCSS, Scala, Slim, SML, Sphinx, SQL, Stylus, Tcl, TeX, +Texinfo, Twig, TypeScript, Vala, Verilog, VHDL, VimL, xHtml, XML, XSLT, XQuery, YACC, YAML, z80, Zope page templates, and zsh. See the [wiki][3] for details about the corresponding supported checkers. A number of third-party Vim plugins also provide checkers for syntastic, -for example: [omnisharp-vim][25], [rust.vim][12], [syntastic-extras][26], -[syntastic-more][27], [vim-crystal][29], [vim-eastwood][28], and -[vim-swift][24]. +for example: [merlin][30], [omnisharp-vim][25], [rust.vim][12], +[syntastic-extras][26], [syntastic-more][27], [vim-crystal][29], +[vim-eastwood][28], and [vim-swift][24]. Below is a screenshot showing the methods that Syntastic uses to display syntax errors. Note that, in practise, you will only have a subset of these methods @@ -159,10 +160,10 @@ following: ## 3\. Recommended settings -Syntastic has a large number of options that can be configured, and the -defaults are not particularly well suitable for new users. It is recommended -that you start by adding the following lines to your `vimrc` file, and return -to them after reading the manual (see `:help syntastic` in Vim): +Syntastic has numerous options that can be configured, and the defaults +are not particularly well suitable for new users. It is recommended +that you start by adding the following lines to your `vimrc` file, and +return to them after reading the manual (see `:help syntastic` in Vim): ```vim set statusline+=%#warningmsg# set statusline+=%{SyntasticStatuslineFlag()} @@ -380,7 +381,7 @@ See `:help syntastic_quiet_messages` for details. __4.11. Q. I have enabled multiple checkers for the current filetype. How can I -display all of the errors from all of the checkers together?__ +display all errors from all checkers together?__ A. Set `g:syntastic_aggregate_errors` to 1 in your `vimrc`: ```vim @@ -427,7 +428,8 @@ There are also a dedicated [google group][5], and a Syntastic aims to provide a common interface to syntax checkers for as many languages as possible. For particular languages, there are, of course, other plugins that provide more functionality than syntastic. You might want to take -a look at [jedi-vim][7], [python-mode][8], or [YouCompleteMe][9]. +a look at [ghcmod-vim][31], [jedi-vim][7], [python-mode][8], [vim-go][32], or +[YouCompleteMe][9]. [0]: https://github.com/scrooloose/syntastic/raw/master/_assets/screenshot_1.png [1]: https://github.com/tpope/vim-pathogen @@ -459,6 +461,9 @@ a look at [jedi-vim][7], [python-mode][8], or [YouCompleteMe][9]. [27]: https://github.com/roktas/syntastic-more [28]: https://github.com/venantius/vim-eastwood [29]: https://github.com/rhysd/vim-crystal +[30]: https://github.com/the-lambda-church/merlin +[31]: https://github.com/eagletmt/ghcmod-vim +[32]: https://github.com/fatih/vim-go " +syn region jadeAttributes matchgroup=jadeAttributesDelimiter start="(" end=")" contained contains=@htmlJavascript,jadeHtmlArg,htmlArg,htmlEvent,htmlCssDefinition nextgroup=@jadeComponent +syn match jadeClassChar "\." contained nextgroup=jadeClass +syn match jadeBlockExpansionChar ":\s\+" contained nextgroup=jadeTag,jadeClassChar,jadeIdChar +syn match jadeIdChar "#[[{]\@!" contained nextgroup=jadeId +syn match jadeClass "\%(\w\|-\)\+" contained nextgroup=@jadeComponent +syn match jadeId "\%(\w\|-\)\+" contained nextgroup=@jadeComponent +syn region jadeDocType start="^\s*\(!!!\|doctype\)" end="$" +" Unless I'm mistaken, syntax/html.vim requires +" that the = sign be present for these matches. +" This adds the matches back for jade. +syn keyword jadeHtmlArg contained href title + +syn match jadePlainChar "\\" contained +syn region jadeInterpolation matchgroup=jadeInterpolationDelimiter start="[#!]{" end="}" contains=@htmlJavascript +syn match jadeInterpolationEscape "\\\@[?!]\@!" +syn match jadeScriptStatement "^\s*\<\%(each\|for\|block\|prepend\|append\|mixin\|extends\|include\)\>[?!]\@!" +syn region jadeScriptLoopRegion start="^\s*\(for \)" end="$" contains=jadeScriptLoopKeywords +syn keyword jadeScriptLoopKeywords for in contained + +syn region jadeJavascript start="^\z(\s*\)script\%(:\w\+\)\=" end="^\%(\z1\s\|\s*$\)\@!" contains=@htmlJavascript,jadeJavascriptTag,jadeCoffeescriptFilter keepend + +syn region jadeCoffeescriptFilter matchgroup=jadeFilter start="^\z(\s*\):coffee-\?script\s*$" end="^\%(\z1\s\|\s*$\)\@!" contains=@htmlCoffeescript contained +syn region jadeJavascriptTag contained start="^\z(\s*\)script\%(:\w\+\)\=" end="$" contains=jadeBegin,jadeTag +syn region jadeCssBlock start="^\z(\s*\)style" nextgroup=@jadeComponent,jadeError end="^\%(\z1\s\|\s*$\)\@!" contains=@htmlCss keepend + +syn match jadeError "\$" contained + +hi def link jadePlainChar Special +hi def link jadeScriptConditional PreProc +hi def link jadeScriptLoopKeywords PreProc +hi def link jadeScriptStatement PreProc +hi def link jadeHtmlArg htmlArg +hi def link jadeAttributeString String +hi def link jadeAttributesDelimiter Identifier +hi def link jadeIdChar Special +hi def link jadeClassChar Special +hi def link jadeBlockExpansionChar Special +hi def link jadePipeChar Special +hi def link jadeTagBlockChar Special +hi def link jadeId Identifier +hi def link jadeClass Type +hi def link jadeInterpolationDelimiter Delimiter +hi def link jadeInlineDelimiter Delimiter +hi def link jadeFilter PreProc +hi def link jadeDocType PreProc +hi def link jadeComment Comment +hi def link jadeCommentBlock Comment +hi def link jadeHtmlConditionalComment jadeComment + +let b:current_syntax = "jade" + +if main_syntax == "jade" + unlet main_syntax +endif diff --git a/sources_non_forked/vim-markdown/syntax/markdown.vim b/sources_non_forked/vim-markdown/syntax/markdown.vim index 49dbe3a7..925f9069 100644 --- a/sources_non_forked/vim-markdown/syntax/markdown.vim +++ b/sources_non_forked/vim-markdown/syntax/markdown.vim @@ -85,14 +85,14 @@ exe 'syn region markdownBoldItalic matchgroup=markdownBoldItalicDelimiter start= syn region markdownCode matchgroup=markdownCodeDelimiter start="`" end="`" keepend contains=markdownLineStart syn region markdownCode matchgroup=markdownCodeDelimiter start="`` \=" end=" \=``" keepend contains=markdownLineStart -syn region markdownCode matchgroup=markdownCodeDelimiter start="^\s*```.*$" end="^\s*```\ze\s*$" keepend +syn region markdownCode matchgroup=markdownCodeDelimiter start="^\s*```*.*$" end="^\s*```*\ze\s*$" keepend syn match markdownFootnote "\[^[^\]]\+\]" syn match markdownFootnoteDefinition "^\[^[^\]]\+\]:" if main_syntax ==# 'markdown' for s:type in g:markdown_fenced_languages - exe 'syn region markdownHighlight'.substitute(matchstr(s:type,'[^=]*$'),'\..*','','').' matchgroup=markdownCodeDelimiter start="^\s*```\s*'.matchstr(s:type,'[^=]*').'\>.*$" end="^\s*```\ze\s*$" keepend contains=@markdownHighlight'.substitute(matchstr(s:type,'[^=]*$'),'\.','','g') + exe 'syn region markdownHighlight'.substitute(matchstr(s:type,'[^=]*$'),'\..*','','').' matchgroup=markdownCodeDelimiter start="^\s*```*\s*'.matchstr(s:type,'[^=]*').'\>.*$" end="^\s*```*\ze\s*$" keepend contains=@markdownHighlight'.substitute(matchstr(s:type,'[^=]*$'),'\.','','g') endfor unlet! s:type endif diff --git a/sources_non_forked/vim-multiple-cursors/.travis.yml b/sources_non_forked/vim-multiple-cursors/.travis.yml index e99037a9..cfb198ab 100644 --- a/sources_non_forked/vim-multiple-cursors/.travis.yml +++ b/sources_non_forked/vim-multiple-cursors/.travis.yml @@ -1,7 +1,11 @@ +sudo: false language: ruby -rvm: - - 1.9.3 -before_install: sudo apt-get install vim-gtk + +addons: + apt: + packages: + - vim-gtk + before_script: - "export DISPLAY=:99.0" - "sh -e /etc/init.d/xvfb start" diff --git a/sources_non_forked/vim-multiple-cursors/Gemfile.lock b/sources_non_forked/vim-multiple-cursors/Gemfile.lock index 12bf0d65..e833b243 100644 --- a/sources_non_forked/vim-multiple-cursors/Gemfile.lock +++ b/sources_non_forked/vim-multiple-cursors/Gemfile.lock @@ -1,17 +1,22 @@ GEM remote: https://rubygems.org/ specs: - diff-lcs (1.2.4) - rake (10.0.4) - rspec (2.13.0) - rspec-core (~> 2.13.0) - rspec-expectations (~> 2.13.0) - rspec-mocks (~> 2.13.0) - rspec-core (2.13.1) - rspec-expectations (2.13.0) - diff-lcs (>= 1.1.3, < 2.0) - rspec-mocks (2.13.1) - vimrunner (0.3.0) + diff-lcs (1.2.5) + rake (10.4.2) + rspec (3.4.0) + rspec-core (~> 3.4.0) + rspec-expectations (~> 3.4.0) + rspec-mocks (~> 3.4.0) + rspec-core (3.4.1) + rspec-support (~> 3.4.0) + rspec-expectations (3.4.0) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.4.0) + rspec-mocks (3.4.0) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.4.0) + rspec-support (3.4.1) + vimrunner (0.3.1) PLATFORMS ruby @@ -20,3 +25,6 @@ DEPENDENCIES rake rspec vimrunner + +BUNDLED WITH + 1.10.6 diff --git a/sources_non_forked/vim-multiple-cursors/README.md b/sources_non_forked/vim-multiple-cursors/README.md index 4afc422e..3c22687f 100644 --- a/sources_non_forked/vim-multiple-cursors/README.md +++ b/sources_non_forked/vim-multiple-cursors/README.md @@ -13,7 +13,7 @@ - *[Known Issues](#known-issues)* - [Changelog](#changelog) - [Contributing](#contributing) - - [Credit](#credit) + - [Credit](#credit) ###Contributors - [eapache](https://github.com/eapache) @@ -138,6 +138,15 @@ normal mode will "fail to replay" when multiple cursors are active. For example, changing it from `{}` to `{'d':1}` makes normal-mode mappings beginning with `d` (such as `dw` to delete a word) work in multi-cursor mode. +### ```g:multi_cursor_visual_maps``` (Default: see below) +Default value: `{'i':1, 'a':1, 'f':1, 'F':1, 't':1, 'T':1}` + +Any key in this map (values are ignored) will cause multi-cursor _Visual_ mode +to pause for map completion just like normal vim. Otherwise keys mapped in +visual mode will "fail to replay" when multiple cursors are active. For example, +changing it from `{}` to `{'i':1}` makes visual-mode mappings beginning with `i` +(such as `it` to select an "inner tag block") work in multi-cursor mode. + The default list contents should work for anybody, unless they have remapped a key from an operator-pending command to a non-operator-pending command or vice versa. @@ -150,9 +159,9 @@ such as `j` as if they were operator-pending commands can break things. ### ```Multiple_cursors_before/Multiple_cursors_after``` (Default: `nothing`) -Other plugins may trigger on keypresses when in insert mode. These plugins +Other plugins may trigger on keypresses when in insert mode. These plugins generally provide a means to toggle their active state. These hooks allow -the user to provide functions in their .vimrc to do this when multiple-cursor-mode +the user to provide functions in their .vimrc to do this when multiple-cursor-mode is entered. For example, if you are using [Neocomplete](https://github.com/Shougo/neocomplete.vim), @@ -193,11 +202,6 @@ highlight link multiple_cursors_visual Visual ## Known Issues - Select mode is not implemented -- `I` and `A` do not work in Visual mode yet (See [#55](../../issues/55)) - - Single key command to switch to Insert mode such as `c` or `s` from Visual mode or `i`, `a`, `I`, `A` in Normal mode should work without any issues. - -**NOTE**: Vim's Visual Block mode also supports `I` and `A` commands, however they do not work in this plugin's Visual mode at the moment. For now, to use `I` and `A`, switch to Normal mode by pressing `v` first. ## Changelog See [CHANGELOG.md](CHANGELOG.md) @@ -219,6 +223,4 @@ Obviously inspired by Sublime Text's [multiple selection][sublime-multiple-selec [emacs-multiple-cursors]:https://github.com/magnars/multiple-cursors.el - [![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/terryma/vim-multiple-cursors/trend.png)](https://bitdeli.com/free "Bitdeli Badge") - diff --git a/sources_non_forked/vim-multiple-cursors/autoload/multiple_cursors.vim b/sources_non_forked/vim-multiple-cursors/autoload/multiple_cursors.vim index 5763c7b4..7784c08c 100644 --- a/sources_non_forked/vim-multiple-cursors/autoload/multiple_cursors.vim +++ b/sources_non_forked/vim-multiple-cursors/autoload/multiple_cursors.vim @@ -268,6 +268,7 @@ function! s:Cursor.new(position) let obj = copy(self) let obj.position = copy(a:position) let obj.visual = [] + let obj.saved_visual = [] " Stores text that was yanked after any commands in Normal or Visual mode let obj.paste_buffer_text = getreg('"') let obj.paste_buffer_type = getregtype('"') @@ -332,6 +333,7 @@ endfunction " Remove the visual selection and its highlight function! s:Cursor.remove_visual_selection() dict + let self.saved_visual = deepcopy(self.visual) let self.visual = [] " TODO(terryma): Move functionality into separate class call s:cm.remove_highlight(self.visual_hi_id) @@ -409,6 +411,7 @@ function! s:CursorManager.reset(restore_view, restore_setting, ...) dict let self.saved_winview = [] let self.start_from_find = 0 let s:char = '' + let s:saved_char = '' if a:restore_setting call self.restore_user_settings() endif @@ -626,6 +629,13 @@ function! s:CursorManager.restore_user_settings() dict call setreg('"', s:paste_buffer_temporary_text, s:paste_buffer_temporary_type) endfunction +" Reposition all cursors to the start or end of their region +function! s:CursorManager.reposition_all_within_region(start) dict + for c in self.cursors + call c.update_position(c.saved_visual[a:start ? 0 : 1]) + endfor +endfunction + " Reselect the current cursor's region in visual mode function! s:CursorManager.reapply_visual_selection() dict call s:select_in_visual_mode(self.get_current().visual) @@ -670,6 +680,9 @@ endfunction " This is the last user input that we're going to replicate, in its string form let s:char = '' +" This is either `I` or `A`, as input in Visual mode, that we're going to use +" to make the appropriate transition into Insert mode +let s:saved_char = '' " This is the mode the user is in before s:char let s:from_mode = '' " This is the mode the user is in after s:char @@ -898,12 +911,34 @@ endfunction " to be called to continue the fanout process function! s:detect_bad_input() if !s:valid_input + " To invoke the appropriate `(multiple-cursors-apply)` mapping, we + " need to revert back to the mode the user was in when the input was entered + call s:revert_mode(s:to_mode, s:from_mode) " We ignore the bad input and force invoke s:apply_user_input_next call feedkeys("\(multiple-cursors-apply)") let s:bad_input += 1 endif endfunction +" Complete transition into Insert mode when `I` or `A` is input in Visual mode +function! s:handle_visual_IA_to_insert() + if !empty(s:saved_char) && s:char =~# 'v\|V' && s:to_mode ==# 'n' + if s:saved_char ==# 'I' + call s:cm.reposition_all_within_region(1) + endif + call feedkeys(tolower(s:saved_char)) + let s:saved_char = '' + endif +endfunction + +" Begin transition into Insert mode when `I` or `A` is input in Visual mode +function! s:handle_visual_IA_to_normal() + if s:char =~# 'I\|A' && s:from_mode =~# 'v\|V' + let s:saved_char = s:char + let s:char = s:from_mode " spoof a 'v' or 'V' input to transiton from Visual into Normal mode + endif +endfunction + " Apply the user input at the next cursor location function! s:apply_user_input_next(mode) let s:valid_input = 1 @@ -931,6 +966,7 @@ function! s:apply_user_input_next(mode) call s:update_visual_markers(s:cm.get_current().visual) endif call feedkeys("\(multiple-cursors-wait)") + call s:handle_visual_IA_to_insert() else " Continue to next call feedkeys("\(multiple-cursors-input)") @@ -1050,8 +1086,8 @@ endfunction let s:retry_keys = "" function! s:display_error() if s:bad_input == s:cm.size() - \ && s:from_mode ==# 'n' - \ && has_key(g:multi_cursor_normal_maps, s:char[0]) + \ && ((s:from_mode ==# 'n' && has_key(g:multi_cursor_normal_maps, s:char[0])) + \ || (s:from_mode =~# 'v\|V' && has_key(g:multi_cursor_visual_maps, s:char[0]))) " we couldn't replay it anywhere but we're told it's the beginning of a " multi-character map like the `d` in `dw` let s:retry_keys = s:char @@ -1124,6 +1160,7 @@ function! s:wait_for_user_input(mode) let s:char = s:retry_keys . s:saved_keys if len(s:saved_keys) == 0 let s:char .= s:get_char() + call s:handle_visual_IA_to_normal() else let s:saved_keys = "" endif diff --git a/sources_non_forked/vim-multiple-cursors/doc/multiple_cursors.txt b/sources_non_forked/vim-multiple-cursors/doc/multiple_cursors.txt index be99e90e..422d5cf7 100644 --- a/sources_non_forked/vim-multiple-cursors/doc/multiple_cursors.txt +++ b/sources_non_forked/vim-multiple-cursors/doc/multiple_cursors.txt @@ -177,6 +177,16 @@ normal mode will "fail to replay" when multiple cursors are active. For example, changing it from `{}` to `{'d':1}` makes normal-mode mappings beginning with `d` (such as `dw` to delete a word) work in multi-cursor mode. +*g:multi_cursor_visual_maps* (Default: ) + +Default value: `{'i':1, 'a':1, 'f':1, 'F':1, 't':1, 'T':1}` + +Any key in this map (values are ignored) will cause multi-cursor _Visual_ mode +to pause for map completion just like normal vim. Otherwise keys mapped in +visual mode will "fail to replay" when multiple cursors are active. For example, +changing it from `{}` to `{'i':1}` makes visual-mode mappings beginning with `i` +(such as `it` to select an "inner tag block") work in multi-cursor mode. + The default list contents should work for anybody, unless they have remapped a key from an operator-pending command to a non-operator-pending command or vice versa. diff --git a/sources_non_forked/vim-multiple-cursors/plugin/multiple_cursors.vim b/sources_non_forked/vim-multiple-cursors/plugin/multiple_cursors.vim index 5709f426..6595bc35 100644 --- a/sources_non_forked/vim-multiple-cursors/plugin/multiple_cursors.vim +++ b/sources_non_forked/vim-multiple-cursors/plugin/multiple_cursors.vim @@ -42,11 +42,14 @@ let s:settings_if_default = { let s:default_insert_maps = {} let s:default_normal_maps = {'!':1, '@':1, '=':1, 'q':1, 'r':1, 't':1, 'T':1, 'y':1, '[':1, ']':1, '\':1, 'd':1, 'f':1, 'F':1, 'g':1, '"':1, 'z':1, 'c':1, 'm':1, '<':1, '>':1} +let s:default_visual_maps = {'i':1, 'a':1, 'f':1, 'F':1, 't':1, 'T':1} let g:multi_cursor_insert_maps = \ get(g:, 'multi_cursor_insert_maps', s:default_insert_maps) let g:multi_cursor_normal_maps = \ get(g:, 'multi_cursor_normal_maps', s:default_normal_maps) +let g:multi_cursor_visual_maps = + \ get(g:, 'multi_cursor_visual_maps', s:default_visual_maps) call s:init_settings(s:settings) diff --git a/sources_non_forked/vim-multiple-cursors/spec/multiple_cursors_spec.rb b/sources_non_forked/vim-multiple-cursors/spec/multiple_cursors_spec.rb index 03f34f66..07efba50 100644 --- a/sources_non_forked/vim-multiple-cursors/spec/multiple_cursors_spec.rb +++ b/sources_non_forked/vim-multiple-cursors/spec/multiple_cursors_spec.rb @@ -17,7 +17,7 @@ def before(string) end def after(string) - get_file_content().should eq normalize_string_indent(string) + expect(get_file_content()).to eq normalize_string_indent(string) end def type(string) @@ -163,6 +163,32 @@ describe "Multiple Cursors when normal_maps is empty" do end +describe "Multiple Cursors when visual_maps is empty" do + let(:filename) { 'test.txt' } + let(:options) { ['let g:multi_cursor_visual_maps = {}'] } + + # Operator-pending commands are handled correctly thanks to their inclusion + # in `g:multi_cursor_visual_maps`. + # + # When an operator-pending command like 'f' is missing from that setting's + # value, then it should result in a no-op, but we should still remain in + # multicursor mode. + specify "#visual mode 'i'" do + before <<-EOF + hello world x + hello world x + EOF + + type 'fwfx' + + after <<-EOF + hello x + hello x + EOF + end + +end + describe "Multiple Cursors" do let(:filename) { 'test.txt' } let(:options) { [] } @@ -417,6 +443,216 @@ describe "Multiple Cursors" do EOF end + specify "#visual mode 'i'" do + before <<-EOF + hi (hello world jan) bye + hi (hello world feb) bye + hi (hello world mar) bye + EOF + + type 'fwibcone' + + after <<-EOF + hi (one) bye + hi (one) bye + hi (one) bye + EOF + end + + specify "#visual mode 'a'" do + before <<-EOF + hi (hello world jan) bye + hi (hello world feb) bye + hi (hello world mar) bye + EOF + + type 'fwabcone' + + after <<-EOF + hi one bye + hi one bye + hi one bye + EOF + end + + specify "#visual mode 'f'" do + before <<-EOF + hi (hello world jan) bye + hi (hello world feb) bye + hi (hello world mar) bye + EOF + + type 'fwf)cone' + + after <<-EOF + hi (hello one bye + hi (hello one bye + hi (hello one bye + EOF + end + + specify "#visual mode 'F'" do + before <<-EOF + hi (hello world jan) bye + hi (hello world feb) bye + hi (hello world mar) bye + EOF + + type 'fwF(cbefore' + + after <<-EOF + hi beforeorld jan) bye + hi beforeorld feb) bye + hi beforeorld mar) bye + EOF + end + + specify "#visual mode 't'" do + before <<-EOF + hello.jan + hello hi.feb + hello hi bye.mar + EOF + + type 't.cone' + + after <<-EOF + one.jan + one.feb + one.mar + EOF + end + + specify "#visual mode 'T'" do + before <<-EOF + jan.world + feb.hi world + mar.bye hi world + EOF + + type 'fwT.cbefore' + + after <<-EOF + jan.beforeorld + feb.beforeorld + mar.beforeorld + EOF + end + + specify "#visual line mode 'f'" do + before <<-EOF + hello jan world + hello feb world + hello mar world + EOF + + type 'VfwvAafter' + + after <<-EOF + hello jan wafterorld + hello feb wafterorld + hello mar wafterorld + EOF + end + + specify "#visual mode 'I'" do + before <<-EOF + hello world jan + hello world feb + hello world mar + EOF + + type 'wIbefore' + + after <<-EOF + hello beforeworld jan + hello beforeworld feb + hello beforeworld mar + EOF + end + + specify "#visual mode 'A'" do + before <<-EOF + hello world jan + hello world feb + hello world mar + EOF + + type 'wAafter' + + after <<-EOF + hello worldafter jan + hello worldafter feb + hello worldafter mar + EOF + end + + specify "#resize regions visual mode 'I'" do + before <<-EOF + hello world jan + hello world feb + hello world mar + EOF + + type 'whhhIbefore' + + after <<-EOF + hello beforeworld jan + hello beforeworld feb + hello beforeworld mar + EOF + end + + specify "#resize regions visual mode 'A'" do + before <<-EOF + hello world jan + hello world feb + hello world mar + EOF + + type 'whhhAbefore' + + after <<-EOF + hello wobeforerld jan + hello wobeforerld feb + hello wobeforerld mar + EOF + end + + specify "#no word boundries visual mode 'I'" do + before <<-EOF + hello hibye world + hello hibye world + hello hibye world + EOF + + vim.normal ':MultipleCursorsFind bye' + type 'Ibefore' + + after <<-EOF + hello hibeforebye world + hello hibeforebye world + hello hibeforebye world + EOF + end + + specify "#variable-length regions visual mode 'I'" do + before <<-EOF + hello hii world + hello hiiii world + hello hiiiiii world + EOF + + vim.normal ':MultipleCursorsFind \' + type 'Ibefore' + + after <<-EOF + hello beforehii world + hello beforehiiii world + hello beforehiiiiii world + EOF + end + specify "#normal mode 'I'" do before <<-EOF hello diff --git a/sources_non_forked/vim-snippets/README.md b/sources_non_forked/vim-snippets/README.md index 4522ccee..9d6b08f9 100644 --- a/sources_non_forked/vim-snippets/README.md +++ b/sources_non_forked/vim-snippets/README.md @@ -169,6 +169,7 @@ so that all users can benefit from them. People can list their snippet reposito * https://github.com/sudar/vim-arduino-snippets (snippets for Arduino files) * https://github.com/zedr/zope-snipmate-bundle.git (snippets for Python, TAL and ZCML) * https://github.com/bonsaiben/bootstrap-snippets (snippets for Twitter Bootstrap markup, in HTML and Haml) +* https://github.com/sniphpets (advanced snippets for PHP, Symfony 2/3, Doctrine and etc.) Installation using VAM: https://github.com/MarcWeber/vim-addon-manager diff --git a/sources_non_forked/vim-snippets/snippets/jinja.snippets b/sources_non_forked/vim-snippets/snippets/jinja.snippets new file mode 100644 index 00000000..7d14ca83 --- /dev/null +++ b/sources_non_forked/vim-snippets/snippets/jinja.snippets @@ -0,0 +1,142 @@ +# Generic tags + +extends html + +snippet % + {% ${1} %} +snippet %% + {% ${1:tag_name} %} + ${0} + {% end$1 %} +snippet { + {{ ${1} }} +# Template Tags + +snippet autoescape + {% autoescape ${1:off} %} + ${0} + {% endautoescape %} +snippet block + {% block ${1} %} + ${0} + {% endblock %} +snippet # + {# ${0:comment} #} +snippet comment + {% comment %} + ${0} + {% endcomment %} +snippet cycle + {% cycle ${1:val1} ${2:val2} ${3:as ${4}} %} +snippet debug + {% debug %} +snippet extends + {% extends "${0:base.html}" %} +snippet filter + {% filter ${1} %} + ${0} + {% endfilter %} +snippet firstof + {% firstof ${1} %} +snippet for + {% for ${1} in ${2} %} + ${0} + {% endfor %} +snippet empty + {% empty %} + ${0} +snippet if + {% if ${1} %} + ${0} + {% endif %} +snippet el + {% else %} + ${1} +snippet eif + {% elif ${1} %} + ${0} +snippet ifchanged + {% ifchanged %}${1}{% endifchanged %} +snippet ifequal + {% ifequal ${1} ${2} %} + ${0} + {% endifequal %} +snippet ifnotequal + {% ifnotequal ${1} ${2} %} + ${0} + {% endifnotequal %} +snippet include + {% include "${0}" %} +snippet load + {% load ${0} %} +snippet now + {% now "${0:jS F Y H:i}" %} +snippet regroup + {% regroup ${1} by ${2} as ${0} %} +snippet spaceless + {% spaceless %}${0}{% endspaceless %} +snippet ssi + {% ssi ${0} %} +snippet trans + {% trans "${0:string}" %} +snippet url + {% url ${1} as ${0} %} +snippet widthratio + {% widthratio ${1:this_value} ${2:max_value} ${0:100} %} +snippet with + {% with ${1} as ${2} %} + ${0} + {% endwith %} + +# Template Filters + +# Note: Since SnipMate can't determine which template filter you are +# expanding without the "|" character, these do not add the "|" +# character. These save a few keystrokes still. + +# Note: Template tags that take no arguments are not implemented. + +snippet add + add:"${0}" +snippet center + center:"${0}" +snippet cut + cut:"${0}" +snippet date + date:"${0}" +snippet default + default:"${0}" +snippet defaultifnone + default_if_none:"${0}" +snippet dictsort + dictsort:"${0}" +snippet dictsortrev + dictsortreversed:"${0}" +snippet divisibleby + divisibleby:"${0}" +snippet floatformat + floatformat:"${0}" +snippet getdigit + get_digit:"${0}" +snippet join + join:"${0}" +snippet lengthis + length_is:"${0}" +snippet pluralize + pluralize:"${0}" +snippet removetags + removetags:"${0}" +snippet slice + slice:"${0}" +snippet stringformat + stringformat:"${0}" +snippet time + time:"${0}" +snippet truncatewords + truncatewords:${0} +snippet truncatewordshtml + truncatewords_html:${0} +snippet urlizetrunc + urlizetrunc:${0} +snippet wordwrap + wordwrap:${0} diff --git a/sources_non_forked/vim-snippets/snippets/xml.snippets b/sources_non_forked/vim-snippets/snippets/xml.snippets new file mode 100644 index 00000000..0ab346ba --- /dev/null +++ b/sources_non_forked/vim-snippets/snippets/xml.snippets @@ -0,0 +1,12 @@ +# xml declaration +snippet xml + +# tag +snippet t + <${1:}> + ${2} + +# inline tag +snippet ti + <${1:}>${2} + diff --git a/update_plugins.py b/update_plugins.py index 404835aa..e4191a95 100644 --- a/update_plugins.py +++ b/update_plugins.py @@ -42,6 +42,7 @@ vim-go https://github.com/fatih/vim-go vim-gitgutter https://github.com/airblade/vim-gitgutter gruvbox https://github.com/morhetz/gruvbox vim-flake8 https://github.com/nvie/vim-flake8 +vim-jade https://github.com/digitaltoad/vim-jade """.strip() GITHUB_ZIP = '%s/archive/master.zip'