"line too long (83 > 79 characters) [E501]" message on gvim - vim

So I use Gvim on Window, so i found an .vimrc file and copied on to my
here is the vimrc file
" plugins
let need_to_install_plugins = 0
if empty(glob('~/.vim/autoload/plug.vim'))
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
"autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
let need_to_install_plugins = 1
endif
call plug#begin()
Plug 'tpope/vim-sensible'
Plug 'itchyny/lightline.vim'
Plug 'joshdick/onedark.vim'
Plug 'ap/vim-buftabline'
Plug 'airblade/vim-gitgutter'
Plug 'vim-scripts/The-NERD-tree'
Plug 'jistr/vim-nerdtree-tabs'
Plug 'Xuyuanp/nerdtree-git-plugin'
Plug 'scrooloose/syntastic'
Plug 'majutsushi/tagbar'
Plug 'vim-scripts/indentpython.vim'
Plug 'lepture/vim-jinja'
Plug 'pangloss/vim-javascript'
call plug#end()
filetype plugin indent on
syntax on
set rnu
if need_to_install_plugins == 1
echo "Installing plugins..."
silent! PlugInstall
echo "Done!"
q
endif
" always show the status bar
set laststatus=2
" enable 256 colors
set t_Co=256
set t_ut=
" turn on line numbering
set number
" sane text files
set fileformat=unix
set encoding=utf-8
set fileencoding=utf-8
" sane editing
set tabstop=4
set shiftwidth=4
set softtabstop=4
set colorcolumn=80
set expandtab
set viminfo='25,\"50,n~/.viminfo
" word movement
imap <S-Left> <Esc>bi
nmap <S-Left> b
imap <S-Right> <Esc><Right>wi
nmap <S-Right> w
" indent/unindent with tab/shift-tab
nmap <Tab> >>
imap <S-Tab> <Esc><<i
nmap <S-tab> <<
" mouse
set mouse=a
let g:is_mouse_enabled = 1
noremap <silent> <Leader>m :call ToggleMouse()<CR>
function ToggleMouse()
if g:is_mouse_enabled == 1
echo "Mouse OFF"
set mouse=
let g:is_mouse_enabled = 0
else
echo "Mouse ON"
set mouse=a
let g:is_mouse_enabled = 1
endif
endfunction
" color scheme
syntax on
colorscheme onedark
filetype on
filetype plugin indent on
" lightline
set noshowmode
let g:lightline = { 'colorscheme': 'onedark' }
" code folding
set foldmethod=indent
set foldlevel=99
" wrap toggle
setlocal nowrap
noremap <silent> <Leader>w :call ToggleWrap()<CR>
function ToggleWrap()
if &wrap
echo "Wrap OFF"
setlocal nowrap
set virtualedit=all
silent! nunmap <buffer> <Up>
silent! nunmap <buffer> <Down>
silent! nunmap <buffer> <Home>
silent! nunmap <buffer> <End>
silent! iunmap <buffer> <Up>
silent! iunmap <buffer> <Down>
silent! iunmap <buffer> <Home>
silent! iunmap <buffer> <End>
else
echo "Wrap ON"
setlocal wrap linebreak nolist
set virtualedit=
setlocal display+=lastline
noremap <buffer> <silent> <Up> gk
noremap <buffer> <silent> <Down> gj
noremap <buffer> <silent> <Home> g<Home>
noremap <buffer> <silent> <End> g<End>
inoremap <buffer> <silent> <Up> <C-o>gk
inoremap <buffer> <silent> <Down> <C-o>gj
inoremap <buffer> <silent> <Home> <C-o>g<Home>
inoremap <buffer> <silent> <End> <C-o>g<End>
endif
endfunction
" move through split windows
nmap <leader><Up> :wincmd k<CR>
nmap <leader><Down> :wincmd j<CR>
nmap <leader><Left> :wincmd h<CR>
nmap <leader><Right> :wincmd l<CR>
" move through buffers
nmap <leader>[ :bp!<CR>
nmap <leader>] :bn!<CR>
nmap <leader>x :bd<CR>
" restore place in file from previous session
autocmd BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
" file browser
let NERDTreeIgnore = ['\.pyc$', '__pycache__']
let NERDTreeMinimalUI = 1
let g:nerdtree_open = 0
map <leader>n :call NERDTreeToggle()<CR>
function NERDTreeToggle()
NERDTreeTabsToggle
if g:nerdtree_open == 1
let g:nerdtree_open = 0
else
let g:nerdtree_open = 1
wincmd p
endif
endfunction
" syntastic
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 1
let g:syntastic_check_on_open = 0
let g:syntastic_check_on_wq = 0
map <leader>s :SyntasticCheck<CR>
map <leader>d :SyntasticReset<CR>
map <leader>e :lnext<CR>
map <leader>r :lprev<CR>
" tag list
map <leader>t :TagbarToggle<CR>
" copy, cut and paste
vmap <C-c> "+y
vmap <C-x> "+c
vmap <C-v> c<ESC>"+p
imap <C-v> <ESC>"+pa
" disable autoindent when pasting text
" source: https://coderwall.com/p/if9mda/automatically-set-paste-mode-in-vim-when-pasting-in-insert-mode
let &t_SI .= "\<Esc>[?2004h"
let &t_EI .= "\<Esc>[?2004l"
function! XTermPasteBegin()
set pastetoggle=<Esc>[201~
set paste
return ""
endfunction
inoremap <special> <expr> <Esc>[200~ XTermPasteBegin()
but anyways here are the problem whenever I enter a list or a string that is too long this message pop up.
line too long (83 > 79 characters) [E501]
so i tried to find a solution on the internet but non of it works, so if anyone knows the solution plz help thanks in advance.:)

You might be using a plug-in like Ale to check your files, if that is the case, this might be of help

Related

CoC: Diagnostic window takes over screen

I am setting up neovim, with CoC.
It seems to work well, but with one big problem: My diagnostic windows are very large
I am not sure why this is. I would expect this to be only a few lines. Ideally, it should show up somewhere not directly over the code, but I'm not sure how to configure this.
This is my neovim config:
call plug#begin('~/.config/nvim/autoload')
Plug 'easymotion/vim-easymotion' " Get to where you want to go fast
Plug 'nanotech/jellybeans.vim' " Pretty theme
Plug 'scrooloose/nerdtree'
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
Plug 'junegunn/fzf.vim' " Fuzzy search
Plug 'jiangmiao/auto-pairs', { 'tag': 'v2.0.0' } " auto-pairs of parens
Plug 'Olical/conjure', {'tag': 'v4.15.0'} " Interactive Clojure Eval
Plug 'guns/vim-sexp' " paredi for vim
Plug 'tpope/vim-sexp-mappings-for-regular-people'
Plug 'clojure-vim/clojure.vim'
Plug 'neoclide/coc.nvim', {'branch': 'release'} " Language servers for vim!
Plug 'w0rp/ale' " linter -- TODO: maybe lsp obviates the need for this?
call plug#end()
" vim:foldmethod=marker:foldlevel=0
" Stopa's vimrc -- my magic sauce for getting things done!
" -----------------------------------------------------------------------------
" Vim settings {{{1
" Important {{{2
set nocompatible " Enable Vim features
syntax on " Turn on syntax highlighting
let mapleader = "," " Set <leader> character
let maplocalleader = "," " Set <localleader> character
colorscheme jellybeans " Favorite so far
set encoding=utf-8 " Use utf-8 when reading files
set fileencoding=utf-8 " Files are written using utf-8
set lazyredraw " Don't redraw on macros -- boosts performance
set ttyfast " Faster redraws and smoother vim
set modelines=1 " Read the modeline at the top
" Ignore these files in Vim's file explorer {{{2
set wildignore+="/tmp/*,*.so,*.swp,*.zip
" Make clipboard the default register {{{2
set clipboard=unnamed
" Highlight column 81 {{{2
set colorcolumn=81
highlight ColorColumn ctermbg=234
" General {{{2
set autoread " Reload files when outside changes made
set backspace=indent,eol,start " Allow backspace in insert mode
set foldnestmax=2 " Sets max fold level.
set gcr=a:blinkon0 " Disable cursor blink
set hidden " Buffers can exist in background
set history=1000 " keep 100 lines of command line history
set laststatus=2 " lightline needs this to display status when opening first buffer
set noshowmode " using Lightline to show status bar instead
set noswapfile " Disable swap files. I don't use them
set number " Line numbers!
set ruler " show the cursor position all the time
set scrolloff=8 " Start scrolling 8 lines away from bottom
set shortmess+=I " Remove Vim startup message for empty file
set showcmd " Show incomplete commands at bottom
set showmode " Show current mode down the bottom
set splitbelow " Default horizontal split below
set splitright " Default vertical split right
set visualbell " Disable sounds
" Wrap {{{2
set wrap
set linebreak " Wrap lines at convienent points
set textwidth=0
set wrapmargin=0
" Searching {{{2
set hlsearch " highlight searching
set incsearch " do incremental searching
set ignorecase " searches are case insensitive
set smartcase " unless you search with a capital letter
" Tabs and Spaces {{{2
set expandtab
set tabstop=4
set softtabstop=4
set shiftwidth=4
" Auto adjust window sizes when they become current {{{2
set winwidth=84
set winheight=5
set winminheight=5
set winheight=999
" }}} End section
" Key mappings {{{1
" Highlight initials in notes {{{2
:match Todo /JA:/
" Easy Navigating {{{2
:inoremap jk <Esc>
:nnoremap j gj
:nnoremap k gk
" Easy window cycling {{{2
:nnoremap <C-h> <C-w>h
:nnoremap <C-j> <C-w>j
:nnoremap <C-k> <C-w>k
:nnoremap <C-l> <C-w>l
" Easy save/quit {{{2
:noremap <leader>w :w<CR>
:nnoremap <leader>q :q!<CR>
:nnoremap <leader>zz :qa!<CR>
" Reload vimrc file {{{2
:nnoremap <silent><leader>sv :so $MYVIMRC<CR>
" Edit useful files {{{2
:nnoremap <silent><leader>ev :e $MYVIMRC<CR>
:nnoremap <silent><leader>et :e $MYTMUXCONF<CR>
:nnoremap <silent><leader>ez :e $MYZSH<CR>
:nnoremap <silent><leader>ep :e $MYPROFILE<CR>
:nnoremap <silent><leader>ed :e $MYTODOS<CR>
" Clear search {{{2
:nnoremap <silent><leader>/ :nohlsearch<CR>
" Easy command Mode {{{2
:nnoremap ; :
" Easy begin/end line navigation {{{2
:nnoremap H 0w
:nnoremap L $
" Easy clipboard copy {{{2
:vnoremap <silent><leader>c :w !pbcopy<CR><CR>
" Easy clipboard paste {{{2
:nnoremap <silent><leader>v :r !pbpaste<CR><CR>
" Easy grep under cursor {{{2
:nmap <silent><leader>r viw"ry:Ag! <C-R>r<CR><CR>
" Easy code folding {{{2
:nnoremap <Space> za
" Focus fold {{{2
:nnoremap <leader>f zMzA
" Toggle lint errors/warnings
:nnoremap <leader>A :ALEToggle<CR><CR>
" Quick newline {{{2
:nnoremap <CR> o<Esc>
" Toggle NERDTree {{{2
:nnoremap <leader>nt :NERDTree<CR>
"
" Toggle show formatting {{{2
:nnoremap <leader>l :set list!<CR>
" Window manipulation {{{2
:nnoremap <leader>\ :vsp<CR>
:nnoremap <leader>m :vertical resize 80<CR>
" Fugitive shortcuts {{{2
:nnoremap <leader>gb :Gblame<CR>
" Tab switching {{{2
:nnoremap <leader>1 1gt
:nnoremap <leader>2 2gt
:nnoremap <leader>3 3gt
:nnoremap <leader>4 4gt
:nnoremap <leader>5 5gt
:nnoremap <leader>6 6gt
:nnoremap <leader>7 7gt
:nnoremap <leader>8 8gt
:nnoremap <leader>9 9gt
:nnoremap <leader>0 :tablast<CR>
:nnoremap <leader>x :tabclose<CR>
:nnoremap <leader>t :0tabnew<CR>
" Easy fzf {{{2
nmap ; :Buffers<CR>
nmap <leader>p :Files<CR>
" Toggle paste mode {{{2
:nnoremap <leader>P :set invpaste!<CR>
" Ctags navigation {{{2
:nnoremap <leader>g <C-]>
:nnoremap <leader>b <C-t>
" Easy Ack/Ag {{{2
:nnoremap <leader>a :Ag
" Easy commenting {{{2
:nnoremap // :TComment<CR>
:vnoremap // :TComment<CR>
" Prevent overwriting default register (system clipboard) when inconvenient {{{2
:vnoremap x "_x
:vnoremap c "_c
:vnoremap p "_dP
" Don't use arrow keys in normal mode :) {{{2
:nnoremap <Left> <NOP>
:nnoremap <Right> <NOP>
:nnoremap <Up> <NOP>
:nnoremap <Down> <NOP>
" In insert or command mode, move normally by using Ctrl {{{2
inoremap <C-h> <Left>
inoremap <C-j> <Down>
inoremap <C-k> <Up>
inoremap <C-l> <Right>
cnoremap <C-h> <Left>
cnoremap <C-j> <Down>
cnoremap <C-k> <Up>
cnoremap <C-l> <Right>
" Enables filetype detection and loads indent files {{{2
" Note: It's important this called after vim/bundle is added to vim's
" runtime path so that ftdetect will be loaded
" Thanks: http://stackoverflow.com/a/19314347
filetype plugin indent on
" Set path for fzf
set rtp+=/usr/local/opt/fzf
" Use Omni-Completion
set omnifunc=syntaxcomplete#Complete
" Plugins {{{1
" Ag {{{2
if executable('ag')
" Use ag over grep
set grepprg=ag\ --nogroup\ --nocolor
" use ag over ack
let g:ackprg = 'ag --vimgrep'
endif
" Lightline {{{2
" General settings
let g:lightline = {
\ 'colorscheme': 'jellybeans',
\ 'mode_map': { 'c': 'NORMAL' },
\ 'active': {
\ 'left': [ [ 'mode', 'paste' ], [ 'fugitive', 'filename' ] ]
\ },
\ 'component_function': {
\ 'fugitive': 'MyFugitive'
\ },
\ 'separator': { 'left': "", 'right': '' },
\ 'subseparator': { 'left': '|', 'right': '|' }
\ }
" NERDTree {{{2
" Files and directories I don't want to see
" Note the use of vim-style regex
let NERDTreeIgnore = [
\ '\.\(pyc\|swp\|db\|coverage\|DS_Store\)$',
\ '\.\(git\|hg\|svn\|egg-info\)$[[dir]]',
\ '\(coverage\|pytests\)\.xml$',
\ ]
" I do want to see dotfiles (like .gitignore)
let NERDTreeShowHidden=1
" Pretty NERDTree
let NERDTreeMinimalUI = 1
let NERDTreeDirArrows = 1
" vim-javascript {{{2
" Enable syntax highlighting for flow
let g:javascript_plugin_flow = 1
" ale {{{2
" Configure error and warning formatting
let g:ale_sign_error = '✘'
let g:ale_sign_warning = '⚠'
highlight ALEErrorSign ctermbg=NONE ctermfg=red
highlight ALEWarningSign ctermbg=NONE ctermfg=yellow
let g:ale_lint_on_enter = 0 " Don't lint files on open
let g:ale_sign_column_always = 1 " Keep column open by default
" Linters
let g:ale_linters = {
\ 'javascript': ['eslint'],
\}
let g:ale_linters_explicit = 1
" Fixers
let g:ale_fixers = {
\ 'javascript': ['eslint']
\ }
" vim-jsx-pretty {{{2
" Colorful style
let g:vim_jsx_pretty_colorful_config = 1
" vim-prettier {{{2
" Run prettier async
let g:prettier#exec_cmd_async = 1
" Custom functions {{{1
" Strip whitespace and save cursor position {{{2
function! <SID>StripTrailingWhitespaces()
" Preparation: save last search, and cursor position.
let _s=#/
let l = line(".")
let c = col(".")
" Do the business:
%s/\s\+$//e
" Clean up: restore previous search history, and cursor position
let #/=_s
call cursor(l, c)
endfunction
" Displays current git branch in powerline {{{2
function! MyFugitive()
if &ft !~? 'vimfiler\|gundo' && exists("*fugitive#head")
let _ = fugitive#head()
return strlen(_) ? "\u00A7 "._ : ''
endif
return ''
endfunction
" }}}
" Autocommands {{{1
augroup configgroup
" Clear previous autocmds
autocmd!
" White Space Settings for different file types {{{2
autocmd FileType python setlocal ts=4 sts=4 sw=4 et
autocmd FileType javascript,jsx,tsx setlocal ts=2 sts=2 sw=2 et
autocmd FileType css setlocal ts=2 sts=2 sw=2 et
autocmd FileType ruby setlocal ts=2 sts=2 sw=2 et
autocmd FileType html,htmljinja setlocal ts=2 sts=2 sw=2 et
" Clean up trailing white spaces {{{2
autocmd BufWritePre * :call <SID>StripTrailingWhitespaces()
" Python folding {{{2
au FileType python setlocal foldmethod=indent
au FileType python setlocal foldlevel=0
" Javascript folding {{{2
au FileType javascript,jsx,tsx setlocal foldmethod=syntax
au FileType javascript,jsx,tsx setlocal foldlevel=1
" Rainbow-ify parens/brackets for selected file types {{{2
au FileType javascriptreact,jsx call rainbow#load()
" Enable vim-jinja highlighting for .jinja files {{{2
autocmd BufNewFile,BufRead *.jinja set filetype=htmljinja
" Trigger autoread whenever I switch buffer or when focusing vim again {{{2
" Thanks: http://stackoverflow.com/questions/2490227/how-does-vims-autoread-work/20418591#20418591
au FocusGained,BufEnter * :silent! !
" Save whenever switching between windows and buffers {{{2
au FocusLost,BufLeave,WinLeave * :silent! w
" Close the Omni-Completion tip window when a selection is made {{{2
" These lines close it on movement in insert mode or when leaving insert mode
" Thanks:
" http://stackoverflow.com/questions/3105307/how-do-you-automatically-remove-the-preview-window-after-autocompletion-in-vim
autocmd CursorMovedI * if pumvisible() == 0|pclose|endif
autocmd InsertLeave * if pumvisible() == 0|pclose|endif
" }}} End section
augroup END
" COC {{{1
" Having longer updatetime (default is 4000 ms = 4 s) leads to noticeable
" delays and poor user experience.
set updatetime=300
" Use tab for trigger completion with characters ahead and navigate.
" NOTE: Use command ':verbose imap <tab>' to make sure tab is not mapped by
" other plugin before putting this into your config.
inoremap <silent><expr> <TAB>
\ pumvisible() ? "\<C-n>" :
\ <SID>check_back_space() ? "\<TAB>" :
\ coc#refresh()
inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>"
function! s:check_back_space() abort
let col = col('.') - 1
return !col || getline('.')[col - 1] =~# '\s'
endfunction
" Use <c-space> to trigger completion.
if has('nvim')
inoremap <silent><expr> <c-space> coc#refresh()
else
inoremap <silent><expr> <c-#> coc#refresh()
endif
" Make <CR> auto-select the first completion item and notify coc.nvim to
" format on enter, <cr> could be remapped by other vim plugin
inoremap <silent><expr> <cr> pumvisible() ? coc#_select_confirm()
\: "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"
" Remap keys for gotos
nmap <silent> gd <Plug>(coc-definition)
nmap <leader>u <Plug>(coc-references)
nmap <leader>rn <Plug>(coc-rename)
command! -nargs=0 Format :call CocAction('format')
" Diagnostics
inoremap <silent><expr> <c-space> coc#refresh()
nmap <silent> [l <Plug>(coc-diagnostic-prev)
nmap <silent> ]l <Plug>(coc-diagnostic-next)
nmap <silent> [k :CocPrev<cr>
nmap <silent> ]k :CocNext<cr>
" Highlight symbol under cursor on CursorHold
autocmd CursorHold * silent call CocActionAsync('highlight')
vmap <leader>f <Plug>(coc-format-selected)
nmap <leader>f <Plug>(coc-format-selected)
" Fix autofix problem of current line
nmap <leader>aq <Plug>(coc-fix-current)
" Show documentation
nnoremap <silent> K :call <SID>show_documentation()<CR>
function! s:show_documentation()
if &filetype == 'vim'
execute 'h '.expand('<cword>')
else
call CocAction('doHover')
endif
endfunction
autocmd BufReadCmd,FileReadCmd,SourceCmd jar:file://* call s:LoadClojureContent(expand("<amatch>"))
function! s:LoadClojureContent(uri)
setfiletype clojure
let content = CocRequest('clojure-lsp', 'clojure/dependencyContents', {'uri': a:uri})
call setline(1, split(content, "\n"))
setl nomodified
setl readonly
endfunction
" }}} End Section
" Source private vimrc {{{1
if filereadable(expand("~/.vim/vimrc.private.after"))
source ~/.vim/vimrc.private.after
endif
Help would be much appreciated. Mainky:
Why is the diagnostic window full-screen?
Is there a way I could configure this to be smaller, or to show up somewhere else? (perhaps below the main pane)
Problem was
" Auto adjust window sizes when they become current {{{2
set winwidth=84
set winheight=5
set winminheight=5
set winheight=999
" }}} End section
Removing this did the trick

