generally speaking, this .vimrc is most core config file that had a most use for me, been messing around with it before, and finally i use janus carl and huda https://github.com/carlhuda/janus (had to thanks to them) for their distro of the .vimrc configuration, it include just all what i need for my macvim, it has a good plugins and configurations to where i can start of developments.
for others that don't want to mess around with vimrc configs (although its fun)just give it a shot and hopefully, and will happifly accept an contribution
Why does it matter if there's no standard location? Do you use the ; command that often in vim anyway that this would be an issue if it were mapped to \?
Ymmv but it unfortunately matters for me. I switch between my work PC and personal Macbook daily. The different positions for \ drive me crazy, but as least it's rarely used on Macs due to sane file paths. Using a moving key in Vim is a bad idea.
I go with whatever the default is. I've logged on to hundreds of *nix machines in just the past few years, and it's completely not worth the effort to try and maintain a concurrent configuration.
Insert single characters: Press 's' in normal mode and the next character you type will be inserted at the cursor and put you back in normal. Press 'S' (Capital S or shift+s) and the character will be inserted after the cursor like 'a' append. This is also repeatable, so you can insert a character and then do '5.' to insert it 5 times, still leaving you in normal mode afterwards. Being repeatable is the reasoning I read for it being a function. I picked this up from the Vim wikia site awhile ago.
" Insert single char (repeatable)
function! RepeatChar(char, count)
return repeat(a:char, a:count)
endfunction
nnoremap <silent> s :<C-U>exec "normal i".RepeatChar(nr2char(getchar()), v:count1)<CR>
nnoremap <silent> S :<C-U>exec "normal a".RepeatChar(nr2char(getchar()), v:count1)<CR>
Press 'F5' to run the file you're editing, assuming it has a shebang.
" Run current file if it has a shebang
function! <SID>CallInterpreter()
if match(getline(1), '^\#!') == 0
let l:interpreter = getline(1)[2:]
exec ("!".l:interpreter." %:p")
else
echohl ErrorMsg | echo "Err: No shebang present in file, canceling execution" | echohl None
endif
endfun
map <F5> :call <SID>CallInterpreter()<CR>
I don't actually use this one a lot, but it can be handy. F10 to switch between the line numbering modes, in Vim versions that have relative line numbering (>= 7.3)
" Toggle line numbering modes
" Default to relativenumber in newer vim, otherwise regular numbering
if v:version >= 703
set relativenumber
let s:relativenumber = 0
function! <SID>ToggleRelativeNumber()
if s:relativenumber == 0
set number
let s:relativenumber = 1
elseif s:relativenumber == 1
set relativenumber
let s:relativenumber = 2
else
set norelativenumber
let s:relativenumber = 0
endif
endfunction
map <silent><F10> :call <SID>ToggleRelativeNumber()<CR>
else
set number
endif
Ctrl-[, too. But for some reason it's not as smooth for me. This idea of mapping semicolon came from a command layout rethink experiment I originally did on emacs. Always been meaning to reconstruct that more fully some day. Vim doesn't make it possible to define new first-class modes, so it will probably have to be a from-scratch editor (if I ever get around to it).
I have mapped Caps Lock to switch between input and command mode. I use F10 as a "placeholder" to avoid triggering an actual changing of caps lock mode.
I prefer a variant of that. You can specify more than one place (that is, first choice, second choice, etc.) with a comma-separated list. I do this:
" Vim 7.3, now with persistent undo
set undofile
set undodir=$HOME/.vim_undo,/tmp
That way, if I've remembered to create a .vim_undo folder, they go there (best option). Otherwise, /tmp. (You can do the same thing when specifying places for swap and backup files.)
As the comment suggests, the undo feature is only 7.3 or better.
I work with multiple files a lot, so I'm always navigating between split screens and across buffers.
" Split windows/multiple files
" use <Ctrl>+s to split the current window
nmap <C-S> <C-W>s
" use <Ctrl>+j/<Ctrl>+k to move up/down through split windows
nmap <C-J> <C-W>j
nmap <C-K> <C-W>k
" use <Ctrl>+-/<Ctrl>+= to maximise/equalise the size of split windows
nmap <C--> <C-W>_
nmap <C-=> <C-W>=
" use <Ctrl>+h/<Ctrl>+l to move back/forth through files:
nmap <C-L> :next<CR>
nmap <C-H> :prev<CR>
Now you can run `vim foo bar baz` and then when open just type `\ta` and it will open them cleanly in three different tabs. Why they renamed a command "tab ball" I will never know.
While the flexibility and portability of Vim is quite attractive, I doubt I could really retrain myself to use the modal interface. Are there packages/scripts/whatever that would allow one to use Vim in the way that one would use a more "normal" text editor?
Gvim in insert mode is essentially a "normal" editor, I.e. You can use it like ms notepad. But that would defeat the whole purpose. It takes memorizing about a dozen key bindings to be proficient with basic editing, and then you're off to the races. You'll have no problem.
I'm not a vim scripter, but I'd be willing to bet you could make a (very very simple) script that would dump you back into input mode after a single command. That, or use a gui vim and ignore the whole command-mode thing (probably augmented with the before-mentioned script) and use buttons.
It's worth mentioning that Cream is completely Vim underneath, however, by default it uses the Common User Access interface for user input like most modern editors.
It is also possible to enable traditional Vim input using expert mode, CUA is retained in insert mode making it very easy for anyone not familiar with Vim to get started and transition.
87 comments
[ 5.9 ms ] story [ 160 ms ] threadhttps://github.com/Pewpewarrows/dotfiles/blob/master/home/.v...
https://github.com/technicalpickles/homesick
https://github.com/wallace/vim_config
for others that don't want to mess around with vimrc configs (although its fun)just give it a shot and hopefully, and will happifly accept an contribution
git clone git://github.com/carlhuda/janus.git
(don't forget to rake it after)
Here's my .vimrc: https://github.com/ElbertF/dotfiles/blob/master/.vimrc
Try using <space> instead. The default binding is useless for the largest key.
http://www.jedberg.net/vimrc
I use splits heavily, and these mappings for navigating and resizing splits are indispensable:
That's too much effort? Enjoy your default configs with no syntax highlighting etc.
<Esc> is one of the most frequent commands, no reason it should be on one of the farthest keys.
As the comment suggests, the undo feature is only 7.3 or better.
https://github.com/sjl/dotfiles/blob/master/vim/.vimrc
https://github.com/cloudhead/dotfiles/blob/master/.vimrc
https://github.com/rtomayko/dotfiles/blob/rtomayko/.vimrc
https://github.com/nvie/vimrc/blob/master/vimrc
https://github.com/vgod/vimrc/blob/master/vimrc
https://github.com/spf13/spf13-vim/blob/master/.vimrc
tons of extensions and custom bindings. good README.
Obligatory comment about the tabbar not being a replacement for :ls. Many things in Vim don't respect the one buffer = one tab paradigm.
Without modal interface vim is just another editor. Modal is fundamental to vim's power.
http://cream.sourceforge.net/
It is also possible to enable traditional Vim input using expert mode, CUA is retained in insert mode making it very easy for anyone not familiar with Vim to get started and transition.