diff options
author | Ryan Kavanagh <rak@rak.ac> | 2021-12-14 11:42:41 -0500 |
---|---|---|
committer | Ryan Kavanagh <rak@rak.ac> | 2021-12-14 11:42:41 -0500 |
commit | fd2001cd614dfa0d55ec820b7c358a1795d3ea27 (patch) | |
tree | 932b5f91ad3c70f9cfa4455a0ccfb27a7b259bf1 /dot_vim/ftplugin/latex-suite/pytools.py | |
parent | added symlink to cclub afs (diff) |
Simplify vim configuration
Diffstat (limited to 'dot_vim/ftplugin/latex-suite/pytools.py')
-rw-r--r-- | dot_vim/ftplugin/latex-suite/pytools.py | 52 |
1 files changed, 0 insertions, 52 deletions
diff --git a/dot_vim/ftplugin/latex-suite/pytools.py b/dot_vim/ftplugin/latex-suite/pytools.py deleted file mode 100644 index 1934e23..0000000 --- a/dot_vim/ftplugin/latex-suite/pytools.py +++ /dev/null @@ -1,52 +0,0 @@ -import string, vim, re, os, glob -# catFile: assigns a local variable retval to the contents of a file {{{ -def catFile(filename): - try: - file = open(filename) - lines = ''.join(file.readlines()) - file.close() - except: - lines = '' - - # escape double quotes and backslashes before quoting the string so - # everything passes throught. - vim.command("""let retval = "%s" """ % re.sub(r'"|\\', r'\\\g<0>', lines)) - return lines - -# }}} -# isPresentInFile: check if regexp is present in the file {{{ -def isPresentInFile(regexp, filename): - try: - fp = open(filename) - fcontents = string.join(fp.readlines(), '') - fp.close() - if re.search(regexp, fcontents): - vim.command('let retval = 1') - return 1 - else: - vim.command('let retval = 0') - return None - except: - vim.command('let retval = 0') - return None - -# }}} -# deleteFile: deletes a file if present {{{ -# If the file does not exist, check if its a filepattern rather than a -# filename. If its a pattern, then deletes all files matching the -# pattern. -def deleteFile(filepattern): - if os.path.exists(filepattern): - try: - os.remove(filepattern) - except: - vim.command('let retval = -1') - else: - if glob.glob(filepattern): - for filename in glob.glob(filepattern): - os.remove(filename) - else: - vim.command('let retval = -1') - -# }}} -# vim:fdm=marker:ff=unix:noet:ts=4:sw=4:nowrap |