Vim and other editors

Completely and utter newfag on vim here.
It feels like I'm missing out on a lot of things by not having a good vimrc.
I only have:
set expandtab

set smarttab

set shiftwidth=4
set tabstop=4

set autoindent

syntax enable

What would you recommend? You could just post yours and say why you have a certain thing enabled.
I'd love for it to have autocompletion on language dictionaries and my own written functions from the file.
Aside from that, it's a very neat editor after going through vimtutor.

Other urls found in this thread:

dotfiles.github.io
pastebin.com/PaT6h03K
stevelosh.com/blog/2010/09/coming-home-to-vim/
twitter.com/SFWRedditGifs

Shameless self bump.

The most important part:

syntax on (not "enable")
filetype plugin indent on

For now, don't worry about manually setting up autoindent and stuff like that. It's okay to have defaults but you'll probably end up with settings specific to each language. Some of that will be set up by the language plugin, and other parts can go in your after/indent/lang.vim scripts.

The next thing is to set up a plugin that manages your other plugins, so you don't have to fuck around with installing things by hand. I like Vundle. I'll let you google that. I'll make a couple more posts about the plugins I use and what they do.

dude, just use emacs lmao

Neat. I'll be on the lookout then.

set hlsearch
set incsearch

I find these useful, the first highlights all instances of what you're searching for, the second activates incremental searching, so you start getting results as soon as you type

"disablle compatibility with Vi
set nocompatible

"Make tabs work as expected (and be proper tabs!)
set tabstop=4 "width of a tab in spaces
set softtabstop=0 "when this is non-zero, the tab key inserts a combination of spaces and tabs
set shiftwidth=4 "the width of the < and > commands
set noexpandtab "don't convert tabs to spaces

"Enable some fancy indenting
set autoindent
set smartindent

"Enable line numbers
set number

"Line wrap
set wrap "enable line wrap
set linebreak "don't break lines in the middle of a word

