├── janus ├── vim │ ├── tools │ │ ├── janus │ │ │ └── after │ │ │ │ └── plugin │ │ │ │ ├── kwbd.vim │ │ │ │ ├── tagbar.vim │ │ │ │ ├── zoomwin.vim │ │ │ │ ├── gundo.vim │ │ │ │ ├── syntastic.vim │ │ │ │ ├── unimpaired.vim │ │ │ │ ├── fugitive.vim │ │ │ │ ├── gist.vim │ │ │ │ ├── NERD_commenter.vim │ │ │ │ ├── ctrlp.vim │ │ │ │ ├── ack.vim │ │ │ │ └── nerdtree.vim │ │ ├── before │ │ │ └── plugin │ │ │ │ └── nerdtree.vim │ │ └── tasks │ │ │ └── watchtower.rake │ ├── core │ │ ├── before │ │ │ └── plugin │ │ │ │ ├── autocmds.vim │ │ │ │ ├── gui_settings.vim │ │ │ │ ├── statusline.vim │ │ │ │ ├── filetypes.vim │ │ │ │ ├── settings.vim │ │ │ │ ├── mappings.vim │ │ │ │ └── janus.vim │ │ ├── janus │ │ │ ├── after │ │ │ │ └── plugin │ │ │ │ │ └── vimrc_after.vim │ │ │ └── doc │ │ │ │ └── janus.txt │ │ └── plugins.vim │ ├── gvimrc │ ├── langs │ │ └── tasks │ │ │ └── mustache.rake │ └── vimrc ├── ruby │ ├── janus │ │ ├── vim.rb │ │ ├── errors.rb │ │ ├── github.rb │ │ ├── git.rb │ │ ├── gems.rb │ │ └── plugins.rb │ └── janus.rb └── submodules.yaml ├── .gitignore ├── bootstrap.sh ├── Rakefile ├── .gitmodules └── README.md /janus/vim/tools/janus/after/plugin/kwbd.vim: -------------------------------------------------------------------------------- 1 | call janus#add_mapping('kwbd', 'nmap', '!', 'Kwbd') 2 | -------------------------------------------------------------------------------- /janus/vim/tools/before/plugin/nerdtree.vim: -------------------------------------------------------------------------------- 1 | if !janus#is_plugin_disabled("nerdtree") 2 | let NERDTreeHijackNetrw = 0 3 | endif 4 | -------------------------------------------------------------------------------- /janus/vim/tools/janus/after/plugin/tagbar.vim: -------------------------------------------------------------------------------- 1 | " Tagbar mappings. 2 | call janus#add_mapping('tagbar', 'map', 'rt', ':TagbarToggle') 3 | -------------------------------------------------------------------------------- /janus/vim/core/before/plugin/autocmds.vim: -------------------------------------------------------------------------------- 1 | if has("autocmd") 2 | if exists("g:autosave_on_blur") 3 | au FocusLost * silent! wall 4 | endif 5 | endif 6 | -------------------------------------------------------------------------------- /janus/vim/tools/janus/after/plugin/zoomwin.vim: -------------------------------------------------------------------------------- 1 | " Map to ZoomWin 2 | call janus#add_mapping('zoomwin', 'map', 'zw', ':ZoomWin') 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # ViM files 2 | _backup 3 | _temp 4 | .netrwhist 5 | 6 | # Vimius file 7 | .vimius 8 | 9 | # Plugins without git-mirror 10 | watchtower.vim 11 | mustache.vim 12 | -------------------------------------------------------------------------------- /janus/ruby/janus/vim.rb: -------------------------------------------------------------------------------- 1 | module Janus 2 | module VIM 3 | extend self 4 | 5 | # Folders 6 | def folders 7 | %w[ _backup _temp ] 8 | end 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /janus/ruby/janus/errors.rb: -------------------------------------------------------------------------------- 1 | module Janus 2 | # Errors 3 | JanusError = Class.new Exception 4 | BlockNotGivenError = Class.new JanusError 5 | RubyGemsNotFoundError = Class.new JanusError 6 | end 7 | -------------------------------------------------------------------------------- /janus/vim/tools/janus/after/plugin/gundo.vim: -------------------------------------------------------------------------------- 1 | " Toggle Gundo 2 | call janus#add_mapping('gundo', 'nmap', '', ':GundoToggle') 3 | call janus#add_mapping('gundo', 'imap', '', ':GundoToggle') 4 | -------------------------------------------------------------------------------- /janus/vim/tools/janus/after/plugin/syntastic.vim: -------------------------------------------------------------------------------- 1 | if janus#is_plugin_enabled('syntastic') 2 | let g:syntastic_enable_signs=1 3 | let g:syntastic_quiet_warnings=0 4 | let g:syntastic_auto_loc_list=2 5 | endif 6 | -------------------------------------------------------------------------------- /janus/vim/core/before/plugin/gui_settings.vim: -------------------------------------------------------------------------------- 1 | if has("gui_running") 2 | if has("autocmd") 3 | " Automatically resize splits when resizing MacVim window 4 | autocmd VimResized * wincmd = 5 | endif 6 | endif 7 | -------------------------------------------------------------------------------- /janus/vim/core/janus/after/plugin/vimrc_after.vim: -------------------------------------------------------------------------------- 1 | " Customization 2 | " 3 | " This loads after the janus plugins so that janus-specific plugin mappings can 4 | " be overwritten. 5 | 6 | if filereadable(expand("~/.vimrc.after")) 7 | source ~/.vimrc.after 8 | endif 9 | -------------------------------------------------------------------------------- /janus/vim/tools/tasks/watchtower.rake: -------------------------------------------------------------------------------- 1 | install_vim_plugin "tools", "watchtower" do |module_loaded| 2 | download_and_save_file github_raw("TechnoGate/watch_tower/master/lib/watch_tower/editor/extensions/watchtower.vim"), 3 | "janus/vim/tools/watchtower/autoload/watchtower.vim" 4 | end 5 | -------------------------------------------------------------------------------- /janus/ruby/janus/github.rb: -------------------------------------------------------------------------------- 1 | module Janus 2 | 3 | # Return a fully-qualified url to the raw page of a file stores inside 4 | # a repository on github 5 | # 6 | # @param [String] Path 7 | # @return [String] URL 8 | def github_raw(path) 9 | "https://raw.github.com/#{path}" 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /janus/vim/core/before/plugin/statusline.vim: -------------------------------------------------------------------------------- 1 | if has("statusline") && !&cp 2 | set laststatus=2 " always show the status bar 3 | 4 | " Start the status line 5 | set statusline=%f\ %m\ %r 6 | set statusline+=Line:%l/%L[%p%%] 7 | set statusline+=Col:%v 8 | set statusline+=Buf:#%n 9 | set statusline+=[%b][0x%B] 10 | endif 11 | -------------------------------------------------------------------------------- /janus/vim/gvimrc: -------------------------------------------------------------------------------- 1 | if filereadable(expand("~/.gvimrc.before")) 2 | source ~/.gvimrc.before 3 | endif 4 | 5 | " CtrlP OS-X Menu remapping 6 | if janus#is_plugin_enabled('ctrlp') && has("gui_macvim") 7 | macmenu &File.New\ Tab key= 8 | endif 9 | 10 | if filereadable(expand("~/.gvimrc.after")) 11 | source ~/.gvimrc.after 12 | endif 13 | -------------------------------------------------------------------------------- /janus/vim/langs/tasks/mustache.rake: -------------------------------------------------------------------------------- 1 | install_vim_plugin "langs", "mustache" do |module_loaded| 2 | download_and_save_file github_raw("defunkt/mustache/master/contrib/mustache.vim"), 3 | "janus/vim/langs/mustache/syntax/mustache.vim" 4 | open_and_save_file "janus/vim/langs/mustache/ftdetect/mustache.vim", 5 | "au BufNewFile,BufRead *.mustache setf mustache" 6 | end 7 | -------------------------------------------------------------------------------- /janus/vim/tools/janus/after/plugin/unimpaired.vim: -------------------------------------------------------------------------------- 1 | " Normal Mode: Bubble single lines 2 | call janus#add_mapping('unimpaired', 'nmap', '', '[e') 3 | call janus#add_mapping('unimpaired', 'nmap', '', ']e') 4 | 5 | " Visual Mode: Bubble multiple lines 6 | call janus#add_mapping('unimpaired', 'vmap', '', '[egv') 7 | call janus#add_mapping('unimpaired', 'vmap', '', ']egv') 8 | -------------------------------------------------------------------------------- /janus/vim/tools/janus/after/plugin/fugitive.vim: -------------------------------------------------------------------------------- 1 | " Janus mappings 2 | call janus#add_mapping('fugitive', 'nmap', 'gb', ':Gblame') 3 | call janus#add_mapping('fugitive', 'nmap', 'gs', ':Gstatus') 4 | call janus#add_mapping('fugitive', 'nmap', 'gd', ':Gdiff') 5 | call janus#add_mapping('fugitive', 'nmap', 'gl', ':Glog') 6 | call janus#add_mapping('fugitive', 'nmap', 'gc', ':Gcommit') 7 | call janus#add_mapping('fugitive', 'nmap', 'gp', ':Git push') 8 | -------------------------------------------------------------------------------- /janus/vim/tools/janus/after/plugin/gist.vim: -------------------------------------------------------------------------------- 1 | if janus#is_plugin_enabled('gist') 2 | if executable("pbcopy") 3 | " The copy command 4 | let g:gist_clip_command = 'pbcopy' 5 | elseif executable("xclip") 6 | " The copy command 7 | let g:gist_clip_command = 'xclip -selection clipboard' 8 | elseif executable("putclip") 9 | " The copy command 10 | let g:gist_clip_command = 'putclip' 11 | end 12 | 13 | " detect filetype if vim failed auto-detection. 14 | let g:gist_detect_filetype = 1 15 | endif 16 | -------------------------------------------------------------------------------- /janus/vim/tools/janus/after/plugin/NERD_commenter.vim: -------------------------------------------------------------------------------- 1 | " NERDCommenter mappings 2 | if has("gui_macvim") && has("gui_running") 3 | call janus#add_mapping('nerdcommenter', 'map', '', 'NERDCommenterToggle') 4 | call janus#add_mapping('nerdcommenter', 'imap', '', 'NERDCommenterTogglei') 5 | else 6 | call janus#add_mapping('nerdcommenter', 'map', '/', 'NERDCommenterToggle') 7 | call janus#add_mapping('nerdcommenter', 'imap', '/', 'NERDCommenterTogglei') 8 | endif 9 | -------------------------------------------------------------------------------- /janus/vim/tools/janus/after/plugin/ctrlp.vim: -------------------------------------------------------------------------------- 1 | if janus#is_plugin_enabled("ctrlp") 2 | let g:ctrlp_map = '' 3 | let g:ctrlp_custom_ignore = { 4 | \ 'dir': '\.git$\|\.hg$\|\.svn$', 5 | \ 'file': '\.pyc$\|\.pyo$\|\.rbc$|\.rbo$\|\.class$\|\.o$\|\~$\', 6 | \ } 7 | endif 8 | 9 | if has("gui_macvim") && has("gui_running") 10 | call janus#add_mapping('ctrlp', 'map', '', ':CtrlP') 11 | call janus#add_mapping('ctrlp', 'imap', '', ':CtrlP') 12 | else 13 | call janus#add_mapping('ctrlp', 'map', '', ':CtrlP') 14 | call janus#add_mapping('ctrlp', 'imap', '', ':CtrlP') 15 | endif 16 | -------------------------------------------------------------------------------- /janus/vim/tools/janus/after/plugin/ack.vim: -------------------------------------------------------------------------------- 1 | if has("gui_macvim") && has("gui_running") 2 | " Command-Shift-F on OSX 3 | call janus#add_mapping('ack', 'map', '', ':Ack') 4 | else 5 | " Define to a dummy value to see if it would set as well. 6 | map :dummy 7 | 8 | if maparg("") == ":dummy" 9 | " f on systems where == 10 | call janus#add_mapping('ack', 'map', 'f', ':Ack') 11 | else 12 | " if we can still map to 13 | call janus#add_mapping('ack', 'map', '', ':Ack') 14 | endif 15 | 16 | map 17 | endif 18 | -------------------------------------------------------------------------------- /bootstrap.sh: -------------------------------------------------------------------------------- 1 | function die() 2 | { 3 | echo "${@}" 4 | exit 1 5 | } 6 | 7 | # Add .old to any existing Vim file in the home directory 8 | for i in $HOME/.vim $HOME/.vimrc $HOME/.gvimrc; do 9 | if [[ ( -e $i ) || ( -h $i ) ]]; then 10 | echo "${i} has been renamed to ${i}.old" 11 | mv "${i}" "${i}.old" || die "Could not move ${i} to ${i}.old" 12 | fi 13 | done 14 | 15 | # Clone Janus into .vim 16 | git clone https://github.com/carlhuda/janus.git $HOME/.vim \ 17 | || die "Could not clone the repository to ${HOME}/.vim" 18 | 19 | # Run rake inside .vim 20 | cd $HOME/.vim || die "Could not go into the ${HOME}/.vim" 21 | rake || die "Rake failed." 22 | -------------------------------------------------------------------------------- /janus/ruby/janus/git.rb: -------------------------------------------------------------------------------- 1 | module Janus 2 | # Get a list of submodules 3 | # 4 | # @return [Array] of submodules 5 | def submodules 6 | `git submodule`.split("\n").collect { |s| s.split(" ")[1] } 7 | end 8 | 9 | # Update a submodule 10 | # 11 | # @param [String] The submodule to update (relative path) 12 | # @param [String] The branch we're tracking 13 | def update_submodule(submodule, branch = "master") 14 | Dir.chdir submodule do 15 | puts 16 | puts "*" * 40 17 | puts "*#{"Updating #{submodule}".center(38)}*" 18 | puts "*" * 40 19 | puts 20 | sh "git checkout #{branch}" 21 | sh "git pull" 22 | end 23 | end 24 | end 25 | -------------------------------------------------------------------------------- /janus/vim/vimrc: -------------------------------------------------------------------------------- 1 | "" 2 | "" Janus setup 3 | "" 4 | 5 | " Define paths 6 | let g:janus_path = escape(fnamemodify(resolve(expand(":p")), ":h"), ' ') 7 | let g:janus_vim_path = escape(fnamemodify(resolve(expand(":p" . "vim")), ":h"), ' ') 8 | let g:janus_custom_path = expand("~/.janus") 9 | 10 | " Source janus's core 11 | exe 'source ' . g:janus_vim_path . '/core/before/plugin/janus.vim' 12 | 13 | " You should note that groups will be processed by Pathogen in reverse 14 | " order they were added. 15 | call janus#add_group("tools") 16 | call janus#add_group("langs") 17 | call janus#add_group("colors") 18 | 19 | "" 20 | "" Customisations 21 | "" 22 | 23 | if filereadable(expand("~/.vimrc.before")) 24 | source ~/.vimrc.before 25 | endif 26 | 27 | 28 | " Disable plugins prior to loading pathogen 29 | exe 'source ' . g:janus_vim_path . '/core/plugins.vim' 30 | 31 | "" 32 | "" Pathogen setup 33 | "" 34 | 35 | " Load all groups, custom dir, and janus core 36 | call janus#load_pathogen() 37 | 38 | " .vimrc.after is loaded after the plugins have loaded 39 | -------------------------------------------------------------------------------- /janus/vim/core/plugins.vim: -------------------------------------------------------------------------------- 1 | " Variables 2 | let s:no_python_support = "Vim is compiled without python support" 3 | let s:no_ruby_support = "Vim is compiled without ruby support" 4 | 5 | " Plugins that requires python support 6 | if !has("python") 7 | call janus#disable_plugin("gundo", s:no_python_support) 8 | endif 9 | 10 | " Plugins that requires ruby support 11 | if !has("ruby") 12 | call janus#disable_plugin("ruby", s:no_ruby_support) 13 | endif 14 | 15 | " Ack requires ack command 16 | if !executable("ack") 17 | call janus#disable_plugin("ack", "The ack program is not installed") 18 | endif 19 | 20 | " Gist-vim requires curl 21 | if !executable("curl") 22 | call janus#disable_plugin("gist", "The curl program is not installed") 23 | endif 24 | 25 | " Tagbar requires ctags 26 | if !executable("ctags") 27 | call janus#disable_plugin("tagbar", "The ctags program is not installed") 28 | endif 29 | 30 | " nodejs does not protect itself 31 | " See #336 32 | if exists("*DetectNode") 33 | call janus#disable_plugin("nodejs", "Nodejs already exists on your system.") 34 | endif 35 | -------------------------------------------------------------------------------- /janus/ruby/janus/gems.rb: -------------------------------------------------------------------------------- 1 | module Janus 2 | # Find an installed gem 3 | # 4 | # @param [String] The gem name to search for 5 | # @param [Mixed] The gem requirements 6 | # @return [Array] The found gems 7 | def find_gem(gem_name, *requirements) 8 | begin 9 | require 'rubygems' 10 | if Gem.const_defined?(:Specification) && Gem::Specification.respond_to?(:find_all_by_name) 11 | Gem::Specification.find_all_by_name(gem_name, *requirements) 12 | elsif Gem.respond_to?(:source_index) 13 | Gem.source_index.find_name(gem_name, *requirements) 14 | else 15 | Gem.cache.find_name(gem_name, *requirements) 16 | end 17 | rescue LoadError 18 | raise RubyGemsNotFoundError 19 | end 20 | end 21 | 22 | # Install a gem 23 | # 24 | # @param [String] The gem name 25 | def install_gem(gem_name) 26 | require 'rubygems' 27 | 28 | # Install the gem only if it can't be found 29 | if find_gem(gem_name).length == 0 30 | # XXX: We should not run sudo if we do not need to! 31 | sudo "gem install #{gem_name}" 32 | end 33 | rescue RubyGemsNotFoundError 34 | puts "Could not install the gem #{gem_name}, please do so manually." 35 | puts "sudo gem install #{gem_name}" 36 | end 37 | end 38 | -------------------------------------------------------------------------------- /janus/ruby/janus.rb: -------------------------------------------------------------------------------- 1 | module Janus 2 | # Return the root path 3 | # 4 | # @return [String] The absolute path to Janus repository 5 | def root_path 6 | ROOT_PATH 7 | end 8 | 9 | # Return Janus path 10 | # 11 | # @return [String] The absolute path to Janus distribution 12 | def janus_path 13 | File.join ROOT_PATH, 'janus' 14 | end 15 | 16 | # Return the vim's path 17 | # 18 | # @return [String] The absolute path to ViM files 19 | def vim_path 20 | File.join janus_path, 'vim' 21 | end 22 | 23 | # Return the ruby's path 24 | # 25 | # @return [String] The absolute path to Ruby files 26 | def ruby_path 27 | File.join janus_path, 'ruby' 28 | end 29 | 30 | # Expand the path of a given file 31 | # 32 | # @param [Array] args 33 | # @return [String] The expanded path to the given file. 34 | def expand(*args) 35 | File.expand_path(*args) 36 | end 37 | 38 | # Execute a command under root 39 | # 40 | # @param [String]* commands to run 41 | def sudo(*args) 42 | if ENV["USER"] != "root" 43 | command = "sudo #{args.join(" ")}" 44 | puts "Please enter your password (if requested) for executing the command '#{command}'" 45 | else 46 | command = args.join(" ") 47 | end 48 | 49 | exec command 50 | end 51 | end 52 | 53 | require 'janus/errors' 54 | require 'janus/git' 55 | require 'janus/vim' 56 | require 'janus/gems' 57 | require 'janus/github' 58 | require 'janus/plugins' 59 | -------------------------------------------------------------------------------- /janus/vim/tools/janus/after/plugin/nerdtree.vim: -------------------------------------------------------------------------------- 1 | if janus#is_plugin_enabled("nerdtree") 2 | let NERDTreeIgnore=['\.pyc$', '\.pyo$', '\.rbc$', '\.rbo$', '\.class$', '\.o$', '\~$'] 3 | 4 | " Default mapping, n 5 | call janus#add_mapping('nerdtree', 'map', 'n', ':NERDTreeToggle') 6 | 7 | augroup AuNERDTreeCmd 8 | autocmd AuNERDTreeCmd VimEnter * call s:CdIfDirectory(expand("")) 9 | autocmd AuNERDTreeCmd FocusGained * call s:UpdateNERDTree() 10 | 11 | " If the parameter is a directory, cd into it 12 | function s:CdIfDirectory(directory) 13 | let explicitDirectory = isdirectory(a:directory) 14 | let directory = explicitDirectory || empty(a:directory) 15 | 16 | if explicitDirectory 17 | exe "cd " . fnameescape(a:directory) 18 | endif 19 | 20 | " Allows reading from stdin 21 | " ex: git diff | mvim -R - 22 | if strlen(a:directory) == 0 23 | return 24 | endif 25 | 26 | if directory 27 | NERDTree 28 | wincmd p 29 | bd 30 | endif 31 | 32 | if explicitDirectory 33 | wincmd p 34 | endif 35 | endfunction 36 | 37 | " NERDTree utility function 38 | function s:UpdateNERDTree(...) 39 | let stay = 0 40 | 41 | if(exists("a:1")) 42 | let stay = a:1 43 | end 44 | 45 | if exists("t:NERDTreeBufName") 46 | let nr = bufwinnr(t:NERDTreeBufName) 47 | if nr != -1 48 | exe nr . "wincmd w" 49 | exe substitute(mapcheck("R"), "", "", "") 50 | if !stay 51 | wincmd p 52 | end 53 | endif 54 | endif 55 | endfunction 56 | endif 57 | -------------------------------------------------------------------------------- /janus/vim/core/before/plugin/filetypes.vim: -------------------------------------------------------------------------------- 1 | "" 2 | "" Helpers 3 | "" 4 | 5 | " Some file types should wrap their text 6 | function! s:setupWrapping() 7 | set wrap 8 | set linebreak 9 | set textwidth=72 10 | set nolist 11 | endfunction 12 | 13 | "" 14 | "" File types 15 | "" 16 | 17 | filetype plugin indent on " Turn on filetype plugins (:help filetype-plugin) 18 | 19 | if has("autocmd") 20 | " In Makefiles, use real tabs, not tabs expanded to spaces 21 | au FileType make setlocal noexpandtab 22 | 23 | " This actually might be confusing, but the plugin +ruby+ already does 24 | " this, so we want to do it only if the plugin +ruby+ is disabled for 25 | " some reason 26 | if janus#is_plugin_disabled("ruby") 27 | " Set the Ruby filetype for a number of common Ruby files without .rb 28 | au BufRead,BufNewFile {Gemfile,Rakefile,Vagrantfile,Thorfile,Procfile,config.ru,*.rake} set ft=ruby 29 | endif 30 | 31 | " Make sure all mardown files have the correct filetype set and setup wrapping 32 | au BufRead,BufNewFile *.{md,markdown,mdown,mkd,mkdn,txt} setf markdown | call s:setupWrapping() 33 | 34 | " Treat JSON files like JavaScript 35 | au BufNewFile,BufRead *.json set ft=javascript 36 | 37 | " make Python follow PEP8 for whitespace ( http://www.python.org/dev/peps/pep-0008/ ) 38 | au FileType python setlocal softtabstop=4 tabstop=4 shiftwidth=4 39 | 40 | " Remember last location in file, but not for commit messages. 41 | " see :help last-position-jump 42 | au BufReadPost * if &filetype !~ '^git\c' && line("'\"") > 0 && line("'\"") <= line("$") 43 | \| exe "normal! g`\"" | endif 44 | endif 45 | -------------------------------------------------------------------------------- /janus/ruby/janus/plugins.rb: -------------------------------------------------------------------------------- 1 | require 'rake' 2 | require 'open-uri' 3 | 4 | module Janus 5 | include Rake::DSL if defined?(Rake::DSL) 6 | 7 | def self.included(base) 8 | # Load all plugin installation tasks 9 | Dir["#{vim_path}/*/tasks/**.rake"].each do |f| 10 | base.send :import, f 11 | end 12 | end 13 | 14 | # Install a plugin 15 | # 16 | # @param [String] The group the plugin belongs to 17 | # @param [String] The plugin name 18 | # @param [&block] The installation block 19 | def install_vim_plugin(group, name, &block) 20 | raise Janus::BlockNotGivenError unless block_given? 21 | 22 | define_install_plugin_tasks(group, name, &block) 23 | end 24 | 25 | # Download and save file 26 | # 27 | # @param [String] url 28 | # @param [String] path 29 | def download_and_save_file(url, path) 30 | open_and_save_file(path, open(url).read) 31 | end 32 | 33 | # Open and save file 34 | # 35 | # @param [String] path 36 | # @param [Value] What to write in the file 37 | # @param [&block] 38 | def open_and_save_file(path, value = nil, &block) 39 | # Make sure the directory up to the folder exists 40 | mkdir_p File.dirname(path) 41 | # Open the file and use either the block or the value to write the 42 | # file 43 | File.open path, 'w' do |f| 44 | if block_given? 45 | f.write(yield) 46 | else 47 | f.write(value) 48 | end 49 | end 50 | end 51 | 52 | protected 53 | 54 | # Define tasks for installing a plugin 55 | # 56 | # @param [String] The group the plugin belongs to 57 | # @param [String] The plugin name 58 | # @param [&block] The installation block 59 | def define_install_plugin_tasks(group, name, &block) 60 | # Create a namespace for the plugin 61 | namespace(name) do 62 | # Define the plugin installation task 63 | desc "Install #{name} plugin." 64 | task :install do 65 | puts 66 | puts "*" * 40 67 | puts "*#{"Installing #{name}".center(38)}*" 68 | puts "*" * 40 69 | puts 70 | yield(Dir["#{vim_path}/#{group}/#{name}/**"].any?) 71 | end 72 | end 73 | 74 | # Hook the plugin's install task to the global install task 75 | task :install => "#{name}:install" 76 | end 77 | end 78 | -------------------------------------------------------------------------------- /janus/vim/core/before/plugin/settings.vim: -------------------------------------------------------------------------------- 1 | "" 2 | "" Basic Setup 3 | "" 4 | 5 | set nocompatible " Use vim, no vi defaults 6 | set number " Show line numbers 7 | set ruler " Show line and column number 8 | syntax enable " Turn on syntax highlighting allowing local overrides 9 | set encoding=utf-8 " Set default encoding to UTF-8 10 | 11 | "" 12 | "" Whitespace 13 | "" 14 | 15 | set nowrap " don't wrap lines 16 | set tabstop=2 " a tab is two spaces 17 | set shiftwidth=2 " an autoindent (with <<) is two spaces 18 | set expandtab " use spaces, not tabs 19 | set list " Show invisible characters 20 | set backspace=indent,eol,start " backspace through everything in insert mode 21 | 22 | if exists("g:enable_mvim_shift_arrow") 23 | let macvim_hig_shift_movement = 1 " mvim shift-arrow-keys 24 | endif 25 | 26 | " List chars 27 | set listchars="" " Reset the listchars 28 | set listchars=tab:\ \ " a tab should display as " ", trailing whitespace as "." 29 | set listchars+=trail:. " show trailing spaces as dots 30 | set listchars+=extends:> " The character to show in the last column when wrap is 31 | " off and the line continues beyond the right of the screen 32 | set listchars+=precedes:< " The character to show in the last column when wrap is 33 | " off and the line continues beyond the right of the screen 34 | 35 | "" 36 | "" Searching 37 | "" 38 | 39 | set hlsearch " highlight matches 40 | set incsearch " incremental searching 41 | set ignorecase " searches are case insensitive... 42 | set smartcase " ... unless they contain at least one capital letter 43 | 44 | "" 45 | "" Wild settings 46 | "" 47 | 48 | " TODO: Investigate the precise meaning of these settings 49 | " set wildmode=list:longest,list:full 50 | 51 | " Disable output and VCS files 52 | set wildignore+=*.o,*.out,*.obj,.git,*.rbc,*.rbo,*.class,.svn,*.gem 53 | 54 | " Disable archive files 55 | set wildignore+=*.zip,*.tar.gz,*.tar.bz2,*.rar,*.tar.xz 56 | 57 | " Ignore bundler and sass cache 58 | set wildignore+=*/vendor/gems/*,*/vendor/cache/*,*/.bundle/*,*/.sass-cache/* 59 | 60 | " Disable temp and backup files 61 | set wildignore+=*.swp,*~,._* 62 | 63 | "" 64 | "" Backup and swap files 65 | "" 66 | 67 | set backupdir=~/.vim/_backup// " where to put backup files. 68 | set directory=~/.vim/_temp// " where to put swap files. 69 | -------------------------------------------------------------------------------- /janus/submodules.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | # Submodules 3 | # 4 | # Each submodule is defined by a name, the name should be the same as the 5 | # folder name. 6 | # 7 | # Each submodule has the following attributes: 8 | # 9 | # Optional: 10 | # +description+: The description of the submodule 11 | # +path+: Override path defaulted to janus/vim/{group}/{name} 12 | # +categories+: The categories for which this plugin belongs to 13 | # +dependencies+: An array of submodules name on which this submodule depends on 14 | submodules: 15 | # Core plugins 16 | # 17 | # Core plugins are installed by default, removal of core plugins is disabled 18 | # We should keep this list as small as possible 19 | core: 20 | pathogen: 21 | 22 | 23 | # Colors 24 | # 25 | colors: 26 | getafe: 27 | github: 28 | irblack: 29 | molokai: 30 | pyte: 31 | sampler-pack: 32 | solarized: 33 | vividchalk: 34 | janus-colors: 35 | dependencies: 36 | - sampler-pack 37 | 38 | 39 | # Langs 40 | # 41 | langs: 42 | arduino: 43 | coffeescript: 44 | categories: 45 | - coffeescript 46 | - syntax 47 | csv: 48 | categories: 49 | - csv 50 | - syntax 51 | cucumber: 52 | categories: 53 | - ruby 54 | - rails 55 | - syntax 56 | - behavior driven development 57 | git: 58 | categories: 59 | - git 60 | - syntax 61 | haml: 62 | categories: 63 | - ruby 64 | - rails 65 | - syntax 66 | handlebars: 67 | javascript: 68 | markdown: 69 | nodejs: 70 | puppet: 71 | rails: 72 | rspec: 73 | ruby: 74 | scala: 75 | scss: 76 | textile: 77 | 78 | 79 | # Tools 80 | # 81 | tools: 82 | ack: 83 | buffergator: 84 | css-color: 85 | ctrlp: 86 | easymotion: 87 | endwise: 88 | fugitive: 89 | webapi: 90 | gist: 91 | dependencies: 92 | - webapi 93 | gundo: 94 | indent-object: 95 | kwbd: 96 | matchit: 97 | narrowregion: 98 | nerdcommenter: 99 | nerdtree: 100 | snipmate: 101 | dependencies: 102 | - vim-addon-mw-utils 103 | - tlib 104 | snipmate-snippets: 105 | dependencies: 106 | - snipmate 107 | supertab: 108 | surround: 109 | syntastic: 110 | tagbar: 111 | tlib: 112 | unimpaired: 113 | vim-addon-mw-utils: 114 | vimwiki: 115 | zoomwin: 116 | rename2: 117 | vroom: 118 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | ROOT_PATH = File.expand_path(File.join(File.dirname(__FILE__))) 2 | $: << File.join(ROOT_PATH, 'janus', 'ruby') 3 | 4 | require 'janus' 5 | require 'fileutils' 6 | include Janus 7 | 8 | desc "link ViM configuration files." 9 | task :link_vim_conf_files do 10 | %w[ vimrc gvimrc ].each do |file| 11 | dest = expand("~/.#{file}") 12 | unless File.exist?(dest) 13 | ln_s(expand("../janus/vim/#{file}", __FILE__), dest) 14 | end 15 | end 16 | end 17 | 18 | namespace :dev do 19 | desc "Update submodules" 20 | task :update_submodules do 21 | submodules.each do |submodule| 22 | update_submodule(submodule) 23 | end 24 | end 25 | 26 | # Taken from RefineryCMD 27 | # https://github.com/resolve/refinerycms/blob/master/core/lib/tasks/refinery.rake 28 | desc 'Removes trailing whitespace across the entire application.' 29 | task :whitespace do 30 | require 'rbconfig' 31 | if RbConfig::CONFIG['host_os'] =~ /linux/ 32 | sh %{find . -name '*.*rb' -o -name '*.*vim' -exec sed -i 's/\t/ /g' {} \\; -exec sed -i 's/ *$//g' {} \\; } 33 | elsif RbConfig::CONFIG['host_os'] =~ /darwin/ 34 | sh %{find . -name '*.*rb' -o -name '*.*vim' -exec sed -i '' 's/\t/ /g' {} \\; -exec sed -i '' 's/ *$//g' {} \\; } 35 | else 36 | puts "This doesn't work on systems other than OSX or Linux. Please use a custom whitespace tool for your platform '#{RbConfig::CONFIG["host_os"]}'." 37 | end 38 | end 39 | end 40 | 41 | desc "Create necessary folders." 42 | task :folders do 43 | Janus::VIM.folders.each do |folder| 44 | mkdir_p folder 45 | end 46 | end 47 | 48 | task :update do 49 | puts "Cleaning the janus folder" 50 | `git clean -xdf -- janus &> /dev/null` 51 | `git ls-files --exclude-standard --others -- janus`.split("\n").each do |untracked| 52 | FileUtils.rm_rf File.expand_path(untracked.chomp, File.dirname(__FILE__)) 53 | end 54 | 55 | puts "Pulling latest changes" 56 | `git pull > /dev/null` 57 | 58 | puts "Cleaning the janus folder" 59 | `git clean -xdf -- janus &> /dev/null` 60 | `git ls-files --exclude-standard --others -- janus`.split("\n").each do |untracked| 61 | FileUtils.rm_rf File.expand_path(untracked.chomp, File.dirname(__FILE__)) 62 | end 63 | 64 | puts "Synchronising submodules urls" 65 | `git submodule sync > /dev/null` 66 | 67 | puts "Updating the submodules" 68 | `git submodule update --init > /dev/null` 69 | end 70 | 71 | task :install => [:folders, :link_vim_conf_files] do 72 | # Dummy task, real work is done with the hooks. 73 | end 74 | 75 | desc "Install or Update Janus." 76 | task :default do 77 | sh "rake update" 78 | sh "rake install" 79 | end 80 | -------------------------------------------------------------------------------- /janus/vim/core/before/plugin/mappings.vim: -------------------------------------------------------------------------------- 1 | "" 2 | "" General Mappings (Normal, Visual, Operator-pending) 3 | "" 4 | 5 | " use :w!! to write to a file using sudo if you forgot to 'sudo vim file' 6 | " (it will prompt for sudo password when writing) 7 | cmap w!! %!sudo tee > /dev/null % 8 | 9 | " Toggle paste mode 10 | nmap :set invpaste:set paste? 11 | imap :set invpaste:set paste? 12 | 13 | " format the entire file 14 | nmap fef ggVG= 15 | 16 | " upper/lower word 17 | nmap u mQviwU`Q 18 | nmap l mQviwu`Q 19 | 20 | " upper/lower first char of word 21 | nmap U mQgewvU`Q 22 | nmap L mQgewvu`Q 23 | 24 | " cd to the directory containing the file in the buffer 25 | nmap cd :lcd %:h 26 | 27 | " Create the directory containing the file in the buffer 28 | nmap md :!mkdir -p %:p:h 29 | 30 | " Some helpers to edit mode 31 | " http://vimcasts.org/e/14 32 | cnoremap %% =expand('%:h').'/' 33 | map ew :e %% 34 | map es :sp %% 35 | map ev :vsp %% 36 | map et :tabe %% 37 | 38 | " Swap two words 39 | nmap gw :s/\(\%#\w\+\)\(\_W\+\)\(\w\+\)/\3\2\1/`' 40 | 41 | " Underline the current line with '=' 42 | nmap ul :t.\|s/./=/g\|:nohls 43 | 44 | " set text wrapping toggles 45 | nmap tw :set invwrap:set wrap? 46 | 47 | " find merge conflict markers 48 | nmap fc /\v^[<=>]{7}( .*\|$) 49 | 50 | " Map the arrow keys to be based on display lines, not physical lines 51 | map gj 52 | map gk 53 | 54 | " Toggle hlsearch with hs 55 | nmap hs :set hlsearch! hlsearch? 56 | 57 | " Adjust viewports to the same size 58 | map = = 59 | 60 | if has("gui_macvim") && has("gui_running") 61 | " Map command-[ and command-] to indenting or outdenting 62 | " while keeping the original selection in visual mode 63 | vmap >gv 64 | vmap >> 67 | nmap << 68 | 69 | omap >> 70 | omap << 71 | 72 | imap >>i 73 | imap < [e 77 | nmap ]e 78 | nmap [e 79 | nmap ]e 80 | 81 | " Bubble multiple lines 82 | vmap [egv 83 | vmap ]egv 84 | vmap [egv 85 | vmap ]egv 86 | 87 | " Map Command-# to switch tabs 88 | map 0gt 89 | imap 0gt 90 | map 1gt 91 | imap 1gt 92 | map 2gt 93 | imap 2gt 94 | map 3gt 95 | imap 3gt 96 | map 4gt 97 | imap 4gt 98 | map 5gt 99 | imap 5gt 100 | map 6gt 101 | imap 6gt 102 | map 7gt 103 | imap 7gt 104 | map 8gt 105 | imap 8gt 106 | map 9gt 107 | imap 9gt 108 | else 109 | " Map command-[ and command-] to indenting or outdenting 110 | " while keeping the original selection in visual mode 111 | vmap >gv 112 | vmap >> 115 | nmap << 116 | 117 | omap >> 118 | omap << 119 | 120 | imap >>i 121 | imap < [e 125 | nmap ]e 126 | nmap [e 127 | nmap ]e 128 | 129 | " Bubble multiple lines 130 | vmap [egv 131 | vmap ]egv 132 | vmap [egv 133 | vmap ]egv 134 | 135 | " Make shift-insert work like in Xterm 136 | map 137 | map! 138 | 139 | " Map Control-# to switch tabs 140 | map 0gt 141 | imap 0gt 142 | map 1gt 143 | imap 1gt 144 | map 2gt 145 | imap 2gt 146 | map 3gt 147 | imap 3gt 148 | map 4gt 149 | imap 4gt 150 | map 5gt 151 | imap 5gt 152 | map 6gt 153 | imap 6gt 154 | map 7gt 155 | imap 7gt 156 | map 8gt 157 | imap 8gt 158 | map 9gt 159 | imap 9gt 160 | endif 161 | 162 | "" 163 | "" Command-Line Mappings 164 | "" 165 | 166 | " Insert the current directory into a command-line path 167 | cmap =expand("%:p:h") . "/" 168 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | # Core 2 | [submodule "janus/vim/core/pathogen"] 3 | path = janus/vim/core/pathogen 4 | url = https://github.com/tpope/vim-pathogen.git 5 | 6 | # Colors 7 | [submodule "janus/vim/colors/sampler-pack"] 8 | path = janus/vim/colors/sampler-pack 9 | url = https://github.com/vim-scripts/Color-Sampler-Pack.git 10 | [submodule "janus/vim/colors/solarized"] 11 | path = janus/vim/colors/solarized 12 | url = https://github.com/altercation/vim-colors-solarized.git 13 | [submodule "janus/vim/colors/irblack"] 14 | path = janus/vim/colors/irblack 15 | url = https://github.com/wgibbs/vim-irblack.git 16 | [submodule "janus/vim/colors/vividchalk"] 17 | path = janus/vim/colors/vividchalk 18 | url = https://github.com/tpope/vim-vividchalk.git 19 | [submodule "janus/vim/colors/molokai"] 20 | path = janus/vim/colors/molokai 21 | url = https://github.com/vim-scripts/molokai.git 22 | [submodule "janus/vim/colors/pyte"] 23 | path = janus/vim/colors/pyte 24 | url = https://github.com/vim-scripts/pyte.git 25 | [submodule "janus/vim/colors/github"] 26 | path = janus/vim/colors/github 27 | url = https://github.com/telamon/vim-color-github.git 28 | [submodule "janus/vim/colors/getafe"] 29 | path = janus/vim/colors/getafe 30 | url = https://github.com/larssmit/vim-getafe.git 31 | [submodule "janus/vim/colors/janus-colors"] 32 | path = janus/vim/colors/janus-colors 33 | url = https://github.com/TechnoGate/janus-colors.git 34 | 35 | # Langs 36 | [submodule "janus/vim/langs/haml"] 37 | path = janus/vim/langs/haml 38 | url = https://github.com/tpope/vim-haml.git 39 | [submodule "janus/vim/langs/javascript"] 40 | path = janus/vim/langs/javascript 41 | url = https://github.com/pangloss/vim-javascript.git 42 | [submodule "janus/vim/langs/cucumber"] 43 | path = janus/vim/langs/cucumber 44 | url = https://github.com/tpope/vim-cucumber.git 45 | [submodule "janus/vim/langs/markdown"] 46 | path = janus/vim/langs/markdown 47 | url = https://github.com/tpope/vim-markdown.git 48 | [submodule "janus/vim/langs/puppet"] 49 | path = janus/vim/langs/puppet 50 | url = https://github.com/ajf/puppet-vim.git 51 | [submodule "janus/vim/langs/scala"] 52 | path = janus/vim/langs/scala 53 | url = https://github.com/rosstimson/scala-vim-support.git 54 | [submodule "janus/vim/langs/handlebars"] 55 | path = janus/vim/langs/handlebars 56 | url = https://github.com/nono/vim-handlebars.git 57 | [submodule "janus/vim/langs/coffeescript"] 58 | path = janus/vim/langs/coffeescript 59 | url = https://github.com/kchmck/vim-coffee-script.git 60 | [submodule "janus/vim/langs/rails"] 61 | path = janus/vim/langs/rails 62 | url = https://github.com/tpope/vim-rails.git 63 | [submodule "janus/vim/langs/git"] 64 | path = janus/vim/langs/git 65 | url = https://github.com/tpope/vim-git.git 66 | [submodule "janus/vim/langs/textile"] 67 | path = janus/vim/langs/textile 68 | url = https://github.com/timcharper/textile.vim.git 69 | [submodule "janus/vim/langs/rspec"] 70 | path = janus/vim/langs/rspec 71 | url = https://github.com/skwp/vim-rspec.git 72 | [submodule "janus/vim/langs/scss"] 73 | path = janus/vim/langs/scss 74 | url = https://github.com/cakebaker/scss-syntax.vim.git 75 | [submodule "janus/vim/langs/csv"] 76 | path = janus/vim/langs/csv 77 | url = https://github.com/vim-scripts/csv.vim.git 78 | [submodule "janus/vim/langs/nodejs"] 79 | path = janus/vim/langs/nodejs 80 | url = https://github.com/mmalecki/vim-node.js.git 81 | [submodule "janus/vim/langs/ruby"] 82 | path = janus/vim/langs/ruby 83 | url = https://github.com/vim-ruby/vim-ruby.git 84 | [submodule "janus/vim/langs/arduino"] 85 | path = janus/vim/langs/arduino 86 | url = https://github.com/vim-scripts/Arduino-syntax-file.git 87 | 88 | # Tools 89 | [submodule "janus/vim/tools/unimpaired"] 90 | path = janus/vim/tools/unimpaired 91 | url = https://github.com/tpope/vim-unimpaired.git 92 | [submodule "janus/vim/tools/nerdcommenter"] 93 | path = janus/vim/tools/nerdcommenter 94 | url = https://github.com/scrooloose/nerdcommenter.git 95 | [submodule "janus/vim/tools/matchit"] 96 | path = janus/vim/tools/matchit 97 | url = https://github.com/edsono/vim-matchit.git 98 | [submodule "janus/vim/tools/supertab"] 99 | path = janus/vim/tools/supertab 100 | url = https://github.com/ervandew/supertab.git 101 | [submodule "janus/vim/tools/zoomwin"] 102 | path = janus/vim/tools/zoomwin 103 | url = https://github.com/vim-scripts/ZoomWin.git 104 | [submodule "janus/vim/tools/ack"] 105 | path = janus/vim/tools/ack 106 | url = https://github.com/mileszs/ack.vim.git 107 | [submodule "janus/vim/tools/fugitive"] 108 | path = janus/vim/tools/fugitive 109 | url = https://github.com/tpope/vim-fugitive.git 110 | [submodule "janus/vim/tools/gundo"] 111 | path = janus/vim/tools/gundo 112 | url = https://github.com/sjl/gundo.vim.git 113 | [submodule "janus/vim/tools/surround"] 114 | path = janus/vim/tools/surround 115 | url = https://github.com/tpope/vim-surround.git 116 | [submodule "janus/vim/tools/snipmate"] 117 | path = janus/vim/tools/snipmate 118 | url = https://github.com/garbas/vim-snipmate.git 119 | [submodule "janus/vim/tools/tlib"] 120 | path = janus/vim/tools/tlib 121 | url = https://github.com/tomtom/tlib_vim.git 122 | [submodule "janus/vim/tools/vim-addon-mw-utils"] 123 | path = janus/vim/tools/vim-addon-mw-utils 124 | url = https://github.com/MarcWeber/vim-addon-mw-utils.git 125 | [submodule "janus/vim/tools/snipmate-snippets"] 126 | path = janus/vim/tools/snipmate-snippets 127 | url = https://github.com/honza/snipmate-snippets.git 128 | [submodule "janus/vim/tools/syntastic"] 129 | path = janus/vim/tools/syntastic 130 | url = https://github.com/scrooloose/syntastic.git 131 | [submodule "janus/vim/tools/tagbar"] 132 | path = janus/vim/tools/tagbar 133 | url = https://github.com/majutsushi/tagbar.git 134 | [submodule "janus/vim/tools/nerdtree"] 135 | path = janus/vim/tools/nerdtree 136 | url = https://github.com/scrooloose/nerdtree.git 137 | [submodule "janus/vim/tools/indent-object"] 138 | path = janus/vim/tools/indent-object 139 | url = https://github.com/michaeljsmith/vim-indent-object.git 140 | [submodule "janus/vim/tools/endwise"] 141 | path = janus/vim/tools/endwise 142 | url = https://github.com/tpope/vim-endwise.git 143 | [submodule "janus/vim/tools/webapi"] 144 | path = janus/vim/tools/webapi 145 | url = https://github.com/mattn/webapi-vim.git 146 | [submodule "janus/vim/tools/gist"] 147 | path = janus/vim/tools/gist 148 | url = https://github.com/mattn/gist-vim.git 149 | [submodule "janus/vim/tools/vimwiki"] 150 | path = janus/vim/tools/vimwiki 151 | url = https://github.com/vim-scripts/vimwiki.git 152 | [submodule "janus/vim/tools/css-color"] 153 | path = janus/vim/tools/css-color 154 | url = https://github.com/ap/vim-css-color.git 155 | [submodule "janus/vim/tools/easymotion"] 156 | path = janus/vim/tools/easymotion 157 | url = https://github.com/Lokaltog/vim-easymotion.git 158 | [submodule "janus/vim/tools/narrowregion"] 159 | path = janus/vim/tools/narrowregion 160 | url = https://github.com/chrisbra/NrrwRgn.git 161 | [submodule "janus/vim/tools/buffergator"] 162 | path = janus/vim/tools/buffergator 163 | url = https://github.com/jeetsukumaran/vim-buffergator.git 164 | [submodule "janus/vim/tools/kwbd"] 165 | path = janus/vim/tools/kwbd 166 | url = https://github.com/rgarver/Kwbd.vim.git 167 | [submodule "janus/vim/tools/rename2"] 168 | path = janus/vim/tools/rename2 169 | url = https://github.com/vim-scripts/Rename2.git 170 | [submodule "janus/vim/tools/ctrlp"] 171 | path = janus/vim/tools/ctrlp 172 | url = https://github.com/kien/ctrlp.vim.git 173 | [submodule "janus/vim/tools/vroom"] 174 | path = janus/vim/tools/vroom 175 | url = https://github.com/skalnik/vim-vroom.git 176 | -------------------------------------------------------------------------------- /janus/vim/core/before/plugin/janus.vim: -------------------------------------------------------------------------------- 1 | "" 2 | "" Janus main functions 3 | "" 4 | 5 | " Return a path separator on the current OS 6 | " Taken from pathogen 7 | " 8 | " @return [String] The separator / or \ 9 | function! janus#separator() 10 | return !exists("+shellslash") || &shellslash ? '/' : '\' 11 | endfunction 12 | 13 | " Return the expanded path 14 | " 15 | " @param [String] path 16 | " @return [String] Absolute path 17 | function! janus#expand_path(path) 18 | return expand(a:path) 19 | endfunction 20 | 21 | " Return a resolved path 22 | " 23 | " @param [String] path 24 | " @return resolved path 25 | function! janus#resolve_path(path) 26 | return resolve(janus#expand_path(a:path)) 27 | endfunction 28 | 29 | " Return the dirname of a path 30 | " 31 | " @param [String] path 32 | " @return [String] The dirname of the path given in the param 33 | function! janus#dirname(path) 34 | return fnamemodify(janus#resolve_path(a:path), ":h") 35 | endfunction 36 | 37 | " Return the basename of a path 38 | " 39 | " @param [String] path 40 | " @return [String] The basename of the path given in the param 41 | function! janus#basename(path) 42 | return fnamemodify(janus#resolve_path(a:path), ":t") 43 | endfunction 44 | 45 | " Return the group name 46 | " 47 | " @param [String] The group path 48 | " @return [String] The group name 49 | function! janus#group_name(path) 50 | return janus#basename(a:path) 51 | endfunction 52 | 53 | " Return the group path 54 | " 55 | " @param [String] The group name 56 | " @return [String] The group path 57 | function! janus#group_path(name) 58 | for group in g:janus_loaded_groups 59 | if janus#group_name(group) == a:name 60 | return group 61 | endif 62 | endfor 63 | endfunction 64 | 65 | " Find vim files inside a folder 66 | " 67 | " @param [String] The path to a folder 68 | " @return [List] List of files. 69 | function! janus#vim_files(folder) 70 | let files = [] 71 | let pattern = janus#resolve_path(a:folder) . janus#separator() . "*" 72 | " Add all found vim files 73 | for file in split(glob(pattern), "\n") 74 | if isdirectory(file) 75 | call extend(files, janus#vim_files(file)) 76 | elseif (file =~ "\.vim$") 77 | call add(files, file) 78 | endif 79 | endfor 80 | 81 | return files 82 | endfunction 83 | 84 | " Add a group of plug-ins to Pathogen 85 | " 86 | " @param [String] The plugin name 87 | " @param [String] (Optional) the base path of the group 88 | function! janus#add_group(name, ...) 89 | if !exists("g:janus_loaded_groups") 90 | let g:janus_loaded_groups = [] 91 | endif 92 | 93 | " Loaded group array will contain full path to group 94 | let base_path = exists("a:1") ? a:1 : g:janus_vim_path 95 | call add(g:janus_loaded_groups, base_path . janus#separator() . a:name) 96 | endfunction 97 | 98 | 99 | " Prepends custom plugins first so they will end up last after pathogen loads 100 | " other janus groups 101 | function! janus#load_custom_before() 102 | if isdirectory(g:janus_custom_path) 103 | let rtp = pathogen#split(&rtp) 104 | let custom_path = g:janus_custom_path . janus#separator() . "*" 105 | let custom = filter(pathogen#glob_directories(custom_path), '!pathogen#is_disabled(v:val)') 106 | let &rtp = pathogen#join(pathogen#uniq(custom + rtp)) 107 | endif 108 | endfunction 109 | 110 | " Append custom plugins 'after' directories to rtp 111 | function! janus#load_custom_after() 112 | if isdirectory(g:janus_custom_path) 113 | let rtp = pathogen#split(&rtp) 114 | let custom_path = g:janus_custom_path . janus#separator() . "*" . janus#separator() . "after" 115 | let custom_after = filter(pathogen#glob_directories(custom_path), '!pathogen#is_disabled(v:val[0:-7])') 116 | let &rtp = pathogen#join(pathogen#uniq(rtp + custom_after)) 117 | 118 | " Add the custom group to the list of loaded groups 119 | call janus#add_group(".janus", expand("~")) 120 | endif 121 | endfunction 122 | 123 | " Load/wrap core around the rtp 124 | function! janus#load_core() 125 | " pathogen#infect will prepend core's 'before' and append 'janus/after' to 126 | " the rtp 127 | call janus#add_group("core") 128 | let core = g:janus_vim_path . janus#separator() . "core" 129 | call pathogen#infect(core) 130 | endfunction 131 | 132 | " Load pathogen groups 133 | function! janus#load_pathogen() 134 | if !exists("g:loaded_pathogen") 135 | " Source Pathogen 136 | exe 'source ' . g:janus_vim_path . '/core/pathogen/autoload/pathogen.vim' 137 | endif 138 | 139 | " Add custom plugins before bundled groups 140 | call janus#load_custom_before() 141 | 142 | for group in g:janus_loaded_groups 143 | call pathogen#infect(group) 144 | endfor 145 | 146 | " Add custom 'after' directories to rtp and then load the core 147 | call janus#load_custom_after() 148 | call janus#load_core() 149 | call pathogen#helptags() 150 | endfunction 151 | 152 | " Which group contains a plugin ? 153 | " 154 | " @param [String] The plugin name 155 | " @return [String] The group name (not an absolute path) 156 | function! janus#which_group(name) 157 | if !exists("g:janus_loaded_groups") 158 | return "" 159 | endif 160 | 161 | for group in g:janus_loaded_groups 162 | if isdirectory(janus#plugin_path(group, a:name)) 163 | return janus#group_name(group) 164 | endif 165 | endfor 166 | endfunction 167 | 168 | " Disable a plugin 169 | " 170 | " @param [String] The group the plugin belongs to, will be determined if 171 | " no group were given. 172 | " @param [String] The plugin name 173 | " @param [String] The reason why it is disabled 174 | " @return [Bool] 175 | function! janus#disable_plugin(...) 176 | if a:0 < 1 || a:0 > 3 177 | throw "The arguments to janus#disable_plugin() should be [group], , [reason]" 178 | elseif a:0 == 1 179 | let group = -1 180 | let name = a:1 181 | let reason = -1 182 | elseif a:0 == 2 183 | let group = -1 184 | let name = a:1 185 | let reason = a:2 186 | elseif a:0 == 3 187 | let group = a:1 188 | let name = a:2 189 | let reason = a:3 190 | endif 191 | 192 | " Verify the existance of the global variables 193 | if !exists("g:pathogen_disabled") 194 | let g:pathogen_disabled = [] 195 | endif 196 | if !exists("g:janus_disabled_plugins") 197 | let g:janus_disabled_plugins = {} 198 | endif 199 | 200 | " Fetch the group if necessary 201 | if group == -1 202 | let group = janus#which_group(name) 203 | endif 204 | 205 | " Check if we need to add it 206 | if has_key(g:janus_disabled_plugins, name) && g:janus_disabled_plugins[name]['group'] == group 207 | " Just update the reason if necessary. 208 | if reason != "No reason given." && g:janus_disabled_plugins[name]['reason'] == -1 209 | let g:janus_disabled_plugins[name]['reason'] = reason 210 | endif 211 | 212 | return 0 213 | endif 214 | 215 | " Find the plugin path 216 | let plugin_path = janus#plugin_path(group, name) 217 | 218 | " Add it to janus_disabled_plugins 219 | let g:janus_disabled_plugins[name] = {'group': group, 'path': plugin_path, 'reason': reason} 220 | 221 | " Add it to pathogen_disabled 222 | call add(g:pathogen_disabled, name) 223 | endfunction 224 | 225 | " Return the plugin path 226 | " 227 | " @param [String] The group the plugin belongs to, will be determined if 228 | " no group were given. 229 | " @param [String] The plugin name 230 | " @return [String] The plugin path relative to g:janus_vim_path 231 | function! janus#plugin_path(...) 232 | if a:0 < 1 || a:0 > 2 233 | throw "The arguments to janus#plugin_path() should be [group], " 234 | elseif a:0 == 1 235 | let name = a:1 236 | let group = janus#which_group(name) 237 | else 238 | let group = a:1 239 | let name = a:2 240 | endif 241 | 242 | return janus#group_path(group) . janus#separator() . name 243 | endfunction 244 | 245 | " Is modules loaded? 246 | " 247 | " @param [String] The plugin name 248 | " @return [Boolean] 249 | function! janus#is_module_loaded(name) 250 | return len(janus#vim_files(janus#plugin_path(a:name))) > 0 251 | endfunction 252 | 253 | " Is plugin disabled? 254 | " 255 | " @param [String] The plugin name 256 | function! janus#is_plugin_disabled(name) 257 | if !exists("g:janus_disabled_plugins") 258 | return 0 259 | endif 260 | 261 | return has_key(g:janus_disabled_plugins, a:name) 262 | endfunction 263 | 264 | " Is plugin enabled? 265 | " 266 | " @param [String] The plugin name 267 | " @return [Boolean] 268 | function! janus#is_plugin_enabled(name) 269 | return janus#is_module_loaded(a:name) && !janus#is_plugin_disabled(a:name) 270 | endfunction 271 | 272 | " Mapping function 273 | " 274 | " @param [String] The plugin name 275 | " @param [String] The mapping command (map, vmap, nmap or imap) 276 | " @param [String] The mapping keys 277 | " @param [String]* The mapping action 278 | function! janus#add_mapping(name, mapping_command, mapping_keys, ...) 279 | if len(a:000) < 1 280 | throw "The arguments to janus#add_mapping() should be [mapping_action]*" 281 | endif 282 | 283 | if janus#is_plugin_enabled(a:name) 284 | let mapping_command = join(a:000) 285 | else 286 | if !janus#is_module_loaded(a:name) 287 | let reason = "Module is not loaded" 288 | elseif g:janus_disabled_plugins[a:name]['reason'] == -1 289 | return 0 290 | else 291 | let reason = g:janus_disabled_plugins[a:name]['reason'] 292 | endif 293 | 294 | let mapping_command = ":echo 'The plugin " . a:name . " is disabled for the following reason: " . reason . ".'" 295 | endif 296 | 297 | let mapping_list = [a:mapping_command, a:mapping_keys, mapping_command] 298 | exe join(mapping_list) 299 | endfunction 300 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Janus: Vim Distribution 2 | 3 | This is a distribution of plug-ins and mappings for Vim, Gvim and 4 | MacVim. 5 | 6 | It is designed to provide minimal working environment using the most 7 | popular plug-ins and the most common mappings. 8 | 9 | The distribution is completely customisable using a `~/.vimrc.before` 10 | and `~/.vimrc.after` Vim RC files. 11 | 12 | # UPGRADING FROM JANUARY 1st 2012 THROUGH JANUARY 10th 13 | 14 | Please run `rake` twice before running macvim; make sure `command-t` is 15 | gone. 16 | 17 | # UPGRADING FROM BEFORE JANUARY 1st 2012 18 | 19 | If you were using Janus before January 2012, note that Janus has gone 20 | through a rewrite to make it more stable and customizable. Most notably, 21 | you can now disable plugins using `janus#disable_plugin` and customize 22 | Janus using `~/.vimrc.before` and `~/.vimrc.after`. See the rest of this 23 | `README` and the [Customization wiki page](https://github.com/carlhuda/janus/wiki/Customization). 24 | 25 | To upgrade to the latest version: 26 | 27 | 1. remove `~/.vim`, `~/.vimrc` and `~/.gvimrc`. 28 | 2. move customizations from `~/.vimrc.local` to `~/.vimrc.before` and 29 | `~/.vimrc.after`. 30 | 3. Do the same with `/.gvimrc.local`. 31 | 4. Run the installer: `curl -Lo- http://bit.ly/janus-bootstrap | bash` 32 | 33 | ## Updating to the latest version (from any time after January 10th, 2012) 34 | 35 | To update to the latest version of the distribution, just run `rake` 36 | inside your `~/.vim` directory. 37 | 38 | NOTE: If you ever have an error updating Janus relating to a 39 | missing commit in a submodule, please try running `rake` again before 40 | submitting an issue. 41 | 42 | ## Mailing list 43 | 44 | The mailing list is hosted at [Google 45 | Groups](http://groups.google.com/group/janus-vimius), please join it for 46 | discussion and announcements. 47 | 48 | ## Pre-requisites 49 | 50 | The distribution is designed to work with Vim >= 7.3. 51 | 52 | The distribution also requires `ack`, `ctags`, `ruby` and `rake`. 53 | For the most comfortable experience, use the GUI version of Vim. Linux 54 | users should install `gvim`, OSX users should install 55 | [MacVim](http://code.google.com/p/macvim/). The recommended way of 56 | installing MacVim is using 57 | [Homebrew](http://mxcl.github.com/homebrew/), but before installing 58 | MacVim you need to use system-wide Python (If you are using python that 59 | is): 60 | 61 | * If you're using **pythonbrew**: do `pythonbrew off` 62 | 63 | ```bash 64 | $ brew install macvim 65 | ``` 66 | 67 | If you don't use Homebrew, you can still download MacVim 68 | [here](https://github.com/b4winckler/macvim/downloads). 69 | 70 | Take a look at the [Pre-requisites wiki 71 | page](https://github.com/carlhuda/janus/wiki/Pre-requisites) for more 72 | information. 73 | 74 | 75 | ## Installation 76 | 77 | To install Janus, please use our [automatic 78 | installer](https://github.com/carlhuda/janus/blob/master/bootstrap.sh) 79 | , which backs up any Vim files found in your home folder and installs 80 | Janus. 81 | 82 | ```bash 83 | $ curl -Lo- http://bit.ly/janus-bootstrap | bash 84 | ``` 85 | 86 | ## Customization 87 | 88 | You can use `~/.gvimrc.before` and `~/.vimrc.before` for settings Janus itself uses, 89 | such as the __leader__ setting. You may also use `~/.gvimrc.after` and 90 | `~/.vimrc.after` for any additional settings; it is also a good place for 91 | overriding Janus settings, as both files will be loaded at the end of 92 | Janus. 93 | 94 | For example, to override the default color schemes: 95 | 96 | ```bash 97 | $ echo 'color desert' >> ~/.vimrc.after 98 | $ echo 'color molokai' >> ~/.gvimrc.after 99 | ``` 100 | 101 | If you want to do additional customization or add more Vim plugins, 102 | create a `~/.janus` directory and add your plugins there, either with a 103 | `git clone` or by adding submodules to your own git repository there. 104 | This directory is treated like a normal pathogen directory. For example: 105 | 106 | ```bash 107 | $ cd ~/.janus 108 | $ git clone https://github.com/vim-scripts/Rename2.git rename2 109 | ``` 110 | 111 | Or, if you have a git repository in `~/.janus`, you can use a submodule: 112 | 113 | ```bash 114 | $ cd ~/.janus 115 | $ git submodule add https://github.com/vim-scripts/Rename2.git rename2 116 | ``` 117 | 118 | If you would like to disable an included plug-in, you can do that with 119 | the `janus#disable_plugin()` function from inside your 120 | `~/.vimrc.before`. This function takes a plug-in name as an argument 121 | without the group. For example, if you would like to disable the 122 | NERDCommenter plug-in, you can do that with the command: 123 | 124 | ```bash 125 | $ echo "call janus#disable_plugin('nerdcommenter')" >> ~/.vimrc.before 126 | ``` 127 | 128 | **WARNING**: We've noticed over and over, that people fork Janus just to 129 | customize it. This is bad practice for several reasons and you should 130 | not do that, and here's why: 131 | 132 | - Janus is fully customisable and there's no need to change the core for 133 | using a different plugin fork or using a different mapping. 134 | - Forking means maintenance; maintenance means burden. Do not burden 135 | yourself with maintaining a fork; that's what the `~/.janus` folder 136 | is for. 137 | 138 | If you find yourself needing a customisation that is not possible with 139 | the current setup, then please open an issue or consider submitting a 140 | pull request to make it possible to continue using/improving the official repo. 141 | 142 | **WARNING**: Any **uncommited** files inside the **janus** folder will be 143 | removed the next time you run `rake` so make sure to either put them in 144 | the custom folder (`~/.janus`), or commit them. We clean the janus 145 | folder in case we replace a manually installed plugin (using rake tasks) 146 | with a submodule. 147 | 148 | For more information on how to customize Janus, you might want to take 149 | a look at the [Customization wiki 150 | page](https://github.com/carlhuda/janus/wiki/Customization). 151 | 152 | # Intro to VIM 153 | 154 | Here're some tips in case you've never used VIM before: 155 | 156 | ## Tutorials 157 | 158 | * Type `vimtutor` into a shell to go through a brief interactive 159 | tutorial inside VIM. 160 | * Read the slides at [VIM: Walking Without Crutches](http://walking-without-crutches.heroku.com/#1). 161 | * Watch the screencasts at [vimcasts.org](http://vimcasts.org/) 162 | * Watch Derek Wyatt's energetic tutorial videos at [his site](http://www.derekwyatt.org/vim/vim-tutorial-videos/) 163 | * Read wycats' perspective on learning Vim at 164 | [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/) 165 | * Read this and other answers to a question about vim at StackOverflow: 166 | [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) 167 | 168 | ## Modes 169 | 170 | * VIM has two modes: 171 | * insert mode- stuff you type is added to the buffer 172 | * normal mode- keys you hit are interpreted as commands 173 | * To enter insert mode, hit `i` 174 | * To exit insert mode, hit `` 175 | 176 | ## Useful commands 177 | 178 | * Use `:q` to exit vim 179 | * Certain commands are prefixed with a `` key, which maps to `\` 180 | by default. You can, for example, use `let mapleader = ","` to change this to a comma. If you want this 181 | to be in effect for uses of `` in the .vimrc file, make sure to define 182 | this in `~/.vimrc.before` 183 | * Keyboard [cheat sheet](http://walking-without-crutches.heroku.com/image/images/vi-vim-cheat-sheet.png). 184 | 185 | # Features 186 | 187 | This Vim distribution includes a number of packages built by others. 188 | 189 | ## Base Customizations 190 | 191 | Janus ships with a number of basic customizations for vim: 192 | 193 | * Line numbers 194 | * Ruler (line and column numbers) 195 | * No wrap (turn off per-buffer via :set wrap) 196 | * Soft 2-space tabs, and default hard tabs to 2 spaces 197 | * Show trailing whitespace as `.` 198 | * Make searching highlighted, incremental, and case insensitive unless a 199 | capital letter is used 200 | * Always show a status line 201 | * Allow backspacing over everything (indentations, eol, and start 202 | characters) in insert mode 203 | * `` inserts the directory of the current file into a command 204 | * Automatically resize splits when resizing the Vim window (GUI only) 205 | * `ew` expands to `:e (directory of current file)/` (open in the 206 | current buffer) 207 | * `es` expands to `:sp (directory of current file)/` (open in a 208 | horizontal split) 209 | * `ev` expands to `:vsp (directory of current file)/` (open in 210 | a vertical split) 211 | * `et` expands to `:tabe (directory of current file)/` (open in 212 | a new tab) 213 | * `:w!!` expands to `%!sudo tee > /dev/null %`. Write to the current file 214 | using sudo (if you forgot to run it with sudo), it will prompt for 215 | sudo password when writing 216 | * `` toggles paste mode 217 | * `fef` formats the entire file 218 | * `u` converts the entire word to uppercace 219 | * `l` converts the entire word to lowercase 220 | * `U` converts the first char of a word to uppercase 221 | * `L` converts the first char of a word to lowercase 222 | * `cd` changes the path to the active buffer's file 223 | * `md` creates the directory of the active buffer's file 224 | (For example, when editing a new file for which the path does not 225 | exist.) 226 | * `gw` swaps the current word with the following word 227 | * `ul` underlines the current line with `=` 228 | * `tw` toggles wrap 229 | * `fc` finds the next conflict marker (tested with Git 230 | conflicted files) 231 | * Remap `` and `` to `gj` and `gk` (Wrapped text is not 232 | considered a single long line of text.) 233 | * `hs` toggles highlight search 234 | * `=` adjusts viewports to the same size (`=`) 235 | * `!` invokes kwbd plugin; it closes all open buffers in the open 240 | windows but keeps the windows open 241 | 242 | ## [Ack.vim](http://github.com/mileszs/ack.vim) 243 | 244 | Ack.vim uses ack to search inside the current directory for a pattern. 245 | You can learn more about it with :help Ack. 246 | 247 | **Customizations**: Janus rebinds command-shift-f (``) to bring up 248 | `:Ack `. 249 | 250 | ## [CtrlP](https://github.com/kien/ctrlp.vim) 251 | 252 | Fuzzy file, buffer, mru and tag finder. Replaces [Command-T](https://github.com/wincent/Command-T) 253 | 254 | **Customizations**: For users of Command-T Janus maps CtrlP to command-t (``) 255 | 256 | ## [NERDCommenter](http://github.com/ddollar/nerdcommenter) 257 | 258 | NERDCommenter allows you to wrangle your code comments, regardless of 259 | filetype. View `:help NERDCommenter` for all the details. 260 | 261 | **Customizations**: Janus binds command-/ (``) to toggle comments. 262 | 263 | ## [NERDTree](https://github.com/scrooloose/nerdtree) 264 | 265 | NERDTree is a file explorer plugin that provides "project drawer" 266 | functionality to your vim projects. You can learn more about it with 267 | :help NERDTree. 268 | 269 | **Customizations**: Janus adds a number of customizations to the core 270 | NERDTree: 271 | 272 | * Use `n` to toggle NERDTree 273 | * Ignore compiled ruby, python, and java files 274 | * When opening vim with vim /path, open the left NERDTree to that 275 | directory, set the vim pwd, and clear the right buffer 276 | * In general, assume that there is a single NERDTree buffer on the left 277 | and one or more editing buffers on the right 278 | 279 | ## [SuperTab](http://github.com/ervandew/supertab) 280 | 281 | In insert mode, start typing something and hit `` to tab-complete 282 | based on the current context. 283 | 284 | ## [Syntastic](https://github.com/scrooloose/syntastic/) 285 | 286 | Syntastic is a syntax checking plugin that runs buffers through external syntax 287 | checkers as they are saved and opened. If syntax errors are detected, the user 288 | is notified and is happy because they didn't have to compile their code or 289 | execute their script to find them. 290 | 291 | ## [Tagbar](https://github.com/majutsushi/tagbar) 292 | 293 | Tagbar is a vim plugin for browsing the tags of source code files. 294 | 295 | **Customizations**: Janus binds `rt` to toggle Tagbar. 296 | 297 | ## [EasyMotion](https://github.com/Lokaltog/vim-easymotion) 298 | 299 | EasyMotion provides a much simpler way to use some motions in vim. It 300 | takes the out of w or f{char} by highlighting 301 | all possible choices and allowing you to press one key to jump directly 302 | to the target. 303 | 304 | When one of the available motions is triggered, all visible text 305 | preceding or following the cursor is faded, and motion targets are 306 | highlighted. 307 | 308 | EasyMotion is triggered by one of the provided mappings. 309 | 310 | check EasyMotion's [home 311 | page](https://github.com/Lokaltog/vim-easymotion) for more information. 312 | 313 | ## [NrrwRgn](https://github.com/chrisbra/NrrwRgn) 314 | 315 | Narrowing means focussing on a region and making the rest inaccessible. 316 | You simply select the region, call :NarrowRegion and the selected part 317 | will open in a new scratch buffer. The rest of the file will be 318 | protected, so you won't accidentally modify that buffer. In the new 319 | buffer, you can do a global replace, search or anything else to modify 320 | that part. When you are finished, simply write that buffer (e.g. by 321 | |:w|) and your modifications will be put in the original buffer making 322 | it accessible again. 323 | 324 | ## Git Support ([Fugitive](http://github.com/tpope/vim-fugitive)) 325 | 326 | Fugitive adds pervasive git support to git directories in vim. For more 327 | information, use `:help fugitive` 328 | 329 | Use `:Gstatus` to view `git status` and type `-` on any file to stage or 330 | unstage it. Type `p` on a file to enter `git add -p` and stage specific 331 | hunks in the file. 332 | 333 | Use `:Gdiff` on an open file to see what changes have been made to that 334 | file 335 | 336 | **customizations**: 337 | 338 | * `gb` maps to `:Gblame` 339 | * `gs` maps to `:Gstatus` 340 | * `gd` maps to `:Gdiff` 341 | * `gl` maps to `:Glog` 342 | * `gc` maps to `:Gcommit` 343 | * `gp` maps to `:Git push` 344 | 345 | ## [ZoomWin](http://github.com/vim-scripts/ZoomWin) 346 | 347 | When working with split windows, ZoomWin lets you zoom into a window and 348 | out again using `Ctrl-W o` 349 | 350 | **Customizations**: Janus binds `zw` to `:ZoomWin` 351 | 352 | ## [BufferGator](https://github.com/jeetsukumaran/vim-buffergator) 353 | 354 | Buffergator is a plugin for listing, navigating between, and selecting 355 | buffers to edit. Upon invocation (using the command, `:BuffergatorOpen` 356 | or `BuffergatorToggle`, or the provided key mapping, `b`), a 357 | `catalog` of listed buffers are displayed in a separate new window split 358 | (vertical or horizontal, based on user options; default = vertical). 359 | From this "buffer catalog", a buffer can be selected and opened in an 360 | existing window, a new window split (vertical or horizontal), or a new 361 | tab page. 362 | 363 | Selected buffers can be "previewed", i.e. opened in a window or tab 364 | page, but with focus remaining in the buffer catalog. Even better, you 365 | can "walk" up and down the list of buffers shown in the catalog by using 366 | `` (or ``) / `` (or ``). These keys select the 367 | next/previous buffer in succession, respectively, opening it for preview 368 | without leaving the buffer catalog viewer. 369 | 370 | ## [Vroom](https://github.com/skalnik/vim-vroom) 371 | 372 | VRoom is a plugin inspired by [Gary Bernhardt's vim 373 | config](https://github.com/garybernhardt/dotfiles/blob/69330074b7a15c67efa4594a71fa91592f1ce4f9/.vimrc#L286-342) 374 | for running your ruby tests/specs/features. 375 | 376 | Imagine you're hacking on a Rails controller, when you switch to the 377 | test or specs for the controller, you can use `r` to run all the 378 | specs or `R` to run the closest spec, then you can jump back to 379 | the controller hack on it and use `r` to run the last spec you 380 | ran last time, so you don't need to open the test again. 381 | 382 | Then benefits of this plugin are to centralize your workflow in one 383 | window, one software to do it all, which is a huge speedup over using 384 | `tmux` or multiple terminal tabs. 385 | 386 | ## Additional Syntaxes 387 | 388 | Janus ships with a few additional syntaxes: 389 | 390 | * Markdown (bound to \*.markdown, \*.md, and \*.mk) 391 | * Mustache (bound to \*.mustache) 392 | * Haml (bound to \*.haml) 393 | * Sass (bound to \*.sass) 394 | * SCSS (bound to \*.scss) 395 | * An improved JavaScript syntax (bound to \*.js) 396 | * Javascript for any file having `nodejs` in the shebang. 397 | * Map Gemfile, Rakefile, Vagrantfile, Procfile, Thorfile, config.ru and 398 | *.rake to Ruby. 399 | * Git commits (set your `EDITOR` to `vim -f` or `mvim -f` on OSX) 400 | `$ echo "export EDITOR='vim -f'" >> ~/.bashrc`, you can also use Git 401 | global config to set this if you have EDITOR set to something else 402 | `$ git config --global core.editor 'vim -f'` 403 | 404 | ## Rakefile 405 | 406 | If you're looking for the old janus distribution controlled by a 407 | Rakefile then please head over to the [rakefile 408 | branch](https://github.com/carlhuda/janus/tree/rakefile) but please note 409 | that the rakefile branch will not be maintained. 410 | 411 | ## License 412 | 413 | ### This code is free to use under the terms of the MIT license. 414 | 415 | Permission is hereby granted, free of charge, to any person obtaining 416 | a copy of this software and associated documentation files (the 417 | "Software"), to deal in the Software without restriction, including 418 | without limitation the rights to use, copy, modify, merge, publish, 419 | distribute, sublicense, and/or sell copies of the Software, and to 420 | permit persons to whom the Software is furnished to do so, subject to 421 | the following conditions: 422 | 423 | The above copyright notice and this permission notice shall be included 424 | in all copies or substantial portions of the Software. 425 | 426 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 427 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 428 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 429 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 430 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 431 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 432 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 433 | -------------------------------------------------------------------------------- /janus/vim/core/janus/doc/janus.txt: -------------------------------------------------------------------------------- 1 | *janus.txt* Janus vim Distribution *janus* 2 | 3 | CONTENTS *janus-contents* 4 | 5 | Introduction |janus-intro| 6 | Mailing list |janus-mailing-list| 7 | Installation |janus-installation| 8 | Customization |janus-customization| 9 | Updating |janus-updating| 10 | Intro to vim |janus-vim-intro| 11 | Janus features |janus-features| 12 | Base customizations |janus-features-base-customizations| 13 | Ack |janus-features-ack| 14 | CtrlP |janus-features-ctrlp| 15 | NERDCommenter |janus-features-nerdcommenter| 16 | NERDTree |janus-features-nerdtree| 17 | SuperTab |janus-features-supertab| 18 | Syntastic |janus-features-syntastic| 19 | Tagbar |janus-features-tagbar| 20 | EasyMotion |janus-features-easymotion| 21 | NrrwRgn |janus-features-nrrwrgn| 22 | git |janus-features-git| 23 | ZoomWin |janus-features-zoomwin| 24 | BufferGator |janus-features-buffergator| 25 | Additional syntaxes |janus-features-syntaxes| 26 | Rakefile |janus-rakefile| 27 | License |janus-license| 28 | 29 | 30 | INTRODUCTION *janus-intro* 31 | 32 | This is a distribution of plug-ins and mappings for Vim, Gvim and 33 | MacVim. 34 | 35 | It is designed to provide minimal working environment using the most 36 | popular plug-ins and the most common mappings. 37 | 38 | The distribution is completely customisable using a `~/.vimrc.before` 39 | and `~/.vimrc.after` Vim RC files. 40 | 41 | 42 | MAILING LIST *janus-mailing-list* 43 | 44 | The mailing list is hosted at [Google 45 | Groups](http://groups.google.com/group/janus-vimius), please join it for 46 | discussion and announcements. 47 | 48 | 49 | PRE-REQUISITES *janus-pre-requisites* 50 | 51 | The distribution is designed to work with Vim >= 7.3. 52 | 53 | The distribution also require `ack`, `pep8`, `ctags`, `ruby` and `rake`, 54 | for the most comfortable experience, use the GUI version of Vim. Linux 55 | users should install `gvim`, OSX users should install 56 | [MacVim](http://code.google.com/p/macvim/), the recommanded way of 57 | installating MacVim is using 58 | [Homebrew](http://mxcl.github.com/homebrew/), but before installing 59 | MacVim you need to use system-wide ruby, if you're using **rvm** `rvm 60 | use system` switches to system ruby, if you're using **rbenv** `rbenv 61 | shell system` switches to system ruby. 62 | 63 | ```bash 64 | $ brew install macvim 65 | ``` 66 | 67 | If you don't use Homebrew, you can still download it 68 | [here](https://github.com/b4winckler/macvim/downloads). 69 | 70 | Take a look at the [Pre-requisites wiki 71 | page](https://github.com/carlhuda/janus/wiki/Pre-requisites) for more 72 | information. 73 | 74 | 75 | INSTALLATION *janus-installation* 76 | 77 | To install Janus, please use our [automatic 78 | installer](https://github.com/carlhuda/janus/blob/master/bootstrap.sh) 79 | , which backups up any Vim files found in your home folder and installs 80 | Janus. 81 | 82 | ```bash 83 | $ curl -Lo- http://bit.ly/janus-bootstrap | bash 84 | ``` 85 | 86 | 87 | CUSTOMIZATION *janus-customization* 88 | 89 | You can use `~/.gvimrc.before` and `~/.vimrc.before` for settings Janus, 90 | like the __leader__ setting, you may also use `~/.gvimrc.after` and 91 | `~/.vimrc.after` for any additional settings; it is also a good place for 92 | overriding Janus settings as both files will be loaded at the end of 93 | Janus. 94 | 95 | For example, to override the default color schemes: 96 | 97 | ```bash 98 | $ echo 'color desert' >> ~/.vimrc.after 99 | $ echo 'color molokai' >> ~/.gvimrc.after 100 | ``` 101 | 102 | If you want to do additional customization or add more Vim plugins, 103 | create a `~/.janus` directory and add your plugins there, either with a 104 | `git clone` or by adding submodules to your own git repository there. 105 | This directory is treated like a normal pathogen directory. For example: 106 | 107 | ```bash 108 | $ cd ~/.janus 109 | $ git checkout git://github.com/vim-scripts/Rename2.git rename2 110 | ``` 111 | 112 | Or, if you have a git repository in `~/.janus`, you can use a submodule: 113 | 114 | ```bash 115 | $ cd ~/.janus 116 | $ git submodule add git://github.com/vim-scripts/Rename2.git rename2 117 | ``` 118 | 119 | If you would like to disable an included plug-in, you can do that with 120 | the `janus#disable_plugin()` function from inside your 121 | `~/.vimrc.before`, this function takes a plug-in name as an argument 122 | without the group, for example, if you would like to disable the 123 | NERDCommenter plug-in, you can do that with the command: 124 | 125 | ```bash 126 | $ echo "call janus#disable_plugin('nerdcommenter')" >> ~/.vimrc.before 127 | ``` 128 | 129 | **WARNING**: We've noticed over and over, that people fork Janus just to 130 | customize it, this is bad practice for several reasons and you should 131 | not do that, here's why: 132 | 133 | - Janus is fully customisable and there's no need to change the core for 134 | using a different plugin fork or using a different mapping. 135 | - Forking means maintenance, maintenance means burden, do not burden 136 | yourself with maintaining a fork, that's what the `~/.janus` folder 137 | is for. 138 | 139 | if you find yourself needing a customisation that is not possible with 140 | the current setup, then please open an issue or submit a pull request to 141 | make it possible to do so without having a fork. 142 | 143 | **WARNING**: Any **uncommited** file inside the **janus** folder will be 144 | removed the next time you run `rake` so make sure to either put them in 145 | the custom folder (`~/.janus`), or commit them. We clean the janus 146 | folder in case we replace a manually installed plugin (using rake tasks) 147 | with a submodule. 148 | 149 | For more information on how to customize Janus, you might want to take 150 | a look at the [Customization wiki 151 | page](https://github.com/carlhuda/janus/wiki/Customization). 152 | 153 | 154 | UPDATING TO THE LATEST VERSION *janus-updating* 155 | 156 | To update to the latest version of the distribution, just run `rake` 157 | again inside your `~/.vim` directory. 158 | 159 | NOTE: If you even had an error updating Janus, problem related to a 160 | missing commit in a submodule, please try running `rake` again before 161 | submitting an issue. 162 | 163 | 164 | INTRO TO VIM *janus-vim-intro* 165 | 166 | Here's some tips if you've never used VIM before: 167 | 168 | 169 | TUTORIALS *janus-vim-tutorials* 170 | 171 | * Type `vimtutor` into a shell to go through a brief interactive 172 | tutorial inside VIM. 173 | * Read the slides at [VIM: Walking Without Crutches](http://walking-without-crutches.heroku.com/#1). 174 | * Watch the screencasts at [vimcasts.org](http://vimcasts.org/) 175 | * Watch Derek Wyatt's energetic tutorial videos at [his site](http://www.derekwyatt.org/vim/vim-tutorial-videos/) 176 | * Read wycats' perspective on learning vim at 177 | [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/) 178 | * Read this and other answers to a question about vim at StackOverflow: 179 | [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) 180 | 181 | 182 | MODES *janus-vim-modes* 183 | 184 | * VIM has two modes: 185 | * insert mode- stuff you type is added to the buffer 186 | * normal mode- keys you hit are interpretted as commands 187 | * To enter insert mode, hit `i` 188 | * To exit insert mode, hit `` 189 | 190 | 191 | USEFUL COMMANDS *janus-vim-useful-commands* 192 | 193 | * Use `:q` to exit vim 194 | * Certain commands are prefixed with a `` key, which maps to `\` 195 | by default. Use `let mapleader = ","` to change this. If you want this 196 | to be in effect for uses of in your .vimrc, make sure to define 197 | this in the `~/.vimrc.pre` 198 | * Keyboard [cheat sheet](http://walking-without-crutches.heroku.com/image/images/vi-vim-cheat-sheet.png). 199 | * Mapped key combinations using the command key (``) are only 200 | available in macvim. 201 | 202 | 203 | JANUS FEATURES *janus-features* 204 | 205 | This vim distribution includes a number of packages built by others. 206 | 207 | 208 | ## Base Customizations *janus-features-base-customizations* 209 | 210 | Janus ships with a number of basic customizations for vim: 211 | 212 | * Line numbers 213 | * Ruler (line and column numbers) 214 | * No wrap (turn off per-buffer via set :wrap) 215 | * Soft 2-space tabs, and default hard tabs to 2 spaces 216 | * Show tailing whitespace as `.` 217 | * Make searching highlighted, incremental, and case insensitive unless a 218 | capital letter is used 219 | * Always show a status line 220 | * Allow backspacing over everything (indentations, eol, and start 221 | characters) in insert mode 222 | * `` inserts the directory of the current file into a command 223 | * Automatically resize splits when resizing the Vim window (GUI only) 224 | * `ew` expands to `:e (directory of current file)/` (open in the 225 | current buffer) 226 | * `es` expands to `:sp (directory of current file)/` (open in an 227 | horizontal split) 228 | * `ev` expands to `:vsp (directory of current file)/` (open in 229 | an vertical split) 230 | * `et` expands to `:tabe (directory of current file)/` (open in 231 | an new tab) 232 | * `:w!!` expands to `%!sudo tee > /dev/null %` Write to the current file 233 | using sudo (if you forgot to run it with sudo), it will prompt for 234 | sudo password when writing. 235 | * `` Toggles paste mode 236 | * `fef` format the entire file 237 | * `u` Convert the entire word to uppercace. 238 | * `l` Convert the entire word to lowercase. 239 | * `U` Convert the first char of a word to uppercase. 240 | * `L` Convert the first char of a word to lowercase. 241 | * `cd` Change the path to the currently active buffer's file. 242 | * `md` Make the directory of the currently active buffer's file 243 | (for example when editing a new file for which the path does not 244 | exist.) 245 | * `gw` Swap the current word with the one next to it. 246 | * `ul` Underline the current line with `=` 247 | * `tw` Toggle wrap 248 | * `fc` Finds the next conflict marker (Tested with Git 249 | conflicted files). 250 | * Remap `` and `` to `gj` and `gk` (Wrapped text is not 251 | considered a one-long-line of text. 252 | * `hs` Toggle highlight search. 253 | * `=` Adjust viewports to the same size (`=`) 254 | * `!` Invokes kwbd plugin, it closes all open buffers in the open 259 | windows but keeps the windows open. 260 | 261 | 262 | ## [Ack.vim](http://github.com/mileszs/ack.vim) *janus-features-ack* 263 | 264 | Ack.vim uses ack to search inside the current directory for a pattern. 265 | You can learn more about it with :help Ack 266 | 267 | **Customizations**: Janus rebinds command-shift-f (``) to bring up 268 | `:Ack `. 269 | 270 | 271 | ## [CtrlP](https://github.com/kien/ctrlp.vim) *janus-features-ctrlp* 272 | 273 | Fuzzy file, buffer, mru and tag finder. Replaces 274 | [Command-T](https://github.com/wincent/Command-T) 275 | 276 | **Customizations**: For users of Command-T Janus maps CtrlP to command-t 277 | (``) 278 | 279 | 280 | ## [NERDCommenter](http://github.com/ddollar/nerdcommenter) *janus-features-nerdcommenter* 281 | 282 | NERDCommenter allows you to wrangle your code comments, regardless of 283 | filetype. View `:help NERDCommenter` for all the details. 284 | 285 | **Customizations**: Janus binds command-/ (``) to toggle comments. 286 | 287 | 288 | ## [NERDTree](https://github.com/scrooloose/nerdtree) *janus-features-nerdtree* 289 | 290 | NERDTree is a file explorer plugin that provides "project drawer" 291 | functionality to your vim projects. You can learn more about it with 292 | :help NERDTree. 293 | 294 | **Customizations**: Janus adds a number of customizations to the core 295 | NERDTree: 296 | 297 | * Use `n` to toggle NERDTree 298 | * Ignore compiled ruby, python, and java files 299 | * When opening vim with vim /path, open the left NERDTree to that 300 | directory, set the vim pwd, and clear the right buffer 301 | * In general, assume that there is a single NERDTree buffer on the left 302 | and one or more editing buffers on the right 303 | 304 | 305 | ## [SuperTab](http://github.com/ervandew/supertab) *janus-features-supertab* 306 | 307 | In insert mode, start typing something and hit `` to tab-complete 308 | based on the current context. 309 | 310 | 311 | ## [Syntastic](https://github.com/scrooloose/syntastic/) *janus-features-syntastic* 312 | 313 | Syntastic is a syntax checking plugin that runs buffers through external syntax 314 | checkers as they are saved and opened. If syntax errors are detected, the user 315 | is notified and is happy because they didn't have to compile their code or 316 | execute their script to find them. 317 | 318 | 319 | ## [Tagbar](https://github.com/majutsushi/tagbar) *janus-features-tagbar* 320 | 321 | Tagbar is a vim plugin for browsing the tags of source code files. 322 | 323 | **Customizations**: Janus binds `rt` to toggle Tagbar. 324 | 325 | 326 | ## [EasyMotion](https://github.com/Lokaltog/vim-easymotion) *janus-features-easymotion* 327 | 328 | EasyMotion provides a much simpler way to use some motions in vim. It 329 | takes the out of w or f{char} by highlighting 330 | all possible choices and allowing you to press one key to jump directly 331 | to the target. 332 | 333 | When one of the available motions is triggered, all visible text 334 | preceding or following the cursor is faded, and motion targets are 335 | highlighted. 336 | 337 | EasyMotion is triggered by one of the provided mappings. 338 | 339 | check EasyMotion's [home 340 | page](https://github.com/Lokaltog/vim-easymotion) for more information. 341 | 342 | 343 | ## [NrrwRgn](https://github.com/chrisbra/NrrwRgn) *janus-features-nrrwrgn* 344 | 345 | Narrowing means focussing on a region and making the rest inaccessible. 346 | You simply select the region, call :NarrowRegion and the selected part 347 | will open in a new scratch buffer. The rest of the file will be 348 | protected, so you won't accidentally modify that buffer. In the new 349 | buffer, you can do a global replace, search or anything else to modify 350 | that part. When you are finished, simply write that buffer (e.g. by 351 | |:w|) and your modifications will be put in the original buffer making 352 | it accessible again. 353 | 354 | 355 | ## Git Support ([Fugitive](http://github.com/tpope/vim-fugitive)) *janus-features-git* 356 | 357 | Fugitive adds pervasive git support to git directories in vim. For more 358 | information, use `:help fugitive` 359 | 360 | Use `:Gstatus` to view `git status` and type `-` on any file to stage or 361 | unstage it. Type `p` on a file to enter `git add -p` and stage specific 362 | hunks in the file. 363 | 364 | Use `:Gdiff` on an open file to see what changes have been made to that 365 | file 366 | 367 | **customizations**: 368 | 369 | * `gb` maps to `:Gblame` 370 | * `gs` maps to `:Gstatus` 371 | * `gd` maps to `:Gdiff` 372 | * `gl` maps to `:Glog` 373 | * `gc` maps to `:Gcommit` 374 | * `gp` maps to `:Git push` 375 | 376 | 377 | ## [ZoomWin](http://github.com/vim-scripts/ZoomWin) *janus-features-zoomwin* 378 | 379 | When working with split windows, ZoomWin lets you zoom into a window and 380 | out again using `Ctrl-W o` 381 | 382 | **Customizations**: Janus binds `zw` to `:ZoomWin` 383 | 384 | 385 | ## [BufferGator](https://github.com/jeetsukumaran/vim-buffergator) *janus-features-buffergator* 386 | 387 | Buffergator is a plugin for listing, navigating between, and selecting 388 | buffers to edit. Upon invocation (using the command, `:BuffergatorOpen` 389 | or `BuffergatorToggle`, or the provided key mapping, `b`), a 390 | `catalog` of listed buffers are displayed in a separate new window split 391 | (vertical or horizontal, based on user options; default = vertical). 392 | From this "buffer catalog", a buffer can be selected and opened in an 393 | existing window, a new window split (vertical or horizontal), or a new 394 | tab page. 395 | 396 | Selected buffers can be "previewed", i.e. opened in a window or tab 397 | page, but with focus remaining in the buffer catalog. Even better, you 398 | can "walk" up and down the list of buffers shown in the catalog by using 399 | `` (or ``) / `` (or ``). These keys select the 400 | next/previous buffer in succession, respectively, opening it for preview 401 | without leaving the buffer catalog viewer. 402 | 403 | ## [Vroom](https://github.com/skalnik/vim-vroom) *janus=features-vroom* 404 | 405 | VRoom is a plugin inspired by [Gary Bernhardt's vim 406 | config](https://github.com/garybernhardt/dotfiles/blob/69330074b7a15c67efa4594a71fa91592f1ce4f9/.vimrc#L286-342) 407 | for running your ruby tests/specs/features. 408 | 409 | Imagine you're hacking on a Rails controller, when you switch to the 410 | test or specs for the controller, you can use `r` to run all the 411 | specs or `R` to run the closest spec, then you can jump back to 412 | the controller hack on it and use `r` to run the last spec you 413 | ran last time, so you don't need to open the test again. 414 | 415 | Then benefits of this plugin are to centralize your workflow in one 416 | window, one software to do it all, which is a huge speedup over using 417 | `tmux` or multiple terminal tabs. 418 | 419 | ## Additional Syntaxes *janus-features-syntaxes* 420 | 421 | Janus ships with a few additional syntaxes: 422 | 423 | * Markdown (bound to \*.markdown, \*.md, and \*.mk) 424 | * Mustache (bound to \*.mustache) 425 | * Haml (bound to \*.haml) 426 | * Sass (bound to \*.sass) 427 | * SCSS (bound to \*.scss) 428 | * An improved JavaScript syntax (bound to \*.js) 429 | * Javascript for any file having `nodejs` in the shebang. 430 | * Map Gemfile, Rakefile, Vagrantfile, Procfile, Thorfile, config.ru and 431 | *.rake to Ruby. 432 | * Git commits (set your `EDITOR` to `vim -f` or `mvim -f` on OSX) 433 | `$ echo "export EDITOR='vim -f'" >> ~/.bashrc`, you can also use Git 434 | global config to set this if you have EDITOR set to something else 435 | `$ git config --global core.editor 'vim -f'` 436 | 437 | 438 | ## Rakefile *janus-rakefile* 439 | 440 | If you're looking for the old janus distribution controlled by a 441 | Rakefile then please head over to the [rakefile 442 | branch](https://github.com/carlhuda/janus/tree/rakefile) but please note 443 | that the rakefile branch will not be maintained. 444 | 445 | 446 | ## License *janus-license* 447 | 448 | ### This code is free to use under the terms of the MIT license. 449 | 450 | Permission is hereby granted, free of charge, to any person obtaining 451 | a copy of this software and associated documentation files (the 452 | "Software"), to deal in the Software without restriction, including 453 | without limitation the rights to use, copy, modify, merge, publish, 454 | distribute, sublicense, and/or sell copies of the Software, and to 455 | permit persons to whom the Software is furnished to do so, subject to 456 | the following conditions: 457 | 458 | The above copyright notice and this permission notice shall be included 459 | in all copies or substantial portions of the Software. 460 | 461 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 462 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 463 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 464 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 465 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 466 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 467 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 468 | 469 | 470 | ------------------------------------------------------------------------------ 471 | vim:tw=78:ft=help: 472 | --------------------------------------------------------------------------------