All Projects → amiorin → Vim Project

amiorin / Vim Project

lcd to the root of the project everytime you BufEnter a file inside a project.

Labels

Projects that are alternatives of or similar to Vim Project

Vim Textobj Line
Vim plugin: Text objects for the current line
Stars: ✭ 134 (-13.55%)
Mutual labels:  viml
Minivimrc
a tiny vimrc to be used primarily for troubleshooting plugins
Stars: ✭ 140 (-9.68%)
Mutual labels:  viml
Vim Jekyll
📝 Fork of psykidellic/vim-jekyll because actually forking it freaks out
Stars: ✭ 151 (-2.58%)
Mutual labels:  viml
Haskellmode Vim
An unpacked copy of the haskellmode vimball. Ping me if it needs updating.
Stars: ✭ 135 (-12.9%)
Mutual labels:  viml
Inkpot
Inkpot 88/256 Colour Scheme for Vim
Stars: ✭ 138 (-10.97%)
Mutual labels:  viml
Matchit.zip
extended % matching for HTML, LaTeX, and many other languages
Stars: ✭ 146 (-5.81%)
Mutual labels:  viml
Unite Outline
outline source for unite.vim
Stars: ✭ 132 (-14.84%)
Mutual labels:  viml
Vim Tmuxify
Vim plugin for handling tmux panes.
Stars: ✭ 152 (-1.94%)
Mutual labels:  viml
Vim Textobj Indent
Vim plugin: Text objects for indented blocks of lines
Stars: ✭ 140 (-9.68%)
Mutual labels:  viml
Mru.vim
Plugin to manage Most Recently Used (MRU) files
Stars: ✭ 149 (-3.87%)
Mutual labels:  viml
Vimkata
Deliberate Practice lessons for learning the Vim Editor
Stars: ✭ 135 (-12.9%)
Mutual labels:  viml
Doxygentoolkit.vim
Simplify Doxygen documentation in C, C++, Python.
Stars: ✭ 138 (-10.97%)
Mutual labels:  viml
Tlib vim
Some utility functions for VIM
Stars: ✭ 147 (-5.16%)
Mutual labels:  viml
Eddie Vim2
Yet another vimrc
Stars: ✭ 135 (-12.9%)
Mutual labels:  viml
Vimside
Vim Scala IDE (VimSIde) built upon ENSIME
Stars: ✭ 151 (-2.58%)
Mutual labels:  viml
Align
Help folks to align text, eqns, declarations, tables, etc
Stars: ✭ 132 (-14.84%)
Mutual labels:  viml
C.vim
C/C++ IDE -- Write and run programs. Insert statements, idioms, comments etc.
Stars: ✭ 142 (-8.39%)
Mutual labels:  viml
Vim Flavored Markdown
Stars: ✭ 153 (-1.29%)
Mutual labels:  viml
Dotvim
A community driven framework for vim
Stars: ✭ 151 (-2.58%)
Mutual labels:  viml
Vim Js Context Coloring
JavaScript Context Coloring in Vim
Stars: ✭ 149 (-3.87%)
Mutual labels:  viml

News

Introduction

A Project is made of :

  • One directory (the root of the project)
  • One title (by default the last part of the the root of the project)
  • One or more callbacks

Everytime you open a file nested in the root of the project

  • the local current directory is changed to the root of the project
  • the guitablabel is set to the title of the project
  • the callbacks of the project are executed

img

Commands

There are four commands :

  • Project It's used inside the .vimrc. The first parameter is the path to the project. The second parameter is optional and it is the title of the project and the default value of it is the last part of the name of the directory containing the project. If the path to the project is a relative path, it's combined with the starting path. The starting path is defined when you initialize the plugin :
