2013-07-08 4 views
3

내가 현재 가지고 내 .vimrc 어쨌든 VIM 서라운드의 키 매핑을 변경 하시겠습니까?

  • s

    내 파일을 저장하는 것이
  • d 비주얼 모드에서 강조되는 모든 텍스트를 삭제 있도록 설정
  • c 커서에 모든 행 (또는 그룹을 언급합니다 강조 표시된 행의 수)

이렇게 분명히 내가 서라운드의 기본 명령을 사용할 수 없습니다. 서라운드의 기본 설정을 바꾸기 위해 .vimrc에서 직접 명령을 내릴 수있는 방법이 있습니까? 여기

은 내 .vimrc

set nocompatible 

filetype off " required! 

set rtp+=~/.vim/bundle/vundle 
call vundle#rc() 

" let Vundle manage Vundle 
" required! 
Bundle 'gmarik/vundle' 

" My Bundles here: 
" 
" original repos on github 
Bundle 'tpope/vim-fugitive' 
Bundle 'jistr/vim-nerdtree-tabs' 
" Bundle 'tpope/vim-haml' 
Bundle 'ap/vim-css-color' 
Bundle 'Lokaltog/vim-easymotion' 
Bundle 'rstacruz/sparkup', {'rtp': 'vim/'} 
Bundle "pangloss/vim-javascript" 
" vim-scripts repos 
Bundle 'surround.vim' 
Bundle 'delimitMate.vim' 
Bundle 'hail2u/vim-css3-syntax' 
" Bundle 'AutoComplPop' 
" Bundle 'ervandew/supertab' 
Bundle 'snipMate' 
Bundle 'tComment' 
" Bundle 'mru.vim' 
Bundle 'scrooloose/nerdtree' 
Bundle 'matchit.zip' 
Bundle 'Vimball' 
Bundle 'ScrollColors' 
Bundle 'L9' 
Bundle 'FuzzyFinder' 
" non github repos 
Bundle 'git://git.wincent.com/command-t.git' 

" Shortcuts 

" Basic pair completion 
" inoremap {  {}<Left> 
" inoremap {<CR> {<CR>}<Esc>O 
" inoremap {{  { 
" inoremap {}  {} 

" inoremap :  :;<Left> 
"inoremap :<CR> :; 
"noremap ::  :;<Left> 
"inoremap :;  :; 

" Create new buffers vertically or horizontally 
nnoremap ,v <C-w>v 
nnoremap ,h <C-w>s 

" Toggle between the buffers 
nnoremap ,, <C-w>w 

" Increase or decrease buffer size 
noremap <C-Up> <C-W>+ 
noremap <C-Down> <C-W>- 
noremap <C-Left> <C-W>> 
noremap <C-Right> <C-W>< 


nmap gf <S-g> 
nmap f :FufFile <CR> 
vmap c gc 
nmap c gcc 
nmap tt :tabnew <CR> 
nmap tc :tabclose <CR> 
nmap ml :MRU <CR> 
nmap ,n :NERDTree <CR>; 
nmap s :w! <CR> 
nmap q :q! <CR> 
syntax on 
set mouse=a "enables mouse 

" map <F2> :NERDTreeToggle<CR>; 
map <F2> :NERDTreeTabsToggle<CR>; 

" Selecting different color schemes 
map <silent> ,3 :NEXTCOLOR<cr> 
map <silent> ,2 :PREVCOLOR<cr> 
map <silent> ,1 :SCROLL<cr> 

" Directory Set up 

set backup "backs up files 
set backupdir=$HOME/.vimbackup 
set directory=$HOME/.vimswap 
set viewdir=$HOME/.vimviews 
" 
" silent execute '!mkdir -p $HOME/.vimbackup' 
" silent execute '!mkdir -p $HOME/.vimswap' 
" silent execute '!mkdir -p $HOME/.vimviews' 

" au BufWinLeave * silent! mkview "makes vim save view state 
" au BufWinEnter * silent! loadview "makes vim load view state 

" Appearance 

set columns=60 

set guifont=Monaco\ 11 

if has("autocmd") 
    au InsertEnter * silent execute "!gconftool-2 --type string --set /apps/gnome-terminal/profiles/Default/cursor_shape ibeam" 
    au InsertLeave * silent execute "!gconftool-2 --type string --set /apps/gnome-terminal/profiles/Default/cursor_shape block" 
    au VimLeave * silent execute "!gconftool-2 --type string --set /apps/gnome-terminal/profiles/Default/cursor_shape ibeam" 
