IT

vim 용 플러그인을 어떻게 설치합니까?

lottoking 2020. 6. 15. 08:07
반응형

vim 용 플러그인을 어떻게 설치합니까?


아래 링크 된 Vim 플러그인을 사용 해보고 싶습니다. 그것은 구문 강조 기능 추가 .haml와 (아마도) .sass파일을.

http://github.com/tpope/vim-haml

나는 이걸했다...

$ cd ~/.vim
$ git clone git://github.com/tpope/vim-haml.git

.hamlVim에서 파일을 열었 지만 강조 표시가 없습니다. 수행해야 할 다른 단계가 있어야합니다.


이 두 명령은 ~/.vim/vim-haml/ftplugin, 구문 등의 디렉토리가 있는 디렉토리를 만듭니다 . 이러한 디렉토리는 ~/.vim적절한 디렉토리에 즉시 ~/.vim/vim-haml있어야 하거나 vim이 플러그인을 검색하는 경로 목록에 추가해야합니다.

편집하다:

나는 최근에 vim 설정을 조정하기로 결정했고 그 과정에서 다음 레이크 파일을 작성하지 못했습니다. Mac / Linux에서만 작동하지만 cp버전에 비해 장점 은 완전히 안전하다는 것입니다 (심볼은 기존 파일을 덮어 쓰지 않고 제거는 심볼릭 링크 만 삭제합니다).

# Easily install vim plugins from a source control checkout (e.g. Github)
#
# alias vim-install=rake -f ~/.vim/rakefile-vim-install
# vim-install
# vim-install uninstall

require 'ftools'
require 'fileutils'

task :default => :install
desc "Install a vim plugin the lazy way"
task :install do
  vim_dir      = File.expand_path("~/.vim")
  plugin_dir   = Dir.pwd

  if not (FileTest.exists? File.join(plugin_dir,".git") or
          FileTest.exists? File.join(plugin_dir,".svn") or
          FileTest.exists? File.join(plugin_dir,".hg"))
      puts "#{plugin_dir} isn't a source controlled directory. Aborting."
      exit 1
  end

  Dir['**/'].each do |d|
    FileUtils.mkdir_p File.join(vim_dir, d)
  end

  Dir["**/*.{txt,snippet,snippets,vim,js,wsf}"].each do |f|
    ln File.join(plugin_dir, f), File.join(vim_dir,f)
  end

  boldred = "\033[1;31m"
  clear = "\033[0m"
  puts "\nDone. Remember to #{boldred}:helptags ~/.vim/doc#{clear}"
end

task :uninstall do
  vim_dir      = File.expand_path("~/.vim")
  plugin_dir   = Dir.pwd
  Dir["**/*.{txt,snippet,snippets,vim}"].each do |f|
    safe_rm File.join(vim_dir, f)
  end
end

def nicename(path)
    boldgreen = "\033[1;32m"
    clear = "\033[0m"
    return "#{boldgreen}#{File.join(path.split('/')[-2..-1])}#{clear}\t"
end

def ln(src, dst)
    begin
        FileUtils.ln_s src, dst
        puts "    Symlink #{nicename src}\t => #{nicename dst}"
    rescue Errno::EEXIST
        puts "  #{nicename dst} exists! Skipping."
    end
end

def cp(src, dst)
  puts "    Copying #{nicename src}\t=> #{nicename dst}"
  FileUtils.cp src, dst
end

def safe_rm(target)
    if FileTest.exists? target and FileTest.symlink? target
        puts "    #{nicename target} removed."
        File.delete target
    else
        puts "  #{nicename target} is not a symlink. Skipping"
    end
end


실제 .vim파일이 있는지 확인하십시오~/.vim/plugin/


Karl의 응답을 확장하기 위해 Vim은 특정 디렉토리 세트에서 런타임 파일을 찾습니다. 를 통해 해당 디렉토리 세트를 볼 수 있습니다 :set runtimepath?. Vim이 내부 ~/.vim/vim-haml들여다 보도록 하려면

set runtimepath+=$HOME/.vim/vim-haml

당신에게 ~/.vimrc. ~/.vimrcvim-haml에서 제공하는 모든 기능을 활성화 하려면 다음을 원할 것 입니다.

filetype plugin indent on
syntax on

You can refer to the 'runtimepath' and :filetype help topics in Vim for more information.


I think you should have a look at the Pathogen plugin. After you have this installed, you can keep all of your plugins in separate folders in ~/.vim/bundle/, and Pathogen will take care of loading them.

Or, alternatively, perhaps you would prefer Vundle, which provides similar functionality (with the added bonus of automatic updates from plugins in github).

참고URL : https://stackoverflow.com/questions/1639606/how-do-i-install-a-plugin-for-vim

반응형