How to change vim command execution priority?

I made :wincmd h<CR> shortcut to <leader>h, and mapleader is <Space> to me
but When I do <leader>h, I feel quite long delay to execute this action,
so I searched commands about <leader>h by :map <leader>h and
I found that I have serveral commands start with <Space>h like below
n <Space>hp #<Plug>(GitGutterPreviewHunk)
n <Space>hu #<Plug>(GitGutterUndoHunk)
n <Space>hs #<Plug>(GitGutterStageHunk)
x <Space>hs #<Plug>(GitGutterStageHunk)
n <Space>h * :wincmd h<CR>
I think because of map priority, <Space>h is performed last,
I want to change execution priority <Space>h to first place.
because <Space>h is the best easy way shortcut to me for :windcmd h.
How do I change priority order of map?
==== edit ====
I think vim wait for next character from h,
then How can I eliminate delay for <Space>h?
<nowait> is not working (I don't know why)
remapping for plugin is not working
==== edit2 ==== (it still not work thought adopt first answer)
init.vim
""Source file
source $HOME/.config/nvim/ascii_art.vim
""Plugin-install
call plug#begin('~/.vim/plugged')
Plug 'neoclide/coc.nvim', {'branch': 'release'}
Plug 'tweekmonster/gofmt.vim'
Plug 'tpope/vim-fugitive'
Plug 'vim-utils/vim-man'
Plug 'mbbill/undotree'
Plug 'sheerun/vim-polyglot'
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
Plug 'junegunn/fzf.vim'
Plug 'stsewd/fzf-checkout.vim'
Plug 'vuciv/vim-bujo'
Plug 'tpope/vim-dispatch'
Plug 'theprimeagen/vim-be-good', {'do': './install.sh'}
Plug 'vim-airline/vim-airline'
Plug 'gruvbox-community/gruvbox'
Plug 'vifm/vifm.vim'
"Theme
Plug 'colepeters/spacemacs-theme.vim'
Plug 'sainnhe/gruvbox-material'
Plug 'phanviet/vim-monokai-pro'
Plug 'flazz/vim-colorschemes'
Plug 'chriskempson/base16-vim'
" fuzzy find files
Plug 'ctrlpvim/ctrlp.vim'
" git gutter
Plug 'airblade/vim-gitgutter'
Plug 'scrooloose/nerdcommenter'
"NerdTree plugins (NerdTree makes vim too slow, so now it unstalled)
"Plug 'scrooloose/nerdtree'
"Plug 'Xuyuanp/nerdtree-git-plugin'
"Plug 'tiagofumo/vim-nerdtree-syntax-highlight'
"Plug 'ryanoasis/vim-devicons'
Plug 'mattn/emmet-vim'
Plug 'vimwiki/vimwiki' "take note
Plug 'mhinz/vim-startify' "easy way to save and load session
call plug#end()
""General-setting
language en_US
syntax on
set number
set relativenumber
set guicursor=
set relativenumber
set nohlsearch
set hidden
set noerrorbells
set tabstop=4 softtabstop=4
set shiftwidth=4 "tab key spaces, = set sw
set expandtab "instead of tab, insert spaces
set smartindent
set nu
set nowrap
set smartcase
set noswapfile
set undofile
set incsearch
set termguicolors
set scrolloff=8 "Scroll offset
set noshowmode
set cmdheight=2
set updatetime=50
set shortmess+=c
set cursorline
set hlsearch "highlight searched words
"NOTE :eol is end of the line
set listchars=eol:↲,tab:→\ ,trail:~,extends:>,precedes:<,space:␣
set nolist "set list => $ is end of the line
"Fold setting: when auto save and load fold
set foldcolumn=2
autocmd BufWinLeave *.* mkview
autocmd BufWinEnter *.* silent! loadview
highlight ColorColumn ctermbg=0 guibg=lightgrey
""Color Theme
colorscheme gruvbox
"cursorline termguicolors
set background=dark
let g:gruvbox_contrast='soft'
let loaded_matchparen = 1
let mapleader = " "
""Status-line
set statusline=
set statusline+=%#IncSearch#
set statusline+=\ %y
set statusline+=\ %r
set statusline+=%#CursorLineNr#
set statusline+=\ %F
set statusline+=%= "Right side settings
set statusline+=%#Search#
set statusline+=\ %l/%L
set statusline+=\ [%c]
""Key-bindings
nnoremap <leader>gc :GCheckout<CR>
nnoremap <leader>ghw :h <C-R>=expand("<cword>")<CR><CR>
nnoremap <leader>prw :CocSearch <C-R>=expand("<cword>")<CR><CR>
nnoremap <leader>pw :Rg <C-R>=expand("<cword>")<CR><CR>
nnoremap <nowait> <leader>j :wincmd j<CR>
nnoremap <nowait> <leader>k :wincmd k<CR>
nnoremap <nowait> <leader>l :wincmd l<CR>
"bug report:: :wincmd h is mapped with below mapping,
"> but can not use shortcuts for GigGutterPreviewHunk, GitGutterUndoHunk, GitGutterStageHunk
autocmd filetype * nnoremap <nowait> <buffer> <leader>h :wincmd h<CR>
"nnoremap <nowait> <leader>h :wincmd h<CR>
nnoremap <leader>u :UndotreeShow<CR>
"nnoremap <leader>pv :wincmd v<bar> :Ex <bar> :vertical resize 30<CR>
nnoremap <leader>pv :call ToggleNetrw() <bar> :vertical resize 30<CR>
nnoremap <Leader>ps :Rg<SPACE>
nnoremap <C-p> :GFiles<CR>
nnoremap <Leader>pf :Files<CR>
nnoremap <Leader><CR> :<c-u>call <sid>Goto_definition() <CR>
nnoremap <F4> :so ~/.config/nvim/init.vim<CR>
nnoremap <Left> :vertical resize -2<CR>
nnoremap <Right> :vertical resize +2<CR>
nnoremap <Up> :resize +2<CR>
nnoremap <Down> :resize -2<CR>
nnoremap <Leader>rp :resize 100<CR>
nnoremap <Leader>ee oif err != nil {<CR>log.Fatalf("%+v\n", err)<CR>}<CR><esc>kkI<esc>
vnoremap J :m '>+1<CR>gv=gv
vnoremap K :m '<-2<CR>gv=gv
vnoremap X "_d
"built-in mapping disable
nnoremap Q <Nop>
" vim TODO
nmap <Leader>tu <Plug>BujoChecknormal
nmap <Leader>th <Plug>BujoAddnormal
let g:bujo#todo_file_path = $HOME . "/.cache/bujo"
" GoTo code navigation.
nmap <leader>gd <Plug>(coc-definition)
nmap <leader>gy <Plug>(coc-type-definition)
nmap <leader>gi <Plug>(coc-implementation)
nmap <leader>gr <Plug>(coc-references)
nmap <leader>rr <Plug>(coc-rename)
nmap <leader>g[ <Plug>(coc-diagnostic-prev)
nmap <leader>g] <Plug>(coc-diagnostic-next)
nmap <silent> <leader>gp <Plug>(coc-diagnostic-prev-error)
nmap <silent> <leader>gn <Plug>(coc-diagnostic-next-error)
nnoremap <leader>cr :CocRestart
nnoremap <silent> K :call <SID>show_documentation()<CR>
"quickly enter new line in normal mode
nnoremap <Leader>o o<Esc>
nmap ghs <Plug>(GitGutterStageHunk)
xmap ghs <Plug>(GitGutterStageHunk)
nmap ghu <Plug>(GitGutterUndoHunk)
nmap ghp <Plug>(GitGutterPreviewHunk)
"Emmet key
let g:user_emmet_mode="n"
let g:user_emmet_leader_key="," "default leader_key is <c-y> with trailing ,(comma)
" coc config
let g:coc_global_extensions = [
\ 'coc-snippets',
\ 'coc-pairs',
\ 'coc-tsserver',
\ 'coc-eslint',
\ 'coc-prettier',
\ 'coc-json',
\ 'coc-marketplace',
\ ]
"coc snippet
" Use <C-l> for trigger snippet expand.
imap <C-l> <Plug>(coc-snippets-expand)
" Use <C-j> for select text for visual placeholder of snippet.
vmap <C-j> <Plug>(coc-snippets-select)
" Use <C-j> for jump to next placeholder, it's default of coc.nvim
let g:coc_snippet_next = '<c-j>'
" Use <C-k> for jump to previous placeholder, it's default of coc.nvim
let g:coc_snippet_prev = '<c-k>'
" Use <C-j> for both expand and jump (make expand higher priority.)
imap <C-j> <Plug>(coc-snippets-expand-jump)
inoremap jk <ESC>
vmap ++ <plug>NERDCommenterToggle
nmap ++ <plug>NERDCommenterToggle
let g:NERDTreeIgnore = ['^node_modules$']
" ctrlp
let g:ctrlp_user_command = ['.git/', 'git --git-dir=%s/.git ls-files -oc --exclude-standard']
" Highlight currently open buffer in NERDTree
autocmd BufEnter * call SyncTree()
" Remap for rename current word
nmap <F2> <Plug>(coc-rename)
"Functions
"show documetation function
function! s:show_documentation()
if (index(['vim','help'], &filetype) >= 0)
execute 'h '.expand('<cword>')
else
call CocAction('doHover')
endif
endfunction
"sync open file with NERDTree, Check if NERDTree is open or active
function! IsNERDTreeOpen()
return exists("t:NERDTreeBufName") && (bufwinnr(t:NERDTreeBufName) != -1)
endfunction
" Call NERDTreeFind iff NERDTree is active, current window contains a modifiable, file, and we're not in vimdiff
function! SyncTree()
if &modifiable && IsNERDTreeOpen() && strlen(expand('%')) > 0 && !&diff
NERDTreeFind
wincmd p
endif
endfunction
" autocomplete functions for neoclide/coc.nvim
"---------------------------------------------------------------------------
" Use tab for trigger completion with characters ahead and navigate.
" NOTE: Use command ':verbose imap <tab>' to make sure tab is not mapped by
" other plugin before putting this into your config.
inoremap <silent><expr> <TAB>
\ pumvisible() ? "\<C-n>" :
\ <SID>check_back_space() ? "\<TAB>" :
\ coc#refresh()
inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>"
function! s:check_back_space() abort
let col = col('.') - 1
return !col || getline('.')[col - 1] =~# '\s'
endfunction
" Use <c-space> to trigger completion.
if has('nvim')
inoremap <silent><expr> <c-space> coc#refresh()
else
inoremap <silent><expr> <c-#> coc#refresh()
endif
" Use <cr> to confirm completion, `<C-g>u` means break undo chain at current
" position. Coc only does snippet and additional edit on confirm.
" <cr> could be remapped by other vim plugin, try `:verbose imap <CR>`.
if exists('*complete_info')
inoremap <expr> <cr> complete_info()["selected"] != "-1" ? "\<C-y>" : "\<C-g>u\<CR>"
else
inoremap <expr> <cr> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"
endif
"open implementation to the right split view(custom function)
"buggy: If you quit after invoke this function, this function will not work(it will quit your only window)
let s:first_open=1
function! s:Goto_definition() abort
if s:first_open
rightbelow vs "same as :vertical split and :wincmd l
normal K
wincmd h
let s:first_open=0
else
wincmd l "If right split window exists then quit
q
rightbelow vs
normal K
wincmd h
endif
endfunction
"---------------------------------------------------------------------------
"" netrw settings
let g:netrw_liststyle=3 "Tree style
let g:netrw_banner = 0 "Remove banner
let g:netrw_browse_split = 4 "Open file in previous window
let g:netrw_altv = 1 "Open vertical split window to the right side
let g:netrw_preview=1 "Preview in right side
set nocompatible "Limit search for your project
set path+=** "Search all subdirectories with recursively
set wildmenu "Show multifiles on one line when you :find
"Root directory:make current directory to root directory
nnoremap <leader>` :Ntree<CR>
let g:NetrwIsOpen=0
function! ToggleNetrw()
if g:NetrwIsOpen
let i = bufnr("$")
while (i >= 1)
if (getbufvar(i, "&filetype") == "netrw")
silent exe "bwipeout " . i
endif
let i-=1
endwhile
let g:NetrwIsOpen=0
else
let g:NetrwIsOpen=1
silent Lexplore
endif
endfunction
let g:netrw_list_hide= netrw_gitignore#Hide()
"=================Unorganized settings==================
"jsx comment
let g:NERDCustomDelimiters={
\ 'javascript': { 'left': '//', 'right': '', 'leftAlt': '{/*', 'rightAlt': '*/}' },
\}
"vimwiki setup
"let g:vimwiki_list = [{'path': '~/vimwiki/',
"\ 'syntax': 'markdown', 'ext': '.md'}]
=== edit for Result (now working) ===
for :map <leader>h now show like this picture
what I did
add 4 snippets from answer
:PlugUpdate => I was out of date.
remove <nowait>
:echo hasmapto('<Plug>(GitGutterStageHunk)', 'n') output 1
when upto 2 step, it didn't work, but after remove nowait it works
something interfereing commands, but I don't know exact reason.
The mappings that include <Leader>h as a prefix will cause this interference. Vim will wait for a timeout or additional keypress before executing your <Leader>h mapping, since it wants to check whether you meant to press one of the longer mappings...
The easiest way to fix this is set alternate mappings for the vim-gitgutter commands. If you set up different mappings for those in your vimrc, vim-gitgutter itself will not create its mappings which are causing the interference.
The vim-gitgutter README suggests using g as an alternative prefix for these:
To set your own mappings for these, for example if you prefer g-based maps:
nmap ghs <Plug>(GitGutterStageHunk)
nmap ghu <Plug>(GitGutterUndoHunk)
So just go ahead and create mappings for the four keybindings that are breaking your <Leader>h. Add these four lines to your vimrc:
nmap ghs <Plug>(GitGutterStageHunk)
xmap ghs <Plug>(GitGutterStageHunk)
nmap ghu <Plug>(GitGutterUndoHunk)
nmap ghp <Plug>(GitGutterPreviewHunk)
The xmap (for staging in Visual mode) is technically not required, you could keep using <Leader>hs there without interference... But on the other hand you might want to keep those consistent between Normal and Visual mode, so I'd recommend remapping that one too.
The reason why <noway> doesn't work to fix this is that <nowait> only works on <buffer>-local mappings, when they shadow global mappings. It doesn't work when all your mappings are global. (In that case, Vim prefers to force you to resolve the conflicts, rather than make then longest mappings always unaccessible.)

Vim - onoremap from learnvimscriptthehardway doesnt work in my case

As i have read the book. I have encounter the onoremap comman, especially this one:
:onoremap in( :<c-u>normal! f(vi(<cr>. But when i pressed din<shift>9, where <shift>9 is parenthesis, to delete content of next argument in parenthesis, nothing happened - just cursor moved up one line. Same here : :onoremap il( :<c-u>normal! F)vi(<cr> where cursos Find backwards the parethesis, but did nothing more.
It is weird, and even more strange because it worked few days ago (nothing has changed). What can be the problem?
I have even used vim -u NONE <somefile>, without loading .vimrc, random file with parethesis inside, and map it once again :onoremap in( :<c-u>normal! f(vi(<cr>, but even then didnt work. I reallt dont get it.
verb omap in( :
o in( * :<C-U>normal! f(vi(<CR>
Last set from ~/.vimrc
ADDITIONAL INFO:
1) .VIMRC:
enter code
:set nocompatible
:set helpheight=9999
:set matchtime=1
:set tabstop=3
:set autoindent
:set smartindent
:set shiftwidth=3
:set laststatus=2
:set fillchars=""
:set timeoutlen=300
"}}}
"statusline{{{
:set statusline=%f
:set statusline+=%=
:set statusline+=%l
:set statusline+=/
:set statusline+=%L
"}}}
"colorscheme{{{
:colorscheme elflord
:hi Folded guibg=NONE ctermbg=NONE guifg=Yellow
"}}}
"leader and localleader{{{
:let mapleader = ","
:let maplocalleader = ";"
"}}}
"edit and source $MYVIMRC{{{
:nnoremap <leader>e :vsplit $MYVIMRC<cr>
:nnoremap <leader>ee :tabedit $MYVIMRC<cr>
:nnoremap <leader>s :source $MYVIMRC<CR>
"}}}
"movements with arrows{{{
:nnoremap - <c-d>
:vnoremap <left> <Nop>
:vnoremap <right> <Nop>
:vnoremap <up> <Nop>
"}}}
"vnoremap <VISUAL>{{{
:vnoremap <leader>" <esc>`>a"<esc>`<i"<esc>lel
:vnoremap jk <esc>
:vnoremap Y "+y
"}}}
"inoremap <INSERT>{{{
:inoremap /<cr> <esc>A<cr>//
:inoremap <leader><cr> <esc>$a<cr>
:inoremap <c-d> <esc>ddi
:inoremap uu <esc>viwUea
:inoremap <leader>x <esc>:wq<cr>
:inoremap <c-h> <esc>hhviwxi
:inoremap <leader>m <esc>
:inoremap <leader>d <esc>dd
:inoremap <leader>ee <esc>:tabedit $MYVIMRC<cr>
:inoremap <leader>c <esc>:
:inoremap cls <esc>G$vggx
:cnoremap <C-DEL> <s-right><c-w>
"}}}
"nnoremap <NORMAL>{{{
:nnoremap <F2> :set wrap!<cr>
:nnoremap tn :tabnew<cr>
:nnoremap bd :bd!<cr>
:nnoremap <left> :w<cr>:bnext<cr>
:nnoremap <right> :w<cr>:bprevious<cr>
:nnoremap <leader><down> :<down>
:nnoremap <leader><up> :<up>
:nnoremap bn :w<cr>:new new<cr><c-w>j<c-w>c
:nnoremap <F1> :Explore<cr>
:nnoremap <leader>m q
:nnoremap <F10> :set nornu!<cr>:set nonu!<cr>
:nnoremap <leader>x :wq<cr>
:nnoremap P "+p
:nnoremap <leader>] <c-w>l
:nnoremap <leader>[ <c-w>h
:nnoremap <leader>r :reg<cr>
:nnoremap <leader>} :tabp<cr>
:nnoremap <leader>{ :tabn<cr>
:nnoremap <BS> i<BS>
:nnoremap <cr> $a<cr><esc>
:nnoremap <tab> i<tab><esc>
:nnoremap cls G$vggx
:nnoremap H 0
:nnoremap L $
:nnoremap q :q!<cr>
:nnoremap r <c-r>
:nnoremap <localleader>s :w<cr>:source %<cr>
:nnoremap <leader>; :exe "normal! mqA;\e`q"<cr>
:nnoremap <F12> :set incsearch!<cr>:set hls!<cr>
:nnoremap <leader>sp :match Error /\s\+/<cr>
:nnoremap <leader>no :match none<cr>
:nnoremap / /\v
:nnoremap gj :cnext!<cr>
:nnoremap gk :cprevious!<cr>
:nnoremap <c-a> Gvgg
"}}}
"cnoremap <COMMAND> {{{
cnoremap <c-h> <c-w>
cnoremap <a-h> <C-E><C-U>
cnoremap <C-DEL> <s-right><c-w>
"}}}
"onoremap <PENDING>{{{
:onoremap il( :<C-u>normal! F)vi(<cr>
:onoremap in( :<C-u>normal! f(vi(<cr>
:onoremap in{ :<C-u>normal! f{vi{<cr>
:onoremap in[ :<C-u>normal! f[vi[<cr>
:onoremap in" :<C-u>normal! f"vi"<cr>
:onoremap in' :<C-u>normal! f'vi'<cr>
:onoremap in< :<C-u>normal! f<vi<<cr>
:onoremap in` :<C-u>normal! f`vi`<cr>
:onoremap il{ :<C-u>normal! F}vi{<cr>
:onoremap il[ :<C-u>normal! F]vi[<cr>
:onoremap il" :<C-u>normal! F"vi"<cr>
:onoremap il' :<C-u>normal! F']i'<cr>
:onoremap il< :<C-u>normal! F>vi<<cr>
:onoremap il` :<C-u>normal! F`vi`<cr>
"}}}
"autocmd filetype_vim{{{
augroup filetype_vim
autocmd!
autocmd FileType vim setlocal foldmethod=marker
augroup END
" }}}
"autocmd filetype_c{{{
augroup filetype_c
autocmd!
autocmd FileType c inoremap <buffer> <localleader>c /**/<esc>hi
autocmd FileType c iabbrev <buffer> main #include <stdio.h><cr>#include <stdlib.h><cr><cr>int main (void) {<cr><cr><cr>return 0;<cr>}<cr><esc>4ki<Tab>
autocmd FileType c nnoremap <F5> :w<cr>:!clear;gcc -lm -std=c99 -Wall -Wextra -pedantic -g % <cr>:!./a.out<cr>
autocmd FileType c nnoremap <F6> :w<cr>:!clear;gcc -pthread %<cr>:!./a.out<cr>
autocmd FileType c iabbrev <buffer><silent> pr printf("\n");<esc>2F"a<C-R>=Eatchar('\s')<cr>
autocmd FileType c inoremap <leader>a <esc>f"a,
autocmd FileType c iabbrev <buffer><silent> sc scanf(" %");<esc>F"i<C-R>=Eatchar('\s')<cr>
autocmd FileType c inoremap <leader>u <esc>kkkO<CR>
autocmd FileType c iabbrev for for(int i =0; i< ; i++)<esc>F<a<C-R>=Eatchar('\s')<cr>
autocmd FileType c iabbrev forj for (int j =0; j< ; j++)<esc>F<a<C-R>=Eatchar('\s')<cr>
augroup END
"}}}
"autocmd filetype_asm{{{
augroup filetype_asm
autocmd!
autocmd FileType asm nnoremap <F5> :w<cr>:!clear;as --32 % -o 1.o;ld -m elf_i386 1.o -o 1<cr>:!./1<cr>
autocmd FileType asm inoremap 3<cr> <cr>#<esc>a
augroup END
"}}}
"autocmd filetype_html{{{
augroup filetype_html
autocmd!
autocmd FileType html nnoremap <buffer> <localleader>f Vatzf
augroup END
"}}}
"autocmd filetype_sh{{{
augroup filetype_sh
autocmd!
autocmd Filetype sh nnoremap <buffer> <F5> :w<cr>:!./%<cr>
augroup END
"}}}
"autocmd filetype_perl{{{
augroup filetype_perl
autocmd!
autocmd Filetype perl inoremap <leader>3 #!/usr/bin/perl<cr>
autocmd Filetype perl nnoremap <leader>3 i#!/usr/bin/perl<cr>
autocmd Filetype perl nnoremap <F5> :w<cr>:!clear;chmod +x %;./%<cr>
autocmd FileType perl inoremap <F5> <esc>:w<cr>:!clear;chmod +x %;./%<cr>
autocmd Filetype perl iabbrev pr print "\n";<esc>2F"a
autocmd Filetype perl inoremap <leader>l <esc>f;s
autocmd Filetype perl inoremap <localleader>s <esc>maggouse strict;<esc>`aa
augroup END
"}}}

Disable weird trackpad scrolling behavior w/ iTerm and Vim

When I accidentally hit the track pad in Vim it scrolls up to a "new" vim pane. I'm not actually sure what entity it's scrolling up into, but here's what it looks like:
https://i.imgur.com/RC1U6Kc.gif
Any thoughts on how to prevent this from happening
Here's my .vimrc file:
set nocompatible " required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
" let Vundle manage Vundle, required
Plugin 'gmarik/Vundle.vim'
" Add all your plugins here (note older versions of Vundle used Bundle instead of Plugin)
Plugin 'tmhedberg/SimpylFold'
Plugin 'vim-scripts/indentpython.vim'
Plugin 'nvie/vim-flake8'
Plugin 'jnurmine/Zenburn'
Plugin 'altercation/vim-colors-solarized'
Plugin 'scrooloose/nerdtree'
Plugin 'jistr/vim-nerdtree-tabs'
Plugin 'kien/ctrlp.vim'
Plugin 'tpope/vim-fugitive'
Plugin 'vim-airline/vim-airline'
Plugin 'auto-pairs-gentle'
Plugin 'tpope/vim-sensible'
Plugin 'vim-syntastic/syntastic'
Plugin 'jiangmiao/auto-pairs'
Plugin 'Xuyuanp/nerdtree-git-plugin'
" All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
let g:AutoPairsUseInsertedCount = 1
set backspace=indent,eol,start " backspace over everything in insert mode
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 1 && isdirectory(argv()[0]) && !exists("s:std_in") | exe 'NERDTree' argv()[0] | wincmd p | ene | endif
let g:syntastic_python_checkers=['flake8']
let g:syntastic_python_flake8_args='--ignore=D100,D101,D103,D104,D105,I002,E501'
autocmd vimenter * if !argc() | NERDTree | endif
if has('gui_running')
set background=dark
colorscheme solarized
else
colorscheme zenburn
endif
set nu
let NERDTreeIgnore=['\.pyc$', '\~$'] "ignore files in NERDTree
let NERDTreeAutoDeleteBuffer = 1
let NERDTreeMinimalUI = 1
let NERDTreeDirArrows = 1
map <silent> <C-n> :NERDTreeToggle<CR>
set splitbelow
set splitright
nnoremap <C-J> <C-W><C-J>
nnoremap <C-K> <C-W><C-K>
nnoremap <C-L> <C-W><C-L>
nnoremap <C-H> <C-W><C-H>
" Enable folding
set foldmethod=indent
set foldlevel=120
" Enable folding with the spacebar
nnoremap <space> za
let g:SimpylFold_docstring_preview=1
au BufNewFile,BufRead *.py
\ set tabstop=4 |
\ set softtabstop=4 |
\ set shiftwidth=4 |
\ set textwidth=120 |
\ set expandtab |
\ set autoindent |
\ set fileformat=unix
set encoding=utf-8
let python_highlight_all=1
syntax on
fun! TrimWhitespace()
let l:save = winsaveview()
%s/\s\+$//e
call winrestview(l:save)
endfun
noremap <ScrollWheelUp> <nop>
noremap <S-ScrollWheelUp> <nop>
noremap <C-ScrollWheelUp> <nop>
noremap <ScrollWheelDown> <nop>
noremap <S-ScrollWheelDown> <nop>
noremap <C-ScrollWheelDown> <nop>
noremap <ScrollWheelLeft> <nop>
noremap <S-ScrollWheelLeft> <nop>
noremap <C-ScrollWheelLeft> <nop>
noremap <ScrollWheelRight> <nop>
noremap <S-ScrollWheelRight> <nop>
noremap <C-ScrollWheelRight> <nop>

Vim cursor moves forward 7 characters when I use my remapped <Esc>

I took a stab at writing my own .vimrc for the first time. I've gotten used to using "kj" as a replacement for Escape so I added a remapping. Here is a copy of my .vimrc:
set nocompatible
filetype off
" Plugins
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'gmarik/Vundle.vim'
Plugin 'sjl/badwolf'
Plugin 'scrooloose/nerdtree'
Plugin 'scrooloose/syntastic'
Plugin 'scrooloose/nerdcommenter'
Plugin 'tpope/vim-fugitive'
Plugin 'kien/ctrlp.vim'
Plugin 'majutsushi/tagbar'
Plugin 'bling/vim-airline'
Plugin 'bronson/vim-trailing-whitespace'
call vundle#end()
filetype plugin indent on
" Ctrl P
let g:ctrlp_atch_window = 'bottom,order:ttb'
let g:ctrlp_switch_buffer = 0
let g:ctrlp_working_path_mode = 0
" Syntastic
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 1
let g:syntastic_check_on_open = 1
let g:syntastic_check_on_wq = 0
let g:syntastic_js_checkers = ['jshint']
" Fugitive
set statusline+=%{fugitive#statusline()}
" Vim Airline
set laststatus=2
" Colors
syntax enable
colorscheme badwolf
let g:badwolf_darkgutter=1
" Misc
set ttyfast
set backspace=indent,eol,start
" Spaces & Tabs
set tabstop=2
set expandtab
set softtabstop=2
set shiftwidth=2
set autoindent
" UI Layout
set number
set showcmd
set cursorline
set wildmenu
set showmatch
match Error /\%81v.\+/
" Searching
set ignorecase
set incsearch
set hlsearch
" Folding
" set foldmethod=indent
" set foldnestmax=10
" set foldenable
" nnoremap <space> za
" set foldlevelstart=10
" Shortcut Remmaping
inoremap kj <Esc>
vnoremap kj <Esc>
" Movement
" nnoremap <buffer> <silent> j gj
" nnoremap <buffer> <silent> k gk
map <C-h> :wincmd h<CR>
map <C-j> :wincmd j<CR>
map <C-k> :wincmd k<CR>
map <C-l> :wincmd l<CR>
" Leader Shortcuts
let mapleader=","
let g:mapleader=","
nnoremap <leader>w :NERDTree<CR>
nnoremap <leader>l :call ToggleNumber()<CR>
nnoremap <leader><space> <silent> :nohlsearch<CR>
nnoremap <leader>t :TagbarToggle<CR>
" Custom Functions
function! ToggleNumber()
if(&relativenumber == 1)
set norelativenumber
set number
else
set relativenumber
endif
endfunc
" Return to last edit position when opening files (You want this!)
autocmd BufReadPost *
\ if line("'\"") > 0 && line("'\"") <= line("$") |
\ exe "normal! g`\"" |
\ endif
" Remember info about open buffers on close
set viminfo^=%
When I include the "kj" remappings upon pressing "kj" while in insert mode, I enter normal mode and then my cursor moves forwards 7 characters. Without the remapping the letters are simply be typed into the buffer.
I have tried disabling all of my plugins, but the problem still persists. This is driving me mad, any ideas what could be causing this to happen?
There are trailing spaces right after inoremap kj <Esc>, which is interpreted as a part of the mapping. Try removing these spaces.

Resources