5

This is happening because Vim's HTML syntax will use style htmlHead to the text within the <head> block and it will link it to syntax group PreProc. (The PreProc group is meant for pre-processor directives, such as #include or #define in C/C++.) The slate colorscheme uses a white background (guibg=white) for the PreProc group, so it ends up styling ...


5

You could do, DJx D -> delete rest of the line J -> join the next line x -> delete the space added by join


4

" tell which cinoption take effect for current line com! WhichCinoption call s:which_cinoption() function s:which_cinoption() abort " test if cindent take effect if !empty(&indentexpr) echo "'indentexpr' exists, it overrides 'cindent'." return endif if !&cindent echo "'cindent' is currently disabled." return endif " ...


4

See the last command mentioned here :h shift-left-right :[range]> {count} [flags] So for your example :40> 21 Alternatively, if you don't want to do any arithmetic in your head: :40,60>


3

After I did gg=G for the buffer with set ft=sh I get: while getopts 'dgSsx' opt; do case $opt in d) DEBUG=true ;; g) USE_GDB=true ;; S) USE_GEB=TRUE SMALL=true ;; s) SMALL=true ;; x) XFT=true ;; ?) for line in \ '-d enable debugging with verbose log output' \ '-g enable debug ...


3

You can fix this with the following command: :set autoindent This causes the indent of the second line also to be used for the rest of the list item. Vim's included filetype plugin for Markdown formats bulleted lists using the 'comments' and 'formatoptions' settings. With q included in the formatoptions setting, Vim will allow the formatting of "comments"...


3

To override settings, you need to use the after directory. In this case, we need to know whether to use after/indent or after/ftplugin—use :verbose set <options we care about>? to find where they were last set, and pay attention to whether it was in the ftplugin or indent directory. We expect it to be indent in this case, but sometimes people do ...


3

As diagnosed through comments, you were probably using some generic indentation (such as Vim's cindent, which is likely to expect semi-colons to end statements.) In order to enable language-specific plugins for indentation, enable filetype detection and filetype indentation plugins, with: filetype plugin indent on


3

The basics of simple mappings are explained in Vim's excellent user manual at :help 05.4. You want some key combination (Shift + Tab) to do what's already provided by Vim's Ctrl + D command, so you map <S-Tab> (using :help key-notation now) to <C-d>. As Vim is a mode-based editor, you need to consider the mode; :help i_CTRL-D is for insert mode. ...


3

The command ]p does almost what you want, except it is not guaranteed to be linewise. In tpope/vim-unimpaired plugin it's already remapped to work linewise only, so if you use it (which I suggest anyway), you get it for free. Otherwise, you can implement the same trick yourself: nnoremap <silent>]p :call <SID>putline("]p")<CR> function ...


3

All "long" jump commands, such as gg, automatically save the bookmark for the previous poisition (note that G here is a "motion", so it does not overwrite the bookmark again), so all you have to do is to go back by that bookmark with two backticks: nnoremap <leader>= gg=G`` Or you can use CTRLO and CTRLI to navigate through the jumplist (:h jumplist) ...


3

