ubuntu默认vim是没有+寄存器的,这个+寄存器代表系统剪切板。没有这个,一切命令都是浮云,老子跟着网上的文章搞了半天,发现问题就在这。
如果你输入命令:reg 发现没有+这个寄存器,就安装吧
参考这篇文章
http://blog.sina.com.cn/s/blog_76550fd701019rol.html
对于非GUI版本的vim,剪切板是不可用的,解决方案很简单,安装一下就是了:
sudo apt-get installgvim
ubuntu 和mint默认安装的vim是不支持系统剪切、粘贴版的,需要执行以下安装:
sudo apt-get install vim-gnome
百度有人输入这个命令也解决了,可能根据自己的系统环境有所区别吧,也弄过来供参考。
apt-get install vim-common-gui
安装后,就有“+”寄存器了
--- Registers ---
"" 445^J
"0 11^J11^J11
"1 445^J
"2 445123^J
"3 445123^J
"4 123^J
"5 11^J
"6 43333^J
"7 12333^J
"8 12333^J
"9 1233. Making GUI Selections^I^I^I^I*gui-selections*^J
"q ^[
"- s
"+ 123^J445123^J445123^J445
". 123^@445
"% 2
"/ typedef
然后开始学习网上到处copy的文档吧: http://www.2cto.com/os/201308/233924.html
简单用法是输入“v”,然后按上下键选择代码
然后输入 “+y 三个字符
这时候,你输入:reg看,”+寄存器已经有数据了,这样就可以ctrl+v复制到博客上,例如我复制了这段代码
struct mm_struct {
struct vm_area_struct * mmap; /* list of VMAs */
struct rb_root mm_rb;
struct vm_area_struct * mmap_cache; /* last find_vma result */
#ifdef CONFIG_MMU
unsigned long (*get_unmapped_area) (struct file *filp,
unsigned long addr, unsigned long len,
unsigned long pgoff, unsigned long flags);
void (*unmap_area) (struct mm_struct *mm, unsigned long addr);
#endif
unsigned long mmap_base; /* base of mmap area */
unsigned long task_size; /* size of task vm space */
unsigned long cached_hole_size; /* if non-zero, the largest hole below free_area_cache */
unsigned long free_area_cache; /* first hole of size cached_hole_size or larger */
pgd_t * pgd;
atomic_t mm_users; /* How many users with user space? */
atomic_t mm_count; /* How many references to "struct mm_struct" (users count as 1) */
int map_count; /* number of VMAs */
struct rw_semaphore mmap_sem;
spinlock_t page_table_lock; /* Protects page tables and some counters */
struct list_head mmlist; /* List of maybe swapped mm's. These are globally strung
* together off init_mm.mmlist, and are protected
* by mmlist_lock
*/
unsigned long hiwater_rss; /* High-watermark of RSS usage */
unsigned long hiwater_vm; /* High-water virtual memory usage */
unsigned long total_vm, locked_vm, shared_vm, exec_vm;
unsigned long stack_vm, reserved_vm, def_flags, nr_ptes;
unsigned long start_code, end_code, start_data, end_data;
unsigned long start_brk, brk, start_stack;
unsigned long arg_start, arg_end, env_start, env_end;
unsigned long saved_auxv[AT_VECTOR_SIZE]; /* for /proc/PID/auxv */
/*
* Special counters, in some configurations protected by the
* page_table_lock, in other configurations by being atomic.
*/
struct mm_rss_stat rss_stat;
struct linux_binfmt *binfmt;
cpumask_t cpu_vm_mask;
/* Architecture-specific MM context */
mm_context_t context;
/* Swap token stuff */
/*
* Last value of global fault stamp as seen by this process.
* In other words, this value gives an indication of how long
* it has been since this task got the token.
* Look at mm/thrash.c
*/
unsigned int faultstamp;
unsigned int token_priority;
unsigned int last_interval;
unsigned long flags; /* Must use atomic bitops to access the bits */
struct core_state *core_state; /* coredumping support */
#ifdef CONFIG_AIO
spinlock_t ioctx_lock;
struct hlist_head ioctx_list;
#endif
#ifdef CONFIG_MM_OWNER
/*
* "owner" points to a task that is regarded as the canonical
* user/owner of this mm. All of the following must be true in
* order for it to be changed:
*
* current == mm->owner
* current->mm != mm
* new_owner->mm == mm
* new_owner->alloc_lock is held
*/
struct task_struct *owner;
#endif
如果在vim上复制,“ 这个符号是必须输入的。粘贴的时候输入“+p三个字符