Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
177 lines (142 sloc) 6.27 KB
*autochmodx.txt* *autochmodx*
Author:
tyru <tyru.exe@gmail.com>
Version: 1.0.0
License:
" NEW BSD LICENSE {{{
" Copyright (c) 2012, tyru
" All rights reserved.
"
" Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
"
" * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
" * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
" * Neither the name of the tyru nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
"
" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
" }}}
==============================================================================
CONTENTS *autochmodx-contents*
Introduction |autochmodx-introduction|
Requirements |autochmodx-requirements|
Interface |autochmodx-interface|
Variables |autochmodx-variables|
Commands |autochmodx-commands|
Functions |autochmodx-functions|
TODO |autochmodx-todo|
Changelog |autochmodx-changelog|
==============================================================================
INTRODUCTION *autochmodx-introduction* {{{
If a current file looks like an executable script,
make it by executable running "chmod +x %".
}}}
==============================================================================
REQUIREMENTS *autochmodx-requirements* {{{
This plugin cannot be used on any platform like the following:
- has("unix") returns 0
- "chmod" is not in PATH
}}}
==============================================================================
INTERFACE *autochmodx-interface* {{{
------------------------------------------------------------------------------
VARIABLES *autochmodx-variables* {{{
*g:autochmodx_chmod_opt*
g:autochmodx_chmod_opt (Default: "+x")
This {value} is passed to "chmod" argument: >
chmod {value} %
<
*g:autochmodx_scriptish_file_patterns*
g:autochmodx_scriptish_file_patterns (Default: See below)
Regexp patterns specified in this variable
are determined as an executable script.
This is a simple way to add a detection
for an executable file.
but if you want to detect by buffer content,
you must use |autochmodx#register_scriptish_detector()|.
The default value is like the following.
(A patch or pull req are welcome :)
>
let g:autochmodx_scriptish_file_patterns = [
\ '\c.*\.pl$',
\ '\c.*\.rb$',
\ '\c.*\.py$',
\ '\c.*\.sh$',
\]
<
NOTE: This variable is used to match for a fullpath.
*g:autochmodx_ignore_scriptish_file_patterns*
g:autochmodx_ignore_scriptish_file_patterns (Default: See below)
Regexp patterns specified in this variable
are NOT determined as an executable script.
Because this variable is seen before
|g:autochmodx_scriptish_file_patterns|,
you can disable 'chmod +x' for specific filename.
NOTE: This variable is used to match for a fullpath.
*g:autochmodx_no_BufWritePost_autocmd*
g:autochmodx_no_BufWritePost_autocmd
If this variable is defined and non-zero,
|autochmodx| will not execute 'chmod +x' at |BufWritePost|.
*g:autochmodx_no_CursorHold_autocmd*
g:autochmodx_no_CursorHold_autocmd
If this variable is defined and non-zero,
|autochmodx| will not execute 'chmod +x' at |CursorHold|.
}}}
------------------------------------------------------------------------------
COMMANDS *autochmodx-commands* {{{
:AutoChmodDisable[!] *:AutoChmodDisable*
If ! was not given, this disables auto-commands
of autochmodx in a current buffer.
If ! was given, this disables auto-commands
of autochmodx in all buffers.
This does not influence |:AutoChmodRun| behavior.
:AutoChmodEnable *:AutoChmodEnable*
This enables auto-commands of autochmodx.
This does not influence |:AutoChmodRun| behavior.
:AutoChmodRun *:AutoChmodRun*
Run "chmod +x %".
:AutoChmodRunAutocmd *:AutoChmodRunAutocmd*
Run "chmod +x %" unless |:AutoChmodDisable|
has been called in current buffer.
This command is called by auto-commands.
}}}
------------------------------------------------------------------------------
FUNCTIONS *autochmodx-functions* {{{
*autochmodx#register_scriptish_detector()*
autochmodx#register_scriptish_detector({func})
Register a function to detect
a current buffer is executable script.
You can simply use |g:autochmodx_scriptish_file_patterns|
for a detection by filename matching.
{func} must:
- be a |Funcref| or |String| which represents
a callable function name.
- receive 2 arguments {bufnr}, {file} in order.
- {bufnr} is buffer number.
- {file} is a fullpath of a current file.
- return a |Number|. (zero or non-zero)
Example:
>
function! DetectScriptish(bufnr, file)
" Detect Perl script is executable.
return a:file =~? '\.pl$'
endfunction
call autochmodx#register_scriptish_detector('DetectScriptish')
" or
" call autochmodx#register_scriptish_detector(function('DetectScriptish'))
<
}}}
}}}
==============================================================================
TODO *autochmodx-todo* {{{
any request? ;)
https://github.com/tyru/autochmodx.vim/issues
}}}
==============================================================================
CHANGELOG *autochmodx-changelog* {{{
0.0.0:
- Upload to github.
1.0.0:
- Upload to www.vim.org .
}}}
==============================================================================
vim:tw=78:fo=tcq2mM:ts=4:ft=help:norl:noet:fdm=marker:fen