From 71062923e5b2ed9f0c9dd6b28667fe8a8a4a7e8f Mon Sep 17 00:00:00 2001 From: Wael Nasreddine Date: Tue, 1 Nov 2011 21:47:34 +0100 Subject: [PATCH 01/53] Janus tools: Add Gundo plugin. --- .gitmodules | 3 +++ janus-tools/gundo | 1 + janus-tools/janus/plugin/gundo.vim | 1 + 3 files changed, 5 insertions(+) create mode 160000 janus-tools/gundo create mode 100644 janus-tools/janus/plugin/gundo.vim diff --git a/.gitmodules b/.gitmodules index 2f189b28..b54bb92d 100644 --- a/.gitmodules +++ b/.gitmodules @@ -46,3 +46,6 @@ [submodule "janus-langs/coffeescript"] path = janus-langs/coffeescript url = https://github.com/kchmck/vim-coffee-script.git +[submodule "janus-tools/gundo"] + path = janus-tools/gundo + url = git://github.com/sjl/gundo.vim.git diff --git a/janus-tools/gundo b/janus-tools/gundo new file mode 160000 index 00000000..12b6f67a --- /dev/null +++ b/janus-tools/gundo @@ -0,0 +1 @@ +Subproject commit 12b6f67aeb892519385529b2b5cdda55cc428d9d diff --git a/janus-tools/janus/plugin/gundo.vim b/janus-tools/janus/plugin/gundo.vim new file mode 100644 index 00000000..82dac57d --- /dev/null +++ b/janus-tools/janus/plugin/gundo.vim @@ -0,0 +1 @@ +nnoremap :GundoToggle From 693e5e5c2708adc706dce677b6535ab232ea1fa8 Mon Sep 17 00:00:00 2001 From: Wael Nasreddine Date: Tue, 1 Nov 2011 21:37:56 +0100 Subject: [PATCH 02/53] Janus Tools: Add hammer. --- .gitmodules | 3 +++ janus-tools/hammer | 1 + janus-tools/janus/plugin/hammer.vim | 13 +++++++++++++ 3 files changed, 17 insertions(+) create mode 160000 janus-tools/hammer create mode 100644 janus-tools/janus/plugin/hammer.vim diff --git a/.gitmodules b/.gitmodules index 2f189b28..7fccbb41 100644 --- a/.gitmodules +++ b/.gitmodules @@ -46,3 +46,6 @@ [submodule "janus-langs/coffeescript"] path = janus-langs/coffeescript url = https://github.com/kchmck/vim-coffee-script.git +[submodule "janus-tools/hammer"] + path = janus-tools/hammer + url = git://github.com/robgleeson/hammer.vim.git diff --git a/janus-tools/hammer b/janus-tools/hammer new file mode 160000 index 00000000..8cf24763 --- /dev/null +++ b/janus-tools/hammer @@ -0,0 +1 @@ +Subproject commit 8cf24763ed792fe54ab4afb42c1dde896341a325 diff --git a/janus-tools/janus/plugin/hammer.vim b/janus-tools/janus/plugin/hammer.vim new file mode 100644 index 00000000..8c5e87b3 --- /dev/null +++ b/janus-tools/janus/plugin/hammer.vim @@ -0,0 +1,13 @@ +function s:setupMarkup() + map p :Hammer +endfunction + +if executable("redcarpet") + " define buffer-local preview for markdown files + au BufRead,BufNewFile *.{md,markdown,mdown,mkd,mkdn} call s:setupMarkup() +endif + +if executable("redcloth") + " define buffer-local preview for textile files + au BufRead,BufNewFile *.textile call s:setupMarkup() +endif From 22511117a4202ffdb225ab49dc5565b2cf22a7c3 Mon Sep 17 00:00:00 2001 From: Wael Nasreddine Date: Tue, 1 Nov 2011 21:23:29 +0100 Subject: [PATCH 03/53] Janus Tools: Add ack. --- .gitmodules | 3 +++ janus-tools/ack | 1 + janus-tools/janus/plugin/ack.vim | 7 +++++++ 3 files changed, 11 insertions(+) create mode 160000 janus-tools/ack create mode 100644 janus-tools/janus/plugin/ack.vim diff --git a/.gitmodules b/.gitmodules index 2f189b28..74fdad5c 100644 --- a/.gitmodules +++ b/.gitmodules @@ -46,3 +46,6 @@ [submodule "janus-langs/coffeescript"] path = janus-langs/coffeescript url = https://github.com/kchmck/vim-coffee-script.git +[submodule "janus-tools/ack"] + path = janus-tools/ack + url = git://github.com/mileszs/ack.vim.git diff --git a/janus-tools/ack b/janus-tools/ack new file mode 160000 index 00000000..98952850 --- /dev/null +++ b/janus-tools/ack @@ -0,0 +1 @@ +Subproject commit 9895285042a2fd5691b2f6582aa979e4d1bdffea diff --git a/janus-tools/janus/plugin/ack.vim b/janus-tools/janus/plugin/ack.vim new file mode 100644 index 00000000..69f3b3b9 --- /dev/null +++ b/janus-tools/janus/plugin/ack.vim @@ -0,0 +1,7 @@ +if has("gui_macvim") + " Command-Shift-F for Ack on mac + map :Ack +else + " Control-Shift-F on other systems + map :Ack +endif From bddc0fe97b09cb0b302c2bb081d1c6f0095a40b5 Mon Sep 17 00:00:00 2001 From: Wael Nasreddine Date: Tue, 1 Nov 2011 21:28:56 +0100 Subject: [PATCH 04/53] Janus Tools: Add fugitive. --- .gitmodules | 3 +++ janus-tools/fugitive | 1 + 2 files changed, 4 insertions(+) create mode 160000 janus-tools/fugitive diff --git a/.gitmodules b/.gitmodules index 2f189b28..24d051ee 100644 --- a/.gitmodules +++ b/.gitmodules @@ -46,3 +46,6 @@ [submodule "janus-langs/coffeescript"] path = janus-langs/coffeescript url = https://github.com/kchmck/vim-coffee-script.git +[submodule "janus-tools/fugitive"] + path = janus-tools/fugitive + url = git://github.com/tpope/vim-fugitive.git diff --git a/janus-tools/fugitive b/janus-tools/fugitive new file mode 160000 index 00000000..1b7e4070 --- /dev/null +++ b/janus-tools/fugitive @@ -0,0 +1 @@ +Subproject commit 1b7e4070f5f7b7522422f5b00a75b323cc314daf From 7d37679a6e0c5001bd5a85d5d1fd199e9b1b60e3 Mon Sep 17 00:00:00 2001 From: Wael Nasreddine Date: Tue, 1 Nov 2011 21:31:54 +0100 Subject: [PATCH 05/53] Janus langs: Add git. --- .gitmodules | 3 +++ janus-langs/git | 1 + 2 files changed, 4 insertions(+) create mode 160000 janus-langs/git diff --git a/.gitmodules b/.gitmodules index 2f189b28..d33cb893 100644 --- a/.gitmodules +++ b/.gitmodules @@ -46,3 +46,6 @@ [submodule "janus-langs/coffeescript"] path = janus-langs/coffeescript url = https://github.com/kchmck/vim-coffee-script.git +[submodule "janus-langs/git"] + path = janus-langs/git + url = git://github.com/tpope/vim-git.git diff --git a/janus-langs/git b/janus-langs/git new file mode 160000 index 00000000..291cbe97 --- /dev/null +++ b/janus-langs/git @@ -0,0 +1 @@ +Subproject commit 291cbe97f2c367f40360949f19b4fa8fb0740e9f From d083a050538def0463c0d15ad35382a183a35e41 Mon Sep 17 00:00:00 2001 From: Wael Nasreddine Date: Tue, 1 Nov 2011 22:01:12 +0100 Subject: [PATCH 06/53] Janus langs: Add Rails, Rspec and Textile to janus-langs. --- .gitmodules | 9 +++++++++ janus-langs/rails | 1 + janus-langs/rspec | 1 + janus-langs/textile | 1 + 4 files changed, 12 insertions(+) create mode 160000 janus-langs/rails create mode 160000 janus-langs/rspec create mode 160000 janus-langs/textile diff --git a/.gitmodules b/.gitmodules index 2f189b28..013a49a3 100644 --- a/.gitmodules +++ b/.gitmodules @@ -46,3 +46,12 @@ [submodule "janus-langs/coffeescript"] path = janus-langs/coffeescript url = https://github.com/kchmck/vim-coffee-script.git +[submodule "janus-langs/rails"] + path = janus-langs/rails + url = git://github.com/tpope/vim-rails.git +[submodule "janus-langs/textile"] + path = janus-langs/textile + url = git://github.com/timcharper/textile.vim.git +[submodule "janus-langs/rspec"] + path = janus-langs/rspec + url = git://github.com/taq/vim-rspec.git diff --git a/janus-langs/rails b/janus-langs/rails new file mode 160000 index 00000000..c7142afd --- /dev/null +++ b/janus-langs/rails @@ -0,0 +1 @@ +Subproject commit c7142afd2b9e67f4eac51496d8be58becfe7256d diff --git a/janus-langs/rspec b/janus-langs/rspec new file mode 160000 index 00000000..4e6e4956 --- /dev/null +++ b/janus-langs/rspec @@ -0,0 +1 @@ +Subproject commit 4e6e4956dd3f3ae58daf1087352951a2ba7137bf diff --git a/janus-langs/textile b/janus-langs/textile new file mode 160000 index 00000000..2f831f45 --- /dev/null +++ b/janus-langs/textile @@ -0,0 +1 @@ +Subproject commit 2f831f45d42dbff41d61decb8fc71b177899f013 From 76ee0fabfe35fde6b01974314ee593f59ff11330 Mon Sep 17 00:00:00 2001 From: Wael Nasreddine Date: Tue, 1 Nov 2011 22:04:02 +0100 Subject: [PATCH 07/53] Janus colors: Add solarized. --- .gitmodules | 3 +++ janus-colors/solarized | 1 + 2 files changed, 4 insertions(+) create mode 160000 janus-colors/solarized diff --git a/.gitmodules b/.gitmodules index 2f189b28..ddbcee18 100644 --- a/.gitmodules +++ b/.gitmodules @@ -46,3 +46,6 @@ [submodule "janus-langs/coffeescript"] path = janus-langs/coffeescript url = https://github.com/kchmck/vim-coffee-script.git +[submodule "janus-colors/solarized"] + path = janus-colors/solarized + url = git://github.com/altercation/vim-colors-solarized.git diff --git a/janus-colors/solarized b/janus-colors/solarized new file mode 160000 index 00000000..528a59f2 --- /dev/null +++ b/janus-colors/solarized @@ -0,0 +1 @@ +Subproject commit 528a59f26d12278698bb946f8fb82a63711eec21 From c50e0a8dcad022e9535943d151a708d48179aed5 Mon Sep 17 00:00:00 2001 From: Wael Nasreddine Date: Tue, 1 Nov 2011 22:38:30 +0100 Subject: [PATCH 08/53] Vimrc: Enable vimrc customisations. --- vimrc | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/vimrc b/vimrc index db6d744e..d703fa98 100644 --- a/vimrc +++ b/vimrc @@ -1,3 +1,11 @@ +"" +"" Customisations +"" + +if filereadable(expand("~/.vimrc.before")) + source ~/.vimrc.before +endif + "" "" Helpers "" @@ -162,3 +170,11 @@ endif set nobackup set nowritebackup set noswapfile + +"" +"" Customisations +"" + +if filereadable(expand("~/.vimrc.after")) + source ~/.vimrc.after +endif From 09f7a56a8f87dabafaadaa68c322a49ea0ea8ebd Mon Sep 17 00:00:00 2001 From: Wael Nasreddine Date: Tue, 1 Nov 2011 22:59:43 +0100 Subject: [PATCH 09/53] Move command-t into the janus-tools folder. --- .gitmodules | 4 ++-- {janus-command-t => janus-tools}/command-t | 0 {janus-command-t => janus-tools}/janus/plugin/command-t.vim | 0 3 files changed, 2 insertions(+), 2 deletions(-) rename {janus-command-t => janus-tools}/command-t (100%) rename {janus-command-t => janus-tools}/janus/plugin/command-t.vim (100%) diff --git a/.gitmodules b/.gitmodules index 2f189b28..86b5777d 100644 --- a/.gitmodules +++ b/.gitmodules @@ -34,8 +34,8 @@ [submodule "janus-tools/snipmate"] path = janus-tools/snipmate url = https://github.com/ervandew/snipmate.vim.git -[submodule "janus-command-t/command-t"] - path = janus-command-t/command-t +[submodule "janus-tools/command-t"] + path = janus-tools/command-t url = git@github.com:wycats/Command-T.git [submodule "janus-colors/sampler-pack"] path = janus-colors/sampler-pack diff --git a/janus-command-t/command-t b/janus-tools/command-t similarity index 100% rename from janus-command-t/command-t rename to janus-tools/command-t diff --git a/janus-command-t/janus/plugin/command-t.vim b/janus-tools/janus/plugin/command-t.vim similarity index 100% rename from janus-command-t/janus/plugin/command-t.vim rename to janus-tools/janus/plugin/command-t.vim From 25da4c2c5cbcc01f65e27c2091ad3a68056804b9 Mon Sep 17 00:00:00 2001 From: Wael Nasreddine Date: Tue, 1 Nov 2011 23:52:35 +0100 Subject: [PATCH 10/53] Rakefile: Add support for plugin installation. --- Rakefile | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/Rakefile b/Rakefile index ae82ef14..ef3e6133 100644 --- a/Rakefile +++ b/Rakefile @@ -1,7 +1,22 @@ +# Return the root path +# +# @return [String] The absolute path to Janus repository +def root_path + @root_path ||= File.expand_path(File.dirname(__FILE__)) +end + def expand(file) File.expand_path(file) end +namespace :plugins do + task :install do + # dummy task for plugins installations hooku. + end +end + +Dir["#{root_path}/janus-*/tasks/**.rake"].each { |f| load f } + task expand("~/.vimrc") => "vimrc" do sh "ln -s ~/.vim/vimrc ~/.vimrc" end @@ -16,4 +31,8 @@ task :update do sh "git submodule update" end -task :default => [:update, expand("~/.vimrc"), expand("~/.gvimrc")] +task :install => [:update, "plugins:install"] do + # Dummy task to run plugins installation tasks +end + +task :default => [:install, expand("~/.vimrc"), expand("~/.gvimrc")] From 2072d3912b748520695dbce63597f65ddbd47d7a Mon Sep 17 00:00:00 2001 From: Wael Nasreddine Date: Tue, 1 Nov 2011 23:53:49 +0100 Subject: [PATCH 11/53] Janus tools/command-t: Add installation task. --- janus-tools/tasks/command-t.rake | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 janus-tools/tasks/command-t.rake diff --git a/janus-tools/tasks/command-t.rake b/janus-tools/tasks/command-t.rake new file mode 100644 index 00000000..adaa4727 --- /dev/null +++ b/janus-tools/tasks/command-t.rake @@ -0,0 +1,21 @@ +namespace :plugins do + desc "Install the command-t plugin." + task :install_command_t do + Dir.chdir "#{root_path}/janus-tools/command-t/ruby/command-t" do + if File.exists?('extconf.rb') + 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" + end + sh "make clean && make" + else + abort "The submodule is not ready, please run 'git submodule update --init'" + end + end + end + + task :install => :install_command_t +end From 08396154bdf2df554f8f7d48bd253ee9fab2c8cc Mon Sep 17 00:00:00 2001 From: Wael Nasreddine Date: Tue, 1 Nov 2011 23:40:50 +0100 Subject: [PATCH 12/53] Rakefile: Make sure ~/.vimrc before linking, also simplifies it (copied from master) --- Rakefile | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/Rakefile b/Rakefile index ae82ef14..b36fbe3e 100644 --- a/Rakefile +++ b/Rakefile @@ -1,13 +1,19 @@ +# Expand the path of a given file +# +# @param [String] file +# @return [String] The expanded path to the given file. def expand(file) File.expand_path(file) end -task expand("~/.vimrc") => "vimrc" do - sh "ln -s ~/.vim/vimrc ~/.vimrc" -end - -task expand("~/.gvimrc") => "gvimrc" do - sh "ln -s ~/.vim/gvimrc ~/.gvimrc" +desc "link ViM configuration files." +task :link_vim_conf_files do + %w[ vimrc gvimrc ].each do |file| + dest = expand("~/.#{file}") + unless File.exist?(dest) + ln_s(expand("../#{file}", __FILE__), dest) + end + end end task :update do @@ -16,4 +22,4 @@ task :update do sh "git submodule update" end -task :default => [:update, expand("~/.vimrc"), expand("~/.gvimrc")] +task :default => [:update, :link_vim_conf_files] From b731b51245afa732e810aa0886336d39dd8d42b4 Mon Sep 17 00:00:00 2001 From: Wael Nasreddine Date: Wed, 2 Nov 2011 00:21:33 +0100 Subject: [PATCH 13/53] Vimrc: Remove the janus-command-t group --- vimrc | 1 - 1 file changed, 1 deletion(-) diff --git a/vimrc b/vimrc index db6d744e..e0968c84 100644 --- a/vimrc +++ b/vimrc @@ -36,7 +36,6 @@ call s:add_group("janus-core") call s:add_group("janus-langs") call s:add_group("janus-tools") call s:add_group("janus-colors") -call s:add_group("janus-command-t") call pathogen#runtime_append_all_bundles() From 8a93098005b7831049bba32a9cb0e5e86bdc53c3 Mon Sep 17 00:00:00 2001 From: Wael Nasreddine Date: Wed, 2 Nov 2011 00:57:15 +0100 Subject: [PATCH 14/53] README.md: Init. --- README.markdown | 0 README.md | 190 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 190 insertions(+) delete mode 100644 README.markdown create mode 100644 README.md diff --git a/README.markdown b/README.markdown deleted file mode 100644 index e69de29b..00000000 diff --git a/README.md b/README.md new file mode 100644 index 00000000..9d53a494 --- /dev/null +++ b/README.md @@ -0,0 +1,190 @@ +# Janus: Carlhuda's vim Distribution + +This is a basic distribution of vim plugins and tools intended to be run +on top of the latest MacVIM snapshot. + +We (Carl and Yehuda) both use this distribution for our own use, and +welcome patches and contributions to help make it an effective way to +get started with vim and then use it productively for years to come. + +At present, we are still learning to use vim ourselves, so you should +anticipate a period of rapid development while we get a handle on the +best tools for the job. So far, we have mostly integrated existing +plugins and tools, and we anticipate to continue doing so while also +writing our own plugins as appropriate. + +In general, you can expect that the tools we use work well together and +that we have given careful thought to the experience of using MacVIM +with the tools in question. If you run into an issue using it, please +report an issue to the issue tracker. + +## Pre-requisites + +Janus is built primarily for [MacVim](http://code.google.com/p/macvim/) on OSX. +Download it [here](https://github.com/b4winckler/macvim/downloads). + +Alternatively, you can use Janus with the bundled console `vim` installation on +OSX (via Terminal), or with any other `vim` or `gvim` installation. + +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; + done` +1. `git checkout experimental` +2. `git clone git://github.com/carlhuda/janus.git ~/.vim` +3. `cd ~/.vim` +4. `rake` + +or + + `curl https://raw.github.com/carlhuda/janus/experimental/bootstrap.sh -o - | sh` + +## Customization + +You can use `~/.gvimrc.before` and `~/.vimrc.before` for settings Janus, +like the __leader__ setting, you may also use `~/.gvimrc.after` and +`~/.vimrc.after` for any additonal setting, it is also a good place for +overriding Janus settings as both files will be loaded at the end of +Janus + +For example, to override the default color schemes: + + echo color desert > ~/.vimrc.after + echo color molokai > ~/.gvimrc.after + +If you want to add additional Vim plugins you can do so by adding a new +submodule in the Janus repository like so: + +```bash +$ cd ~/.vim +$ git submodule add git://github.com/vim-scripts/Rename2.git janus-tools/rename2 +``` + +Plugins hosted at [vim.org](http://www.vim.org/scripts) use a +unique URL for each version, You can use the GitHub mirror at +[https://github.com/vim-scripts](https://github.com/vim-scripts) to get +an url for any ViM script. + +## Updating to the latest version + +To update to the latest version of the distribution, just run `rake` +again inside your `~/.vim` directory. + +# Intro to VIM + +Here's some tips if you've never used VIM before: + +## Tutorials + +* 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 + +* VIM has two modes: + * insert mode- stuff you type is added to the buffer + * normal mode- keys you hit are interpretted as commands +* To enter insert mode, hit `i` +* To exit insert mode, hit `` + +## Useful commands + +* Use `:q` to exit vim +* Certain commands are prefixed with a `` key, which maps to `\` + by default. Use `let mapleader = ","` to change this. If you want this + to be in effect for uses of in your .vimrc, make sure to define + this in the `~/.vimrc.pre` +* Keyboard [cheat sheet](http://walking-without-crutches.heroku.com/image/images/vi-vim-cheat-sheet.png). + +# Features + +This vim distribution includes a number of packages built by others. + +## Base Customizations + +Janus ships with a number of basic customizations for vim: + +* Line numbers +* Ruler (line and column numbers) +* No wrap (turn off per-buffer via set :wrap) +* Soft 2-space tabs, and default hard tabs to 2 spaces +* Show tailing whitespace as `.` +* Make searching highlighted, incremental, and case insensitive unless a + capital letter is used +* Always show a status line +* Allow backspacing over everything (identations, eol, and start + characters) in insert mode +* `e` expands to `:e {directory of current file}/` (open in the + current buffer) +* `te` expands to `:te {directory of current file}/` (open in a + new MacVIM tab) +* `` inserts the directory of the current file into a command + +## [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 +Textmate. + +**Customizations**: Janus rebinds command-t (``) to bring up this +plugin. It defaults to `t`. + +## [NERDCommenter](http://github.com/ddollar/nerdcommenter) + +NERDCommenter allows you to wrangle your code comments, regardless of +filetype. View `:help NERDCommenter` for all the details. + +**Customizations**: Janus binds command-/ (``) to toggle comments. + +## [SuperTab](http://github.com/ervandew/supertab) + +In insert mode, start typing something and hit `` to tab-complete +based on the current context. + +## 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` + +Use `:Gstatus` to view `git status` and type `-` on any file to stage or +unstage it. Type `p` on a file to enter `git add -p` and stage specific +hunks in the file. + +Use `:Gdiff` on an open file to see what changes have been made to that +file + +## [ZoomWin](http://github.com/vim-scripts/ZoomWin) + +When working with split windows, ZoomWin lets you zoom into a window and +out again using `Ctrl-W o` + +**Customizations**: Janus binds `` to `:ZoomWin` + +## Additional Syntaxes + +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, Vagrantfile and Thorfile to Ruby +* Git commits (set your `EDITOR` to `mvim -f`) From aa1ed7345d91debb623b9f61000681efc39a16ca Mon Sep 17 00:00:00 2001 From: Wael Nasreddine Date: Wed, 2 Nov 2011 00:58:54 +0100 Subject: [PATCH 15/53] bootstrap.sh: Init. --- bootstrap.sh | 5 +++++ 1 file changed, 5 insertions(+) create mode 100755 bootstrap.sh diff --git a/bootstrap.sh b/bootstrap.sh new file mode 100755 index 00000000..c49d16f9 --- /dev/null +++ b/bootstrap.sh @@ -0,0 +1,5 @@ +for i in ~/.vim ~/.vimrc ~/.gvimrc; do [ -e $i ] && mv $i $i.old; done +git clone git://github.com/carlhuda/janus.git ~/.vim +cd ~/.vim +git checkout experimental +rake From edea7acc7d6d3727fca2cade155d7fc4f64c2419 Mon Sep 17 00:00:00 2001 From: Wael Nasreddine Date: Wed, 2 Nov 2011 01:01:36 +0100 Subject: [PATCH 16/53] Janus tools/Ack: Move the ack bindings into the after subfolder of janus. --- janus-tools/janus/{plugin => after}/ack.vim | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename janus-tools/janus/{plugin => after}/ack.vim (100%) diff --git a/janus-tools/janus/plugin/ack.vim b/janus-tools/janus/after/ack.vim similarity index 100% rename from janus-tools/janus/plugin/ack.vim rename to janus-tools/janus/after/ack.vim From 4a803bbaa336786bfeb486951e09ae5cc116cce7 Mon Sep 17 00:00:00 2001 From: Wael Nasreddine Date: Wed, 2 Nov 2011 01:05:51 +0100 Subject: [PATCH 17/53] Janus tools/Ack: It should actually be inside a plugin in the after folder. --- janus-tools/janus/after/{ => plugin}/ack.vim | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename janus-tools/janus/after/{ => plugin}/ack.vim (100%) diff --git a/janus-tools/janus/after/ack.vim b/janus-tools/janus/after/plugin/ack.vim similarity index 100% rename from janus-tools/janus/after/ack.vim rename to janus-tools/janus/after/plugin/ack.vim From 0bc9c38c159ffe8232a137cb220f0b5b26eb8c7e Mon Sep 17 00:00:00 2001 From: Wael Nasreddine Date: Wed, 2 Nov 2011 01:12:21 +0100 Subject: [PATCH 18/53] Janus core: Add surround plugin --- .gitmodules | 3 +++ janus-core/surround | 1 + 2 files changed, 4 insertions(+) create mode 160000 janus-core/surround diff --git a/.gitmodules b/.gitmodules index 2f189b28..c0674037 100644 --- a/.gitmodules +++ b/.gitmodules @@ -46,3 +46,6 @@ [submodule "janus-langs/coffeescript"] path = janus-langs/coffeescript url = https://github.com/kchmck/vim-coffee-script.git +[submodule "janus-core/surround"] + path = janus-core/surround + url = git://github.com/tpope/vim-surround.git diff --git a/janus-core/surround b/janus-core/surround new file mode 160000 index 00000000..6f0984a5 --- /dev/null +++ b/janus-core/surround @@ -0,0 +1 @@ +Subproject commit 6f0984a5ca1430047fe760fc680c6cf98ae94b01 From 350e308fb05f6e2cff4402eda2786b1e7d1664be Mon Sep 17 00:00:00 2001 From: Wael Nasreddine Date: Wed, 2 Nov 2011 01:31:22 +0100 Subject: [PATCH 19/53] Janus tools/hammer: Add installation task. --- janus-tools/tasks/hammer.rake | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 janus-tools/tasks/hammer.rake diff --git a/janus-tools/tasks/hammer.rake b/janus-tools/tasks/hammer.rake new file mode 100644 index 00000000..f8055f17 --- /dev/null +++ b/janus-tools/tasks/hammer.rake @@ -0,0 +1,19 @@ +namespace :plugins do + desc "Install the hammer plugin." + task :install_hammer do + begin + require 'rubygems' + if Gem.cache.find_name('github-markup').length == 0 + sh "gem install github-markup" + end + if Gem.cache.find_name('redcarpet').length == 0 + sh "gem install redcarpet" + end + rescue LoadError + puts "Could not install github-markup and redcarpet, please install them manually." + puts "gem install github-markup redcarpet" + end + end + + task :install => :install_hammer +end From b236b1d7d96ca6c81eaf323562e8da57d349a6e1 Mon Sep 17 00:00:00 2001 From: Wael Nasreddine Date: Wed, 2 Nov 2011 01:43:31 +0100 Subject: [PATCH 20/53] Rakefile: Add a method to find an installed gem. --- Rakefile | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/Rakefile b/Rakefile index ae82ef14..9721ce43 100644 --- a/Rakefile +++ b/Rakefile @@ -1,7 +1,30 @@ +module Janus + # Errors + JanusError = Class.new Exception + RubyGemsNotFoundError = Class.new JanusError +end + def expand(file) File.expand_path(file) end +# Find an installed gem +# +# @param [String] The gem name to search for +# @return [Array] The found gems +def find_gem(gem_name) + begin + require 'rubygems' + if Gem.respond_to?(:source_index) + Gem.source_index.find_name(gem_name) + else + Gem.cache.find_name(gem_name) + end + rescue LoadError + raise Janus::RubyGemsNotFoundError + end +end + task expand("~/.vimrc") => "vimrc" do sh "ln -s ~/.vim/vimrc ~/.vimrc" end From 4887cba50c86ca7058faca6997a998c0e943dcf4 Mon Sep 17 00:00:00 2001 From: Wael Nasreddine Date: Wed, 2 Nov 2011 01:44:08 +0100 Subject: [PATCH 21/53] Janus tools/hammer: Fix the installation script for using find_gem instead. --- janus-tools/tasks/hammer.rake | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/janus-tools/tasks/hammer.rake b/janus-tools/tasks/hammer.rake index f8055f17..70c4aaaa 100644 --- a/janus-tools/tasks/hammer.rake +++ b/janus-tools/tasks/hammer.rake @@ -2,14 +2,13 @@ namespace :plugins do desc "Install the hammer plugin." task :install_hammer do begin - require 'rubygems' - if Gem.cache.find_name('github-markup').length == 0 + if find_gem('github-markup').length == 0 sh "gem install github-markup" end - if Gem.cache.find_name('redcarpet').length == 0 + if find_gem('redcarpet').length == 0 sh "gem install redcarpet" end - rescue LoadError + rescue Janus::RubyGemsNotFoundError puts "Could not install github-markup and redcarpet, please install them manually." puts "gem install github-markup redcarpet" end From baad78a081b2ed6037a74cf994a8e20eb3c70ac5 Mon Sep 17 00:00:00 2001 From: Wael Nasreddine Date: Wed, 2 Nov 2011 01:51:53 +0100 Subject: [PATCH 22/53] Rakefile: Gem.source_index is also deperecated, use Gem::Specification but be backward-compatible with older versions of rubygems. --- Rakefile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Rakefile b/Rakefile index 9721ce43..71e09585 100644 --- a/Rakefile +++ b/Rakefile @@ -15,7 +15,9 @@ end def find_gem(gem_name) begin require 'rubygems' - if Gem.respond_to?(:source_index) + if Gem.const_defined?(:Specification) + Gem::Specification.find_all_by_name(gem_name) + elsif Gem.respond_to?(:source_index) Gem.source_index.find_name(gem_name) else Gem.cache.find_name(gem_name) From 4617df87fb291d1fa32975e80902f6ab9919b4ae Mon Sep 17 00:00:00 2001 From: Wael Nasreddine Date: Wed, 2 Nov 2011 01:58:23 +0100 Subject: [PATCH 23/53] Rakefile: Fix typos in the comments --- Rakefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Rakefile b/Rakefile index ef3e6133..9543126a 100644 --- a/Rakefile +++ b/Rakefile @@ -11,7 +11,7 @@ end namespace :plugins do task :install do - # dummy task for plugins installations hooku. + # dummy task for plugin installation tasks. end end @@ -32,7 +32,7 @@ task :update do end task :install => [:update, "plugins:install"] do - # Dummy task to run plugins installation tasks + # Dummy task to run plugin installation tasks end task :default => [:install, expand("~/.vimrc"), expand("~/.gvimrc")] From bf63cb5f079b8098cda2a6f2b80f7e709184181e Mon Sep 17 00:00:00 2001 From: Wael Nasreddine Date: Wed, 2 Nov 2011 02:03:15 +0100 Subject: [PATCH 24/53] README: Fix the order of the commands in the installation process. --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 9d53a494..97fb169b 100644 --- a/README.md +++ b/README.md @@ -38,9 +38,9 @@ support. 0. `for i in ~/.vim ~/.vimrc ~/.gvimrc; do [ -e $i ] && mv $i $i.old; done` -1. `git checkout experimental` -2. `git clone git://github.com/carlhuda/janus.git ~/.vim` -3. `cd ~/.vim` +1. `git clone git://github.com/carlhuda/janus.git ~/.vim` +2. `cd ~/.vim` +3. `git checkout experimental` 4. `rake` or From 8874a912ac09dd64de19475870dfd24fb0606773 Mon Sep 17 00:00:00 2001 From: Wael Nasreddine Date: Wed, 2 Nov 2011 02:11:39 +0100 Subject: [PATCH 25/53] Vimrc: Remove duplicate customisation block. --- vimrc | 8 -------- 1 file changed, 8 deletions(-) diff --git a/vimrc b/vimrc index d703fa98..1da1d6a6 100644 --- a/vimrc +++ b/vimrc @@ -155,14 +155,6 @@ map :ZoomWin cmap =expand("%:p:h") . "/" -"" -"" Customizations -"" - -if filereadable(expand("~/.vimrc.after")) - source ~/.vimrc.after -endif - "" "" Disable swap files "" From d07d8ead4f901cb210461888fa66cbccf2d73caf Mon Sep 17 00:00:00 2001 From: Wael Nasreddine Date: Wed, 2 Nov 2011 02:23:37 +0100 Subject: [PATCH 26/53] Rakefile: Create backup and temp folders. --- .gitignore | 3 +++ Rakefile | 18 ++++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..bfd1d8a8 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +# ViM files +_backup +_temp diff --git a/Rakefile b/Rakefile index ae82ef14..3a0bacde 100644 --- a/Rakefile +++ b/Rakefile @@ -1,3 +1,14 @@ +module Janus + module VIM + extend self + + # Folders + def folders + %w[ _backup _temp ] + end + end +end + def expand(file) File.expand_path(file) end @@ -10,6 +21,13 @@ task expand("~/.gvimrc") => "gvimrc" do sh "ln -s ~/.vim/gvimrc ~/.gvimrc" end +desc "Create necessary folders." +task :folders do + Janus::VIM.folders.each do |folder| + mkdir_p folder + end +end + task :update do sh "git pull" sh "git submodule init" From 9c4158317d8ea0fab7352a05586ed3d8712dfbc0 Mon Sep 17 00:00:00 2001 From: Wael Nasreddine Date: Wed, 2 Nov 2011 02:24:16 +0100 Subject: [PATCH 27/53] Vimrc: Put the backup files in ~/.vim/_backup and swap files in ~/.vim/_temp --- vimrc | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/vimrc b/vimrc index db6d744e..7eb6f45d 100644 --- a/vimrc +++ b/vimrc @@ -156,9 +156,8 @@ if filereadable(expand("~/.vimrc.after")) endif "" -"" Disable swap files +"" Backup and swap files "" -set nobackup -set nowritebackup -set noswapfile +set backupdir=~/.vim/_backup " where to put backup files. +set directory=~/.vim/_temp " where to put swap files. From fea34cdb6b993ebc47cc0daa4513a437f45dc408 Mon Sep 17 00:00:00 2001 From: Wael Nasreddine Date: Wed, 2 Nov 2011 02:29:31 +0100 Subject: [PATCH 28/53] Vimrc: Add hs keymap to toggle hlsearch. --- vimrc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/vimrc b/vimrc index 7eb6f45d..90075d46 100644 --- a/vimrc +++ b/vimrc @@ -67,7 +67,7 @@ set backspace=indent,eol,start " backspace through everything in insert m "" Searching "" -set hlsearch " highlight matches (TODO: Map something convenient to nohlsearch) +set hlsearch " highlight matches set incsearch " incremental searching set ignorecase " searches are case insensitive... set smartcase " ... unless they contain at least one capital letter @@ -139,6 +139,9 @@ map gk " Map to ZoomWin map :ZoomWin +" Toggle hlsearch with hs +nmap hs :set hlsearch! hlsearch? + "" "" Command-Line Mappings "" From c982069de0e53445062caec514de7a41a69a9b00 Mon Sep 17 00:00:00 2001 From: Wael Nasreddine Date: Wed, 2 Nov 2011 02:35:10 +0100 Subject: [PATCH 29/53] Vimrc: *.rake are also ruby files. --- vimrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vimrc b/vimrc index 90075d46..47d74b02 100644 --- a/vimrc +++ b/vimrc @@ -108,7 +108,7 @@ filetype plugin indent on " Turn on filetype plugins (:help filetype-plugin) au FileType make set noexpandtab " Set the Ruby filetype for a number of common Ruby files without .rb -au BufRead,BufNewFile {Gemfile,Rakefile,Vagrantfile,Thorfile,config.ru} set ft=ruby +au BufRead,BufNewFile {Gemfile,Rakefile,Vagrantfile,Thorfile,config.ru,*.rake} set ft=ruby " Markdown and txt files should wrap au BufRead,BufNewFile *.{md,markdown,mdown,mkd,mkdn,txt} call s:setupWrapping() From c904415391b77f53cc0e5ced52029ad525683204 Mon Sep 17 00:00:00 2001 From: Wael Nasreddine Date: Wed, 2 Nov 2011 03:12:42 +0100 Subject: [PATCH 30/53] Rakefile: Invoke folders just after invoking update. --- Rakefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Rakefile b/Rakefile index 3a0bacde..27155620 100644 --- a/Rakefile +++ b/Rakefile @@ -34,4 +34,4 @@ task :update do sh "git submodule update" end -task :default => [:update, expand("~/.vimrc"), expand("~/.gvimrc")] +task :default => [:update, :folders, expand("~/.vimrc"), expand("~/.gvimrc")] From 2f18a5a74e9fa6f09ce214b32c8601c2dfbcfb79 Mon Sep 17 00:00:00 2001 From: Wael Nasreddine Date: Wed, 2 Nov 2011 04:22:35 +0100 Subject: [PATCH 31/53] Command-T: Remove it from gitmodules files (needs to be re-created) --- .gitmodules | 3 --- 1 file changed, 3 deletions(-) diff --git a/.gitmodules b/.gitmodules index 4f471a6b..1d8a6eb6 100644 --- a/.gitmodules +++ b/.gitmodules @@ -34,9 +34,6 @@ [submodule "janus-tools/snipmate"] path = janus-tools/snipmate url = https://github.com/ervandew/snipmate.vim.git -[submodule "janus-tools/command-t"] - path = janus-tools/command-t - url = git@github.com:wycats/Command-T.git [submodule "janus-colors/sampler-pack"] path = janus-colors/sampler-pack url = https://github.com/vim-scripts/Color-Sampler-Pack.git From 39051d68d0a11d0442e5d701537201494b27c5c7 Mon Sep 17 00:00:00 2001 From: Wael Nasreddine Date: Wed, 2 Nov 2011 04:23:22 +0100 Subject: [PATCH 32/53] Command-T: Add the submodule back (needed to be re-created) --- .gitmodules | 3 +++ janus-tools/command-t | 1 + 2 files changed, 4 insertions(+) create mode 160000 janus-tools/command-t diff --git a/.gitmodules b/.gitmodules index 1d8a6eb6..bd449924 100644 --- a/.gitmodules +++ b/.gitmodules @@ -73,3 +73,6 @@ [submodule "janus-tools/hammer"] path = janus-tools/hammer url = git://github.com/robgleeson/hammer.vim.git +[submodule "janus-tools/command-t"] + path = janus-tools/command-t + url = git@github.com:wycats/Command-T.git diff --git a/janus-tools/command-t b/janus-tools/command-t new file mode 160000 index 00000000..9136f745 --- /dev/null +++ b/janus-tools/command-t @@ -0,0 +1 @@ +Subproject commit 9136f74510479a3d40c5c555ece2220ee1c153f1 From db0791825acf09403a4e408875341654ee36b948 Mon Sep 17 00:00:00 2001 From: Wael Nasreddine Date: Wed, 2 Nov 2011 04:24:24 +0100 Subject: [PATCH 33/53] Janus tools/Command-T Install: Fixes the task when the submodule is missing (folder was not found) --- janus-tools/tasks/command-t.rake | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/janus-tools/tasks/command-t.rake b/janus-tools/tasks/command-t.rake index adaa4727..55b822fb 100644 --- a/janus-tools/tasks/command-t.rake +++ b/janus-tools/tasks/command-t.rake @@ -1,8 +1,8 @@ namespace :plugins do desc "Install the command-t plugin." task :install_command_t do - Dir.chdir "#{root_path}/janus-tools/command-t/ruby/command-t" do - if File.exists?('extconf.rb') + if File.exists?("#{root_path}/janus-tools/command-t/ruby/command-t") + Dir.chdir "#{root_path}/janus-tools/command-t/ruby/command-t" do 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 @@ -11,9 +11,9 @@ namespace :plugins do sh "rvm system ruby extconf.rb" end sh "make clean && make" - else - abort "The submodule is not ready, please run 'git submodule update --init'" end + else + abort "The submodule is not ready, please run 'git submodule update --init'" end end From 112ac32cc88babb4e5099bbf17f085fdde7efd71 Mon Sep 17 00:00:00 2001 From: Wael Nasreddine Date: Wed, 2 Nov 2011 04:36:49 +0100 Subject: [PATCH 34/53] Vimrc: Invoke pathogen helptags. --- vimrc | 1 + 1 file changed, 1 insertion(+) diff --git a/vimrc b/vimrc index db6d744e..f1957277 100644 --- a/vimrc +++ b/vimrc @@ -39,6 +39,7 @@ call s:add_group("janus-colors") call s:add_group("janus-command-t") call pathogen#runtime_append_all_bundles() +call pathogen#helptags() "" "" Basic Setup From 1eca19c4e08223df2b666d8f88fc36bef4d66772 Mon Sep 17 00:00:00 2001 From: Wael Nasreddine Date: Wed, 2 Nov 2011 04:44:35 +0100 Subject: [PATCH 35/53] README: Add instruction on how to disable plugins. --- README.md | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 97fb169b..c7b66adf 100644 --- a/README.md +++ b/README.md @@ -57,8 +57,8 @@ Janus For example, to override the default color schemes: - echo color desert > ~/.vimrc.after - echo color molokai > ~/.gvimrc.after + echo color desert >> ~/.vimrc.after + echo color molokai >> ~/.gvimrc.after If you want to add additional Vim plugins you can do so by adding a new submodule in the Janus repository like so: @@ -68,6 +68,12 @@ $ cd ~/.vim $ git submodule add git://github.com/vim-scripts/Rename2.git janus-tools/rename2 ``` +If you want to disable one of the modules, add the folder name of the +plugin without the janus-* group (nerdcommenter for example) to +g:pathogen_disabled in your `~/.vimrc.before` file + + echo "let g:pathogen_disabled = ['nerdcommenter']" >> ~/.vimrc.before + Plugins hosted at [vim.org](http://www.vim.org/scripts) use a unique URL for each version, You can use the GitHub mirror at [https://github.com/vim-scripts](https://github.com/vim-scripts) to get From a48697d078673907e6f86c2d14087721a8e0f5df Mon Sep 17 00:00:00 2001 From: Wael Nasreddine Date: Wed, 2 Nov 2011 01:58:23 +0100 Subject: [PATCH 36/53] Rakefile: Fix typos in the comments --- Rakefile | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/Rakefile b/Rakefile index ef3e6133..9c5e6d6f 100644 --- a/Rakefile +++ b/Rakefile @@ -9,12 +9,7 @@ def expand(file) File.expand_path(file) end -namespace :plugins do - task :install do - # dummy task for plugins installations hooku. - end -end - +# Load all plugin installation tasks Dir["#{root_path}/janus-*/tasks/**.rake"].each { |f| load f } task expand("~/.vimrc") => "vimrc" do @@ -31,8 +26,8 @@ task :update do sh "git submodule update" end -task :install => [:update, "plugins:install"] do - # Dummy task to run plugins installation tasks +task :install => :update do + # Dummy task. end task :default => [:install, expand("~/.vimrc"), expand("~/.gvimrc")] From 01868d0f5d9ef22278c4a5ff40a247f31eb081ed Mon Sep 17 00:00:00 2001 From: Wael Nasreddine Date: Wed, 2 Nov 2011 01:58:23 +0100 Subject: [PATCH 37/53] Rakefile: Fix typos in the comments --- Rakefile | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/Rakefile b/Rakefile index ef3e6133..9c5e6d6f 100644 --- a/Rakefile +++ b/Rakefile @@ -9,12 +9,7 @@ def expand(file) File.expand_path(file) end -namespace :plugins do - task :install do - # dummy task for plugins installations hooku. - end -end - +# Load all plugin installation tasks Dir["#{root_path}/janus-*/tasks/**.rake"].each { |f| load f } task expand("~/.vimrc") => "vimrc" do @@ -31,8 +26,8 @@ task :update do sh "git submodule update" end -task :install => [:update, "plugins:install"] do - # Dummy task to run plugins installation tasks +task :install => :update do + # Dummy task. end task :default => [:install, expand("~/.vimrc"), expand("~/.gvimrc")] From 2686b71ea3cfeae8e53d8bbed8201a469a8cb174 Mon Sep 17 00:00:00 2001 From: Wael Nasreddine Date: Wed, 2 Nov 2011 05:35:51 +0100 Subject: [PATCH 38/53] Rakefile: Add a vim_install_plugin method to simply plugin installation process. --- Rakefile | 41 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/Rakefile b/Rakefile index 9c5e6d6f..44b62a01 100644 --- a/Rakefile +++ b/Rakefile @@ -1,3 +1,9 @@ +module Janus + # Errors + JanusError = Class.new Exception + BlockNotGivenError = Class.new JanusError +end + # Return the root path # # @return [String] The absolute path to Janus repository @@ -9,8 +15,41 @@ def expand(file) File.expand_path(file) end +# Install a plugin +# +# @param [String] The group the plugin belongs to +# @param [String] The plugin name +# @param [&block] The installation block +def install_vim_plugin(group, name, &block) + raise Janus::BlockNotGivenError unless block_given? + + # Create a namespace for the plugin + namespace(name) do + task :verify_plugin do + unless Dir["#{root_path}/#{group}/#{name}/**"].any? + abort "The submodule #{group}/#{name} is not ready, please run 'git submodule update --init'" + end + end + + # Define the plugin installation task + desc "Install #{name} plugin." + task :install do + puts + puts "*" * 40 + puts "*#{"Installing #{name}".center(38)}*" + puts "*" * 40 + puts + yield + end + task :install => :verify_plugin + end + + # Hook the plugin's install task to the global install task + task :install => "#{name}:install" +end + # Load all plugin installation tasks -Dir["#{root_path}/janus-*/tasks/**.rake"].each { |f| load f } +Dir["#{root_path}/janus-*/tasks/**.rake"].each { |f| import f } task expand("~/.vimrc") => "vimrc" do sh "ln -s ~/.vim/vimrc ~/.vimrc" From f2f9c971e8103c8cc3630068f74c15b20919bca5 Mon Sep 17 00:00:00 2001 From: Wael Nasreddine Date: Wed, 2 Nov 2011 06:05:11 +0100 Subject: [PATCH 39/53] Janus tools/Command T: Update the install script to use the new method. --- janus-tools/tasks/command-t.rake | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/janus-tools/tasks/command-t.rake b/janus-tools/tasks/command-t.rake index 55b822fb..5160cf56 100644 --- a/janus-tools/tasks/command-t.rake +++ b/janus-tools/tasks/command-t.rake @@ -1,21 +1,12 @@ -namespace :plugins do - desc "Install the command-t plugin." - task :install_command_t do - if File.exists?("#{root_path}/janus-tools/command-t/ruby/command-t") - Dir.chdir "#{root_path}/janus-tools/command-t/ruby/command-t" do - 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" - end - sh "make clean && make" - end - else - abort "The submodule is not ready, please run 'git submodule update --init'" +install_vim_plugin "janus-tools", "command-t" do + Dir.chdir "#{root_path}/janus-tools/command-t/ruby/command-t" do + 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" end + sh "make clean && make" end - - task :install => :install_command_t end From 71f3c8b135e52e3451684f287af845330f14c407 Mon Sep 17 00:00:00 2001 From: Wael Nasreddine Date: Wed, 2 Nov 2011 06:11:30 +0100 Subject: [PATCH 40/53] Rakefile: Add a method to install a gem --- Rakefile | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Rakefile b/Rakefile index 71e09585..a7d1ec2c 100644 --- a/Rakefile +++ b/Rakefile @@ -27,6 +27,21 @@ def find_gem(gem_name) end end +# Install a gem +# +# @param [String] The gem name +def install_gem(gem_name) + require 'rubygems' + + # Install the gem only if it can't be found + if find_gem(gem_name).length == 0 + sh "gem install #{gem_name}" + end +rescue Janus::RubyGemsNotFoundError + puts "Could not install the gem #{gem_name}, please do so manually." + puts "gem install #{gem_name}" +end + task expand("~/.vimrc") => "vimrc" do sh "ln -s ~/.vim/vimrc ~/.vimrc" end From 34bccca685b5dc6314646feba9306725fc466609 Mon Sep 17 00:00:00 2001 From: Wael Nasreddine Date: Wed, 2 Nov 2011 06:11:56 +0100 Subject: [PATCH 41/53] Janus Tools/Hammer: Use the new syntax to install the plugin. --- janus-tools/tasks/hammer.rake | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/janus-tools/tasks/hammer.rake b/janus-tools/tasks/hammer.rake index 70c4aaaa..de530843 100644 --- a/janus-tools/tasks/hammer.rake +++ b/janus-tools/tasks/hammer.rake @@ -1,18 +1,4 @@ -namespace :plugins do - desc "Install the hammer plugin." - task :install_hammer do - begin - if find_gem('github-markup').length == 0 - sh "gem install github-markup" - end - if find_gem('redcarpet').length == 0 - sh "gem install redcarpet" - end - rescue Janus::RubyGemsNotFoundError - puts "Could not install github-markup and redcarpet, please install them manually." - puts "gem install github-markup redcarpet" - end - end - - task :install => :install_hammer +install_vim_plugin "janus-tools", "hammer" do + install_gem 'github-markup' + install_gem 'redcarpet' end From 79b173a6862e6b066822fb6945fa8c0cff5e1279 Mon Sep 17 00:00:00 2001 From: Wael Nasreddine Date: Wed, 2 Nov 2011 09:52:47 +0100 Subject: [PATCH 42/53] Janus core/Pathogen: Init. --- .gitmodules | 3 +++ janus-core/pathogen | 1 + 2 files changed, 4 insertions(+) create mode 160000 janus-core/pathogen diff --git a/.gitmodules b/.gitmodules index 2f189b28..7f3e4648 100644 --- a/.gitmodules +++ b/.gitmodules @@ -46,3 +46,6 @@ [submodule "janus-langs/coffeescript"] path = janus-langs/coffeescript url = https://github.com/kchmck/vim-coffee-script.git +[submodule "janus-core/pathogen"] + path = janus-core/pathogen + url = git://github.com/tpope/vim-pathogen.git diff --git a/janus-core/pathogen b/janus-core/pathogen new file mode 160000 index 00000000..00ce0614 --- /dev/null +++ b/janus-core/pathogen @@ -0,0 +1 @@ +Subproject commit 00ce0614f0526708431243ca6b126a3bec802697 From 7afb85d6405af657a70a734f125d4c2ab02501f6 Mon Sep 17 00:00:00 2001 From: Wael Nasreddine Date: Wed, 2 Nov 2011 10:02:39 +0100 Subject: [PATCH 43/53] Janus core/Pathogen: Add installation tasks. --- autoload/pathogen.vim | 142 --------------------------------- janus-core/tasks/pathogen.rake | 6 ++ 2 files changed, 6 insertions(+), 142 deletions(-) delete mode 100644 autoload/pathogen.vim create mode 100644 janus-core/tasks/pathogen.rake diff --git a/autoload/pathogen.vim b/autoload/pathogen.vim deleted file mode 100644 index e10fac98..00000000 --- a/autoload/pathogen.vim +++ /dev/null @@ -1,142 +0,0 @@ -" pathogen.vim - path option manipulation -" Maintainer: Tim Pope -" Version: 1.3 - -" Install in ~/.vim/autoload (or ~\vimfiles\autoload). -" -" API is documented below. - -if exists("g:loaded_pathogen") || &cp - finish -endif -let g:loaded_pathogen = 1 - -" Split a path into a list. -function! pathogen#split(path) abort " {{{1 - if type(a:path) == type([]) | return a:path | endif - let split = split(a:path,'\\\@ Date: Wed, 2 Nov 2011 10:03:38 +0100 Subject: [PATCH 44/53] Gitignore: Ignore autoload/pathogen.vim file. --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..33d36bfb --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +# Vim files +autoload/pathogen.vim From 6bcde978cc10ad3e52db6679ebbd6a832db6a0ef Mon Sep 17 00:00:00 2001 From: Wael Nasreddine Date: Wed, 2 Nov 2011 10:28:36 +0100 Subject: [PATCH 45/53] Rakefile: Allow gem requirements (so we'd have something like bundler working, just for installing gems anyway). --- Rakefile | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Rakefile b/Rakefile index a7d1ec2c..9122a792 100644 --- a/Rakefile +++ b/Rakefile @@ -11,16 +11,17 @@ end # Find an installed gem # # @param [String] The gem name to search for +# @param [Mixed] The gem requirements # @return [Array] The found gems -def find_gem(gem_name) +def find_gem(gem_name, *requirements) begin require 'rubygems' if Gem.const_defined?(:Specification) - Gem::Specification.find_all_by_name(gem_name) + Gem::Specification.find_all_by_name(gem_name, *requirements) elsif Gem.respond_to?(:source_index) - Gem.source_index.find_name(gem_name) + Gem.source_index.find_name(gem_name, *requirements) else - Gem.cache.find_name(gem_name) + Gem.cache.find_name(gem_name, *requirements) end rescue LoadError raise Janus::RubyGemsNotFoundError From 357dbd4d3e9fbebdd60ead0a01f8474fd5bf1f11 Mon Sep 17 00:00:00 2001 From: Wael Nasreddine Date: Wed, 2 Nov 2011 12:25:26 +0100 Subject: [PATCH 46/53] Rakefile: Add a task to easly update all submodules. --- Rakefile | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/Rakefile b/Rakefile index ae82ef14..e4fce37d 100644 --- a/Rakefile +++ b/Rakefile @@ -6,6 +6,38 @@ task expand("~/.vimrc") => "vimrc" do sh "ln -s ~/.vim/vimrc ~/.vimrc" end +# Get a list of submodules +# +# @return [Array] of submodules +def submodules + `git submodule`.split("\n").collect { |s| s.split(" ")[1] } +end + +# Update a submodule +# +# @param [String] The submodule to update (relative path) +# @param [String] The branch we're tracking +def update_submodule(submodule, branch = "master") + Dir.chdir submodule do + puts + puts "*" * 40 + puts "*#{"Updating #{submodule}".center(38)}*" + puts "*" * 40 + puts + sh "git checkout #{branch}" + sh "git pull" + end +end + +namespace :dev do + desc "Update submodules" + task :update_submodules do + submodules.each do |submodule| + update_submodule(submodule) + end + end +end + task expand("~/.gvimrc") => "gvimrc" do sh "ln -s ~/.vim/gvimrc ~/.gvimrc" end From 4fc7f1ba5e5bf6b65df33402a77bf57ed60d73b3 Mon Sep 17 00:00:00 2001 From: Wael Nasreddine Date: Thu, 3 Nov 2011 01:05:13 +0100 Subject: [PATCH 47/53] Vimrc: Define functions with a bang, sourcing the vim is otherwize followed by errors. --- vimrc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vimrc b/vimrc index 47d74b02..4cf1e10a 100644 --- a/vimrc +++ b/vimrc @@ -3,7 +3,7 @@ "" " Some file types should wrap their text -function s:setupWrapping() +function! s:setupWrapping() set wrap set linebreak set textwidth=72 @@ -12,7 +12,7 @@ endfunction let s:current_file = expand(":p") -function s:add_group(name) +function! s:add_group(name) let resolved = resolve(s:current_file) let dir = fnamemodify(resolved, ":h") let file = dir . "/" . a:name From 9b725e1ce89c31c255126374a2ebf63b5457dd31 Mon Sep 17 00:00:00 2001 From: Wael Nasreddine Date: Thu, 3 Nov 2011 01:05:36 +0100 Subject: [PATCH 48/53] Vimrc: Set ft=markdown for all markdown files. --- vimrc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vimrc b/vimrc index 4cf1e10a..0db1f584 100644 --- a/vimrc +++ b/vimrc @@ -110,8 +110,8 @@ au FileType make set noexpandtab " Set the Ruby filetype for a number of common Ruby files without .rb au BufRead,BufNewFile {Gemfile,Rakefile,Vagrantfile,Thorfile,config.ru,*.rake} set ft=ruby -" Markdown and txt files should wrap -au BufRead,BufNewFile *.{md,markdown,mdown,mkd,mkdn,txt} call s:setupWrapping() +" Make sure all mardown files have the correct filetype set and setup wrapping +au BufRead,BufNewFile *.{md,markdown,mdown,mkd,mkdn,txt} set ft=markdown | call s:setupWrapping() " Treat JSON files like JavaScript au BufNewFile,BufRead *.json set ft=javascript From c208ee36c9672e28a136f3179f6e85de7c2afbf4 Mon Sep 17 00:00:00 2001 From: Wael Nasreddine Date: Thu, 3 Nov 2011 01:06:45 +0100 Subject: [PATCH 49/53] Vimrc: Move ZoomWin mappings into it's own module --- janus-tools/janus/after/plugin/zoomwin.vim | 2 ++ janus-tools/janus/plugin/zoomwin.vim | 0 vimrc | 3 --- 3 files changed, 2 insertions(+), 3 deletions(-) create mode 100644 janus-tools/janus/after/plugin/zoomwin.vim delete mode 100644 janus-tools/janus/plugin/zoomwin.vim diff --git a/janus-tools/janus/after/plugin/zoomwin.vim b/janus-tools/janus/after/plugin/zoomwin.vim new file mode 100644 index 00000000..2ddb90d4 --- /dev/null +++ b/janus-tools/janus/after/plugin/zoomwin.vim @@ -0,0 +1,2 @@ +" Map to ZoomWin +map :ZoomWin diff --git a/janus-tools/janus/plugin/zoomwin.vim b/janus-tools/janus/plugin/zoomwin.vim deleted file mode 100644 index e69de29b..00000000 diff --git a/vimrc b/vimrc index 0db1f584..cf234d30 100644 --- a/vimrc +++ b/vimrc @@ -136,9 +136,6 @@ map te :tabe =expand("%:p:h") . "/" map gj map gk -" Map to ZoomWin -map :ZoomWin - " Toggle hlsearch with hs nmap hs :set hlsearch! hlsearch? From 2a5d6e807b18458c4749ac85e06c2675083f8cbd Mon Sep 17 00:00:00 2001 From: Wael Nasreddine Date: Thu, 3 Nov 2011 01:07:50 +0100 Subject: [PATCH 50/53] CommandT: Add mappings for non-osx systems. --- janus-command-t/janus/plugin/command-t.vim | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/janus-command-t/janus/plugin/command-t.vim b/janus-command-t/janus/plugin/command-t.vim index a21f73e7..6feaad09 100644 --- a/janus-command-t/janus/plugin/command-t.vim +++ b/janus-command-t/janus/plugin/command-t.vim @@ -1,6 +1,18 @@ if has("gui_macvim") macmenu &File.New\ Tab key= + map :CommandT - imap :CommandT + imap :CommandT + + map :CommandTFlush + imap :CommandTFlush +else + map :CommandT + imap :CommandT + + map :CommandTFlush + imap :CommandTFlush endif +map :CommandTBuffer +imap :CommandTBuffer From 94702074deb373169992e5d8190c6b06cd0685f2 Mon Sep 17 00:00:00 2001 From: Wael Nasreddine Date: Thu, 3 Nov 2011 01:08:12 +0100 Subject: [PATCH 51/53] NERDCommenter: Add mappings for non-osx systems. --- janus-core/janus/after/plugin/NERD_commenter.vim | 3 +++ 1 file changed, 3 insertions(+) diff --git a/janus-core/janus/after/plugin/NERD_commenter.vim b/janus-core/janus/after/plugin/NERD_commenter.vim index e3ad4780..9d146a97 100644 --- a/janus-core/janus/after/plugin/NERD_commenter.vim +++ b/janus-core/janus/after/plugin/NERD_commenter.vim @@ -1,4 +1,7 @@ if has("gui_macvim") map NERDCommenterToggle imap NERDCommenterTogglei +else + map / NERDCommenterToggle + imap / NERDCommenterTogglei endif From 43dbaa753fef05a2cdd9bb0c61825182e499fbd2 Mon Sep 17 00:00:00 2001 From: Wael Nasreddine Date: Thu, 3 Nov 2011 01:08:30 +0100 Subject: [PATCH 52/53] Janus: Add mappings for non-osx systems. --- janus-core/janus/plugin/janus.vim | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/janus-core/janus/plugin/janus.vim b/janus-core/janus/plugin/janus.vim index 0fd9545c..fcf3b9c5 100644 --- a/janus-core/janus/plugin/janus.vim +++ b/janus-core/janus/plugin/janus.vim @@ -12,4 +12,18 @@ if has("gui_macvim") imap >>i imap < >gv + vmap >> + nmap << + + omap >> + omap << + + imap >>i + imap < Date: Thu, 3 Nov 2011 01:38:08 +0100 Subject: [PATCH 53/53] Vimrc: Ignore output files and ruby temp files in the wildmenu. --- vimrc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/vimrc b/vimrc index cf234d30..c5c360fc 100644 --- a/vimrc +++ b/vimrc @@ -78,7 +78,9 @@ set smartcase " ... unless they contain at least one capital letter " TODO: Investigate the precise meaning of these settings " set wildmode=list:longest,list:full -" set wildignore+=*.o,*.obj,.git,*.rbc,*.class,.svn,vendor/gems/* + +" Disable output and VCS files +set wildignore+=*.o,*.out,*.obj,.git,*.rbc,*.class,.svn,vendor/gems/*,.bundle/*,.sass-cache/* "" "" Status bar