[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

> Be me > Enjoying learning Vim, really seeing it's

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 40
Thread images: 3

File: vim-editor_logo-300x300-300x255.png (22KB, 300x255px) Image search: [Google]
vim-editor_logo-300x300-300x255.png
22KB, 300x255px
> Be me
> Enjoying learning Vim, really seeing it's utility at this point
> Find out you can't delete (at least rapidly) text without copying it
> You also can't replace text with what you have on your clipboard
Why is Vim like this. This is one of the things I do the most while programming, replace a word with something I've copied. There should be a letter reserved to this, or make "x" behave that you could delete a word by typing "xe".
How do you guys cope with this?
>>
>>58988814
>> Find out you can't delete (at least rapidly) text without copying it
You can.
>> You also can't replace text with what you have on your clipboard
You can.

>the state of /g/
>>
>>58988848
I meant with 2 or less letters, rapidly, as I do this constantly.
The first one I know you could do something like:
"_d
And the second:
vep
But now you have the word you replaced on your clipboard.
Is there a faster way to do this? I'm just trying to learn, I know I'm a noob.
>>
>learning vim
Thats your problem
Use nano for config files and emacs for everything else
You are welcome
>>
>>58988890
Learn into noremap.
>>
>>58988890
you could bind those to something
>>
Not a vim expert but I think your problem can be solved with registers. And perhaps macros.
I understand registers allow to save a sequence of keystrokes under a key, and you could use a macro to wrap the sequence in another sequence, so you could probably "yank" your latest copy into a register, and use a macro to get that sequence into the buffer.
God I need to get better at Vim.
>>
>>58989142
Actually, a quick web search for "vim registers" has the answer. use "r to refer to register r, use "ry to yank text to register r, use "rp to paste the contents of register r onto the buffer
your welcome
>>
>>58988814
I remember having a similar frustration when I was learning, but I just grew used to it. You're still used to the way you move around and edit a text file with standard keybindings, but it turns out there's more than one way to do it.
Eventually the vim way will start feeling natural and it will be weird when a different text editor doesn't copy the stuff you delete.
>>
>>58988814
I use atom
>>
>>58988814
Hello OP. I have your solution:

First, shove this in your vimrc
" map t in normal mode to "cut", since t is rather useless in normal mode
nnoremap t "_d


Then install this https://www.google.fi/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&uact=8&url=https%3A%2F%2Fgithub.com%2Fvim-scripts%2FReplaceWithRegister&usg=AFQjCNESdJLB2DiB8J3Cm60bh1ySn2CpLg

It lets you type "gr" in normal mode, and then press some motion or text object, and that range of text will get replaced by your clipboard contents without going into any register
>>
>>58989290
>
since t is rather useless in normal mode

>
>>
>>58989317
What is it useful for? I never want to go "to a character before a character", it's only useful if you want to use said character as an exclusive boundary in operator pending mode.
>>
I've not had this issue. My vim clip board is independent of my system clip board.

I delete some text and can copy it with p, or I can cntrl shift v to copy paste what I had from cntrl c, or use highlight & middle click.
>>
>>58988814

You can use registers. For example, to put a word in register "q", go to the start of the word and use:

"qye

Then move the cursor to the start of a different word, which you can then replace with what's in register "q" by doing this:

ce^Rq

where ^R means CTRL+R.

Once you get this working, then you can add a map to .vimrc to do it with fewer keystrokes.
>>
Some cool/practical vim tips here.
http://hackaday.com/2016/08/08/editor-wars-the-revenge-of-vim/
>>
>no clipboard support by default
>still the best editor

It's like other editors aren't even trying.
>>
:help registers
>cool
:help register
>aww man.
>>
>>58989377
>editing C file
>int foo = bar(1, bla);
>want to change foo to the constant BAZ
>can't just cW because space
>ct;BAZ
>it werks

>same thing, but now I want to switch from a call to bar(...) to a call to bleh(void)
>ct)bleh(
>>
>>58988814

It's not 1980 anymore, grandpa.
>>
>>58989451
put cursor over word.
type caw (change a word)
>word is deleted and vim switches to insert mode.
type new word and esc key.
move cursor to other word.
press . (period)
>last edit is repeated.
c4w = change 4 words
ci( = change inside ( )
ci{
>>
>>58988955
Kys
>>
>>58989765
Did you read my posts? I specifically said it's useless in normal mode, not operator pending mode. nnoremap doesn't map operator mode so your ct's work just fine.
>>
>>58989803
Then why are you still using a keyboard?
>>
vim is obsolete. Programming is more about software reuse than coding so saving time typing is very minimal. Programs like Visual studio are much better because they have vastly better coding management capabilities
>>
>>58989953
I am not. Voice typing and using 3D touch interface on my iPad Pro to hit the post button.
>>
>>58988814
OP, I believe you need this https://github.com/svermeulen/vim-easyclip

Among other functionality it basically rebinds d motion to copy instead of cutting. Cutting rebinds to m button afterwards.

Anyway, vim is shit, but you have to learn it in order to use god-tier combination - evil mode with emacs. Also vim is useful on bare bone systems and foreign servers - vi or vi.tiny installed almost everywhere and it much more convenient than nano or whatever shit other people use.
>>
>>58992098
>rebinds d motion to copy instead of cutting
>rebinds d motion to delete instead of cutting
Fixed.
>>
>tfw sublime text has better C suggestions and documentation plugins than vim
why would I use this piece of shit now?
>>
I have mapleader bound to ",", so permanent deletion of a line for example is ",dd", deletion of a word is ",dw".
>>
>>58992027
There is nothing that can replace keyboards, voice is not good because it would need to be adjusted to the individual accent and language. You would need an amazing self learning AI which will learn from you how you pronounce staff.
>>
>>58988814
ever heard of the registers and the blackhole register aka _ ?
kids these days

http://vim.wikia.com/wiki/Replace_a_word_with_yanked_text

can't even use a fucking wiki
>>
>>58992934
>complains about kids these days
>links to a stupid wiki instead of the help files
>>
File: satania.png (208KB, 325x898px) Image search: [Google]
satania.png
208KB, 325x898px
I've recently switched from using tabs to spaces in Vim. I figured out the basic stuff like tabstop, shiftwidth, softtabstop, and expandtab, but I can't figure out how to make Vim treat a group of spaces as a tab while navigating the file. Whenever I want to move through them, I have to go through each space.

How do I make it so it goes through groups of spaces like they're tabs?
>>
File: sorata no baka.jpg (174KB, 1278x756px) Image search: [Google]
sorata no baka.jpg
174KB, 1278x756px
>>58988814
> Enjoying learning Vim
you are both autistic and masochistic
>>
>>58988814
> Find out you can't delete (at least rapidly) text without copying it

The unnamed buffed will have your most recent delete / yank / whatever. If you paste from buffer 0 you will have the most recent yank.
>>
>>58995690
You're probably doing it wrong if you care how your white space is formatted. Try indent expressions (filetype indent on), use I (capital i) and A for insertions, and move forward/backward with w/b instead of l/h.
>>
>>58996565
I wanted to do that without leaving insert mode, but I guess there's no escaping the normal mode for that.
>>
>>58988814
Take the CMU Vim intro course, and do all the recommended reading including that stackexchange post 'Your problem with Vim is you don't grok vi " https://www.cs.cmu.edu/~15131/f16/topics/vim/ esp pay attention to 'Vim as a language'

Also I use emacs, because down with insertion mode.
>>
>>58996793
Basically vi vs. emacs, in the modern context, breaks down to whether you hate incessant mode shifting and no UI or fuckawful key bindings more. You may actually want to try emacs.

Also if you're hitting Esc every time you want to leave insert mode, try ctrl-c or ctrl-[ instead.
Thread posts: 40
Thread images: 3


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.