如何多次缩进行组

时间:2017-08-30 19:55:48

标签: vim

在Vim 5 > > 将移动下面的五行,包括光标是一个标签或{{1空格正确。 5 < < 左侧相同。

如果我要向左或向右移动一些行数两次或三次,该怎么办?我正在寻找以某种方式指定要移位的shiftwidth的数量,而不是 5 > > > > > >

4 个答案:

答案 0 :(得分:3)

One way is to use visual selection to select the lines:

e.g. to indent the current line and the next 4 lines, select with v4j

and then use a number followed by Query queryRef = mReference.child("users").orderByChild("username").startAt(query).endAt(query + "\uf8ff"); to indent that many times e.g. 3>

答案 1 :(得分:2)

来自:help >官方手册: Vjj4> move three lines 4 indents to the right :<<< move current line 3 indents to the left :>> 5 move 5 lines 2 indents to the right :5>> move line 5 2 indents to the right

  

要移动几行'shiftwidth',请使用可视模式或:命令。

     

例如:

5>>

或简单地说,.并在正常模式下使用import React from 'react' import ReactDOM from 'react-dom' class App extends React.Component{ constructor(props) { super(props) this.state = { list: [{id: 1,val: 'aa'}, {id: 2, val: 'bb'}, {id: 3, val: 'cc'}] } } click() { this.state.list.reverse() this.setState({}) } render() { return ( <ul> <div onClick={this.click.bind(this)}>reverse</div> { this.state.list.map(function(item, index) { return ( <Li key={item.id} val={item.val}></Li> ) }.bind(this)) } </ul> ) } } class Li extends React.Component{ constructor(props) { super(props) } componentDidMount() { console.log('===did===') } componentWillUpdate(nextProps, nextState) { console.log('===mount====') } render() { return ( <li> {this.props.val} <input type="text"></input> </li> ) } } ReactDOM.render(<App/>, document.getElementById('app'))重复命令,因为@acushner指出

答案 2 :(得分:0)

You can do this:

package com.example.android.cloudmusic;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.DisplayMetrics;

public class MainActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
}

DisplayMetrics metrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(metrics);
int height = metrics.heightPixels;
int width = metrics.widthPixels;

    }
}

This way, something like 123|xx3|1x23|1x2x3|x123x|123x will indent the current line with 5 spaces. This isn't the perfect solution because there are many different ways you might want to do this. For example, what if you want this to be 5 tabs instead? Or 5 times the current setting of (?:.*?\\|){3}(.*) ? But that comes down to personal preference and you didn't really specify this in your question, so if you do want to do something like that, I'll let you figure it out.

But for example, if you know you want 4 spaces, you could do:

nnoremap > :<C-u>exec 'set shiftwidth='.v:count1<cr>>
nnoremap < :<C-u>exec 'set shiftwidth='.v:count1<cr><
xnoremap > :<C-u>exec 'set shiftwidth='.v:count1<cr>gv>
xnoremap < :<C-u>exec 'set shiftwidth='.v:count1<cr>gv<

But this doesn't take into account if you're using a smaller shiftwidth.

答案 3 :(得分:0)

使用命令

的Anoter选项
4:>>>

当您按<Enter>时,您会看到:

:.,.+3>>>

然后按<Enter>