Open
Conversation
wting
requested changes
May 3, 2019
| " fix for Windows users (https://github.com/wting/gitsessions.vim/issues/2) | ||
| if !exists('g:VIMFILESDIR') | ||
| let g:VIMFILESDIR = has('unix') ? $HOME . '/.vim/' : $VIM . '/vimfiles/' | ||
| let g:VIMFILESDIR = has('unix') ? $HOME . '/.vim/' : $HOME . '/vimfiles/' |
Owner
There was a problem hiding this comment.
Isn't this a tautology and break the original reason why we added this line? Why bother with the unix check?
| if has('unix') | ||
| return a:path[0] == s:os_sep() | ||
| else | ||
| return a:path[1] == ':' |
Owner
There was a problem hiding this comment.
Instead of hardcoding the path separator could we simply change the index position? Why use == ':'?
Suggested change
| return a:path[1] == ':' | |
| return a:path[1] == s:os_sep() |
| function! s:parent_dir(path) | ||
| let l:sep = s:os_sep() | ||
| let l:front = s:is_abs_path(a:path) ? l:sep : '' | ||
| let l:front = s:is_abs_path(a:path) && has('unix') ? l:sep : '' |
Owner
There was a problem hiding this comment.
Doesn't the has('unix') check make the is_abs_path(a:path) changes unnecessary since it'll never be true on Windows?
The result is all absolute paths are converted into relative paths on Windows, regardless if it was an absolute path to begin with or not.
| return a:dir . '/.git' | ||
| elseif has('file_in_path') && has('path_extra') | ||
| if isdirectory(a:dir . s:os_sep() . '.git') | ||
| return a:dir . s:os_sep() . '.git' |
| if has('unix') | ||
| let l:path = a:sdir . a:pdir | ||
| else | ||
| let l:path = a:sdir . substitute(a:pdir,'^\([A-Z]\):','\\\1','g') |
Owner
There was a problem hiding this comment.
This is some regex backreferencing stuff. Can you help me understand why this change is necessary?
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I had to make some tweaks to have the plugin working on windows. I also tested it on linux and it seems that there are no regressions there.
Please tell me if some other change or explanation is required in order to merge.