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= " minimal culumns for line numbers
set textwidth= " 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= " 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= " 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= " complete popup height
set scrolloff= " minimal number of screen lines to keep beyond the cursor
set autoindent " automatically indent new line
set cinoptions=:,l1,g0,t0,(,(s " C kind language indent options
set clipboard+=unnamed " shared clipboard
set noexpandtab " do not use spaces instead of tabs set tabstop= " number of spaces in a tab
set softtabstop= " insert and delete space of <tab>
set shiftwidth= " 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-
set termencoding=utf-
set fileencoding=utf-
set fileencodings=gb2312,utf-,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- " use chinese messages if has
endif " Restore the last quit position when open file.
autocmd BufReadPost *
\ if line("'\"") > && line("'\"") <= line("$") |
\ exe "normal g'\"" |
\ endif
"}}} " Key Bindings: {{{
let mapleader = ","
let maplocalleader = "\\" " map : -> <space>
map <Space> : " move between windows
nmap <C-h> <C-w>h
nmap <C-j> <C-w>j
nmap <C-k> <C-w>k
nmap <C-l> <C-w>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 <silent> <leader>l :set nolist!<CR> " Ctrl-E to switch between 2 last buffers
nmap <C-E> :b#<CR> " ,e to fast finding files. just type beginning of a name and hit TAB
nmap <leader>e :e **/ " Make shift-insert work like in Xterm
map <S-Insert> <MiddleMouse>
map! <S-Insert> <MiddleMouse> " ,n to get the next location (compilation errors, grep etc)
nmap <leader>n :cn<CR>
nmap <leader>p :cp<CR> " Ctrl-N to disable search match highlight
nmap <silent> <C-N> :silent noh<CR> " 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 =
nmap <Leader>r :MRU<cr> " taglist
let g:Tlist_WinWidth =
let g:Tlist_Use_Right_Window =
let g:Tlist_Auto_Update =
let g:Tlist_Process_File_Always =
let g:Tlist_Exit_OnlyWindow =
let g:Tlist_Show_One_File =
let g:Tlist_Enable_Fold_Column =
let g:Tlist_Auto_Highlight_Tag =
let g:Tlist_GainFocus_On_ToggleOpen =
nmap <Leader>t :TlistToggle<cr> " nerdtree
let g:NERDTreeWinPos = "right"
let g:NERDTreeWinSize =
let g:NERDTreeShowLineNumbers =
let g:NERDTreeQuitOnOpen =
nmap <Leader>f :NERDTreeToggle<CR>
nmap <Leader>F :NERDTreeFind<CR> "paste
vmap <C-c> "+y
nmap <C-v> "+p
set pastetoggle=<F12> "C,C++ Java Compile and run by F5
map <F5> :call CompileRunGcc()<CR>
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 <F8> :call Rungdb()<CR>
func! Rungdb()
exec "w"
exec "!g++ % -g -o %<"
exec "!gdb ./%<"
endfunc -----------------------------------------------------------
:wq
-----------------------------------------------------------
root@kali:~#

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

颜色了。

00-03.kaliLinux-vi粘贴复制功能配置的更多相关文章

  1. vi、vim 配置上下左右方向键和删除键

    vi.vim 配置上下左右方向键和删除键 " An example for a vimrc file. " " Maintainer: Bram Moolenaar &l ...

  2. linux vi粘贴格式易错乱

    对于一些冗长的代码完全可以粘贴的时候,vi粘贴所有格式全部错乱,完全无法阅读. 解决办法:esc进入命令行模式后,输入 :set paste,然后再i进入粘贴编辑模式,即可正常复制并保留原有格式-

  3. Redis Exception: Exceeded timeout of 00:00:03

    Redis Exception: Exceeded timeout of 00:00:03 居然是 重启了网管, 把网络禁用重启就好了. 服 最终更新: 原来是架构湿      设置为每分钟只能读取6 ...

  4. vi编辑器常用配置

    在终端下使用vim进行编辑时,默认情况下,编辑的界面上是没有显示行号.语法高亮度显示.智能缩进等功能的.为了更好的在vim下进行工作,需要手动设置一个配置文件:.vimrc. 在启动vim时,当前用户 ...

  5. 防止vi粘贴时自动添加缩进的方法

    使用Xshell连接Linux服务器,使用vi打开文件进行粘贴时,会自动在行首添加很多空格,导致格式错乱.可以用如下方法剞劂 在拷贝前输入:set paste (这样的话,vim就不会启动自动缩进,而 ...

  6. vi粘贴代码后格式混乱的问题

    最近在远程终端使用vi发现从其他地方复制代码的后,粘贴到vi里面出现格式变乱的问题. 主要是因为终端通常无法区分输入是来自用户输入还是来自粘贴,所以终端也不能通知 vim 输入来自何处.在 vim 里 ...

  7. Vim 的粘贴复制功能

    Vim作为最好用的文本编辑器之一,使用vim来编文档,写代码实在是很惬意的事情.每当学会了vim的一个新功能,就会很大地提高工作效率.有人使用vim几十年,还没有完全掌握vim的功能,这也说明了vim ...

  8. 禁止UITextField 使用粘贴复制功能

    在开发中有时候会遇到这样的需求,就是一个文本框里面的内容不允许用户复制,或者不允许用户将其它地方复制的内容粘贴进来,本文交给你怎么实现禁止 UITextField 的粘贴.复制. 在 UITextFi ...

  9. Hibernate框架笔记03表操作多对多配置

    目录 1. 数据库表与表之间的关系 1.1 一对多关系 1.2 多对多关系 1.3 一对一关系[了解] 2. Hibernate的一对多关联映射 2.1 创建一个项目,引入相关jar包 2.2. 创建 ...

随机推荐

  1. python Lambda, filter, reduce and map

    1. lambda The lambda operator or lambda function is a way to create small anonymous functions , i.e. ...

  2. Iterator模式C++实现

    原文链接 #include <iostream> using namespace std; typedef int DATA; class Iterator; // 容器的抽象基类 cla ...

  3. poj3687拓扑排序

    Labeling Balls Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 14749   Accepted: 4325 D ...

  4. 决策树purity/基尼系数/信息增益 Decision Trees

    目录 决策树简单描述 衡量purity的三种方法 Gini Coefficient Entropy熵 决策树简单描述 决策树的样子大概是这个样子的: 选择一个特征作为根节点,把这个特征划分成两个孩子节 ...

  5. 干货 | Kafka 内核知识梳理,附思维导图

    前面我们已经分享过几篇Kafka的文章,最近简单梳理了下Kafka内核相关的知识,涵盖了Kafka架构总结,副本机制,控制器,高水位机制,日志或消息存储,消息发送与消费机制等方面知识.文末含对应的Ka ...

  6. ios时间显示NaN

    问题是当时js里时间是这种格式的 2016-09-07 16:37:50 用var time = obj.replace(/\-/g, "/");将格式改成 2016/09/07 ...

  7. COLA的扩展性使用和源码研究

    cola扩展点使用和设计初探 封装变化,可灵活应对程序的需求变化. 扩展点使用 步骤: 定义扩展点接口,类型可以是校验器,转换器,实体: 必须以ExtPt结尾,表示一个扩展点. 比如,我定义一个云枢的 ...

  8. 4.Linux的目录结构

    Linux的目录结构 (1)"/"目录 Linux文件系统的入口,也是出于最高一级的目录 (2)"/bin" 基础系统所需要的那些命令位于此目录.也是最小系统所 ...

  9. (五)Ajax修改购物车单品数量

    需要gson-2.2.4.jar BookServlet.java package com.aff.bookstore.servlet; import java.io.IOException; imp ...

  10. StringBuffer & StringBuilder

    java.lang.StringBuffer: ①代表可变的字符序列,可以对字符串内容进行增删.                       ②很多方法与String相同,但StingBuffer是可 ...