summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--VimperatorrcBuilder.py14
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