[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]

Vim thread

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: 10
Thread images: 2

File: 1455880290792.gif (821KB, 688x448px) Image search: [Google]
1455880290792.gif
821KB, 688x448px
Just learnt Vim this morning and it's great!

I was just wondering how you guys do these certain things:

1. Select multiple lines and increase/decrease indent, and edit? See gif
I know I have to use v but how can I get multiple cursors?
2. How can you edit tab length?
3. Can I set shortcuts that will compile and run the current file within a new terminal window?
4. I want to place a ";" at the end automatically after I press "{". I am using delimiter plugin. Wat do?
5. Any plugins that remembers variable name so I can call them from pressing tab?
>>
>>58548284
If it only took you a morning I'd spend the afternoon learning emacs. Emacs is better than Vim IMHO
>>
>>58548299
Vimtutor is only 7 lessons, takes less than an hour though. But I have heard Emacs is terribly hard
>>
https://www.youtube.com/watch?v=aHm36-na4-4 have fun op
>>
>>58548284
Fuck it, I'm bored

>1. Select multiple lines and increase/decrease indent, and edit? See gif
Forget about multiple cursors. Use the superior built-in Vim way
Use ctrl-v to block select then press > to indent or A to prepend or I to append text.
Usually you can
shift-v
to select multiple lines and press = to auto-indent or press = and a motion like =} to auto-indent to the end of the paragraph

>2. How can you edit tab length?
Never edit tab length (unless you are really sure you want it)
Use
:set expandtab shiftwidth=4 softtabstop=4
to expand tabs to spaces and use 4 spaces for indenting.
Use the built-in help to learn more, eg
:help 'shiftwidth'


>3. Can I set shortcuts that will compile and run the current file within a new terminal window?
Yes, but you are a scrub. Lurk more.
Still here is a start. Suppose you have a c file open in vim. Compile with
:make %:r

% expands to the file name you are on, %:r to the file name without extension. Use
:help %:r
to learn more

To run the compiled file
:!./%:r

The ! allows Vim to call external programs

To make these by pressing \m and \r stick these in .vimrc
nnoremap <leader>m :make %:r<CR>
nnoremap <leader>r :!./%:r<CR>



>4. I want to place a ";" at the end automatically after I press "{". I am using delimiter plugin. Wat do?
Stop using plugins. Simple as that.

>5. Any plugins that remembers variable name so I can call them from pressing tab?
Don't use plugins.

Seriously, don't use plugins, read this and AVOID shitty plugins
>https://www.vi-improved.org/loathing/

Also avoid /r/vim - Worst advice on vim on the web by far
Seriously, don't go to /r/vim. It's really really bad.

Also always keep in mind:
VIM IS NOT AN IDE


Welcome and have fun
>>
>>58548284
>1. Select multiple lines and increase/decrease indent, and edit? See gif
To adjust the indent on three lines:
Put the cursor anywhere in the first line.
Press V then jj to visually select the three lines.
Press > to indent (shift text one 'shiftwidth' to the right), or press < to shift left.
Press . to repeat the indent, or u to undo if you have shifted too far.
Type gv if you want to reselect the lines (not needed).
Alternatively, if you know that you want to adjust three lines, you can simply:
Type 3>> to shift right or 3<< to shift left.
Or:
Type >2j to shift right or <2j to shift left.
>>
File: 1470256637176.jpg (72KB, 540x562px) Image search: [Google]
1470256637176.jpg
72KB, 540x562px
>first programing class at university today
>instructor gives us the options of notepad++, emacs or vim

is now at the beginning of my programing phase a god time to start learning vim, or should that come later after i ah e experience working with text editors and development environments?
>>
>>58549266
Although I use Vim I think it would be better if you stick with notepad++, Vim and first programming class together may be too much for you

Although I programmed for the first time in university, on vi (not vim) on an old unix terminal with pascal, kek

The terminal didn't even have arrow keys
>>
>>58549324
cool thanks for the advice
>>
Damn dude, most people spend several years wasting time configuring it and memorizing retarded hotkeys and you did it in a morning
Thread posts: 10
Thread images: 2


[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.