[a / b / c / d / e / f / g / gif / h / hr / k / m / o / p / s / t / u / v / vg / vm / vmg / vr / vrpg / vst / w / wg] [i / ic] [r9k / s4s / vip] [cm / hm / lgbt / y] [3 / aco / adv / an / bant / biz / cgl / ck / co / diy / fa / fit / gd / hc / his / int / jp / lit / mlp / mu / n / news / out / po / pol / pw / qst / sci / soc / sp / tg / toy / trv / tv / vp / vt / wsg / wsr / x / xs] [Settings] [Search] [Mobile] [Home]
Board
Settings Mobile Home
/g/ - Technology


Thread archived.
You cannot reply anymore.


[Advertise on 4chan]


File: 1680747867294.png (290 KB, 848x480)
290 KB PNG
>Vim is a text editor for Unix that comes with Linux, BSD, and macOS. It is known to be fast and powerful, partly because it is a small program that can run in a terminal (although it has a graphical interface)
>It is mainly because it can be managed entirely without menus or a mouse with a keyboard

>resources
https://www.vim.org/ (official website)
https://www.vim.org/docs.php (official documentation)
https://vimdoc.sourceforge.net/vimum.html (or you can just type vimtutor in your terminal)

>further reading
http://www.oualline.com/vim-cook.html (Vim Cookbook by Steve Oualline)
https://www.moolenaar.net/habits.html (Seven habits of effective text editing)

>i need some help with vimscript
https://learnvimscriptthehardway.stevelosh.com/ (for users of the Vim editor who want to learn how to customize Vim)

>i want some colors
https://vimcolorschemes.com/

>lsp
https://github.com/prabirshrestha/vim-lsp
https://www.vimfromscratch.com/articles/vim-and-language-server-protocol (article about LSP)

>i want some ploogins
https://vimawesome.com/

>i am gay
https://neovim.io/ (hyperextensible Vim-based text editor)
https://code.visualstudio.com/
https://www.gnu.org/software/emacs/
https://www.jetbrains.com/
>>
>>109236921
vim is deprecated, just use neovim.
>>
>>109236929
glowie
>>
>>109236976
you WILL donate to the Ugandan kids
>>
File: 1761620811343715.png (966 KB, 1276x716)
966 KB PNG
This is not the emac
>>
>>109236921
hag
>>
>>109236929
Genuinely why if I'm ok with standard vim?
>>
notepad++ users try to mog vimmers with multicursor editing. what are vim workflows to make them shut up. I know of ctrl+v X/I being useful for commenting. one can also record very complicated macros - but that's not as immediate as multicursor editing
>>
File: 1763581158371514.png (73 KB, 790x559)
73 KB PNG
Very cool. However...
>>
>>109238027
...continued
let's say we have following code:
let faggot;
let nigger;
let kike;

we need to edit it to following spec:
let totalFaggotDeath: TotalDeath<Faggot>;
let totalNiggerDeath: TotalDeath<Nigger>;
let totalKikeDeath: TotalDeath<Kike>;

i've recorded macro
0w~bywitotal^[wiDeath: TotalDeath<>^[bp

but it's quite a hassle
>>
>>109238145
I would probably just do
%s/\v(\S*);/total\u\1Death: TotalDeath<\u\1>;/

I realize that's quite long too though and could probably be shortened, but the time it would take to think up a better solution would take (at least me) longer than just typing it like this.
>>
has anyone gamified vim yet for learning and no i don't mean esoteric vim golf shit or that dumb tutorial. just becoming fast and efficient at normal usage
>>
>>109238321
Just realized I forgot the : at the start so that's an extra character.

How many key presses would it take with multicursor? I know that's not really a good metric though since how much you have to think about it weighs in too.
>>
>>109236921
>vibecoded
into the trash it goes
>>
>>109237330
>mfw I only know where uganda is because of knuckles
>>
i just use emacs instead of vibeslop
>>
>>109238145
Honestly I'd just delete lines 2 and 3, it's easier to just copy the whole finished line 1 and then replace the faggots
>>
>>109238321
I guess re approach is somewhat more robust but it is also time consuming but it's bettter for applying such edit to multiple files

>>109238650
it's just an example - the structure of edit could be different e.g. xml/html, there could more lines and deleting and replacing is somewhat error prone.
>>
File: 390210377474538.jpg (113 KB, 1200x675)
113 KB JPG
>>109238403
>>
>>109239384
>it's just an example - the structure of edit could be different
I think that's the problem, Vim doesn't offer any obvious alternative for the people who are used to multicursors, it has several ways of doing the same (from visual block mode, to macros, to command-line substitution and the global command, to just finding a different solution altogether, even refactoring your code to avoid the repetition) and what's best depend on the situation. Which is hard to get used to if you're already used to multicursor.
>>
>>109238403
>>109239434
I'll just keep using vim 9.0
>>
found out that vim has built in rot13, kek
g?{motion}              Rot13 encode {motion} text.

check it out
Vg'f gur wrjf, naba!
>>
>>109240032
markup lang files have a ton of repetition no matter how well structured, anon.
i just asked is there any workflow that could come close to multicursor shenanigans. i know that neovim has experimental multicursor and that there are some plugins such as vim-surround/emmet that can aid in dealing with markup, but i'm more interested in vanilla vim power moves
>>
>>109240249
markup files was what forced me to get good at regexes.
>>
>>109240277
ok, well, i guess i should up my basic regex skill then
>>
>>109238403
come home, brown man
https://vim-classic.org/
>>
>>109240323
No, I shan't use that either.
It's over.
>>
>>109240532
>fags
bullied by everyone
>hohols
bullied by rusnigggers
>palestinians
bullied by kikes
>poor niggers in uganda
bullied by other niggers and aids

vim is ultimate *vi*ctim editor, kek
>>
>>109236921
I don't think /g/ needs a new "general" at this point. Just go back to discord you piece of shit.
>>
File: fight4victory.jpg (102 KB, 1280x667)
102 KB JPG
>>109240731
don't listen to that fag, OP. fight for /vim/ stand your ground and prove that you are *vi*ctor not a *vi*ctim
>>
>>109240532
faggots
cuckrain
somefuckingniggerland

whoever it may be behind this site shall be castrated and skinned alive publicly
>>
File: copying shit.png (664 KB, 877x3153)
664 KB PNG
>>109236921
>Vim Isn't Meme
>>
>>109240228
kek nice, that's probably a remnant from the usenet days when rot13 was used for spoilers and stuff like that.
>>
>>109241468
>when rot13 was used for spoilers and stuff like that.
That's way cooler than having to hover over something to reveal it.
>>
>>109240299
Usually the basics are enough. The traces plugin is pretty nice for practicing, it shows live previews while you type. And if you only want barebones vim, turning on incsearch and hlsearch at least helps you see what gets caught.
>>
>>109236921
I get why you might need a general for emacs and lisp but does vim really justify a general? I don’t hate vim but at least with emacs general it’s substantially more than just a text editor and it has a large amount of extra substance to it with broader lisp discussion
>>
>>109241898
same as vim, idk what is your point
>>
>still no use case because GNU nano exists
>still forget how to log out
~
~
~
~
*power cycles PSU because I made the mistake of running it in a TTY-only system*
>>
>>109241866
thanks for the tips anon. vim usage feels like a game of golf, with all that figuring out how to get next edit/move with least number of key strokes and regex is obviously it's own game of golf (sic) so you can play golf while you are playing golf :P
>>
>>109242110
>vim usage feels like a game of golf, with all that figuring out how to get next edit/move with least number of key strokes
True, though in practice, I prefer doing things in ways where I don't have to think too much when actually editing. But it becomes easier and easier to do new things without thinking, with use and practice too.
>>
>>109240532
oh my, that mish-mash isnt classic

--
so hiya, retards, posting my AI generated C indentation:

" sm-c indentation {{{
function! SmCIndent()
let l:prev_line = getline(v:lnum - 1)
let l:prev_indent = indent(v:lnum - 1)
let l:curr_line = getline(v:lnum)

" Rule 0: Edge case - Empty body closure
" If previous line opens and current line closes, match the previous line's indent
if l:prev_line =~# '[\({]\s*$' && l:curr_line =~# '^\s*[\)}]'
return l:prev_indent
endif

" Rule 1: If the current line starts with a closing parenthesis or brace,
" drop back 1 shiftwidth, but never go below 0.
if l:curr_line =~# '^\s*[\)}]'
let l:target_indent = l:prev_indent - &shiftwidth
return l:target_indent < 0 ? 0 : l:target_indent
endif

" Rule 2: If the previous line ends with an unclosed opening parenthesis or brace
" Skip if the brace is preceded by a comment marker (// or #)
if l:prev_line =~# '[\({]\s*$' && l:prev_line !~# '\v(//|#).*[\({]'
return l:prev_indent + &shiftwidth
endif

" Default fallback: maintain previous line's indent level
return l:prev_indent
endfunction

augroup SmIndent
autocmd!
autocmd FileType c,h setlocal nocindent nosmartindent indentexpr=SmCIndent() indentkeys=0),0},0],:,0#,!^F,o,O
augroup END
" }}}
>>
File: vimjeeted.png (46 KB, 921x567)
46 KB PNG
>>109238403
what is the problem sir?
we are doing the needful redeeming vim with gorgeous looking code asap
>>
File: ba.jpg (250 KB, 1370x761)
250 KB JPG
>>109245774
>ai sloppa AND it's indian
alright emacsfags, you win this one
>>
>tfw when there's only vim and sh on a server
Vim is fun unless you actually have to use it at work. Vim does adapt to terminal capabilities, so if you have some nightmare minimal server, it's actually easier to do your thing with ed or cat and echo. Vim gives me nightmares. Also I always promise myself to memorize it, but I always forget anything besides basics.
>>
>>109245383
AI has turned out to be so good for generating lua and .json snippets. Actually insane.

Can’t believe I actually was typing manually back when on VS in Windows.
>>
File: 2983467328.png (3.9 MB, 2636x1478)
3.9 MB PNG
>>109236921
naruhodo naruhodo
>>
>>109246613
>it's actually easier to do your thing with ed or cat and echo.
If not vi compatibility mode, maybe you could use vim in ex mode or improved ex mode instead. I guess it's not that different from ed, but it has some extra functionality, especially improved ex mode.
>>
>>109237940
If you're OK with vim then there's no reason to switch.
They're actively working on a native multi-cursor implementation though.
If I was still using vim I might switch to nvim for that.

I use nvim myself but I can't deny that half of its userbase are retards that only use it because they think it makes them look cool.
More than 80% of plugins made for nvim are also straight up dog shit.



[Advertise on 4chan]

Delete Post: [File Only] Style:
[Disable Mobile View / Use Desktop Site]

[Enable Mobile View / Use Mobile Site]

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.