📜 ⬆️ ⬇️

Pathogen. We organize plugins

Problem


Wim inherited the directory structure from Unix, where files are organized according to the function it performs, and not the packages to which they belong. The complexity of removing and updating packages with such an organization has led to the emergence of package managers.

Decision


Pathogen allows you to install plug-ins in separate directories completely transparent to Wim, and the plug-ins placed “as before” will continue to work (for example, a collection of color schemes).

Example of directories on the working machine:
$ ls ~/.vim/bundle/ eclim nerdtree vim-align vim-haml vim-ruby vim-vividchalk gist PreciseJump VimCalc vim-markdown vim-ruby-debugger wombat256mod IndexedSearch snipmate.vim vim-cucumber vim-rails vim-shoulda jquery SuperTab-continued. vim-fugitive vim-repeat vim-surround matchit.zip textile.vim vim-git Vim-R-plugin vim-tcomment 


Installation

Just download the latest version of pathogen.vim , put it in ~/.vim/autoload and add the following lines to your .vimrc :
')
 filetype off call pathogen#helptags() call pathogen#runtime_append_all_bundles() filetype plugin indent on 


Everything, now all plugins located in their directories in ~/.vim/bundle will be automatically loaded.

Update

In addition, it became easy to update the plugins, for which Tammer Saleh wrote a small script (carefully, before updating, it deletes all the old plugins), it needs to be placed in the ~/.vim :
 #!/usr/bin/env ruby git_bundles = [ "git://github.com/astashov/vim-ruby-debugger.git", "git://github.com/msanders/snipmate.vim.git", "git://github.com/scrooloose/nerdtree.git", "git://github.com/timcharper/textile.vim.git", "git://github.com/tpope/vim-cucumber.git", "git://github.com/tpope/vim-fugitive.git", "git://github.com/tpope/vim-git.git", "git://github.com/tpope/vim-haml.git", "git://github.com/tpope/vim-markdown.git", "git://github.com/tpope/vim-rails.git", "git://github.com/tpope/vim-repeat.git", "git://github.com/tpope/vim-surround.git", "git://github.com/tpope/vim-vividchalk.git", "git://github.com/tsaleh/vim-align.git", "git://github.com/tsaleh/vim-shoulda.git", "git://github.com/tsaleh/vim-supertab.git", "git://github.com/tsaleh/vim-tcomment.git", "git://github.com/vim-ruby/vim-ruby.git", ] vim_org_scripts = [ ["IndexedSearch", "7062", "plugin"], ["gist", "12732", "plugin"], ["jquery", "12107", "syntax"], ] require 'fileutils' require 'open-uri' bundles_dir = File.join(File.dirname(__FILE__), "bundle") FileUtils.cd(bundles_dir) puts "Trashing everything (lookout!)" Dir["*"].each {|d| FileUtils.rm_rf d } git_bundles.each do |url| dir = url.split('/').last.sub(/\.git$/, '') puts " Unpacking #{url} into #{dir}" `git clone #{url} #{dir}` FileUtils.rm_rf(File.join(dir, ".git")) end vim_org_scripts.each do |name, script_id, script_type| puts " Downloading #{name}" local_file = File.join(name, script_type, "#{name}.vim") FileUtils.mkdir_p(File.dirname(local_file)) File.open(local_file, "w") do |file| file << open("http://www.vim.org/scripts/download_script.php?src_id=#{script_id}").read end end 

Source: https://habr.com/ru/post/116523/


All Articles