diff --git a/.gitignore b/.gitignore index 6524f395..66d01465 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ sources_forked/yankring/doc/tags sources_non_forked/tlib/doc/tags my_configs.vim tags +.DS_Store diff --git a/sources_non_forked/goyo.vim/plugin/goyo.vim b/sources_non_forked/goyo.vim/plugin/goyo.vim index c64d4aae..7c43f4ef 100644 --- a/sources_non_forked/goyo.vim/plugin/goyo.vim +++ b/sources_non_forked/goyo.vim/plugin/goyo.vim @@ -1,4 +1,4 @@ -" Copyright (c) 2013 Junegunn Choi +" Copyright (c) 2014 Junegunn Choi " " MIT License " @@ -33,13 +33,12 @@ function! s:set_color(group, attr, color) execute printf("hi %s %s%s=%s", a:group, gui ? 'gui' : 'cterm', a:attr, a:color) endfunction -function! s:blank() - let main = bufwinnr(t:goyo_master) - if main != -1 - execute main . 'wincmd w' - else +function! s:blank(repel) + if bufwinnr(t:goyo_pads.r) <= bufwinnr(t:goyo_pads.l) + 1 + \ || bufwinnr(t:goyo_pads.b) <= bufwinnr(t:goyo_pads.t) + 3 call s:goyo_off() endif + execute 'wincmd' a:repel endfunction function! s:init_pad(command) @@ -59,12 +58,12 @@ function! s:init_pad(command) return bufnr endfunction -function! s:setup_pad(bufnr, vert, size) +function! s:setup_pad(bufnr, vert, size, repel) let win = bufwinnr(a:bufnr) execute win . 'wincmd w' execute (a:vert ? 'vertical ' : '') . 'resize ' . max([0, a:size]) augroup goyop - autocmd WinEnter,CursorMoved nested call s:blank() + execute 'autocmd WinEnter,CursorMoved nested call s:blank("'.a:repel.'")' autocmd WinLeave call s:hide_statusline() augroup END @@ -86,17 +85,21 @@ function! s:hmargin() endfunction function! s:resize_pads() + let t:goyo_width = max([2, t:goyo_width]) + let t:goyo_margin_top = min([max([2, t:goyo_margin_top]), &lines / 2 - 1]) + let t:goyo_margin_bottom = min([max([2, t:goyo_margin_bottom]), &lines / 2 - 1]) + let hmargin = s:hmargin() - let tmargin = get(g:, 'goyo_margin_top', 4) - let bmargin = get(g:, 'goyo_margin_bottom', 4) augroup goyop autocmd! augroup END - call s:setup_pad(t:goyo_pads.t, 0, tmargin - 1) - call s:setup_pad(t:goyo_pads.b, 0, bmargin - 2) - call s:setup_pad(t:goyo_pads.l, 1, hmargin / 2 - 1) - call s:setup_pad(t:goyo_pads.r, 1, hmargin / 2 - 1) + call s:setup_pad(t:goyo_pads.t, 0, t:goyo_margin_top - 1, 'j') + call s:setup_pad(t:goyo_pads.b, 0, t:goyo_margin_bottom - 2, 'k') + call s:setup_pad(t:goyo_pads.l, 1, hmargin / 2 - 1, 'l') + call s:setup_pad(t:goyo_pads.r, 1, hmargin / 2 - 1, 'h') + + let t:goyo_width = winwidth(0) endfunction function! s:tranquilize() @@ -119,6 +122,41 @@ function! s:hide_statusline() let &l:statusline = repeat(' ', winwidth(0)) endfunction +function! s:hide_linenr() + if !get(g:, 'goyo_linenr', 0) + setlocal nonu + if exists('&rnu') + setlocal nornu + endif + endif + if exists('&colorcolumn') + setlocal colorcolumn= + endif +endfunction + +function! s:maps_nop() + let mapped = filter(['R', 'H', 'J', 'K', 'L', '|', '_', '='], + \ "empty(maparg(\"\\".v:val, 'n'))") + for c in mapped + execute 'nnoremap '.escape(c, '|').' ' + endfor + return mapped +endfunction + +function! s:maps_resize() + let commands = { + \ '>': ':let t:goyo_width = winwidth(0) + 2 * v:count1 call resize_pads()', + \ '<': ':let t:goyo_width = winwidth(0) - 2 * v:count1 call resize_pads()', + \ '+': ':let t:goyo_margin_top -= v:count1 let t:goyo_margin_bottom -= v:count1 call resize_pads()', + \ '-': ':let t:goyo_margin_top += v:count1 let t:goyo_margin_bottom += v:count1 call resize_pads()' + \ } + let mapped = filter(keys(commands), "empty(maparg(\"\\".v:val, 'n'))") + for c in mapped + execute 'nnoremap '.c.' '.commands[c] + endfor + return mapped +endfunction + function! s:goyo_on(width) let s:orig_tab = tabpagenr() @@ -127,6 +165,8 @@ function! s:goyo_on(width) let t:goyo_master = winbufnr(0) let t:goyo_width = a:width + let t:goyo_margin_top = get(g:, 'goyo_margin_top', 4) + let t:goyo_margin_bottom = get(g:, 'goyo_margin_bottom', 4) let t:goyo_pads = {} let t:goyo_revert = \ { 'laststatus': &laststatus, @@ -140,6 +180,7 @@ function! s:goyo_on(width) \ 'sidescroll': &sidescroll, \ 'sidescrolloff': &sidescrolloff \ } + let t:goyo_maps = extend(s:maps_nop(), s:maps_resize()) if has('gui_running') let t:goyo_revert.guioptions = &guioptions endif @@ -177,16 +218,7 @@ function! s:goyo_on(width) silent! call lightline#disable() endif - if !get(g:, 'goyo_linenr', 0) - setlocal nonu - if exists('&rnu') - setlocal nornu - endif - endif - if exists('&colorcolumn') - setlocal colorcolumn= - endif - + call s:hide_linenr() " Global options let &winheight = max([&winminheight, 1]) set winminheight=1 @@ -217,11 +249,11 @@ function! s:goyo_on(width) augroup goyo autocmd! - autocmd BufWinLeave call s:goyo_off() autocmd TabLeave * call s:goyo_off() autocmd VimResized * call s:resize_pads() autocmd ColorScheme * call s:tranquilize() - autocmd WinEnter,WinLeave call s:hide_statusline() + autocmd BufWinEnter * call s:hide_linenr() | call s:hide_statusline() + autocmd WinEnter,WinLeave * call s:hide_statusline() augroup END call s:hide_statusline() @@ -251,6 +283,10 @@ function! s:goyo_off() augroup END augroup! goyop + for c in t:goyo_maps + execute 'nunmap '.escape(c, '|') + endfor + let goyo_revert = t:goyo_revert let goyo_disabled_gitgutter = t:goyo_disabled_gitgutter let goyo_disabled_signify = t:goyo_disabled_signify @@ -268,6 +304,7 @@ function! s:goyo_off() tabclose execute 'normal! '.s:orig_tab.'gt' if winbufnr(0) == goyo_orig_buffer + " Doesn't work if window closed with `q` execute printf('normal! %dG%d|', line, col) endif diff --git a/sources_non_forked/nerdtree/lib/nerdtree/path.vim b/sources_non_forked/nerdtree/lib/nerdtree/path.vim index ea6aa032..dbecb027 100644 --- a/sources_non_forked/nerdtree/lib/nerdtree/path.vim +++ b/sources_non_forked/nerdtree/lib/nerdtree/path.vim @@ -623,8 +623,13 @@ function! s:Path.str(...) if has_key(options, 'truncateTo') let limit = options['truncateTo'] - if len(toReturn) > limit - let toReturn = "<" . strpart(toReturn, len(toReturn) - limit + 1) + if len(toReturn) > limit-1 + let toReturn = toReturn[(len(toReturn)-limit+1):] + if len(split(toReturn, '/')) > 1 + let toReturn = ' @@ -35,17 +52,17 @@ 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, syntax checking plugins exist for ActionScript, -Ada, AppleScript, Arduino, 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, NASM, -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, Tcl, TeX, Texinfo, -Twig, TypeScript, Vala, Verilog, VHDL, VimL, xHtml, XML, XSLT, YACC, YAML, -z80, Zope page templates, and zsh. See the [wiki][3] for details about the -corresponding supported checkers. +Ada, 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, NASM, 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, Tcl, TeX, Texinfo, Twig, TypeScript, Vala, +Verilog, VHDL, VimL, xHtml, XML, XSLT, YACC, YAML, z80, Zope page templates, +and zsh. See the [wiki][3] for details about the corresponding supported +checkers. 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 @@ -128,18 +145,36 @@ If you get an error when you do this, then you probably didn't install following: 1. Created both the `~/.vim/autoload` and `~/.vim/bundle` directories. -2. Added the `call pathogen#infect()` line to your `~/.vimrc` file +2. Added the `execute pathogen#infect()` line to your `~/.vimrc` file 3. Did the `git clone` of syntastic inside `~/.vim/bundle` 4. Have permissions to access all of these directories. + + +## 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): +```vim +set statusline+=%#warningmsg# +set statusline+=%{SyntasticStatuslineFlag()} +set statusline+=%* + +let g:syntastic_always_populate_loc_list = 1 +let g:syntastic_auto_loc_list = 1 +let g:syntastic_check_on_open = 1 +let g:syntastic_check_on_wq = 0 +``` -## 3\. FAQ +## 4\. FAQ -__Q. I installed syntastic but it isn't reporting any errors...__ +__4.1. Q. I installed syntastic but it isn't reporting any errors...__ A. The most likely reason is that none of the syntax checkers that it requires is installed. For example: by default, python requires either `flake8` or @@ -155,7 +190,7 @@ create an issue - or better yet, create a pull request. -__Q. The `python` checker complains about syntactically valid Python 3 constructs...__ +__4.2. Q. The `python` checker complains about syntactically valid Python 3 constructs...__ A. Configure the `python` checker to call a Python 3 interpreter rather than Python 2, e.g: @@ -163,9 +198,27 @@ Python 2, e.g: let g:syntastic_python_python_exec = '/path/to/python3' ``` + + +__4.3. Q. Are there any local checkers for HTML5 that I can use with syntastic?__ + +[HTML Tidy][18] has a fork named [HTML Tidy for HTML5][19]. It's a drop +in replacement, and syntastic can use it without changes. Just install it +somewhere and point `g:syntastic_html_tidy_exec` to its executable. + +Alternatively, you can install [vnu.jar][21] from the [validator.nu][20] +project and run it as a [HTTP server][23]: +```sh +$ java -Xss512k -cp /path/to/vnu.jar nu.validator.servlet.Main 8888 +``` +Then you can [configure][22] syntastic to use it: +```vim +let g:syntastic_html_validator_api = 'http://localhost:8888/' +``` + -__Q. The `perl` checker has stopped working...__ +__4.4. Q. The `perl` checker has stopped working...__ A. The `perl` checker runs `perl -c` against your file, which in turn __executes__ any `BEGIN`, `UNITCHECK`, and `CHECK` blocks, and any `use` @@ -174,14 +227,14 @@ wrote the file yourself, but it's a security problem if you're checking third party files. Since there is currently no way to disable this behaviour while still producing useful results, the checker is now disabled by default. To (re-)enable it, make sure the `g:syntastic_perl_checkers` list includes `perl`, -and set `g:syntastic_enable_perl_checker` to 1 in your vimrc: +and set `g:syntastic_enable_perl_checker` to 1 in your `vimrc`: ```vim let g:syntastic_enable_perl_checker = 1 ``` -__Q. What happened to the `rustc` checker?__ +__4.5. Q. What happened to the `rustc` checker?__ A. It has been included in the [Rust compiler package][12]. If you have a recent version of the Rust compiler, the checker should be picked up @@ -189,27 +242,27 @@ automatically by syntastic. -__Q. I run a checker and the location list is not updated...__ -__Q. I run`:lopen` or `:lwindow` and the error window is empty...__ +__4.6. Q. I run a checker and the location list is not updated...__ +__4.6. Q. I run`:lopen` or `:lwindow` and the error window is empty...__ A. By default the location list is changed only when you run the `:Errors` command, in order to minimise conflicts with other plugins. If you want the location list to always be updated when you run the checkers, add this line to -your vimrc: +your `vimrc`: ```vim let g:syntastic_always_populate_loc_list = 1 ``` -__Q. How can I pass additional arguments to a checker?__ +__4.7. Q. How can I pass additional arguments to a checker?__ A. Almost all syntax checkers use the `makeprgBuild()` function. Those checkers that do can be configured using global variables. The general form of the global `args` variables is `syntastic___args`. -So, If you wanted to pass "--my --args --here" to the ruby mri checker you -would add this line to your vimrc: +So, If you wanted to pass `--my --args --here` to the ruby mri checker you +would add this line to your `vimrc`: ```vim let g:syntastic_ruby_mri_args = "--my --args --here" ``` @@ -218,10 +271,10 @@ See `:help syntastic-checker-options` for more information. -__Q. Syntastic supports several checkers for my filetype - how do I tell it +__4.8. Q. Syntastic supports several checkers for my filetype - how do I tell it which one(s) to use?__ -A. Stick a line like this in your vimrc: +A. Stick a line like this in your `vimrc`: ```vim let g:syntastic__checkers = [''] ``` @@ -259,7 +312,7 @@ filetype of the current file is `php`). -__Q. What is the difference between syntax checkers and style checkers?__ +__4.9. Q. What is the difference between syntax checkers and style checkers?__ A. The errors and warnings they produce are highlighted differently and can be filtered by different rules, but otherwise the distinction is pretty much @@ -289,10 +342,10 @@ See `:help syntastic_quiet_messages` for details. -__Q. I have enabled multiple checkers for the current filetype. How can I +__4.10. Q. I have enabled multiple checkers for the current filetype. How can I display all of the errors from all of the checkers together?__ -A. Set `g:syntastic_aggregate_errors` to 1 in your vimrc: +A. Set `g:syntastic_aggregate_errors` to 1 in your `vimrc`: ```vim let g:syntastic_aggregate_errors = 1 ``` @@ -301,19 +354,19 @@ See `:help syntastic-aggregating-errors` for more details. -__Q. How can I jump between the different errors without using the location +__4.11. Q. How can I jump between the different errors without using the location list at the bottom of the window?__ A. Vim provides several built-in commands for this. See `:help :lnext` and -`:help :lprev`. +`:help :lprevious`. If you use these commands a lot then you may want to add shortcut mappings to -your vimrc, or install something like [unimpaired][2], which provides such +your `vimrc`, or install something like [unimpaired][2], which provides such mappings (among other things). -__Q. The error window is closed automatically when I :quit the current buffer +__4.12. Q. The error window is closed automatically when I :quit the current buffer but not when I :bdelete it?__ A. There is no safe way to handle that situation automatically, but you can @@ -324,10 +377,9 @@ nnoremap :lclose:bdelete cabbrev bd lclose\|bdelete ``` - -## 4\. Other resources +## 5\. Resources The preferred place for posting suggestions, reporting bugs, and general discussions related to syntastic is the [issue tracker at GitHub][4]. @@ -358,6 +410,12 @@ a look at [jedi-vim][7], [python-mode][8], or [YouCompleteMe][9]. [15]: https://github.com/MarcWeber/vim-addon-manager [16]: https://github.com/junegunn/vim-plug/ [17]: https://github.com/gmarik/Vundle.vim +[18]: http://tidy.sourceforge.net/ +[19]: http://w3c.github.io/tidy-html5/ +[20]: http://about.validator.nu/ +[21]: https://github.com/validator/validator/releases/latest +[22]: https://github.com/scrooloose/syntastic/wiki/HTML%3A---validator +[23]: http://validator.github.io/validator/#standalone