Previous thread: General Vim discussion can go here, but the main focus is on how to achieve maximum vim comfiness.
/cvg/- Comfy Vim General
Other urls found in this thread:
stackoverflow.com
twitter.com
I use atom
The best way to achieve a comfy vim setup is to use as little plugins as possible.
>being gay
wew
i don't know how to jump to the start or end of a document so i use the directional keys to scroll all the way through AMA
Would you like to know how to do that?
Spasemacs
> thinking in vi
stackoverflow.com
> Comfy plugins:
> Manager: Vundle
> molokai
> nerdtree
> indentpython
> vim-surround
> align
> syntastic
> vim-mucomplete
> c-support
> slimv
> airline
> rainbow_parentheses
> Tagbar
there are too many generals on this fucking board
what's there to discuss about vim besides "it's objectively the best editor"??
if you want to know how to do stuff :help or fucking google it
gg -> go to top
G -> go to bottm
i use default vim, lulz
Go complain about the actually cancerous generals that don't belong here, or the 700 billion AYYMD vs JEWTEL threads.
who else defeating the point of having 60000000 keyboard shortcuts by tapping j and k all the time (sometimes in insert mode)
Can someone pls help me to make a simple search & replace function, so far
" Search and replace
vimgrep pattern **/*
cfdo %s/pattern/replaced_pattern/gc
I have no idea what to do anymore
I mean, "recursively" search and replace in a directory
>2017
>still programming in a terminal based text editor
retard, get an IDE with decent UI like Atom or IntelliJ and save yourself 10 years of studying something you don't need. Those two are not bloaty either. Fucking autists still using Emacs and vim, blows my mind.
specially since eclipse and intellij have vim plugins
I use GVim on Windows for my RegEx needs. Come at me.
>atom
>not bloat
You aren't even trying.
bloat on your 1990 pc running gentoo and i3, not on a relatively modern one.
>atom
>not bloat
madness
Any cool key combinations? I read about the most popular ones but I know there is lot more to discover.
obligatory
I like your functionality but how do you not gouge your eyes out using that colorscheme?
Rate my plugins Sup Forums
I once went all vi-improved using only VCM, netrw, !make and MRU but I think this is less hassle and more comfy imo
Why is neovim so shit?
I work in a well lit room.
What's wrong with it? I haven't used it, so i wouldn't know.
Reposting a .vimrc without plugins (except for netrw, but that is native)
" BASIC SETUP:
" enter the new millenium
set nocompatible
" enable plugins
filetype plugin on
" PERSONAL MAPPINGS:
" save file
nnoremap :w
inoremap :wi
" exit
nnoremap :q
inoremap :q
" leader
let mapleader = "¿"
" localleader
let maplocalleader = "\\"
" edit vimrc file
nnoremap ev :vsplit $MYVIMRC
" source vimrc file
nnoremap sv :source $MYVIMRC
" TEXT AUTOCORRECTION AND EXPANSIONS:
iabbrev teh the
iabbrev waht what
iabbrev aslo also
iabbrev @@ [email protected]
" TEXT SNIPPETS:
" Read an HTML template and move cursor to title
nnoremap html :-1read $HOME/.vim/snippets/skeleton.html3jwf>a
" NOW WE CAN:
" - html for HTML snippet
" - can be used to create more snippets
" COSMETIC CHANGES:
" enable syntax highlightening
syntax enable
" colorscheme
colorscheme basal
" background color
"set background=dark
" toolbar
set ruler
" line wrap
set wrap
" when wrapping, don't break words
set linebreak
" indent using previously indented line as example
set autoindent
" indent C-like syntax
set smartindent
" set line number for current line and relative number to the rest
"set number relativenumber
" TAB COMPLETION:
" enable spellchecking
"set spell
" match dictionary words for completion
set complete+=kspell
" FINDING FILES:
" Search down into subfolders
" Provides tab-completion for all file-related tasks
set path+=**
" Display all matching files when we tab complete
set wildmenu
" NOW WE CAN:
" - Hit tab to :find by partial match
" - use * to make it fuzzy
" - :b lets you autocomplete any buffer
" TAG JUMPING:
" - This doesn't help if you want a visual list of tags
" Create the 'tags' file (may need to install ctags first)
command! MakeTags !ctags -R .
" NOW WE CAN:
" - Use ^] to jump to tag under cursor
" - Use g^] for ambiguous tags
" - Use ^t to jump back up the tag stack
cont.
" AUTOCOMPLETE:
" Already set with the tags file
" The good stuff is documented in |ins-completion|
" HIGHLIGHTS:
" - ^x^n for JUST this file
" - ^x^f for filenames (woks with our path trick!)
" - ^x^] for tags only
" - ^n for anything specified by the 'complete' option
" - Use ^n and ^p to go back and forth in the suggestion list
" ELEMENT INSPECTOR:
" Show syntax highlighting groups for word under cursor
" Use ctrl-shift-p to reveal the syntax groups to which the element belongs
nmap :call SynStack()
function! SynStack()
if !exists("*synstack")
return
endif
echo map(synstack(line('.'), col('.')), 'synIDattr(v:val, "name")')
endfunc
" FILE BROWSING:
" Tweaks for browsing
let g:netrw_banner=0 " disable annoying banner
let g:netrw_browse_split=4 " open in prior window
let g:netrw_altv=1 " open splits to the right
let g:netrw_liststyle=3 " tree view
let g:netrw_list_hide=netrw_gitignore#Hide()
let g:netrw_list_hide.=',\(^\|\s\s\)\zs\.\S\+'
" NOW WE CAN:
" - :edit a folder to open a file browser
" - /c/t to open in an h-split/v-split/tab
" - check |netrw-browse-maps| for more mappings
I've only been using vim for 2 years, and I bet I can edit stuff 10x faster and more comfortably than you can do with any IDE.
I've also modified vim to the point where it is basically an IDE. I have a command that compiles my code and moves the cursor to any errors that have been found. I pretty much never need to move my hand from the home-row, and the result is that I can work extremely quickly.
I'm also using a plugin that flawlessly integrates git into vim.
I've used IDEs before. My experience is they add overhead and I work slower overall.
Reposting intro to vim
# Vim Grammar
**Modal nature** - Insert mode is not the default mode
* Verbs - Operations you can run on the text
* Nouns - Text objects that you can target
* Modifiers - Specify how far the change should go
* Adverbs - Repeat actions with counts and selection
* Macros - Recordable and modifiable sequences of actions
* Commands - Including whole scripting language inside vim
# Verbs
* `i/I` - Insert here / Insert at the beginning of line
* `o/O` - Open after / Open line before
* `d/D` - Delete / Delete till the end of line
* `y/Y` - Yank(copy) / Yank till the end of line
* `c/C` - Change / Change till the end of line
* `s/S` - Substitute / Substitute whole line
* `p/P` - Paste after / Paste before
* `r/R` - Replace char / Replace mode
* `~` - Toggle case
* `>>` / `
cont.
# Repeating & Macros
**The most powerful action in Vim grammar is `.` (dot).**
Repeat any sentence constructed using Vim grammar with one key press.
* Repeat support for plugins:
### Macros
* `q` - start and end recording macro in register, end with `q`
* `@` - run recorded macro
All macros are recorded in regular registers,
like any cut or copied text, and can be pasted and modified.
* `"ap` - paste contents of register a here
* `"ayy` - copy current line to register a
# Commands
* Regex Substitution:
* `:%s/\v(\d+)//g` - enclose all digits in file in `` brackets
* `:%s//thing/g` - replace all instances of last search with `thing`
* `:%s##thing#g` - use different dividers: `@`, `$`, any non-alphanumeric char
* `:help substitute`
* Global Commands:
* `:g/^TEXT/m $` - move all lines mathcing `/^TEXT/` to the end of file
* `:g/^TEXT/c 't` - copy all lines mathcing `/^TEXT/` to the `'t` mark
* `:g/^TEXT/normal "Ayy` - append every line matching`/^TEXT/` into `A` register
* `:help global`
* Buffer Commands:
* `:bufdo %s/TEXT//g` - remove all occurences of **TEXT** from all open buffers
* `:argdo g/TEXT/y R` - append all lines matching **TEXT** into register `r` from all buffers in the `args` list
Maybe this should be in a pastebin and in the OP no that I think
gg, G
In a directory, you wouldn't use vim but find, sed, and awk.
What about doing that from vim? Is there any hack you can put in vimrc to do this automatically?
>to use as little plugins as possible
This.
Vimscript is an abomination and bringing in complex plugins written in it degrades Vim.
I've found "vim modes" in other IDEs are fucking awful. they emulate the shortcuts, and do a passable insert/normal mode combo, but they completely fail to realize the true power of vi's modal editing and UI.
I'm using it. Pretty comfy except sometimes it overrides your init file, so you have to do retarded shit to override the override.
>he doesn't disable simple navigational keys to force the use of more efficient ones
pleb
I use emacs because I don't like being told I should donate to uganda kids.
kek, I prefer GPL myself and lisp is what vim needs, but until someone makes a vi with lisp implementation or vile has more support, vim it is
Any decent language would be fine, honestly.
Thanks, wp G
What's the best auto-complete plugin?
The way i remember is to think of the document like a water well
>to get a bucket of water all the way to the top, your arms make several small repeated pulls (gg)
>to get to the bottom of the well you make one big jump and it makes a loud splash (G)
Deoplete by far
That's for neovim tho
I use SublimeText
Also, do you Sup Forumsays mingle with Neovimers?
I always had trouble with building youcompleteme. and it's huge and ungainly.
Today I'm using mu-complete and it's fine for my needs.
It's also written in vimscript and doesn't contain as much external code
>shitloads of plugins and ricing
>for something any modern editor can do
This
I used to use YCM and recently switched to mu-complete as well and it's so much more pleasant.
Thank you!
Is cream allowed?
why not vimcompleteme?
where is the guide to achieve comfiness?
this is so useful and only learnt about this 2 days ago ;-;
also how do you remove the highlighted words after completing the search
Emacs is a good operating system.
Too bad it lacks a proper text editor
To turn it on, it's :set hlsearch
To turn it off, it's probably :set hlsearch! or :set nohlsearch
To take highlighting away away it's :nohl
How would I delete every line with "Hello" in it?
:g/Hello/d
I just like the default. I mean, Vim has a shit ton of features and I feel like the ones that aren't enabled by default are subjective. Vim even has fucking mouse support. I don't use it, but it's there if you want it.
do you people really need a general for this shit
Nice satanic trips..
I think it's a journey:
>Beginner:
>Vim is used as a YSWYG text editor with fancy shortcuts
"how do I move to a certain line?"
"how can I cut this and paste this here?"
"how can I replace text?"
>Intermediate:
>Understanding the different modes
"Nice, I can do all this stuff without using insert mode.."
>Advanced:
>Using macros and plugins, using tabs and splitscreens
"Why should I bother with parentheses?"
"Sweet, I can yank this whole text block!"
>Pro:
>Editing your vimrc, writing Vimscript
"It's super comfy to just use my favorite shortcuts."
>Power user:
>Starting to "speak" Vim, understanding Ed/Ex commands
"I just realized I don't need this custom keybinding, when I can just have the same result with this little shortcut here."
"This line means: For every line that contains parentheses and 'static void', I want to insert my interface before the opening brace - but only for line 10-40."
>Entering the void:
>Speaking "Vim", using registers and pipes, almost no plugins or macros anymore
"Whoa, Vim is so simple, why didn't I get this before?"
"Sometimes I use some Vim one-liner from the command line to do a quick file manipulation."
"I have a few text files which insert comments and load my favorite Vim comands in my registers, so I can execute them from the registers with the @-command."
grep -v Hello > newfile
is ootd vim/vi one that gives easy rsi?
I have no Vim here, so I can't test it.
But from Vim it should be something like this:
:w | bd | ! grep -v Hello % > newfile
save file, delete buffer (=close file), run bash command (% is the current file)
This.
Being using the gui version on desktop and keeping vim on term
I think I tried it and it didn't work out of the box. mu did, so won by merit of comfyness
> learn how to use vim without plugins and with a clean config
> start building config suitable for your needs
> start getting plugins
I'm sure there is, but I just haven't found it.
Actually, you would run the script using !, so like
!find ./ -type f -print0 | xargs -0 sed -i 's/search/replacement/g
Must be tough being gay