Simplify vim options changes
This commit is contained in:
parent
a5ee534c98
commit
553ad95404
2 changed files with 35 additions and 19 deletions
|
|
@ -266,28 +266,30 @@ class DebugSession( object ):
|
|||
self._codeView = code.CodeView( vim.current.window )
|
||||
|
||||
# Call stack
|
||||
vim.command( 'topleft 50vspl' )
|
||||
vim.command( 'enew' )
|
||||
self._stackTraceView = stack_trace.StackTraceView( self,
|
||||
self._connection,
|
||||
vim.current.buffer )
|
||||
with utils.TemporaryVimOptions( { 'splitright': False,
|
||||
'equalalways': False, } ):
|
||||
vim.command( 'topleft 50vspl' )
|
||||
vim.command( 'enew' )
|
||||
self._stackTraceView = stack_trace.StackTraceView( self,
|
||||
self._connection,
|
||||
vim.current.buffer )
|
||||
|
||||
with utils.TemporaryVimOption( 'splitbelow', False ):
|
||||
with utils.TemporaryVimOption( 'eadirection', 'ver' ):
|
||||
with utils.TemporaryVimOption( 'equalalways', 1 ):
|
||||
# Watches
|
||||
vim.command( 'spl' )
|
||||
vim.command( 'enew' )
|
||||
watch_win = vim.current.window
|
||||
with utils.TemporaryVimOptions( { 'splitbelow': False,
|
||||
'eadirection': 'ver',
|
||||
'equalalways': True } ):
|
||||
# Watches
|
||||
vim.command( 'spl' )
|
||||
vim.command( 'enew' )
|
||||
watch_win = vim.current.window
|
||||
|
||||
# Variables
|
||||
vim.command( 'spl' )
|
||||
vim.command( 'enew' )
|
||||
vars_win = vim.current.window
|
||||
# Variables
|
||||
vim.command( 'spl' )
|
||||
vim.command( 'enew' )
|
||||
vars_win = vim.current.window
|
||||
|
||||
self._variablesView = variables.VariablesView( self._connection,
|
||||
vars_win,
|
||||
watch_win )
|
||||
self._variablesView = variables.VariablesView( self._connection,
|
||||
vars_win,
|
||||
watch_win )
|
||||
|
||||
|
||||
with utils.TemporaryVimOption( 'splitbelow', True ):
|
||||
|
|
|
|||
|
|
@ -96,6 +96,20 @@ def RestoreCurrentBuffer( window ):
|
|||
vim.current.buffer = old_buffer
|
||||
|
||||
|
||||
@contextlib.contextmanager
|
||||
def TemporaryVimOptions( opts ):
|
||||
old_value = {}
|
||||
try:
|
||||
for option, value in opts.items():
|
||||
old_value[ option ] = vim.options[ option ]
|
||||
vim.options[ option ] = value
|
||||
|
||||
yield
|
||||
finally:
|
||||
for option, value in old_value.items():
|
||||
vim.options[ option ] = value
|
||||
|
||||
|
||||
@contextlib.contextmanager
|
||||
def TemporaryVimOption( opt, value ):
|
||||
old_value = vim.options[ opt ]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue