All Projects → jbgutierrez → Vim Partial

jbgutierrez / Vim Partial

Licence: mit
Makes creating partials in your code a breeze!

Labels

Projects that are alternatives of or similar to Vim Partial

Vim Lookup
Jump to the definition of variables or functions in VimL code.
Stars: ✭ 51 (-12.07%)
Mutual labels:  viml
Javacomplete
Omni Completion for JAVA
Stars: ✭ 53 (-8.62%)
Mutual labels:  viml
Rubyblue
A collection of themes for different text editors that mimic the colors used in the code samples on ruby-lang.org
Stars: ✭ 54 (-6.9%)
Mutual labels:  viml
Fmacvim
MacVim + essential plugins + my custom (and awesome) .vimrc
Stars: ✭ 52 (-10.34%)
Mutual labels:  viml
Bookmark
[DEPRECATED] 웹 즐겨찾기
Stars: ✭ 53 (-8.62%)
Mutual labels:  viml
Yaml Vim
YAML Highlight script for VIM editor
Stars: ✭ 53 (-8.62%)
Mutual labels:  viml
Vimtips Fortune
A vimtips to fortune software.
Stars: ✭ 50 (-13.79%)
Mutual labels:  viml
Grep.vim
Grep search tools integration with Vim
Stars: ✭ 56 (-3.45%)
Mutual labels:  viml
Ansible Splunk Simple
Simple deployment of Splunk using Ansible, static host lists.
Stars: ✭ 53 (-8.62%)
Mutual labels:  viml
Vim Alignta
Align Them All!
Stars: ✭ 54 (-6.9%)
Mutual labels:  viml
Buffet.vim
A vimplugin for switching and managing buffer lists
Stars: ✭ 52 (-10.34%)
Mutual labels:  viml
Viki vim
A personal wiki for Vim
Stars: ✭ 52 (-10.34%)
Mutual labels:  viml
Vim Giphy
Giphy in your vim
Stars: ✭ 54 (-6.9%)
Mutual labels:  viml
Ctrlp Extensions.vim
Plugins for ctrlp.vim
Stars: ✭ 51 (-12.07%)
Mutual labels:  viml
Vim Better Javascript Completion
An expansion of Vim's current JavaScript syntax file.
Stars: ✭ 55 (-5.17%)
Mutual labels:  viml
Vim Qargs
A Vim plugin that adds a :Qargs utility command, for populating the argument list from the files in the quickfix list.
Stars: ✭ 50 (-13.79%)
Mutual labels:  viml
Vim Togglemouse
Toggles the mouse focus between Vim and your terminal emulator, allowing terminal emulator mouse commands, like copy/paste.
Stars: ✭ 53 (-8.62%)
Mutual labels:  viml
Vim Holylight
A Vim plugin for MacBook users that automatically sets the background to light or dark depending on the ambient light
Stars: ✭ 57 (-1.72%)
Mutual labels:  viml
Vim Sauce
Multiple source file management for Vim
Stars: ✭ 55 (-5.17%)
Mutual labels:  viml
Vimdown
A dirty tool to convert .vimrc and .vim script files to markdown
Stars: ✭ 54 (-6.9%)
Mutual labels:  viml

vim-partial

Partial plugin is a tool developed to help you break down your code into partials.

Usage

Simply select some lines on Visual mode, hit <leader>x, enter the desired partial location and the plugin will place the appropriate replacement.

Let me show you:

vim-partial

Note: Did you find this plugin useful? Please star it and share with others.

Configuration

You can tweak the behavior of Partial by setting a few variables in your vimrc file.

Default Mapping

The default mapping to extract a partial is <leader>x in visual mode. The same mapping will dispose an existing partial in normal mode.

You can easy map it to other keys. For example:

vmap <Leader>p :PartialExtract<cr>
nmap <Leader>p :PartialDispose<cr>

g:loaded_partial

Partial is loaded only once. Set this to 1 to force Partial to reload every time its file is sourced.

g:partial_templates

Common file extensions are supported (Markup: .dust, .erb, .haml, .slim - Stylesheets: .css, .less, .sass, .scss) and you can widen this list by declaring a dictionary like so:

let g:partial_templates = {
      \   'ejs': '<%% include %s %%>',
      \   'hbs': '{{> %s }}'
      \ }

g:partial_templates_roots

Partial works with a list of usual roots for keeping your templates. If you happen to use an uncommon root folder you can extend this list like so:

let s:partial_templates_roots = [
      \ 'stylus',
      \ 'tmpls'
      \ ]

g:partial_keep_position

Cursor stays on the same position after replacement. Set this to 0 if you want to continue with the edition of the partial file.

g:partial_use_splits

New windows for partials are closed after being created. Set this to 1 if you want to keep the partial in a new window.

g:partial_vertical_split

Partial uses horizontal splits. Set this to 1 if you prefer vertical splits.

g:partial_create_dirs

Partial creates directories as required. Set this to 0 if you don't want Partial to create new directories.

Implementation details

After triggering :PartialExtract the editor will:

  • throw an error if the file type is not supported (you may want to expand this list!)
  • suggest a folder with the same name as the file you are working in (without extensions)
  • throw an error if the file exists (you can overcome this error by triggering :PartialExtract!)
  • ensure the file has the proper extension(s) and create intermediate directories as required
  • set partial path relative to the templates folder and dispose any preceding underscores on the partial name
  • save the partial content getting rid of unneeded leading spaces and tabs
  • make the replacement

Partial tries to set suffixesadd and includeexpr on BufEnter to navigate to partials under the cursor with gf.

Bugs

Please report any bugs you may find on the GitHub issue tracker.

Contributing

Think you can make Partial better? Great!, contributions are always welcome.

Fork the project on GitHub and send a pull request.

Credits

This isn't new. I've borrow the core idea from the following two plugins:

License

Partial is licensed under the MIT license. See http://opensource.org/licenses/MIT

Happy hacking!

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].