Skip to content

Commit

Permalink
Add boolsetting() and clean up a bit.
Browse files Browse the repository at this point in the history
  • Loading branch information
sjl committed Jun 13, 2011
1 parent a52ef7a commit 7dac7b1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
10 changes: 5 additions & 5 deletions plugin/threesomelib/modes.py
@@ -1,6 +1,6 @@
import vim
from util import buffers, windows
from settings import setting
from settings import boolsetting, setting
from util.io import error


Expand Down Expand Up @@ -130,7 +130,7 @@ class GridMode(Mode):
def __init__(self):
self._current_layout = int(setting('initial_layout_grid', 0))
self._current_diff_mode = int(setting('initial_diff_grid', 0))
self._current_scrollbind = int(setting('initial_scrollbind_grid', 0)) and True or False
self._current_scrollbind = boolsetting('initial_scrollbind_grid')

self._number_of_diff_modes = 2
self._number_of_layouts = 3
Expand Down Expand Up @@ -259,7 +259,7 @@ class LoupeMode(Mode):
def __init__(self):
self._current_layout = int(setting('initial_layout_loupe', 0))
self._current_diff_mode = int(setting('initial_diff_loupe', 0))
self._current_scrollbind = int(setting('initial_scrollbind_loupe', 0)) and True or False
self._current_scrollbind = boolsetting('initial_scrollbind_loupe')

self._number_of_diff_modes = 1
self._number_of_layouts = 1
Expand Down Expand Up @@ -314,7 +314,7 @@ class CompareMode(Mode):
def __init__(self):
self._current_layout = int(setting('initial_layout_compare', 0))
self._current_diff_mode = int(setting('initial_diff_compare', 0))
self._current_scrollbind = int(setting('initial_scrollbind_compare', 0)) and True or False
self._current_scrollbind = boolsetting('initial_scrollbind_compare')

self._number_of_diff_modes = 2
self._number_of_layouts = 2
Expand Down Expand Up @@ -467,7 +467,7 @@ class PathMode(Mode):
def __init__(self):
self._current_layout = int(setting('initial_layout_path', 0))
self._current_diff_mode = int(setting('initial_diff_path', 0))
self._current_scrollbind = int(setting('initial_scrollbind_path', 0)) and True or False
self._current_scrollbind = boolsetting('initial_scrollbind_path')

self._number_of_diff_modes = 5
self._number_of_layouts = 2
Expand Down
6 changes: 6 additions & 0 deletions plugin/threesomelib/settings.py
Expand Up @@ -8,3 +8,9 @@ def setting(name, default=None):
return default
else:
return vim.eval(full_name)

def boolsetting(name):
if int(setting(name, 0)):
return True
else:
False

0 comments on commit 7dac7b1

Please sign in to comment.