Exemple #1
0
  def test_onpar1( self ):
    index = 100

    arglist = argformat.get_arglist_at( source, index )
    fmt = onpar.OnParFormatter( source, arglist )
    print( fmt.apply() )
Exemple #2
0
  def test_multiline2( self ):
    index = 400

    arglist = argformat.get_arglist_at( source, index )
    fmt = multiline.MultilineFormatter( source, arglist )
    print( fmt.apply() )
Exemple #3
0
  def test_concise1( self ):
    index = 100

    arglist = argformat.get_arglist_at( source, index )
    fmt = concise.ConciseFormatter( source, arglist )
    print( fmt.apply() )
Exemple #4
0
indent_size = 2
if indent_style == "tabs":
    indent_size = vim.eval("&tabstop")
else:
    indent_size = vim.eval("&shiftwidth")


spaces_around_arglist = 0
if vim.eval("g:argformat_spaces_around_arglist") == "1":
    spaces_around_arglist = 1

index = vimutils.pos_to_index(vim.current.buffer, vim.current.window.cursor)
source = vimutils.unlines(vim.current.buffer)

arglist = argformat.get_arglist_at(source, index + 1)

style = vim.eval("a:style")
fmt = None
if style == "concise":
    fmt = concise.ConciseFormatter(source, arglist, spaces_around_arglist)
elif style == "onpar":
    fmt = onpar.OnParFormatter(source, arglist, spaces_around_arglist)
elif style == "multiline":
    fmt = multiline.MultilineFormatter(source, arglist)

if fmt is not None:

    affected_start, col = vimutils.index_to_pos(vim.current.buffer, arglist.start_index)
    affected_end, _ = vimutils.index_to_pos(vim.current.buffer, arglist.end_index)
Exemple #5
0
indent_style = ['tabs', 'spaces'][int(vim.eval('&expandtab'))]

indent_size = 2
if indent_style == 'tabs':
    indent_size = vim.eval('&tabstop')
else:
    indent_size = vim.eval('&shiftwidth')

spaces_around_arglist = 0
if vim.eval('g:argformat_spaces_around_arglist') == '1':
    spaces_around_arglist = 1

index = vimutils.pos_to_index(vim.current.buffer, vim.current.window.cursor)
source = vimutils.unlines(vim.current.buffer)

arglist = argformat.get_arglist_at(source, index + 1)

style = vim.eval('a:style')
fmt = None
if style == 'concise':
    fmt = concise.ConciseFormatter(source, arglist, spaces_around_arglist)
elif style == 'onpar':
    fmt = onpar.OnParFormatter(source, arglist, spaces_around_arglist)
elif style == 'multiline':
    fmt = multiline.MultilineFormatter(source, arglist)

if fmt is not None:

    affected_start, col = vimutils.index_to_pos(vim.current.buffer,
                                                arglist.start_index)
    affected_end, _ = vimutils.index_to_pos(vim.current.buffer,
Exemple #6
0
    def test_onpar1(self):
        index = 100

        arglist = argformat.get_arglist_at(source, index)
        fmt = onpar.OnParFormatter(source, arglist)
        print(fmt.apply())
Exemple #7
0
    def test_concise1(self):
        index = 100

        arglist = argformat.get_arglist_at(source, index)
        fmt = concise.ConciseFormatter(source, arglist)
        print(fmt.apply())
Exemple #8
0
    def test_multiline2(self):
        index = 400

        arglist = argformat.get_arglist_at(source, index)
        fmt = multiline.MultilineFormatter(source, arglist)
        print(fmt.apply())