# 1. edit whatever code i want to display in vim
# 2. use a user-defined command (while still in vim) :Xc to process the entire (or selected lines) of the current buffer to yield nicely-highlighted code block & load it to the X11 clipboard (using xclip)
# 3. use middle mouse click (hehe, i'm using thinkpad, anyway, this can be done by doing left & right click together on mouse) to paste it to whereever i like (eg. the textarea i'm typing in right now)
Enough said, let's get into action:
# S1. Installing the required packages:
pacman -S xclip
# S2. Inserting the user-defined command :Xc to ~/.vimrc
1 | func! Xclip() range |
# S3. Revising the existing ~/bin/code2html.rb to accept extra args
1 | #!/usr/bin/env ruby |
To try out, restart ur vim to edit any file, to convert the entire file, run the following command in vim:
:Xc
Alternatively, if u want to convert the selected lines (in visual mode, using Shift-v to select the specific lines):
:'<,'>Xc
And to do the pasting, just do middle (mouse) click on any textarea u are working on.
No comments:
Post a Comment