vim on davidchua https://dchua.com/tags/vim/ Recent content in vim on davidchua Hugo -- gohugo.io en-us Mon, 21 Mar 2016 23:32:45 +0800 Disable wordwrapping for easier markdown composing in vim https://dchua.com/posts/2016-03-21-disable-wordwrapping-for-easier-markdown-composing-in-vim/ Mon, 21 Mar 2016 23:32:45 +0800 https://dchua.com/posts/2016-03-21-disable-wordwrapping-for-easier-markdown-composing-in-vim/ If you’re writting a really long prose in markdown, you probably have experienced the annoying thing that vim does when dealing with a long line; it creates linebreaks when your textwidth value is met. This gets absolutely annoying especially since markdown reads linebreaks as linebreaks and displays it as such when rendered. Fret not, a quick way is to set your autocmd in your .vimrc to disable said wrapping for markdown files or any file extension that you’d like. Change your Vim Colorscheme https://dchua.com/posts/2015-08-24-change-your-vim-colorscheme/ Mon, 24 Aug 2015 00:00:00 +0000 https://dchua.com/posts/2015-08-24-change-your-vim-colorscheme/ Step 1: Install the awesome vim-colorschemes If you’re using vim + vundle like me: " add to .vimrc Plugin 'flazz/vim-colorschemes' :PluginInstall Step 2: Choose your colorscheme There’s a pretty cool site that aggregates most of the available colorschemes on github and previews them for you. You can check them out at vimcolors.com Step 3: Install your colorscheme Most colorschemes are pretty easy to install. To get you started, you can clone flazz/vim-colorschemes and just copy the colors/*. Add text to end of multiple line - vim https://dchua.com/posts/2014-01-26-add-text-to-end-of-multiple-line-vim/ Sun, 26 Jan 2014 12:21:39 +0800 https://dchua.com/posts/2014-01-26-add-text-to-end-of-multiple-line-vim/ Suppose you have a whole list of text: Movies Travel Fashion (Men) Fashion (Women) Education Technology Clubbing Nightlife Fine Dining Food E-Commerce Beauty Wellness Gaming Performing Arts Sports Books Music Photography Fitness Gadgets And you want to make the whole thing an array in ruby. How do you do it in vim, quickly? First, we need to give everyone quotation marks. Using surround.vim, do: Surround the entire text using Ctrl-V In vim, type: :norm yss " This will give every single line in the selection a "" like: Backspacing in vim (OSX) https://dchua.com/posts/2011-09-06-backspacing-in-vim-osx/ Tue, 06 Sep 2011 00:00:00 +0000 https://dchua.com/posts/2011-09-06-backspacing-in-vim-osx/ A quick tip for those using vim on their OSX terminal. If you’re trying to figure out why you can’t backspace and remove characters from vim, you’d need to add the following in your ~/.vimrc set backspace=indent,eol,start That should allow you to now delete previous characters with your ‘backspace’ (delete) key :) References: http://stackoverflow.com/questions/3534028/mac-terminal-vim-will-only-use-backspace-when-at-the-end-of-a-line http://blog.edogg.com/index.php?/archives/19-How-to-fix-the-backspace-keep-in-vim-on-OS-X.html Changing default colorscheme in gvim/mvim https://dchua.com/posts/2011-02-09-changing-default-colorscheme-in-gvimmvim/ Wed, 09 Feb 2011 00:00:00 +0000 https://dchua.com/posts/2011-02-09-changing-default-colorscheme-in-gvimmvim/ A common mistake I’ve often fall into is forgetting how to set a default colorscheme for GUI vim editors. If you’re using gvim, MacVim, to set your default colorscheme, you’ll need to edit (or create if it doesn’t exist) ~/.gvimrc instead of your normal ~/.vimrc. For example in my ~/.gvimrc: colorscheme darkblue