3

NVIM version v0.6.1

Suppose I am writing a list in markdown and let's say that the cursor is on the item3. Now, doing o in normal mode or Enter in insert mode automatically indents the next line.

+ item1
+ item2
+ item3
    |

First, I don't know why this behavior is happening? I am sure it is not from my .vimrc file. Here is my .vimrc:

1 " basics
2 set nocompatible
3 set nobackup
4 set noswapfile
5 set list
6 set listchars=eol:¬
7 set number
8 set mouse=a
9 set wildmenu
10 set ic
11 set ai
12 set clipboard=unnamedplus
13 set tabstop=4
14 set shiftwidth=4
15 set expandtab
16 set scrolloff=5
17 syntax on
18 let g:tex_flavor = "latex" " try using modline in latex files
19 "colorscheme morning
20 
21 
22 function! ExecuteMacroOverVisualRange()
23   echo "@".getcmdline()
24   execute ":'<,'>normal @".nr2char(getchar())
25 endfunction
26 
27 
28 " mapping
29 let mapleader="," "
30 nnoremap <C-j> <C-w>j
31 nnoremap <C-k> <C-w>k
32 nnoremap <C-l> <C-w>l
33 nnoremap <C-h> <C-w>h
34 xnoremap . :norm.<CR>
35 map <F5> :set spell! spelllang=en_us<CR>
36 xnoremap @ :<C-u>call ExecuteMacroOverVisualRange()<CR>
37 nnoremap <Leader>o 3o<Esc><Esc>i
38 nnoremap <Leader>O 3O<Esc><Esc>2ki
39 nnoremap <Leader>i 2o<Esc><Esc>i
40 nnoremap <Leader>I 2O<Esc><Esc>ki
41 autocmd FileType markdown nnoremap <buffer> o o<C-d>
42 autocmd FileType markdown nnoremap <buffer> O O<C-d>
43 autocmd FileType markdown inoremap <buffer> <CR> <CR><C-d>
44 
45 
46 "plugin settings
47 autocmd FileType python setlocal commentstring=#\ %s "vim-commentary
48 map <Leader>vv :Vifm<CR>
49 map <F2> :NERDTreeToggle<CR>
50 let g:UltiSnipsExpandTrigger="<tab>"
51 let g:UltiSnipsJumpForwardTrigger="<c-j>"
52 let g:UltiSnipsJumpBackwardTrigger="<c-k>"
53 let g:UltiSnipsEditSplit="vertical"

Second, as per now I have found a workaround to avoid this issue, shown in the line 41-43 in the .vimrc file. I feel that more better solutions to avoid this issue might exist, what is the optimal way to tackle it?

1 Answer 1

0

At least in my case, the unexpected indentation was coming from the vim-markdown plugin being installed in ~/.vim/pack/, and removing it got rid of this indentation issue. Another user has noticed this issue and reported it here: https://github.com/preservim/vim-markdown/issues/640. As of now it is still an open issue there.

If you can't find the issue in your own vim config, I recommend moving ~/.vim off to the side temporarily or using vim -u NONE to narrow down the behavior to less configuration. You can also see what config vim is trying to load with vim --version.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .