Neovim: How to enable yanking to system clipboard in Ubuntu
Yanking or copying to system clipboard can be enabled using the following commandset clipboard=unnamedplus
set clipboard=unnamedplus
vim-share-7.2.446.tgz
libiconv-1.14.tgz
gettext-lib-0.18.1.1.tgz
vim-7.2.446nb1.tgz
#: ls /tmp bootstrap.tar.gz vim-share-7.2.446.tgz libiconv-1.14.tgz gettext-lib-0.18.1.1.tgz vim-7.2.446nb1.tgz
#: tar -xvzf bootstrap.tar.gz -C /
#: echo 'export PATH=${PATH}:/usr/pkg/bin:/usr/pkg/sbin' >> ~/.profile
setconf CS_LIBPATH $(getconf CS_LIBPATH):/usr/pkg/lib
#: pkg_add -v /tmp/libiconv-1.14.tgz #: pkg_add -v /tmp/gettext-lib-0.18.1.1.tgz #: pkg_add -v /tmp/vim-share-7.2.446.tgz #: pkg_add -v /tmp/vim-7.2.446nb1.tgz
set backspace=indent,eol,start
#: export TERM=ansi #: vim
| Command | Action | Notes |
| Basic operations | ||
| :q | Quit VI | This will exit VI editor |
| :q! | Force quit | This will exit VI editor even if buffers are dirty |
| :w | Save current buffer | Save currently active buffer |
| :e <ENTER> | Reload current buffer from file | |
| :e /path/to/file | Load /path/to/file to a buffer | |
| General | ||
| :set nowrap | Don't wrap text | |
| :set number | Show line number | |
| :set nu | Show line number (short hand) | |
| :set nonumber | Hide line number | |
| :set nu! | Hide line number (short hand) | |
| Text Operations | ||
| v | Start Visual Mode(for copying) | |
| y | Yank/copy selected text | |
| yy | Copy line | |
| 2y | Copy 2 lines from the cursor | |
| p | Paste _after_ the current line | |
| P | Paste _before_ the current line | |
| x | Delete char under the cursor | |
| dw | Delete the word under the cursor | This will also delete the space after it |
| 3dw | Delete 3 words | This will also delete the space after it |
| dd | Delete line | Deletes the entire line |
| Navigation | ||
| 0 | Jump to beginning of line | |
| $ | Jump to end of line | |
| w | (count)Move to beginning of the word | |
| b | Move to the beginning of the word | |
| e | Move to the end of the word (punctuation considered part of the word) | |
| ge | Jump to previous word ending | |
| gE | Jump to previous word ending, ignore punctuation | |
| gg | Start of file | |
| G | End of file | |
| 21G | Go to line 22 | |
| Search and Replace | ||
| /{string}{ENTER} | Search for string | |
| :%s/foo/bar/g | Search for foo and replace with bar in the current buffer | |
| Merging | ||
| Note** run vimdiff file1 file2 | ||
| ]c | Jump to the next difference | |
| [c | Jump to the previous difference | |
| do | Copy line diff from _right_ buffer to the _left_ buffer | |
| dp | Copy line diff from _left_ buffer to the _right_ buffer | |
| Buffer operations | ||
| :bd | Delete current buffer | |
| :bnext | Move to next buffer | |
| :bprevious | Move to previous buffer | |
| :b <tab> | Tab select buffers | |
| :ls | List buffers (or :buffers or :files) | |
| :ls <CR> :bx | List buffers and then select buffer "x" | |
| Multiple Windows | ||
| C-w C-w | Move cursor to another window (cycle). Useful with NerdTree | |
:set guitablabel=%N/\ %t\ %MShow tab number.
Basics Hello world User input While loop If statement For loop Switch statement Read file using ifstream Write to a file using ofstr...