00-03.kaliLinux-vi粘贴复制功能配置

KaliLinux在xShell的vim中默认是无法复制和粘贴的,需要做如下配置后才能使用:

 

方法一

进入vim命令行模式,输入:

:set mouse=c   #进入Command-line 模式

然后就可以正常粘贴复制了。

 

方法二

在root目录中新建一个名称为.vimrc的配置文件。

root@kali:~# vi .vimrc
-----------------------------------------------------------------------
" Vim config file.
 
 
" Global Settings: {{{
syntax on                           " highlight syntax
filetype plugin indent on           " auto detect file type
 
set nocompatible                    " out of Vi compatible mode
"set number                          " show line number
set numberwidth=3                   " minimal culumns for line numbers
set textwidth=0                     " do not wrap words (insert)
set nowrap                          " do not wrap words (view)
set showcmd                         " show (partial) command in status line
set ruler                           " line and column number of the cursor position
set wildmenu                        " enhanced command completion
set wildmode=list:longest,full      " command completion mode
set laststatus=2                    " always show the status line
set mouse=                         " use mouse in all mode
set foldenable                      " fold lines
set foldmethod=marker               " fold as marker 
set noerrorbells                    " do not use error bell
set novisualbell                    " do not use visual bell
set t_vb=                           " do not use terminal bell
 
set wildignore=.svn,.git,*.swp,*.bak,*~,*.o,*.a
set autowrite                       " auto save before commands like :next and :make
set cursorline
set hidden                          " enable multiple modified buffers
set history=1000                     " record recent used command history
set autoread                        " auto read file that has been changed on disk
set backspace=indent,eol,start      " backspace can delete everything
set completeopt=menuone,longest     " complete options (insert)
set pumheight=10                    " complete popup height
set scrolloff=5                     " minimal number of screen lines to keep beyond the cursor
set autoindent                      " automatically indent new line
set cinoptions=:0,l1,g0,t0,(0,(s    " C kind language indent options
set clipboard+=unnamed              " shared clipboard
set noexpandtab                     " do not use spaces instead of tabs
 
set tabstop=4                       " number of spaces in a tab
set softtabstop=4                   " insert and delete space of 
set shiftwidth=4                    " number of spaces for indent
set expandtab                       " expand tabs into spaces
set incsearch                       " incremental search
set hlsearch                        " highlight search match
set ignorecase                      " do case insensitive matching
set smartcase                       " do not ignore if search pattern has CAPS
set nobackup                        " do not create backup file
"set noswapfile                      " do not create swap file
set backupcopy=yes                  " overwrite the original file
 
set encoding=utf-8
set termencoding=utf-8
set fileencoding=utf-8
set fileencodings=gb2312,utf-8,gbk,gb18030
set fileformat=unix
 
set background=dark
"colorscheme SolarizedDark_modified 
"colorscheme wombat_modified
" gui settings
if has("gui_running")
    set guioptions-=T " no toolbar
    set guioptions-=r " no right-hand scrollbar
    set guioptions-=R " no right-hand vertically scrollbar
    set guioptions-=l " no left-hand scrollbar
    set guioptions-=L " no left-hand vertically scrollbar
    autocmd GUIEnter * simalt ~x " window width and height
    language messages zh_CN.utf-8 " use chinese messages if has
endif
 
" Restore the last quit position when open file.
autocmd BufReadPost *
    \ if line("'\"") > 0 && line("'\"") <= line("$") |
    \     exe "normal g'\"" |
    \ endif
"}}}
 
" Key Bindings: {{{
let mapleader = ","
let maplocalleader = "\\"
 
" map : -> 
map  :
 
" move between windows
nmap  h
nmap  j
nmap  k
nmap  l
 
" Don't use Ex mode, use Q for formatting
map Q gq
 
"make Y consistent with C and D
nnoremap Y y$
 
" toggle highlight trailing whitespace
nmap  l :set nolist!
 
" Ctrl-E to switch between 2 last buffers
nmap  :b#
 
" ,e to fast finding files. just type beginning of a name and hit TAB
nmap e :e **/
 
" Make shift-insert work like in Xterm
map  
map!  
 
" ,n to get the next location (compilation errors, grep etc)
nmap n :cn
nmap p :cp
 
" Ctrl-N to disable search match highlight
nmap   :silent noh
 
" center display after searching
nnoremap n   nzz
nnoremap N   Nzz
nnoremap *   *zz
nnoremap #   #zz
nnoremap g*  g*zz
nnoremap g#  g#z
"}}}
 
" mru
let MRU_Window_Height = 10
nmap r :MRU
 
" taglist
let g:Tlist_WinWidth = 25
let g:Tlist_Use_Right_Window = 0
let g:Tlist_Auto_Update = 1
let g:Tlist_Process_File_Always = 1
let g:Tlist_Exit_OnlyWindow = 1
let g:Tlist_Show_One_File = 1
let g:Tlist_Enable_Fold_Column = 0
let g:Tlist_Auto_Highlight_Tag = 1
let g:Tlist_GainFocus_On_ToggleOpen = 1
nmap t :TlistToggle
 
" nerdtree
let g:NERDTreeWinPos = "right"
let g:NERDTreeWinSize = 30
let g:NERDTreeShowLineNumbers = 1
let g:NERDTreeQuitOnOpen = 1
nmap f :NERDTreeToggle
nmap F :NERDTreeFind
 
"paste
vmap  "+y
nmap  "+p
set pastetoggle=
 
"C,C++ Java Compile and run by F5
map  :call CompileRunGcc()
func! CompileRunGcc()
    exec "w"
    if &filetype == 'c'
        exec "!g++ % -o %<"
        exec "! ./%<"
    elseif &filetype == 'cpp'
        exec "!g++ % -o %<"
        exec "! ./%<"
    elseif &filetype == 'java' 
        exec "!javac %" 
        exec "!java %<"
    elseif &filetype == 'sh'
        :!./%
    endif
endfunc
 
"C,C++ debug
map  :call Rungdb()
func! Rungdb()
    exec "w"
    exec "!g++ % -g -o %<"
    exec "!gdb ./%<"
endfunc

-----------------------------------------------------------
:wq
-----------------------------------------------------------
root@kali:~#
View Code

至此,用vim打开文件就具有粘贴和复制的功能,并且有高亮和至此,用vim打开文件就具有粘贴和复制的功能,并且有高亮和颜色了。

颜色了。

你可能感兴趣的:(00-03.kaliLinux-vi粘贴复制功能配置)