Created
March 2, 2016 20:42
-
-
Save ryanoasis/53a8d4c96f7acddaf93d to your computer and use it in GitHub Desktop.
Experiment to test vim-devicon's custom ctrlp open function changes (solve E16)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| " setup | |
| function! s:strip(input) | |
| return substitute(a:input, '^\s*\(.\{-}\)\s*$', '\1', '') | |
| endfunction | |
| " current way: | |
| function! Original115() | |
| let line = ' ~/www/some/big/long/jenky/path/something.something/whatever_it_is/bigUgly/path/too/long/something.vim' | |
| let line = substitute(line, "[-]", "", "") | |
| let line = s:strip(line) | |
| endfun | |
| " alternate way: | |
| function! Alternate115() | |
| let line = ' ~/www/some/big/long/jenky/path/something.something/whatever_it_is/bigUgly/path/too/long/something.vim' | |
| let glyphCandidate = char2nr(strpart(line, 0, 3)) | |
| let glyphASCIIRangeStart = 57344 | |
| let glyphASCIIRangeEnd = 63743 | |
| if glyphCandidate >= glyphASCIIRangeStart && glyphCandidate <= glyphASCIIRangeEnd | |
| let line = strpart(line, 3) | |
| endif | |
| let line = s:strip(line) | |
| endfun | |
| " alternate way cached variables: | |
| let s:glyphASCIIRangeStart = 57344 | |
| let s:glyphASCIIRangeEnd = 63743 | |
| function! AlternateCached115() | |
| let line = ' ~/www/some/big/long/jenky/path/something.something/whatever_it_is/bigUgly/path/too/long/something.vim' | |
| let glyphCandidate = char2nr(strpart(line, 0, 3)) | |
| if glyphCandidate >= s:glyphASCIIRangeStart && glyphCandidate <= s:glyphASCIIRangeEnd | |
| let line = strpart(line, 3) | |
| endif | |
| let line = s:strip(line) | |
| endfun | |
| " }}} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment