zoukankan      html  css  js  c++  java
  • vim hehe

    
    

    复制粘贴

    Hard Way

    You can call vim functions in command mode.
    The command below will write yanked lines to /tmp/myFile.

    
    
    :call writefile(split(getreg('"'), '
    '), '/tmp/myFile')
    
    
    

    Note: Yanked lines are in unnamed register ("", type :help registers for help).

    
    
    
    

    Easy Way

    Why not do it visually. Just 3 basic commands everyone can understand:

    • :tabe -- open new tab
    • p -- paste to buffer
    • :w /tmp/myFile.txt -- save file




    I had issue because my vim was not supporting clipboard: vim
    --version | grep clip -clipboard +insert_expand +path_extra +user_commands +emacs_tags -mouseshape +startuptime -xterm_clipboard I installed vim-gnome (which support clipboard) and then checked again: vim --version | grep clipboard +clipboard +insert_expand +path_extra +user_commands +emacs_tags +mouseshape +startuptime +xterm_clipboard Now I am able to copy and paste using "+y and "+p respectively. As suggested, I also installed vim-gtk and put set clipboard=unnamedplus in my .vimrc and everything works fine On Mac OSX copy selected part: visually select text(type v or V in normal mode) and type :w !pbcopy copy the whole file :%w !pbcopy paste from the clipboard :r !pbpaste On most Linux Distros, you can substitute: pbcopy above with xclip -i -sel c or xsel -i -b pbpaste using xclip -o -sel -c or xsel -o -b -- Note: In case neither of these tools (xsel and xclip) are preinstalled on your distro, you can probably find them in the repos


    sudo apt-get install vim vim-scripts vim-gtk vim-gnome


    开大文件

    First, try loading vim with no plugins or vimrc:

    vim -u NONE gargantuan.txt
    

    If this is substantially faster, then you probably have syntax highlighting, folding, plugins, or something else going on that's taking up most of the time. Try turning stuff off in your vimrc (and disabling your plugins) until you find the culprit.

    Also make sure to set ft= syn= and syntax off.

    If this doesn't help, it's probably the case that you have very long lines that are causing the problem. Try set nowrap to turn line wrapping off.

  • 相关阅读:
    无线放大器扩展后,无线网络上不了网的问题解决
    可变现净值
    三大PLM厂商
    CF #589 (Div. 2) D. Complete Tripartite 构造
    CF #589 (Div. 2)C. Primes and Multiplication 快速幂+质因数
    BZOJ 4025 二分图 LCT维护最大生成树
    BZOJ3791 作业 动态规划
    luogu 2943 [USACO09MAR]清理Cleaning Up 动态规划
    luogu 4909 [Usaco2006 Mar]Ski Lift 缆车支柱 动态规划
    SP1716 GSS3(线段树+矩阵乘法)
  • 原文地址:https://www.cnblogs.com/Searchor/p/11487071.html
Copyright © 2011-2022 走看看