Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'master' of https://github.com/carlhuda/janus

Conflicts:
	Rakefile
	vimrc
  • Loading branch information...
commit b9e4bf20cca5026504ffe64ab7143876c0513cc8 2 parents 5f8a7d1 + 32c97ea
@pointcom authored
Showing with 160 additions and 58 deletions.
  1. +1 −0  .gitignore
  2. +52 −24 README.markdown
  3. +38 −14 Rakefile
  4. +33 −9 gvimrc
  5. +36 −11 vimrc
View
1  .gitignore
@@ -9,6 +9,7 @@ plugin
ruby
snippets
syntax
+syntax_checkers
ftdetect
ftplugin
colors
View
76 README.markdown
@@ -30,6 +30,10 @@ Linux users can install `gvim` for an experience identical to MacVim.
On Debian/Ubuntu, simply `apt-get install vim-gnome`. For remote
servers, install console vim with `apt-get install vim-nox`.
+On a fresh Ubuntu install you also have to install the packages `rake` and `ruby-dev`
+before running the install script and `exuberant-ctags` for ctags
+support.
+
## Installation
0. `for i in ~/.vim ~/.vimrc ~/.gvimrc; do [ -e $i ] && mv $i $i.old;
@@ -40,7 +44,7 @@ servers, install console vim with `apt-get install vim-nox`.
or
- `curl https://github.com/carlhuda/janus/raw/master/bootstrap.sh -o - | sh`
+ `curl https://raw.github.com/carlhuda/janus/master/bootstrap.sh -o - | sh`
## Customization
@@ -52,6 +56,21 @@ For example, to override the default color schemes:
echo color desert > ~/.vimrc.local
echo color molokai > ~/.gvimrc.local
+If you want to add additional Vim plugins you can do so by adding a
+`~/.janus.rake` like so:
+
+ vim_plugin_task "zencoding", "git://github.com/mattn/zencoding-vim.git"
+ vim_plugin_task "minibufexpl", "git://github.com/fholgado/minibufexpl.vim.git"
+
+If you do not wish to use one of the plugins Janus provides out of the
+box you can have it skipped using the `skip_vim_plugin` method in
+`~/.janus.rake`:
+
+ skip_vim_plugin "color-sampler"
+
+**Note**: Skipping the plugin will only apply to installation. It won't
+remove configurations or mappings Janus might have added for it.
+
## Updating to the latest version
To update to the latest version of the distribution, just run `rake`
@@ -66,6 +85,12 @@ Here's some tips if you've never used VIM before:
* Type `vimtutor` into a shell to go through a brief interactive
tutorial inside VIM.
* Read the slides at [VIM: Walking Without Crutches](http://walking-without-crutches.heroku.com/#1).
+* Watch the screencasts at [vimcasts.org](http://vimcasts.org/)
+* Watch Derek Wyatt's energetic tutorial videos at [his site](http://www.derekwyatt.org/vim/vim-tutorial-videos/)
+* Read wycats' perspective on learning vim at
+ [Everyone who tried to convince me to use vim was wrong](http://yehudakatz.com/2010/07/29/everyone-who-tried-to-convince-me-to-use-vim-was-wrong/)
+* Read this and other answers to a question about vim at StackOverflow:
+ [Your problem with Vim is that you don't grok vi](http://stackoverflow.com/questions/1218390/what-is-your-most-productive-shortcut-with-vim/1220118#1220118)
## Modes
@@ -105,9 +130,8 @@ Janus ships with a number of basic customizations for vim:
* `<Leader>tr` expands to `:te {directory of current file}/` (open in a
new MacVIM tab)
* `<C-P>` inserts the directory of the current file into a command
-* Automatic insertion of closing quotes, parenthesis, and braces
-## "Project Drawer" aka NERDTree
+## "Project Drawer" aka [NERDTree](http://github.com/wycats/nerdtree)
NERDTree is a file explorer plugin that provides "project drawer"
functionality to your vim projects. You can learn more about it with
@@ -128,7 +152,8 @@ NERDTree:
* In general, assume that there is a single NERDTree buffer on the left
and one or more editing buffers on the right
-## Ack.vim
+## [Ack.vim](http://github.com/mileszs/ack.vim)
+
Ack.vim uses ack to search inside the current directory for a pattern.
You can learn more about it with :help Ack
@@ -136,14 +161,14 @@ You can learn more about it with :help Ack
**Customizations**: Janus rebinds command-shift-f (`<D-F>`) to bring up
`:Ack `.
-## Align
+## [Align](http://github.com/tsaleh/vim-align)
Align lets you align statements on their equal signs, make comment
boxes, align comments, align declarations, etc.
* `:5,10Align =>` to align lines 5-10 on `=>`'s
-## Command-T
+## [Command-T](https://wincent.com/products/command-t)
Command-T provides a mechanism for searching for a file inside the
current working directory. It behaves similarly to command-t in
@@ -152,7 +177,7 @@ Textmate.
**Customizations**: Janus rebinds command-t (`<D-t>`) to bring up this
plugin. It defaults to `<Leader>t`.
-## ConqueTerm
+## [ConqueTerm](http://code.google.com/p/conque/)
ConqueTerm embeds a basic terminal inside a vim buffer. The terminal has
an insert mode in which you can type commands, tab complete and use the
@@ -165,7 +190,7 @@ other vim commands on the buffer, like yank and paste.
**Note**: To get colors working, you might have to `export TERM=xterm`
and use `ls -G` or `gls --color`
-## indent\_object
+## [indent\_object](http://github.com/michaeljsmith/vim-indent-object)
Indent object creates a "text object" that is relative to the current
ident. Text objects work inside of visual mode, and with `c` (change),
@@ -175,7 +200,7 @@ normal mode, and type `v ii`. Then repeat `ii`.
**Note**: indent\_object seems a bit busted. It would also be nice if
there was a text object for Ruby `class` and `def` blocks.
-## surround
+## [surround](http://github.com/tpope/vim-surround)
Surround allows you to modify "surroundings" around the current text.
For instance, if the cursor was inside `"foo bar"`, you could type
@@ -183,22 +208,23 @@ For instance, if the cursor was inside `"foo bar"`, you could type
There's a lot more; check it out at `:help surround`
-## NERDCommenter
+## [NERDCommenter](http://github.com/ddollar/nerdcommenter)
NERDCommenter allows you to wrangle your code comments, regardless of
-filetype. View `help :NERDCommenter` for all the details.
+filetype. View `:help NERDCommenter` for all the details.
**Customizations**: Janus binds command-/ (`<D-/>`) to toggle comments.
-## SuperTab
+## [SuperTab](http://github.com/ervandew/supertab)
In insert mode, start typing something and hit `<TAB>` to tab-complete
based on the current context.
## ctags
-Janus includes the TagList plugin, which binds `:Tlist` to an overview
-panel that lists all ctags for easy navigation.
+Janus includes the [TagList](http://github.com/vim-scripts/taglist.vim)
+plugin, which binds `:Tlist` to an overview panel that lists all ctags
+for easy navigation.
**Customizations**: Janus binds `<Leader>rt` to the ctags command to
update tags.
@@ -211,7 +237,7 @@ ctag support. Tag navigation creates a stack which can traversed via
`Ctrl-]` (to find the source of a token) and `Ctrl-T` (to jump back up
one level).
-## Git Support (Fugitive)
+## Git Support ([Fugitive](http://github.com/tpope/vim-fugitive))
Fugitive adds pervasive git support to git directories in vim. For more
information, use `:help fugitive`
@@ -223,19 +249,20 @@ hunks in the file.
Use `:Gdiff` on an open file to see what changes have been made to that
file
-## ZoomWin
+## [Gist-vim](http://github.com/mattn/gist-vim)
-When working with split windows, ZoomWin lets you zoom into a window and
-out again using `Ctrl-W o`
+Nice [gist integration](https://github.com/mattn/gist-vim) by mattn.
+Requires exporting your `GITHUB_TOKEN` and `GITHUB_USER` as environment
+variables or setup your [GitHub token config](http://help.github.com/git-email-settings/).
-**Customizations**: Janus binds `<Leader>z` to `:ZoomWin`
+Try `:Gist`, `:Gist -p` and visual blocks.
-## Markdown Preview
+## [ZoomWin](http://github.com/vim-scripts/ZoomWin)
-Markdown preview takes the current buffer, converts the Markdown to
-HTML, and opens it in your default browser.
+When working with split windows, ZoomWin lets you zoom into a window and
+out again using `Ctrl-W o`
-**Customizations**: Janus binds `<Leader>p` to this plugin.
+**Customizations**: Janus binds `<Leader><Leader>` to `:ZoomWin`
## Additional Syntaxes
@@ -243,11 +270,12 @@ Janus ships with a few additional syntaxes:
* Markdown (bound to \*.markdown, \*.md, and \*.mk)
* Mustache (bound to \*.mustache)
+* Arduino (bound to \*.pde)
* Haml (bound to \*.haml)
* Sass (bound to \*.sass)
* SCSS (bound to \*.scss)
* An improved JavaScript syntax (bound to \*.js)
-* Map Gemfile, Rakefile and Thorfile to Ruby
+* Map Gemfile, Rakefile, Vagrantfile and Thorfile to Ruby
* Git commits (set your `EDITOR` to `mvim -f`)
## Color schemes
View
52 Rakefile
@@ -93,7 +93,7 @@ def vim_plugin_task(name, repo=nil)
else
subdirs.each do |subdir|
if File.exists?(subdir)
- sh "cp -rf #{subdir}/* #{cwd}/#{subdir}/"
+ sh "cp -RfL #{subdir}/* #{cwd}/#{subdir}/"
end
end
end
@@ -120,8 +120,12 @@ def vim_plugin_task(name, repo=nil)
task :default => name
end
+def skip_vim_plugin(name)
+ Rake::Task[:default].prerequisites.delete(name)
+end
+
vim_plugin_task "ack.vim", "git://github.com/mileszs/ack.vim.git"
-vim_plugin_task "color-sampler", "http://www.vim.org/scripts/download_script.php?src_id=12179"
+vim_plugin_task "color-sampler", "git://github.com/vim-scripts/Color-Sampler-Pack.git"
vim_plugin_task "conque", "http://conque.googlecode.com/files/conque_1.1.tar.gz"
vim_plugin_task "fugitive", "git://github.com/tpope/vim-fugitive.git"
vim_plugin_task "git", "git://github.com/tpope/vim-git.git"
@@ -132,14 +136,15 @@ vim_plugin_task "jslint", "git://github.com/hallettj/jslint.vim.git"
vim_plugin_task "nerdtree", "git://github.com/wycats/nerdtree.git"
vim_plugin_task "nerdcommenter", "git://github.com/ddollar/nerdcommenter.git"
vim_plugin_task "surround", "git://github.com/tpope/vim-surround.git"
-vim_plugin_task "taglist", "http://vim.sourceforge.net/scripts/download_script.php?src_id=7701"
+vim_plugin_task "taglist", "git://github.com/vim-scripts/taglist.vim.git"
vim_plugin_task "vividchalk", "git://github.com/tpope/vim-vividchalk.git"
+vim_plugin_task "solarized", "git://github.com/altercation/vim-colors-solarized.git"
vim_plugin_task "supertab", "git://github.com/ervandew/supertab.git"
vim_plugin_task "cucumber", "git://github.com/tpope/vim-cucumber.git"
vim_plugin_task "textile", "git://github.com/timcharper/textile.vim.git"
vim_plugin_task "rails", "git://github.com/tpope/vim-rails.git"
vim_plugin_task "rspec", "git://github.com/taq/vim-rspec.git"
-vim_plugin_task "zoomwin", "http://www.vim.org/scripts/download_script.php?src_id=9865"
+vim_plugin_task "zoomwin", "git://github.com/vim-scripts/ZoomWin.git"
vim_plugin_task "snipmate", "git://github.com/msanders/snipmate.vim.git"
vim_plugin_task "markdown", "git://github.com/tpope/vim-markdown.git"
vim_plugin_task "align", "git://github.com/tsaleh/vim-align.git"
@@ -150,16 +155,22 @@ vim_plugin_task "irblack", "git://github.com/wgibbs/vim-irblack.git"
vim_plugin_task "scratch", "http://github.com/duff/vim-scratch.git"
vim_plugin_task "vim-coffee-script","git://github.com/kchmck/vim-coffee-script.git"
vim_plugin_task "syntastic", "git://github.com/scrooloose/syntastic.git"
-vim_plugin_task "markdown-preview", "git://github.com/mkitt/markdown-preview.vim.git"
+vim_plugin_task "puppet", "git://github.com/ajf/puppet-vim.git"
+vim_plugin_task "scala", "git://github.com/bdd/vim-scala.git"
+vim_plugin_task "gist-vim", "git://github.com/mattn/gist-vim.git"
-vim_plugin_task "command_t", "git://github.com/wincent/Command-T.git" do
+#vim_plugin_task "hammer", "git://github.com/robgleeson/hammer.vim.git" do
+# sh "gem install github-markup redcarpet"
+#end
- sh "find ruby -name '.gitignore' | xargs rm"
+vim_plugin_task "command_t", "http://s3.wincent.com/command-t/releases/command-t-1.2.1.vba" do
Dir.chdir "ruby/command-t" do
- if `rvm > /dev/null 2>&1` && $?.exitstatus == 0
+ if File.exists?("/usr/bin/ruby1.8") # prefer 1.8 on *.deb systems
+ sh "/usr/bin/ruby1.8 extconf.rb"
+ elsif File.exists?("/usr/bin/ruby") # prefer system rubies
+ sh "/usr/bin/ruby extconf.rb"
+ elsif `rvm > /dev/null 2>&1` && $?.exitstatus == 0
sh "rvm system ruby extconf.rb"
- else
- sh "/usr/bin/ruby extconf.rb" # assume /usr/bin/ruby is system ruby
end
sh "make clean && make"
end
@@ -194,13 +205,26 @@ vim_plugin_task "janus_themes" do
end
vim_plugin_task "molokai" do
- sh "curl http://www.vim.org/scripts/download_script.php?src_id=9750 > colors/molokai.vim"
+ sh "curl https://raw.github.com/mrtazz/molokai.vim/master/colors/molokai.vim > colors/molokai.vim"
+end
+vim_plugin_task "mustache" do
+ sh "curl https://raw.github.com/defunkt/mustache/master/contrib/mustache.vim > syntax/mustache.vim"
+ File.open(File.expand_path('../ftdetect/mustache.vim', __FILE__), 'w') do |file|
+ file << "au BufNewFile,BufRead *.mustache setf mustache"
+ end
end
-vim_plugin_task "mustasche" do
- sh "curl http://github.com/defunkt/mustache/raw/master/contrib/mustache.vim > syntax/mustache.vim"
+vim_plugin_task "arduino","git://github.com/vim-scripts/Arduino-syntax-file.git" do
+ File.open(File.expand_path('../ftdetect/arduino.vim', __FILE__), 'w') do |file|
+ file << "au BufNewFile,BufRead *.pde setf arduino"
+ end
end
vim_plugin_task "vwilight" do
- sh "curl https://gist.github.com/raw/796172/724c7ca237a7f6b8d857c4ac2991cfe5ffb18087/vwilight.vim > colors/vwilight.vim"
+ sh "curl https://raw.github.com/gist/796172/724c7ca237a7f6b8d857c4ac2991cfe5ffb18087 > colors/vwilight.vim"
+end
+
+if File.exists?(janus = File.expand_path("~/.janus.rake"))
+ puts "Loading your custom rake file"
+ import(janus)
end
desc "Update the documentation"
View
42 gvimrc
@@ -1,4 +1,3 @@
-
if has("gui_macvim")
" Fullscreen takes up entire screen
set fuoptions=maxhorz,maxvert
@@ -19,6 +18,8 @@ if has("gui_macvim")
" Command-/ to toggle comments
map <D-/> <plug>NERDCommenterToggle<CR>
+ imap <D-/> <Esc><plug>NERDCommenterToggle<CR>i
+
" Command-][ to increase/decrease indentation
vmap <D-]> >gv
@@ -45,8 +46,25 @@ if has("gui_macvim")
imap <D-8> <Esc>8gt
map <D-9> 9gt
imap <D-9> <Esc>9gt
+
+ " Command-Option-ArrowKey to switch viewports
+ map <D-M-Up> <C-w>k
+ imap <D-M-Up> <Esc> <C-w>k
+ map <D-M-Down> <C-w>j
+ imap <D-M-Down> <Esc> <C-w>j
+ map <D-M-Right> <C-w>l
+ imap <D-M-Right> <Esc> <C-w>l
+ map <D-M-Left> <C-w>h
+ imap <D-M-Left> <C-w>h
+
+ " Adjust viewports to the same size
+ map <Leader>= <C-w>=
+ imap <Leader>= <Esc> <C-w>=
endif
+" Don't beep
+set visualbell
+
" Start without the toolbar
set guioptions-=T
@@ -82,7 +100,13 @@ function s:CdIfDirectory(directory)
let directory = explicitDirectory || empty(a:directory)
if explicitDirectory
- exe "cd " . a:directory
+ exe "cd " . fnameescape(a:directory)
+ endif
+
+ " Allows reading from stdin
+ " ex: git diff | mvim -R -
+ if strlen(a:directory) == 0
+ return
endif
if directory
@@ -142,7 +166,7 @@ endfunction
" Public NERDTree-aware versions of builtin functions
function ChangeDirectory(dir, ...)
- execute "cd " . a:dir
+ execute "cd " . fnameescape(a:dir)
let stay = exists("a:1") ? a:1 : 1
NERDTree
@@ -153,7 +177,7 @@ function ChangeDirectory(dir, ...)
endfunction
function Touch(file)
- execute "!touch " . a:file
+ execute "!touch " . shellescape(a:file, 1)
call s:UpdateNERDTree()
endfunction
@@ -164,14 +188,14 @@ function Remove(file)
if (current_path == removed_path) && (getbufvar("%", "&modified"))
echo "You are trying to remove the file you are editing. Please close the buffer first."
else
- execute "!rm " . a:file
+ execute "!rm " . shellescape(a:file, 1)
endif
call s:UpdateNERDTree()
endfunction
function Mkdir(file)
- execute "!mkdir " . a:file
+ execute "!mkdir " . shellescape(a:file, 1)
call s:UpdateNERDTree()
endfunction
@@ -180,15 +204,15 @@ function Edit(file)
wincmd p
endif
- execute "e " . a:file
+ execute "e " . fnameescape(a:file)
ruby << RUBY
- destination = File.expand_path(VIM.evaluate(%{system("dirname " . a:file)}))
+ destination = File.expand_path(VIM.evaluate(%{system("dirname " . shellescape(a:file, 1))}))
pwd = File.expand_path(Dir.pwd)
home = pwd == File.expand_path("~")
if home || Regexp.new("^" + Regexp.escape(pwd)) !~ destination
- VIM.command(%{call ChangeDirectory(system("dirname " . a:file), 0)})
+ VIM.command(%{call ChangeDirectory(fnamemodify(a:file, ":h"), 0)})
end
RUBY
endfunction
View
47 vimrc
@@ -23,7 +23,7 @@ set smartcase
" Tab completion
set wildmode=list:longest,list:full
-set wildignore+=*.o,*.obj,.git,*.rbc
+set wildignore+=*.o,*.obj,.git,*.rbc,*.class,.svn,vendor/gems/*
" Status bar
set laststatus=2
@@ -37,7 +37,7 @@ let mapleader = ","
set noequalalways
" NERDTree configuration
-let NERDTreeIgnore=['\.rbc$', '\~$']
+let NERDTreeIgnore=['\.pyc$', '\.rbc$', '\~$']
map <Leader>n :NERDTreeToggle<CR>
" Command-T configuration
@@ -48,6 +48,7 @@ map <Leader><Leader> :ZoomWin<CR>
" CTags
map <Leader>rt :!ctags --extra=+f -R *<CR><CR>
+map <C-\> :tnext<CR>
" Remember last location in file
if has("autocmd")
@@ -57,27 +58,32 @@ endif
function s:setupWrapping()
set wrap
- set wm=2
+ set wrapmargin=2
set textwidth=72
endfunction
function s:setupMarkup()
call s:setupWrapping()
- map <buffer> <Leader>p :Mm <CR>
+ map <buffer> <Leader>p :Hammer<CR>
endfunction
-" make and python use real tabs
-au FileType make set noexpandtab
-au FileType python set noexpandtab
+" make uses real tabs
+au FileType make set noexpandtab
-" Thorfile, Rakefile and Gemfile are Ruby
-au BufRead,BufNewFile {Gemfile,Rakefile,Thorfile,config.ru} set ft=ruby
+" Thorfile, Rakefile, Vagrantfile and Gemfile are Ruby
+au BufRead,BufNewFile {Gemfile,Rakefile,Vagrantfile,Thorfile,config.ru} set ft=ruby
" md, markdown, and mk are markdown and define buffer-local preview
au BufRead,BufNewFile *.{md,markdown,mdown,mkd,mkdn} call s:setupMarkup()
+" add json syntax highlighting
+au BufNewFile,BufRead *.json set ft=javascript
+
au BufRead,BufNewFile *.txt call s:setupWrapping()
+" make Python follow PEP8 ( http://www.python.org/dev/peps/pep-0008/ )
+au FileType python set softtabstop=4 tabstop=4 shiftwidth=4 textwidth=79
+
" allow backspacing over everything in insert mode
set backspace=indent,eol,start
@@ -106,6 +112,16 @@ vmap <C-Down> ]egv
" Enable syntastic syntax checking
let g:syntastic_enable_signs=1
+let g:syntastic_quiet_warnings=1
+
+" gist-vim defaults
+if has("mac")
+ let g:gist_clip_command = 'pbcopy'
+elseif has("unix")
+ let g:gist_clip_command = 'xclip -selection clipboard'
+endif
+let g:gist_detect_filetype = 1
+let g:gist_open_browser_after_post = 1
" Use modeline overrides
set modeline
@@ -120,8 +136,17 @@ map <Leader>p <C-^> " Go to previous file
set backupdir=~/.vim/backup
set directory=~/.vim/backup
-" xterm not recognized right by vim
-" set term=builtin_ansi
+" Turn off jslint errors by default
+let g:JSLintHighlightErrorLine = 0
+
+" MacVIM shift+arrow-keys behavior (required in .vimrc)
+let macvim_hig_shift_movement = 1
+
+" % to bounce from do to end etc.
+runtime! macros/matchit.vim
+
+" Show (partial) command in the status line
+set showcmd
" Include user's local vim config
if filereadable(expand("~/.vimrc.local"))
Please sign in to comment.
Something went wrong with that request. Please try again.