I'm trying to make VIM as my ruby/rails editor. So fat I'm really impress with its features and I was able to install following plug ins to give me a better IDE experience
However I'm still having difficulties in finding a way to format/align my code. As an example sometimes I might copy and paste code from another place and then the entire code is scattered.
Ex: items.css.scss
.throw {
float:left; width: 100%;
margin-bottom: 2px;
border: solid gray 1px;
border-radius: 10px;
.cell {
float: left;
padding-left: 6px;
padding-right: 6px;
}
}
I want it to be
.throw {
float:left; width: 100%;
margin-bottom: 2px;
border: solid gray 1px;
border-radius: 10px;
.cell {
float: left;
padding-left: 6px;
padding-right: 6px;
}
}
What would be the best plugin/method to align/format code in VIM
Try pasting it with ]p
or issue :set paste
before pasting and :set nopaste
afterwards to put vim into paste mode when you're pasting code. Also you can map that to some key combination of your choosing so that you won't have to type it every time. You can get more info on both methods from vim's help (:h ]p
, :h paste
).