Skip to content

Provides indent functions for buffer. Simple, fast, robust, with no side effects.

License

Notifications You must be signed in to change notification settings

iibe/vim-autoindent

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

vim-autoindent

Provides indent functions for buffer. Simple, fast, robust, with no side effects.

Installation

Install using your favorite package manager, or manually.

Plugin Manager

For Pathogen:

git clone https://github.com/iibe/vim-autoindent ~/.vim/bundle/vim-autoindent

Remember to run :Helptags to generate help tags.

For neobundle.vim:

NeoBundle 'iibe/vim-autoindent'

For Vundle.vim:

Plugin 'iibe/vim-autoindent'

For vim-plug:

Plug 'iibe/vim-autoindent'

For vim-addon-manager:

call vam#ActivateAddons([ 'vim-autoindent' ])

For dein.vim:

call dein#add('iibe/vim-autoindent')

For minpac:

call minpac#add('iibe/vim-autoindent')

Manual

For Neovim:

git clone https://github.com/iibe/vim-autoindent.git ~/.config/nvim/plugged/vim-autoindent

For Vim:

git clone https://github.com/iibe/vim-autoindent.git ~/.vim/bundle/vim-autoindent

For Vim 8 (pack):

git clone https://github.com/iibe/vim-autoindent ~/.vim/pack/dist/start/vim-autoindent

Remember to run :helptags ~/.vim/pack/dist/start/vim-autoindent/doc to generate help tags.

Quick Start

Map keys or use format-on-save feature.

Keymap

nnoremap <silent> <leader>ib  :VaiBuffer<CR>
nnoremap <silent> <leader>ibi :VaiBufferIndentation<CR>
nnoremap <silent> <leader>ibw :VaiBufferWhitespaces<CR>

nnoremap <silent> <leader>if  :VaiFolder<CR>
nnoremap <silent> <leader>ifi :VaiFolderIndentation<CR>
nnoremap <silent> <leader>ifw :VaiFolderWhitespaces<CR>

Format on save

This is a potentially dangerous autocmd to have as it will always strip trailing whitespace and fix indentation from every file a user saves. Sometimes, trailing whitespace and native indentation is desired, or even essential in a file so be careful when implementing this autocmd. Use this features at your own risk.

For current file:

autocmd BufWritePre * call autoindent#Buffer()

For whole project (without .gitignore files):

autocmd BufWritePre * call autoindent#Folder()

Troubleshooting

  • If you get an error during installation, try to visit official repository for your package manager (since it's probably some typo or guide it outdated by itself).
  • If you have any suggestions for how the plugin works, feel free to do pull request.

Feedback

  • If you think vim-autoindent is useful, consider giving it a star.
  • If you have a bug or an idea, feel free to open an issue.

About

Provides indent functions for buffer. Simple, fast, robust, with no side effects.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages