Удалите пробел в редакторе vi, созданном “опцией” ню набора

Я несколько раз использовал редактор vi на многих различных машинах, но я никогда не видел такого поведения set nu опция.

Это - то, о чем заботится мой редактор vi, я установил set nu опция в .vimrc файл в моем корневом каталоге: vi editor screen-shot

Как ясно замечено, некоторое количество пробела создается слева от номеров строки. Как я могу удалить это пространство так, чтобы я мог лучше использовать свою рабочую область.

Заранее спасибо.

1
задан 24 October 2015 в 09:47

1 ответ

От помощи на nu ( :h 'number' )

                                'number' 'nu' 'nonumber' 'nonu'
'number' 'nu'           boolean (default off)
                            local to window
        Print the line number in front of each line.  When the 'n' option is
        excluded from 'cpoptions' a wrapped line will not use the column of
        line numbers (this is the default when 'compatible' isn't set).
        The 'numberwidth' option can be used to set the room used for the line
        number.

И в свою очередь, от :h 'numberwidth':

'numberwidth' 'nuw'     number  (Vim default: 4  Vi default: 8)
                        local to window
                        {not in Vi}
                        {only available when compiled with the +linebreak
                        feature}
        Minimal number of columns to use for the line number.  Only relevant
        when the 'number' or 'relativenumber' option is set or printing lines
        with a line number. Since one space is always between the number and
        the text, there is one less character for the number itself.
        The value is the minimum width.  A bigger width is used when needed to
        fit the highest line number in the buffer respectively the number of
        rows in the window, depending on whether 'number' or 'relativenumber'
        is set. Thus with the Vim default of 4 there is room for a line number
        up to 999. When the buffer has 1000 lines five columns will be used.
        The minimum value is 1, the maximum value is 10.
        NOTE: 'numberwidth' is reset to 8 when 'compatible' is set.

таким образом, ширина по умолчанию равняется 4, но 8 когда в compatible способ. vi в дефолте Ubuntu vim.tiny , который не поддерживает nocompatible, таким образом, ширина стала 8. Вы должны установить vim, чтобы получить нормальное поведение.

Тем не менее, если Вы действительно хотите установить другую минимальную ширину, скажите 2, просто сделайте:

set nuw=2
0
ответ дан 30 September 2019 в 06:50

Другие вопросы по тегам:

Похожие вопросы: