parent
1e6fc685c5
commit
e02bdd3b19
|
@ -1,6 +1,7 @@
|
||||||
import commands, os
|
import commands, os
|
||||||
import color, method, mode
|
import color, method, mode
|
||||||
from lex import Grammar, PatternRule, RegionRule
|
from lex import Grammar, PatternRule, RegionRule
|
||||||
|
from mode.text import TextInsertSpace
|
||||||
|
|
||||||
class LatexGrammar(Grammar):
|
class LatexGrammar(Grammar):
|
||||||
rules = [
|
rules = [
|
||||||
|
@ -33,9 +34,10 @@ class Latex(mode.Fundamental):
|
||||||
self.add_action_and_bindings(LatexInsertSquotes(), ("M-'",))
|
self.add_action_and_bindings(LatexInsertSquotes(), ("M-'",))
|
||||||
self.add_action_and_bindings(LatexInsertDquotes(), ('M-"',))
|
self.add_action_and_bindings(LatexInsertDquotes(), ('M-"',))
|
||||||
self.add_action_and_bindings(LatexInsertBraces(), ('M-{',))
|
self.add_action_and_bindings(LatexInsertBraces(), ('M-{',))
|
||||||
self.add_action_and_bindings(LatexBuild(), ("C-c C-c",))
|
self.add_action_and_bindings(LatexBuild(), ("C-c C-c", 'C-c B'))
|
||||||
self.add_action(LatexBuildPdf())
|
self.add_action_and_bindings(LatexInsertSpace(), ('SPACE',))
|
||||||
self.add_action(LatexViewPdf())
|
self.add_action_and_bindings(LatexBuildPdf(), ("C-c C-p",))
|
||||||
|
self.add_action_and_bindings(LatexViewPdf(), ('C-c C-v',))
|
||||||
|
|
||||||
class LatexBuild(method.Method):
|
class LatexBuild(method.Method):
|
||||||
'''Insert a pair of LaTeX-style single-quotes into the buffer'''
|
'''Insert a pair of LaTeX-style single-quotes into the buffer'''
|
||||||
|
@ -54,7 +56,7 @@ class LatexBuild(method.Method):
|
||||||
def _modpath(self, w, ext):
|
def _modpath(self, w, ext):
|
||||||
return os.path.splitext(w.buffer.path)[0] + ext
|
return os.path.splitext(w.buffer.path)[0] + ext
|
||||||
def _readlog(self, w):
|
def _readlog(self, w):
|
||||||
logpath = self._modpath('.log')
|
logpath = self._modpath(w, '.log')
|
||||||
f = open(logpath, 'r')
|
f = open(logpath, 'r')
|
||||||
output = f.read()
|
output = f.read()
|
||||||
f.close()
|
f.close()
|
||||||
|
@ -104,4 +106,7 @@ class LatexInsertBraces(method.Method):
|
||||||
w.insert_string_at_cursor("{}")
|
w.insert_string_at_cursor("{}")
|
||||||
w.backward()
|
w.backward()
|
||||||
|
|
||||||
|
class LatexInsertSpace(TextInsertSpace):
|
||||||
|
pass
|
||||||
|
|
||||||
install = Latex.install
|
install = Latex.install
|
||||||
|
|
Loading…
Reference in New Issue