Somehow my cursor jumps to the right in some filetypes (html, vue, json, maybe others...) when I switch lines with j or k

Jumpy cursor...

My .vimrc is kinda messy atm...but I've seen worse... :)

" Basics {{{
syntax on

let mapleader = ","

set shell=/bin/bash
set nocompatible
set t_Co=256
set noswapfile
set nobackup
set encoding=utf-8
set backspace=indent,eol,start
set hidden
set laststatus=2
set relativenumber
set number
set switchbuf=usetab,newtab
set helplang=de
set ffs=unix,dos
set autoindent
set ttyfast
set wildmenu
set noshowmode
set showcmd
set cmdheight=1
set updatetime=100
set modeline
set modelines=1
set foldmethod=indent
set foldlevel=0
set foldnestmax=1
set foldminlines=100
set conceallevel=0
set concealcursor=
set tabstop=2
set softtabstop=2
set noexpandtab
" }}}
" Mappings {{{
"========================= [MAPPINGS] =========================

map <silent> <F2> :call fzf#run({'source': 'rg --files --column --no-heading --hidden --follow --glob "!.git/*"', 'sink': 'e', 'down': '~30%'})<cr>
let g:fzf_colors =
\ {
\ 'fg': ['fg', 'Normal'],
\ 'bg': ['bg', 'Normal']
map <silent> <F3> :NERDTreeToggle<cr>
no <Leader>ws :ToggleWorkspace<cr>
no <Leader>bw :bwipeout<cr>
no <Space> za
no <Leader>we <C-W>=
ino <C-e> <C-o>$
ino <C-q> <C-o>0
" ino kj <Esc>
" ino jk <Esc>
" }}}

" Plugins {{{
" Vundle Setup {{{
set runtimepath=$HOME/vimfiles,$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after,$HOME/vimfiles/after,$HOME/.vim/bundle/Vundle.vim,$HOME/.vim/bundle/,$HOME/.vim/
filetype off

set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
" }}}
Plugin 'tpope/vim-fugitive'

Plugin 'scrooloose/nerdtree.git'
Plugin 'ryanoasis/vim-devicons'
Plugin 'Xuyuanp/nerdtree-git-plugin'

Plugin 'flazz/vim-colorschemes'
colorscheme donbass
set background=light

Plugin 'benmills/vimux'
Plugin 'jtdowney/vimux-cargo'

Plugin 'tpope/vim-commentary.git'
Plugin 'tpope/vim-surround.git'
Plugin 'jiangmiao/auto-pairs.git'

Plugin 'thaerkh/vim-workspace'
Plugin 'tpope/vim-obsession'

Plugin 'rust-lang/rust.vim'
Plugin 'racer-rust/vim-racer'

Plugin 'w0rp/ale'

Plugin 'mattn/emmet-vim'

Plugin 'rstacruz/sparkup', {'rtp': 'vim/'}

Plugin 'ap/vim-css-color'

Plugin 'junegunn/fzf'


Plugin 'junegunn/goyo.vim'
Plugin 'godlygeek/tabular'
Plugin 'plasticboy/vim-markdown'
let g:markdown_folding=1

call vundle#end()            " required
filetype plugin indent on    " required

" ==================== [YouCompleteMe] =====================
Plugin 'Valloric/YouCompleteMe'
" ==================== [Airline] =========================
Plugin 'vim-airline/vim-airline'
Plugin 'vim-airline/vim-airline-themes'
let g:airline_theme = 'solarized'
let g:airline_powerline_fonts = 1
let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#tabline#fnamemod = ':t'

let g:airline#enable#fugitive = 1
let g:airline#enable#bufferline = 1
let g:airline#enable#syntastic = 1

let g:airline#extensions#tabline#buffer_idx_mode = 1
nmap <leader>1 <Plug>AirlineSelectTab1
nmap <leader>2 <Plug>AirlineSelectTab2
nmap <leader>3 <Plug>AirlineSelectTab3
nmap <leader>4 <Plug>AirlineSelectTab4
nmap <leader>5 <Plug>AirlineSelectTab5
nmap <leader>6 <Plug>AirlineSelectTab6
nmap <leader>7 <Plug>AirlineSelectTab7
nmap <leader>8 <Plug>AirlineSelectTab8
nmap <leader>9 <Plug>AirlineSelectTab9
nmap <leader>n <Plug>AirlineSelectPrevTab
nmap <leader>m <Plug>AirlineSelectNextTab

Plugin 'jeetsukumaran/vim-buffergator'
"================== [vim-vue] ===================
Plugin 'posva/vim-vue'
let g:vue_disable_pre_processor = 0

"================== [GitGutter] =================
Plugin 'airblade/vim-gitgutter'
let g:gitgutter_grep='grep'

"================== [UltiSnips] =================
" Track the engine.
Plugin 'SirVer/ultisnips'

" Snippets are separated from the engine. Add this if you want them:
Plugin 'honza/vim-snippets'

" Trigger configuration. Do not use <tab> if you use
" https://github.com/Valloric/YouCompleteMe.
let g:UltiSnipsExpandTrigger="<s-tab>"
let g:UltiSnipsJumpForwardTrigger="<c-b>"
let g:UltiSnipsJumpBackwardTrigger="<c-z>"

" If you want :UltiSnipsEdit to split your window.
let g:UltiSnipsEditSplit="vertical"

"================== [Syntastic] =================
Plugin 'vim-syntastic/syntastic'

" }}}
" AutoCMDs {{{
" ========================================================
" ===== AUTOCMDs
" ========================================================
autocmd FileType c,cpp,java,php,vimrc,vue,javascript,js  autocmd BufWritePre <buffer> %s/\s\+$//e
autocmd FileType vue setl sw=2 sts=2 ts=2  expandtab
autocmd FileType javascript,js setl sw=2 sts=2 ts=2 noexpandtab
autocmd FileType json set sw=2 sts=2 ts=2 noexpandtab
autocmd FileType md setl sw=2 sts=2 ts=2 noexpandtab
autocmd BufNewFile,BufRead *.vue setf vue
" }}}

Really hoping for a solution, I guess it's a plugin but I've disabled most of them one by one, still the same "error".... So I'm out of ideas really.

  • Do you notice a delay between when you press J or K and when the cursor actually moves? If so, a mapping is definitely in play. Do you notice anything out of the ordinary with :map j or :map k? What about in the bottom right of the screen when you press a key (see :h showcmd)? – ZeroKnight Nov 9 '18 at 20:49
  • Yeah, I've noticed the delay, that's why I've disabled the jk, kj <Esc> mappings, I thought there was a "hidden" space behind the <Esc> somewhere, didn't help tho. There's nothing showing up in the showcmd area when pressing j or k. I suspect a weird glitch in one of the plugins still.... Although I dis- and re-enabled all plugins I've recently installed... ¯_(ツ)_/¯ – dustypaws - Reinstate Monica Nov 9 '18 at 20:53
  • Ruled out tmux....vim behaves the same in a simple terminal... :/ – dustypaws - Reinstate Monica Nov 9 '18 at 21:10
  • Can you check the output of map as mentioned above? Does this persist with vim -u NONE ? – D. Ben Knoble Nov 9 '18 at 23:00
  • Sorry @ZeroKnight I misunderstood what exactly you wanted. So @d-ben-knoble :map k and :map j return no mapping vim -u NONE, so with vanilla settings, everything works as it should. I guess it's a misbehaving plugin. :/ – dustypaws - Reinstate Monica Nov 10 '18 at 9:18

Okay, so in my case disabling thaerkh/vim-workspace solved the issue. If it's the fault of the plugin or a combination of plugins and settings, I don't know. I might investigate that further at a later point and post my findings here. I really love that plugin, it's like vim-obsession, but fully automated...so yeah...disabling it is somewhat annoying. :/

Also: https://github.com/thaerkh/vim-workspace/issues/9 (>_<)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.