'indentexpr' has the highest priority of how vim can automatically indent lines. :h 'indentexpr': When this option is not empty, it overrules the 'cindent' and 'smartindent' indenting. Your value is indentexpr=GetTeXIndent(). Customize GetTeXIndent() The behavior of GetTeXIndent() can be customized by a few variables (e.g. g:tex_indent_brace or ...


3

As of Vim 8.2.0139, there are no configuration options to specify this behaviour. Furthermore, any changes to the behaviour of Vim's soft wrapping via 'wrap' will require implementing in the source code: there is no workaround possible by using Vimscript.* See the feature request that Ryan Lue (who asked this question) added to the Vim project's issue ...


3

There are too many such options to be able to answer this quesion in a general manner. However, they are mostly programming-languages oriented or exotic ones. In case of a "text document", such as markdown, you likely have to deal with only autoindent (an alternative is smartindent, as si is sometimes set default in some vimrc's, but si is a sort of "...


3

In the absence of a complete solution, I thought I'd just write a quick answer that shows one way you can achieve the first part of your question. Try the following mapping (for F3): nnoremap <F3> :s/%>%/&\r/g<CR>V``j=gv>> How it works Splitting the line First, it breaks the line on the pipes: :s/%>%/&\r/g :s/ #...


2

touch ~/.vimrc echo "set ts=4 sw=4" >> ~/.vimrc Shorthand for J.Chomel's answer. touch will create the file .vimrc in your home directory if it doesn't exists yet Next, append tabstop and shiftwidth with your preferences to the .vimrc file.


2

@dedoswdi's answer was extremely helpful! I adapted it somewhat to produce the result for each line on the buffer. My adapted script can be found in this Gist. After applying it to the original C++ code, I got the results with both cinoptions= (none of them set) and cinoptions=N-s (which triggers the odd behavior with the second struct.) Here are the ...


2

This is :h cino-+. It looks like get_c_indent() (from src/cindent.c) doesn't know about template and treats it like an ordinary expression split over several lines (here namespace serves as "a function" from :h cino-+). The relevant piece of code from src/cindent.c is 2831 else if (lookfor == LOOKFOR_UNTERM) 2832 { 2833 if (cont_amount > 0) 2834 ...


2

ctrl w w (hold ctrl, don't release) Note that you need to set :h 'backspace' to indent,eol,start for this to work . You can also use <backspace> or <c-u> instead of <c-w> if you want. The behavior is described in :h i_backspacing .


2

You can combine the > and < operators with % to indent blocks of code. The % key will jump to the matching parenthesis, bracket or brace if your cursor is sitting on one of these characters: (, ), [, ], { or }. For an example, say you have a block of code like this and you want to indent it: { stuff here } To indent the code block, put the ...


2

The easiest way is to change the keystrokes you use to start editing an empty line from a to cc. This allows the built-in cindent indentation to correctly adjust the indent when you enter insert mode, which it doesn't do when you specify that you want to append to the existing (blank) line. Note that this will only work if cindent is actually switched on. ...


2

This works with the options formatoptions and comments. Create the file .vim/after/ftplugin/rst.vim and add the following lines: setlocal comments+=b:- setlocal formatoptions+=ro For comments, the b:- adds the the dash as a comment character that has to be followed by a blank. See :help 'comments' and :help format-comments For formatoptions, the r ...


2

As stated in your comment you have cindent and cinoptions set like: set cindent set cinoptions=N-s,g0,:0,(0 The options cindent should only be set for the file types you want to use it. It is set automatically for the C or CPP file types (assuming you have filetype indent on in your vimrc [or better: filetype plugin indent on]). Remove the line set ...


2

the best I could come up with is using visual mode: v, j, h, d h is needed, because you've set selection=inclusive (this is default). To make the selection behave like in a majority of other text editors use set selection=exclusive. Next, if you want shift+arrow to start the selection you should set keymodel=startsel. Also, "delete" normally works the ...


2

With the help of this, this, and this, I come up with this: nnoremap >> 0i<tab><esc>^ nnoremap << :norm 0ldF<tab><enter>^ For multiline selection (works on VISUAL, VISUAL BLOCK and VISUAL LINE): vnoremap > :norm 0i<tab><enter>gv vnoremap < :norm 0ldF<tab><enter>gv Put them on your ~/.vimrc....


1

I eventually figured out it was cindent.


1

I think the setting set smartindent has the behavior you want. If you use the following .vimrc on a.js, then you can see what's happening when you create a new line and press <cr> in normal mode while the cursor is over the indentation section of the new line. I'm using the setting set list to make ends of lines visible (as $) and tabs visible (as ^I)...


1

The 'autoindent' option enables this behavior: When autoindent is on, formatting (with the gq command or when you reach 'textwidth' in Insert mode) uses the indentation of the first line. Note that this option has interactions with other options such as 'smartindent' and 'cindent'. Also, if an 'indentexpr' is set, it can often override what 'autoindent' ...


1

This is controlled by shiftwidth set sw=4


1

If you want to indent html, use the indent operator = with the inner-tag text object it: Place your cursor on the tag whose contents need indenting Press =it


Only top voted, non community-wiki answers of a minimum length are eligible