set rtp+=~/.vim/bundle/vim-project/
" custom starting path
call project#rc("~/Code")
" default starting path (the home directory)
call project#rc()
  • ProjectPath It's used inside the cmdline mode. The first parameter is the path without quotation. The second parameter is optional and it is the title of the project without quotation. If the path to the project is a relative path, it's combined with current working directory and not with the starting path.
  • File It's used inside the .vimrc. The first parameter is the path to the file. The second parameter is the title of the file. This command doesn't change the local current directory.
  • Callback It's used inside the .vimrc. The first parameter is the title of a project already defined with Project or File. The second parameter is the name a function or an array of function names. This function or these functions are callbacks and they are executed everytime a file nested in the root of the project is opened with one parameter that is the title of the project.
  • Welcome It's the Startify equivalent. If you don't want Welcome to appear when you start vim:
" before call project#rc()
let g:project_enable_welcome = 0
" if you want the NERDTree integration.
let g:project_use_nerdtree = 1

set rtp+=~/.vim/bundle/vim-project/
call project#rc("~/Code")

Welcome

Callbacks

The command Callback accepts a string (the name of the function). The function project#config#callback accepts string or dictionary. If it's a dictionary, the method invoke(title) is called on the dictionary.

" For more information on dictionary and prototype programming in vim :
:h self

The function project#utils#alternate can be used together with project#config#callback. It returns a dictionary. This dictionary has the method invoke(title) that creates <buffer> commands to switch to the alternate files like the plugin vim-rake.

" :A :AE :AS :AV :AT :AD :AR . They all accept the bang (!)
" Remembet that the title of the project is only the last dir of the path
Project  'nugg.ad/nuggad-compiler'

" project#utils#alternate returns a dictionary with a method ``invoke(title)``.
"
" everytime we open a file inside the project if the path starts with
" ``spec`` or ``src`` the commands :A are defined.
"
" +_spec means add _spec to the file
" -_spec means remove _spec to the file
call project#config#callback("nuggad-compiler", project#utils#alternate(
  \  [{'regex': '^src', 'string': 'spec', 'suffix': '+_spec'},
  \   {'regex': '^spec', 'string': 'src', 'suffix': '-_spec'}]
  \  ))

Install

If you use Vundle you can install this plugin using Vim command :BundleInstall amiorin/vim-project. Don't forget put a line Bundle 'amiorin/vim-project' in your .vimrc.

If you use Pathogen, you just execute following:

cd ~/.vim/bundle
git clone https://github.com/amiorin/vim-project.git

If you don't use either plugin management system, copy the plugin directory to your .vim directory.

*nix: $HOME/.vim Windows: $HOME/vimfiles

Configure

sample .vimrc:

let g:project_use_nerdtree = 1
set rtp+=~/.vim/bundle/vim-project/
call project#rc("~/Code")

Project  'scratch'

Project  'dotfiles'
File     'dotfiles/vimrc'                       , 'vimrc'
File     'dotfiles/gvimrc'                      , 'gvimrc'
File     'dotfiles/zshrc'                       , 'zshrc'

Project  'gollum'
File     'gollum/Todo.md'                       , 'todo'
Callback 'gollum'                               , 'RemoveTextWidth'

function! RemoveTextWidth(...) abort
  setlocal textwidth=0
endfunction

Project  'octopress'
Project  'gsource'
Project  'markup'
Project  'glib'
Project  'reloadlive'
Project  'flashcards'
Project  'leitner'
Callback 'leitner'                              , ['AddSpecToPath', 'RemoveTextWidth']

function! AddSpecToPath(tile) abort
  setlocal path+=spec
endfunction

Project  '~/.vim/bundle/vim-fenced-code-blocks' , 'fenced'
Project  '~/.vim/bundle/vim-project'            , 'project'
Project  '~/.vim/bundle/vim-bookmarks'          , 'bookmarks'
Project  '~/.vim/bundle/ctrlp.vim'              , 'ctrlp'
Project  '~/.vim/bundle/ctrlp-z'                , 'ctrlp-z'
Project  '~/.vim/bundle/vim-eval'               , 'eval'

Interactive

From the cmdline mode.

ProjectPath uses the cwd and the arguments are not quoted.

:ProjectPath .
:ProjectPath /etc myconfig

Self-Promotion

Like this plugin?

Bitdeli Badge

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].