diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2019-06-09 00:20:01 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2019-06-09 00:20:01 +1200 |
commit | 7acc720aa7d6efbfc65784dd694a023cda3e6b43 (patch) | |
tree | 735afb88ad48a300a35adf821c324766764ac6a5 /vim/autoload/vimrc.vim | |
parent | Merge branch 'release/v5.22.0' (diff) | |
parent | Bump VERSION (diff) | |
download | dotfiles-5.23.0.tar.gz (sig) dotfiles-5.23.0.zip |
Merge branch 'release/v5.23.0'v5.23.0
* release/v5.23.0: (52 commits)
Develop commentary of 'modeline' awfulness
Move C resets further up
Adjust commentary around indent settings
Group 'showmatch' and 'matchtime' meaningfully
Move 'runtimepath' manipulation to top of file
Change heading underline
Move and more thoroughly explain 'path' settings
Flesh out a comment
Adjust split explanation
Break a paragraph
Correct type of plugin existence checks
Bump Vim 'history' to 10000, the maximum value
Add more literate comments to vimrc
Adjust a couple of stray lines
Fix up a few more comments
Even more agonising over directory creation
More detail on vimrc re-sourcing
Remove repeated word
Refine detail on MYVIM comma termination
...
Diffstat (limited to 'vim/autoload/vimrc.vim')
-rw-r--r-- | vim/autoload/vimrc.vim | 63 |
1 files changed, 0 insertions, 63 deletions
diff --git a/vim/autoload/vimrc.vim b/vim/autoload/vimrc.vim deleted file mode 100644 index 57c2f0f4..00000000 --- a/vim/autoload/vimrc.vim +++ /dev/null @@ -1,63 +0,0 @@ -" Escape a text value for :execute-based :set inclusion in an option -function! vimrc#EscapeSet(string) abort - return escape(a:string, '\ |"') -endfunction - -" Escape a text value for inclusion as an element in a comma-separated list -" option. Yes, the comma being the sole inner escaped character here is -" correct. No, we shouldn't escape backslash itself. Yes, that means it's -" impossible to have the literal string '\,' in a part. -function! vimrc#EscapeSetPart(string) abort - return vimrc#EscapeSet(escape(a:string, ',')) -endfunction - -" Expand the first path in an option string, check if it exists, and attempt -" to create it if it doesn't. Strip double-trailing-slash hints. -function! vimrc#Establish(string) abort - let part = vimrc#SplitOption(a:string)[0] - let part = substitute(part, '//$', '', '') - let dirname = expand(part) - return isdirectory(dirname) - \ || mkdir(dirname, 'p') -endfunction - -" Check that we have a plugin available, and will be loading it -function! vimrc#PluginReady(filename) abort - return globpath(&runtimepath, 'plugin/'.a:filename.'.vim') !=# '' - \ && &loadplugins -endfunction - -" Split a comma-separated option string into its constituent parts, imitating -" copy_option_part() in the Vim sources. This isn't perfect, but it should be -" more than good enough. A separator can be defined as: a comma that is not -" preceded by a backslash, and which is followed by any number of spaces -" and/or further commas. -function! vimrc#SplitOption(string) abort - return split(a:string, '\\\@<!,[, ]*') -endfunction - -" Convenience version function check that should work with 7.0 or newer; -" takes strings like 7.3.251 -function! vimrc#Version(string) abort - - " Test the version string and get submatches for each part - let match = matchlist(a:string, '^\(\d\+\)\.\(\d\+\)\.\(\d\+\)$') - - " Throw toys if the string didn't match the expected format - if !len(match) - echoerr 'Invalid version string: '.a:string - return - endif - - " Get the major, minor, and patch numbers from the submatches - let [major, minor, patch] = match[1:3] - - " Create a string like 801 from a version number 8.1 to compare it to the - " v:version integer - let ver = major * 100 + minor - - " Compare versions - return v:version > ver - \ || v:version == ver && has('patch'.patch) - -endfunction |