diff options
author | Olivier Gayot <duskcoder@gmail.com> | 2014-05-28 16:18:21 +0200 |
---|---|---|
committer | Olivier Gayot <duskcoder@gmail.com> | 2014-05-28 16:19:30 +0200 |
commit | e3731db59b8cb4a918120b50a7719413cee16fd4 (patch) | |
tree | fe31c3890ee44d5edcbec23e8f82412be44019fa | |
parent | 259846dcf1829b378ffd44dc05d9f32b8e794735 (diff) |
append a 'vim: ft=' line
you can specify how vim shall handle the generated output
by default, it will be considered as a vimrc file
-rw-r--r-- | VimperatorrcBuilder.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/VimperatorrcBuilder.py b/VimperatorrcBuilder.py index a73f329..d918276 100644 --- a/VimperatorrcBuilder.py +++ b/VimperatorrcBuilder.py @@ -32,6 +32,8 @@ class VimperatorrcBuilder(): '<C-b>': '<Left>', } + vim_filetype = 'vim' + def __init__(self): pass @@ -50,6 +52,14 @@ class VimperatorrcBuilder(): self.default_engine = engine + def append_vim_filetype(self, filetype='vim'): + """ Set how vim shall interpret the generated file """ + append_vim_filetype = filetype + + def disable_vim_filetype(self): + """ Prevent the output of a vim: line """ + append_vim_filetype = None + def get_output(self): ''' Return a string containing the full output to redirect ''' @@ -74,5 +84,9 @@ class VimperatorrcBuilder(): output += 'cnoremap ' + key + ' ' + self.cli_bindings[key] + '\n' output += 'inoremap ' + key + ' ' + self.cli_bindings[key] + '\n' + if self.vim_filetype is not None: + # XXX dirty hack to avoid vim interpretation of the following line + output += '\n" vim' + ': set ft=' + self.vim_filetype + ':\n' + return output |