endif 

" set guicursor=n-v-c:block-Cursor 
" set guicursor+=i:ver100-iCursor 
" set guicursor+=n-v-c:blinkon0 
" set guicursor+=i:blinkwait10 

if has("gui_running") 
    set guioptions=aiA " Disable toolbar, menu bar, scroll bars 
    colorscheme jellybeans 
else 
    colorscheme desert256 
endif " has("gui_running") 

set t_Co=256 
set tabpagemax=10 "show only 10 tabs 
set background=dark 

set number 

set scrolloff=3 "minimum lines to keep above/below cursor 
set foldenable "auto fold code 
set foldmethod=manual 

" Behaviour 
" set nowrap "wrap long lines 
set linebreak 
:filetype plugin indent on " lets filetype plugins be used 

" Treat SCSS files as CSS files 
" au BufRead,BufNewFile *.scss set filetype=css 

" Close VIM even if NERDTree is the last buffer 
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTreeType") && b:NERDTreeType == "primary") | q | endif 

" after appending closing delimiter, it indents 
let delimitMate_expand_cr=1 

" if bufwinnr(1) 
" map <kPlus><C-W>+ 
" map <kMinus><C-W>- 
" map <kDivide><c-w>< 
" map <kMultiply><c-w>> 
" endif 

set autoindent 
set smartindent         
set tabstop=2 
set shiftwidth=2 
set smarttab 
set expandtab 
set softtabstop=2 
set spell 

set showmatch "shows matching parens, brackets 

set winminheight=0 

set go-=T "eliminates tool bar in gVim 
set go-=m "eliminates menu bar in gVim 
set go-=r "eliminates right scroll bar 
set lines=50 "50 lines of text instead of 24 

set backspace=2 "makes backspace work like normally it does 
:fixdel 

set vb t_vb= "prevents vim from beeping when command is bad. instead it flashes screen.    

set ruler "shows statusline, displays curor position 

set incsearch "vim searches text as you enter it 
" set hlsearch "hilights searched items 
set ignorecase "case insensitive search 
set smartcase "case sensetive when using captials 
set wildmenu "shows list instead of completing 
set wildmode=list:longest,full "command <TAB> completeiton, lists matches, 
set virtualedit=all "lets cursor freely roam anywhere like in command mode 
+3

'sdc'와 같은 기본 연산자는 아주 좋은 아이디어는 아닙니다. ''을 암시 적으로', 3'과 친구들과 같이 사용하거나': help mapleader'를 읽은 후에 명시 적으로 사용해야합니다. – romainl

답변

5

당신이 다음 블록 알 수 있습니다 플러그인 서라운드의 소스를 살펴 경우 : 당신이 볼 수 있듯이

if !exists("g:surround_no_mappings") || ! g:surround_no_mappings 
    nmap ds <Plug>Dsurround 
    nmap cs <Plug>Csurround 
    nmap ys <Plug>Ysurround 
    nmap yS <Plug>YSurround 
    nmap yss <Plug>Yssurround 
    nmap ySs <Plug>YSsurround 
    nmap ySS <Plug>YSsurround 
    xmap S <Plug>VSurround 
    xmap gS <Plug>VgSurround 
    if !exists("g:surround_no_insert_mappings") || ! g:surround_no_insert_mappings 
    if !hasmapto("<Plug>Isurround","i") && "" == mapcheck("<C-S>","i") 
     imap <C-S> <Plug>Isurround 
    endif 
    imap  <C-G>s <Plug>Isurround 
    imap  <C-G>S <Plug>ISurround 
    endif 
endif 

하면, 당신은 방지 할 수 있습니다 추가하여 아무것도 매핑에서 플러그인 당신의 .vimrc에 다음

let g:surround_no_mappings = 1 

그런 다음이 블록에 정의 된 함수에 대한 고유 한 매핑을 추가 할 수 있습니다.

+0

감사합니다. Randy. 그래서 나는'let g : surround_no_mappings = 1'을 넣었고'Csurround' 명령을위한 자체 맵핑을 추가하고 싶다면'nmap fcs Csurround'를 내'.vimrc'에 넣는 것이 트릭이 될까요? –

+0

그게 좋은 생각입니다. 지금 당장은 100 % 확신 할 수는 없지만 일반적으로 어떻게 작동해야하는지는 확실합니다. –

+0

네, 효과가있었습니다. 감사. –

관련 문제