"Let the open brace key automatically insert a closing brace after hitting enter
inoremap { {}ko

"In normal mode, oo inserts a newline below, and OO inserts a newline above
nmap oo ok
nmap OO Oj

if has("gui_running")
"in gVim, disable the menu bar, toolbar and scrollbars
set guioptions-=m "menu bar
set guioptions-=T "toolbar
set guioptions -=r "right scroll bar
set guioptions-=L "left scroll bar
endif

"let the F4 key toggle between the .h and .cpp file
map :e %:p:s,.h$,.X123X,:s,.cpp$,.h,:s,.X123X$,.cpp,

"Don't automatically comment new lines
autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o

Plugin 'jiangmiao/auto-pairs'

When you type a left parenthesis, this automatically inserts a right parenthesis after the cursor. Same thing for square brackets, curly braces, and quotes. Then you can "type over" the closing character, so you don't really have to change your typing habits. Some people don't like it. I'm pretty fond of it. Give it a shot.

Plugin 'tpope/vim-surround'

Extends Vim's text object manipulation with various ways of addressing matching pairs (so it goes hand in hand with the above plugin). For example, if the cursor is between two square brackets and you need to change them to curly braces, you can type cs]} and it'll do that in one edit. Also works on angle brackets, quotes, even HTML tags.

Who /GNUemacs/ here?

Plugin 'Shougo/neocomplete.vim'

Better autocompletion, including complete-as-you-type. It's a minor pain in the ass to set up, mostly because you have to do it for each language, but once it's working it's pretty great.

Plugin 'reedes/vim-thematic'

If you find yourself changing certain settings at the same time, like switching to a certain color scheme and changing the font (in the GUI version) then this lets you automate some of that. Not actually useful, just convenient.

Plugin 'godlygeek/csapprox'

Makes GUI color schemes work in the terminal. (If you're on Windows, this is useless, but whatever.)

Plugin 'itchyny/lightline.vim'

There are like 15 different plugins for changing the look of the tab bar and status bar. This is one of them. I like it because it actually works and doesn't have any crazy dependencies.

>because you have to do it for each language
Do I need a dictionary for each language then? Also, what about user defined functions?

Emacs getting a new graphical browser in emacs 25 is going to be pretty cool.

didn't know that

hopefully it's more useful than listing the phases of the moon

If you're going to add that many plugins, you're better off using Emacs.

dotfiles.github.io

set ruler
set scrolloff=4

set wildmenu
set wildmode=longest,list

Plugin 'scrooloose/nerdtree'
Plugin 'vimwiki/vimwiki'

Both of these are classics.

Also:

"remap escape and capslock in vim

au VimEnter * !xmodmap -e 'clear Lock' -e 'keycode 0x42 = Escape'
au VimLeave * !xmodmap -e 'clear Lock' -e 'keycode 0x42 = Caps_Lock'


This remaps escape as capslock inside of vim.

If you do decide to use vimWiki (and a lot of people have vim only for this reason), this is helpful.

" Run multiple wikis "
let g:vimwiki_list = [
\{'path': '~/Documents/VimWiki/main'},
\{'path': '~/Documents/VimWiki/work'},
\{'path': '~/Documents/VimWiki/creative'},
\{'path': '~/Documents/VimWiki/household'},
\{'path': '~/Documents/VimWiki/organization'},
\{'path': '~/Documents/VimWiki/technical'},
\]

au BufRead,BufNewFile *.wiki set filetype=vimwiki


This lets you run multiple predefined wikis and switch them using ws

just use atom with vim bindings

Atom isn't even on my non-free repos. I could build it, but I don't want botnet.

>i don't like VIM because my .vimrc is wrong!!!
no

you're using vim wrong

you start off with the most minimal install you can, then piecemeal identify features you wish vim had, then add them.

you dont start off with a starter pack of changes that someone else drops in your lap, because then you dont understand why they're helpful and why you should use them

:e $HOME/.vimrc

pastebin.com/PaT6h03K

set backup
set backupdir=~/.backup
set relativenumber
set ruler

map j
map k
map h
map l

map! ,,

> adding even more bloat shit to emacs

build your vim rc while reading through this

stevelosh.com/blog/2010/09/coming-home-to-vim/

I always map jk for esc

Bloat is very subjective and an opinion.

let me know when they get a new text editor lmao

What the fuck is your shitposting supposed to mean?

Only if you're shilling Emacs. If, on the other hand, you don't use Emacs as your designated shitting editor, it is very easy to specifically define.

What does the clump of four lines do? I found that in my vimrc the other day because I snatched it from somewhere a while ago but I still don't know what this does.

I'm retarded. I'm referring to the second clump of four lines.

Okay, kid.

Some plugins you might want
vundle (plugin manager)
tabular (alignment)
fugitive (git)
ultisnips (snippets)
syntastic (syntax errors)
youcompleteme (autocomplete)

Emacs is the systemd of text editors. It tries to do everything, even things that are not needed and ends up bloated.

Sup Forums definitely does not have the attention span for emacs... which is fine, because emacs can get next level. emacs is great if you can program in ELISP and want to use emacs to run your entire personal life and stem career, but most people will never get there

you guys can have fun writing hello world and editing zshrc in nano/vim/sublime text (so productive)

At least make the bait funny, it's just asinine.

>he can't program worth shit
>he googled what is the best text editor
>he thought it was vim

how do you comment a block of code in Vim, again? Don't you have to change the mode three times? Isn't it minimum six steps?

>how do you comment a block of code in Vim, again
You bind a key or a user command to it in your vimrc, just like any other action you find yourself doing often.
And no, you don't even have to change modes once, you could do the whole thing in one regex.
If you really wanted to record a macro for it, you could.

For example, bloat is like compiling a spell checker into your text editor when *NIX already has spell checkers like aspell and hunspell, or compiling fucking grep into your text editor.

Oh wait.