В .vimrc
:
inoremap ii <esc> " ii to go back into command mode
Проблема полягає в тому, що iiкурсор стрибає 35 стовпчиків праворуч. Єдиний інший рядок, який стосується Esc:
nnoremap <esc><esc> :noh<return><esc>
Я спробував прокоментувати це, не допомагає.
set nocompatible
filetype off
" Vundle ---------------------------------------------------------------------
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'gmarik/Vundle.vim'
Plugin 'bling/vim-airline'
Plugin 'vim-airline/vim-airline-themes'
Plugin 'scrooloose/nerdtree'
Plugin 'scrooloose/nerdcommenter'
Plugin 'scrooloose/syntastic'
Plugin 'freitass/todo.txt-vim'
Plugin 'plasticboy/vim-markdown'
Plugin 'tpope/vim-fugitive' " :GitCommands
Plugin 'tpope/vim-git' " allows to see branch in airline
Plugin 'airblade/vim-gitgutter' " git status in SL area
Plugin 'ctrlpvim/ctrlp.vim' " TODO: learn more about this
Plugin 'Shougo/neocomplete.vim' " TAB completion
" Plugin 'tmhedberg/SimpylFold' " should we add FastFold?
Plugin 'spf13/vim-autoclose' " autoclose brackets(properly)
Plugin 'godlygeek/tabular' " V -> : -> /SYMBOL_TO_LINE-UP
Plugin 'terryma/vim-multiple-cursors' " steep learning curve
Plugin 'Yggdroot/indentLine' " shows | intendation
Plugin 'mhinz/vim-startify' " start screen
Plugin 'hashivim/vim-vagrant'
Plugin 'pearofducks/ansible-vim'
Plugin 'whatyouhide/vim-gotham'
Plugin 'ryanoasis/vim-devicons' " glyph icons everywhere
call vundle#end()
" System ---------------------------------------------------------------------
set lazyredraw " do we need this?
set ttyfast " theoretically make things faster
set mouse=a " enable mouse
set guicursor=a:blinkon0 " don't blink with the cursor
set termencoding=utf-8 " terminal is UTF-8
set encoding=utf8 " ...as well as the editor
set fileformat=unix " *nix format
set clipboard=unnamed " Fix clipboard in *nix
set wildmenu
set wildmode=longest:full,full
set wildignore=*.o,*.pyc,*.DS_Store
set magic " needed for regexp
set hidden " allow switching buffers w/o saving
set nojoinspaces " don't join spaces on paste
set formatoptions-=r formatoptions-=c formatoptions-=o " don't autoextend comments
set lines=40 columns=90 " default size for GUI
set gdefault " replace all without /g
set virtualedit=all " keep cursor horizontal pos. when scrolling
set backup " backups ON
set undofile " persistent undo
set backupdir=~/.vim/backup
set directory=~/.vim/tmp
set undolevels=1000 " max number of undos
set undoreload=10000 " max lines to to save for undo
set history=1000 " 1000 of history (what?)
set incsearch " incremental search
set smartcase " ... and case sensitive if Uppercase is present
set expandtab " spaces instead of tabs
set smarttab " smart tabs/intends
set tabstop=4 " TAB = 4 spaces
set softtabstop=4
set smartindent
set autoindent
set shiftwidth=4
set shiftround " round to 4
let NERDSpaceDelims=1 " add space before comment
let NERDTreeMapOpenInTab='\r' " open files in new tab
let g:vim_markdown_folding_disabled=1 " don't fold *.md
let g:neocomplete#enable_at_startup = 1 " NeoComplete
let g:neocomplete#enable_auto_select = 1
let g:neocomplete#enable_smart_case = 1
let g:neocomplete#min_keyword_length = 2 " min symbols before autocomplete
" Visuals --------------------------------------------------------------------
filetype plugin indent on " enable filetype plugins
syntax enable " enable syntax highlighting
let python_highlight_all=1 " full python highlighting
colorscheme gotham256 " GUI colours
let g:airline_theme = "gotham256" " airline theme
if has("gui_running")
set cul
endif
set title " set terminal title
set t_Co=256 " 256 colors terminal
set guifont=Meslo\ LG\ S\ Regular\ for\ Powerline\ Nerd\ Font\ Complete\ Windows\ Compatible:h12
set guioptions=L " disable right scrlbar
set guioptions=R " disable left scrlbar
set number " show line numbers
set nowrap " don't wrap long lines
set fillchars+=vert:\? " vertical unicode split
set shortmess+=I " remove startup message
set splitbelow " Natural splits
set splitright
set hlsearch " highlight search results
set showmatch " show matching brackets
set noerrorbells " disable bells
set novisualbell
set vb t_vb=
set laststatus=2 " always show airline
let g:airline_powerline_fonts=1 " use glyph fonts
let g:airline#extensions#tabline#enabled=1 " enable tabline (top)
let g:airline#extensions#tabline#fnamemod=':t' " filename only
set completeopt-=preview " don't show doc. window by default
let g:SimplylFold_docstring_preview=1 " keep docstring unfolded.
let g:gitgutter_sign_added = '?' " Gitgutter
let g:gitgutter_sign_modified = '•'
let g:gitgutter_sign_removed = '?'
let g:indentLine_char = '¦' " intendation vertical lines
" Hotkeys --------------------------------------------------------------------
nnoremap <F1> <nop> " F1 does noothing
map <F2> :NERDTreeToggle<CR> " F2 to open NerdTree
set pastetoggle=<F3> " F3 to switch in paste mode
map <F4> :mksession! ~/.vim/vim_session<CR> " F4 to write current session
map <F5> :source ~/.vim/vim_session<CR> " F5 to load prev. session
inoremap ii <esc> " ii to go back into command mode
let mapleader = "\<Space>" " remap leader key from '\' to Space
map <leader>cd :cd %:p:h<cr>:pwd<cr> " CWD to the dir of the open buffer
nnoremap <esc><esc> :noh<return><esc> " 2xESC clears search highlights
nnoremap <C-J> <C-W><C-J> " switch splits with CTRL+hjkl
nnoremap <C-K> <C-W><C-K>
nnoremap <C-L> <C-W><C-L>
nnoremap <C-H> <C-W><C-H>
nmap <leader>l :bn<CR> " next buffer by Space+l
nmap <leader>h :bp<CR> " previous buffer by Space+h
nmap <leader>q :bp <BAR> bd #<CR> " close buffer by Space+q
vnoremap < <gv " leave txt selected after <>
vnoremap > >gv
set t_ku=OA " fix arrow keys
set t_kd=OB
set t_kr=OC
set t_kl=OD
nmap <leader>f1 :set foldlevel=0<CR> " change folding levels
nmap <leader>f2 :set foldlevel=1<CR>
nmap <leader>f3 :set foldlevel=2<CR>
nmap <leader>f4 :set foldlevel=3<CR>
nnoremap <silent> <leader>gs :Gstatus<CR> " GIT shortcuts
nnoremap <silent> <leader>gd :Gdiff<CR>
nnoremap <silent> <leader>gc :Gcommit<CR>
nnoremap <silent> <leader>gb :Gblame<CR>
nnoremap <silent> <leader>gl :Glog<CR>
nnoremap <silent> <leader>gp :Git push<CR>
nnoremap <silent> <leader>gr :Gread<CR>
nnoremap <silent> <leader>gw :Gwrite<CR>
nnoremap <silent> <leader>ge :Gedit<CR>
nnoremap <silent> <leader>ga :Git add %:p<CR>
set backspace=eol,start,indent " esoteric backspace fix
set whichwrap+=<,> " move to another line with <- ->
if bufwinnr(1) " resize splits with +-
map + <C-W>+
map - <C-W>-
endif
" NeoComplete
" <CR>: close popup and save indent.
inoremap <silent> <CR> <C-r>=<SID>my_cr_function()<CR>
function! s:my_cr_function()
" return neocomplete#close_popup() . "\<CR>"
" For no inserting <CR> key.
return pumvisible() ? neocomplete#close_popup() : "\<CR>"
endfunction
" <TAB>: completion.
inoremap <expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>"
" Macros ---------------------------------------------------------------------
" Emulate any other editor with tabs
try
set switchbuf=useopen,usetab,newtab
catch
endtry
" Close vim if NerdTree is the only buffer left
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTreeType") && b:NERDTreeType == "primary") | q | endif
" Return to last edit position when opening files
autocmd BufReadPost *
\ if line("'\"") > 0 && line("'\"") <= line("$") |
\ exe "normal! g`\"" |
\ endif
" Python with virtualenv support
py << EOF
import os
import sys
if 'VIRTUAL_ENV' in os.environ:
project_base_dir = os.environ['VIRTUAL_ENV']
activate_this = os.path.join(project_base_dir, 'bin/activate_this.py')
execfile(activate_this, dict(__file__=activate_this))
EOF
" Enable omni completion.
autocmd FileType css setlocal omnifunc=csscomplete#CompleteCSS
autocmd FileType html,markdown setlocal omnifunc=htmlcomplete#CompleteTags
autocmd FileType javascript setlocal omnifunc=javascriptcomplete#CompleteJS
autocmd FileType python setlocal omnifunc=pythoncomplete#Complete
autocmd FileType xml setlocal omnifunc=xmlcomplete#CompleteTags
" Enable heavy omni completion.
if !exists('g:neocomplete#sources#omni#input_patterns')
let g:neocomplete#sources#omni#input_patterns = {}
endif
" format JSON code
com! FormatJSON %!python -m json.tool
" BG fix for tmux
set t_ut=
inoremap
той самий ефект. Додано посилання на vimrc. Дякуємо:]
inoremap ii <Esc>
. Я не думаю, що це вирішить вашу проблему, але це все-таки найкраща практика. Ви також можете опублікувати своє повне.vimrc
: що може допомогти нам допомогти вам ;-)