Многие мои сопоставления ключей, некоторые из которых работали до этого, больше не применяются. Я буду отображать все отдельные сопоставления по одному за раз. В конце я поставлю весь файл .vimrc
. Я должен сказать, что я не вим-гуру, поэтому было добавлено значительное количество копий.
Лидеры карт:
let mapleader = ","
let g:mapleader = ","
nmap <leader>w :w!<cr>
map <leader>e :e! ~/.vimrc<cr>
ни , w, ни , e ничего не делать.
Дерево NERD:
map <F2> :NERDTreeToggle<CR> "Toggle Nerd Tree on/off
F2 больше не работает.
Буферная навигация:
map <S-j> :bp<CR>
map <S-k> :bn<CR>
Shift j или Shift k больше не перемещаются в следующий или предыдущий буфер, даже если они использовались.
В дополнение к этому многие другие функции не работают, например, Latex-Suite \ r Команда f который, как предполагается, сбрасывает латексный код, ничего не делает.
Ответы на следующие вопросы:
Q: Это только проблема отображения/функции
A: Насколько мне известно, Да
В: Работают ли ваши другие настройки?
A: Да
Q: работают ли эти сопоставления, если вы вводите их в командной строке, например :nmap <leader>w :w!<cr>
A: Это не так, даже если я сделал :let mapleader = ","
и/или let g:mapleader = ","
, однако :NERDTreeToggle
работает
Запрошенные команды:
:redir >for_stack_overflow.txt
:scriptnames
:verb map ,
:verb map <f2>
:redir END
Вывод запрошенных команд:
1: /usr/share/vim/vimrc
2: /usr/share/vim/vim73/debian.vim
3: /usr/share/vim/vim73/syntax/syntax.vim
4: /usr/share/vim/vim73/syntax/synload.vim
5: /usr/share/vim/vim73/syntax/syncolor.vim
6: /usr/share/vim/vim73/filetype.vim
7: /home/peyman/.vimrc
8: /usr/share/vim/vim73/syntax/nosyntax.vim
9: /usr/share/vim/vim73/ftplugin.vim
10: /home/peyman/.vim/colors/xoria256.vim
11: /home/peyman/.vim/autoload/pathogen.vim
12: /usr/share/vim/vim73/ftoff.vim
13: /home/peyman/.vim/plugin/NERD_tree.vim
14: /home/peyman/.vim/plugin/SearchComplete.vim
15: /home/peyman/.vim/plugin/SyntaxFolds.vim
16: /home/peyman/.vim/plugin/filebrowser.vim
17: /home/peyman/.vim/plugin/imaps.vim
18: /home/peyman/.vim/plugin/jsbeautify.vim
19: /home/peyman/.vim/plugin/libList.vim
20: /home/peyman/.vim/plugin/mru.vim
21: /home/peyman/.vim/plugin/remoteOpen.vim
22: /home/peyman/.vim/plugin/showmarks.vim
23: /home/peyman/.vim/plugin/supertab.vim
24: /home/peyman/.vim/plugin/syntastic.vim
25: /home/peyman/.vim/syntax_checkers/c.vim
26: /home/peyman/.vim/syntax_checkers/coffee.vim
27: /home/peyman/.vim/syntax_checkers/cpp.vim
28: /home/peyman/.vim/syntax_checkers/cucumber.vim
29: /home/peyman/.vim/syntax_checkers/eruby.vim
30: /home/peyman/.vim/syntax_checkers/haml.vim
31: /home/peyman/.vim/syntax_checkers/haskell.vim
32: /home/peyman/.vim/syntax_checkers/html.vim
33: /home/peyman/.vim/syntax_checkers/javascript.vim
34: /home/peyman/.vim/syntax_checkers/lua.vim
35: /home/peyman/.vim/syntax_checkers/perl.vim
36: /home/peyman/.vim/syntax_checkers/php.vim
37: /home/peyman/.vim/syntax_checkers/python.vim
38: /home/peyman/.vim/syntax_checkers/ruby.vim
39: /home/peyman/.vim/syntax_checkers/sass.vim
40: /home/peyman/.vim/syntax_checkers/sh.vim
41: /home/peyman/.vim/syntax_checkers/tex.vim
42: /home/peyman/.vim/syntax_checkers/xhtml.vim
43: /home/peyman/.vim/bundle/syntastic/syntax_checkers/c.vim
44: /home/peyman/.vim/bundle/syntastic/syntax_checkers/coffee.vim
45: /home/peyman/.vim/bundle/syntastic/syntax_checkers/cpp.vim
46: /home/peyman/.vim/bundle/syntastic/syntax_checkers/cucumber.vim
47: /home/peyman/.vim/bundle/syntastic/syntax_checkers/eruby.vim
48: /home/peyman/.vim/bundle/syntastic/syntax_checkers/haml.vim
49: /home/peyman/.vim/bundle/syntastic/syntax_checkers/haskell.vim
50: /home/peyman/.vim/bundle/syntastic/syntax_checkers/html.vim
51: /home/peyman/.vim/bundle/syntastic/syntax_checkers/javascript.vim
52: /home/peyman/.vim/bundle/syntastic/syntax_checkers/lua.vim
53: /home/peyman/.vim/bundle/syntastic/syntax_checkers/perl.vim
54: /home/peyman/.vim/bundle/syntastic/syntax_checkers/php.vim
55: /home/peyman/.vim/bundle/syntastic/syntax_checkers/python.vim
56: /home/peyman/.vim/bundle/syntastic/syntax_checkers/ruby.vim
57: /home/peyman/.vim/bundle/syntastic/syntax_checkers/sass.vim
58: /home/peyman/.vim/bundle/syntastic/syntax_checkers/sh.vim
59: /home/peyman/.vim/bundle/syntastic/syntax_checkers/tex.vim
60: /home/peyman/.vim/bundle/syntastic/syntax_checkers/xhtml.vim
61: /home/peyman/.vim/plugin/tabname.vim
62: /home/peyman/.vim/plugin/tcomment.vim
63: /home/peyman/.vim/bundle/gundo/plugin/gundo.vim
64: /home/peyman/.vim/bundle/syntastic/plugin/syntastic.vim
65: /usr/share/vim/vim73/plugin/getscriptPlugin.vim
66: /usr/share/vim/vim73/plugin/gzip.vim
67: /usr/share/vim/vim73/plugin/matchparen.vim
68: /usr/share/vim/vim73/plugin/netrwPlugin.vim
69: /usr/share/vim/vim73/plugin/rrhelper.vim
70: /usr/share/vim/vim73/plugin/spellfile.vim
71: /usr/share/vim/vim73/plugin/tarPlugin.vim
72: /usr/share/vim/vim73/plugin/tohtml.vim
73: /usr/share/vim/vim73/plugin/vimballPlugin.vim
74: /usr/share/vim/vim73/plugin/zipPlugin.vim
75: /home/peyman/.vim/nerdtree_plugin/exec_menuitem.vim
76: /home/peyman/.vim/nerdtree_plugin/fs_menu.vim
,_s * :TCommentAs <C-R>=&ft<CR>_
Last set from ~/.vim/plugin/tcomment.vim
,_n * :TCommentAs <C-R>=&ft<CR><Space>
Last set from ~/.vim/plugin/tcomment.vim
,_a * :TCommentAs<Space>
Last set from ~/.vim/plugin/tcomment.vim
,_b * :TCommentBlock<CR>
Last set from ~/.vim/plugin/tcomment.vim
x ,_r * :TCommentRight<CR>
Last set from ~/.vim/plugin/tcomment.vim
nos,_r * :TCommentRight<CR>
Last set from ~/.vim/plugin/tcomment.vim
x ,_i * :TCommentInline<CR>
Last set from ~/.vim/plugin/tcomment.vim
,_<Space> * :TComment<Space>
Last set from ~/.vim/plugin/tcomment.vim
,_p * vip:TComment<CR>
Last set from ~/.vim/plugin/tcomment.vim
x ,__ * :TCommentMaybeInline<CR>
Last set from ~/.vim/plugin/tcomment.vim
nos,__ * :TComment<CR>
Last set from ~/.vim/plugin/tcomment.vim
,mm :ShowMarksPlaceMark<CR>
Last set from ~/.vim/plugin/showmarks.vim
,ma :ShowMarksClearAll<CR>
Last set from ~/.vim/plugin/showmarks.vim
,mh :ShowMarksClearMark<CR>
Last set from ~/.vim/plugin/showmarks.vim
,mo :ShowMarksOn<CR>
Last set from ~/.vim/plugin/showmarks.vim
,mt :ShowMarksToggle<CR>
Last set from ~/.vim/plugin/showmarks.vim
n ,ff * :call g:Jsbeautify()<CR>
Last set from ~/.vim/plugin/jsbeautify.vim
,e :e! ~/.vimrc<CR>
Last set from ~/.vimrc
n ,/ :nohlsearch<CR>
Last set from ~/.vimrc
n ,w :w!<CR>
Last set from ~/.vimrc
<F2> :NERDTreeToggle<CR> <Space>
Last set from ~/.vimrc
Дополнительные вопросы: Каково значение параметров тайм-аута и тайм-аута
Другие ответы на следующие вопросы:
`:verb set timeout` --> No Output
`:verb set timeoutlen` --> timeoutlen=1000
.vimrc:
" With a map leader it possible to do extra key combinations
" like <leader>w saves the current file
let mapleader = ","
let g:mapleader = ","
"Turn on syntax (I guess)
syntax on
" Needed for Syntax Highlighting and stuff
filetype on
filetype plugin on
syntax enable
set grepprg=grep\ -nH\ $*
" Tell vim to remember certain things when we exit
" '10 : marks will be remembered for up to 10 previously edited files
" "100 : will save up to 100 lines for each register
" :20 : up to 20 lines of command-line history will be remembered
" % : saves and restores the buffer list
" n... : where to save the viminfo files
set viminfo='10,\"100,:20,%,n~/.viminfo
"Restore cursor position
function! ResCur()
if line("'\"") <= line("$")
normal! g`"
return 1
endif
endfunction
augroup resCur
autocmd!
autocmd BufWinEnter * call ResCur()
augroup END
" Fast saving
nmap <leader>w :w!<cr>
" Fast editing of the .vimrc
map <leader>e :e! ~/.vimrc<cr>
" When vimrc is edited, reload it
autocmd! bufwritepost vimrc source ~/.vim_runtime/vimrc
"Latex Suite
"This specifies what I want folded. I have included the defaults as well as
"some of my own as well
" let g:Tex_FoldedSections=',test'
" let g:Tex_FoldedCommands=',lstset'
" let g:Tex_FoldedEnvironments=',itemize'
" let g:Tex_FoldedMiscl=',comments'
"These two lines display the file name at the bottom
set modeline
set ls=2
"Default for checking marks is 4 seconds, make it faster
set updatetime=100
"Persistent Undo
set undodir=~/.vim/undodir
set undofile
set undolevels=10000 "maximum number of changes that can be undone
set undoreload=10000 "maximum number lines to save for undo on a buffer reload
"Use GUndo to better view undo tree
"http://sjl.bitbucket.org/gundo.vim/
nnoremap <F5> :GundoToggle<CR>
"Keep undo history when switching buffers
set hidden
"Don't use vi-compatibility mode
set nocompatible
"Use the smart version of backspace (jumps over tabs apparently instead of
"spaces
set backspace=2
"Use spaces instead of tabs
set expandtab
"Line Numbers
set number
"Makes unnamed clipboard accesible to X window
set clipboard=unnamedplus
"Number of spaces to use for each step of (auto)indent.
set shiftwidth=4
"This shows what you are typing as a command
set showcmd
"Not too sure what this does
set smarttab
"Indent every time you press enter
set autoindent
set smartindent
"Use C style indent instead (note this causes problems with non C code)
" set cindent
"Cursor Always in middle
"NOTE This causes problems with word wrap of long lines as they are not
"displayed correctly
set scrolloff=999
"Always display row/column info
set ruler
"Set a red ruler at some point for comment blocks
"But only for php and js files as they make heavy use of comments
au BufNewFile,BufRead *.php,*.js set cc=80
"turn on spell check for tex files
au BufNewFile,BufRead *.tex set spell spelllang=en_gb
set tags=tags;/
"make word wrap wrap words, not character
set formatoptions=l
set lbr
"Use ... when word wrapping
set showbreak=...
"enable status line always
set laststatus=2
"
" statusline
" cf the default statusline: %<%f\ %h%m%r%=%-14.(%l,%c%V%)\ %P
" format markers:
" %< truncation point
" %n buffer number
" %f relative path to file
" %m modified flag [+] (modified), [-] (unmodifiable) or nothing
" %r readonly flag [RO]
" %y filetype [ruby]
" %= split point for left and right justification
" %-35. width specification
" %l current line number
" %L number of lines in buffer
" %c current column number
" %V current virtual column number (-n), if different from %c
" %P percentage through buffer
" %) end of width specification
set statusline=%f%m%r%h%w[%n]\ [F=%{&ff}][T=%Y]\ %=[LINE=%l][%p%%]
"set it up to change the status line based on mode
if version >= 700
au InsertEnter * hi StatusLine term=reverse ctermbg=4
au InsertLeave * hi StatusLine term=reverse ctermbg=2
endif
autocmd FileType tex setlocal makeprg=pdflatex\ --shell-escape\ '%' "Compile tex files with :make
"start searching as you type
set incsearch
"Map jj to escape
imap jj <Esc>
map <F2> :NERDTreeToggle<CR> "Toggle Nerd Tree on/off
"Highlight search strings
set hlsearch
" Set off the other paren
highlight MatchParen ctermbg=4
"Ignore case when searching
set ignorecase
"But remember case when capitals used
set smartcase
" Use english for spellchecking, but don't spellcheck by default
if version >= 700
set spl=en spell
set nospell
endif
" Cool tab completion stuff
" Is irritating and I hardly ever use it
" set wildmenu
" set wildmode=list:longest,full
"Show matching bracets when text indicator is over them
set showmatch
"How many tenths of a second to blink
"Does not seem to change anything
set mat=2
" Swap ; and : Convenient.
nnoremap ; :
nnoremap : ;
" Create Blank Newlines and stay in Normal mode
nnoremap <silent> zj o<Esc>
nnoremap <silent> zk O<Esc>
"Highlight current line
set cul
"adjust highlight color
hi CursorLine term=none cterm=none ctermbg=232
"Make cursor move as expected with wrapped lines:
inoremap <Down> <C-o>gj
inoremap <Up> <C-o>gk
"Map Shift+ J to previous buffer
map <S-J> :bp<CR>
"Map Shift + K to next buffer
map <S-k> :bn<CR>
"enable 256 color
set t_Co=256
" IMPORTANT: grep will sometimes skip displaying the file name if you
" search in a singe file. This will confuse Latex-Suite. Set your grep
" program to always generate a file-name.
set grepprg=grep\ -nH\ $*
" OPTIONAL: Starting with Vim 7, the filetype of empty .tex files defaults to
" 'plaintex' instead of 'tex', which results in vim-latex not being loaded.
" The following changes the default filetype back to 'tex':
let g:tex_flavor='latex'
"Do not want spell checking in my commented blocks
let g:tex_comment_nospell= 1
if &t_Co == 256
colorscheme xoria256
else
colorscheme peachpuff
endif
" Restore cursor position to where it was before
augroup JumpCursorOnEdit
au!
autocmd BufReadPost *
\ if expand("<afile>:p:h") !=? $TEMP |
\ if line("'\"") > 1 && line("'\"") <= line("$") |
\ let JumpCursorOnEdit_foo = line("'\"") |
\ let b:doopenfold = 1 |
\ if (foldlevel(JumpCursorOnEdit_foo) > foldlevel(JumpCursorOnEdit_foo - 1)) |
\ let JumpCursorOnEdit_foo = JumpCursorOnEdit_foo - 1 |
\ let b:doopenfold = 2 |
\ endif |
\ exe JumpCursorOnEdit_foo |
\ endif |
\ endif
" Need to postpone using "zv" until after reading the modelines.
autocmd BufWinEnter *
\ if exists("b:doopenfold") |
\ exe "normal zv" |
\ if(b:doopenfold > 1) |
\ exe "+".1 |
\ endif |
\ unlet b:doopenfold |
\ endif
augroup END
"for Syntastic
function! BufSel(pattern)
let bufcount = bufnr("$")
let currbufnr = 1
let nummatches = 0
let firstmatchingbufnr = 0
while currbufnr <= bufcount
if(bufexists(currbufnr))
let currbufname = bufname(currbufnr)
if(match(currbufname, a:pattern) > -1)
echo currbufnr . ": ". bufname(currbufnr)
let nummatches += 1
let firstmatchingbufnr = currbufnr
endif
endif
let currbufnr = currbufnr + 1
endwhile
if(nummatches == 1)
execute ":buffer ". firstmatchingbufnr
elseif(nummatches > 1)
let desiredbufnr = input("Enter buffer number: ")
if(strlen(desiredbufnr) != 0)
execute ":buffer ". desiredbufnr
endif
else
echo "No matching buffers"
endif
endfunction
"Bind the BufSel() function to a user-command
command! -nargs=1 Bs :call BufSel("<args>")
call pathogen#infect()
"For syntax checking (syntastic)
let g:syntastic_auto_loc_list=1
let g:syntastic_disabled_filetypes=['html']
let g:syntastic_enable_signs=1
function! Time()
return strftime("%c", getftime(bufname("%")))
endfunction
"For jsbeautify
map <F9> :call g:Jsbeautify()<CR>
"Check PHP Syntax
:autocmd FileType php noremap <C-L> :!php -l %<CR>
"Beautify PHP Syntax In 4 steps
"1) reduce all multiple blank lines to a single blank line
"2) change all blank lines to something unique like 'if(true)echo('it puts the lotion on the skin');'
"3) apply beautifier
"4) change unique quote back to new line
func! ParsePHP()
:exe 'g/^\_$\n\_^$/d'
:%s/^[\ \t]*\n/$x = 'It puts the lotion on the skin';\r/ge
:exe '%!php_beautifier --filters "ArrayNested() IndentStyles(style=k&r)"'
:%s/$x = 'It puts the lotion on the skin';//ge
endfunc
map <F8> :call ParsePHP()<CR>