Sometimes, we want an in-momery jpg or png image that is represented as binary data. But often, what we have got is image in numpy ndarray or PIL Image format. In this post, I describe how to convert numpy image or PIL Image object to binary data without saving the underlying image.
One key spirit of Vim is to accomplish something in as fewer key strokes as
possible. When you repeat a command a few times in order to perform an action,
you need to ask yourself if there is a better way to do it. Only in this way,
can you make progress in mastering Vim. For example, when your want to delete
five lines of texts, if you press
dd five times, you are certainly doing it
the wrong way. After looking up the Vim manual, you know that you can use
d4j: you only need three keystrokes instead of ten!
The other day, I saw a post in a forum asking for help on how to quickly move the cursor inside a buffer. After using Neovim for nearly a year, I would like to share what I have learnt about fast movement and navigation inside Neovim/Vim.
Recently, I was bitten by the unintuitive behaviour of
glob.glob() and I
think it would be beneficial to write down what I have found.
In this post, I want to share how to use
bindkeys command to solve a few
issues when using Zsh.
6.18 快到了，加上在家里使用的 IKBC C87 青轴声音太大，敲击费力，所以动了换一把更加静音，触发力度更小的键盘的心思。在京东和淘宝上入手了多款键盘试用，不得不说，一把好的键盘真的是难选啊。自从去年双十一入手了一把 Leopold 红轴键盘以后，其他的键盘真的很难入我的眼睛了。试用过的几把键盘以及感受如下：
Over the past few years, I have been using some dedicated note-taking software to take my notes. But all these tools I have tried are either slow or do not work well when I want to search some notes. Finally, I decided to take my notes in Markdown and convert them to PDF for reading.
Suppose that we have the following text in normal mode (cursor is indicated by
if we use
dw, we delete
hello<Space>1 and only
world is left; if we
hello is deleted and
<Space>world is left. Have you ever wondered
dw do not delete
de will delete the
seems that the motion
w are somewhat inconsistent. It turns out that
this has something to do with the exclusivity of motions in Vim.
Neovim has powerful ability in editing texts. But if you are in a browser and want to input some text, can we somehow utilize the editing power of Vim? In this post, I would like to share several ways to use Vim or Vim-like editing when you are working inside a browser.
Many normal mode commands accept a
count, which means to repeat the motion
count times. For example,
3j moves the cursor 3 lines below the current
4w will move the cursor four words forward. Usually, the
user-defined mappings can not take a count. Even if they can, they will most
probably not work the way you expect them to. In this post, I will describe
what I have learned to make a fairly complex mapping repeatable with a count.
In this post, I want to talk about how to enable built-in spell check in Nvim.
Some words are hard to type, it is handy if Neovim can provide auto-completion for the words we are typing. We can achieve word completion in Neovim in two ways.
I have been using Vim-airline for a while to customize my statusline. We can change the theme used for statusline with the many themes available in vim-airline-themes. Not all these themes looks good since it depends on the background color you use for Neovim and certainly your aesthetics.
I only use a handful of themes myself and I change my themes when I feel bored with one theme. It occurs to me that I can write a simple script to randomly pick a theme from my favorite list1. It turns out writing such a script is not easy for Neovim newbies like me.
In this post, I would like to share how I end up achieving what I want by mixing Vim script and Python script.
If you have used Sublime Text before, you may be familiar with the snippet function. Snippets let you input a trigger word and expand the trigger to some boilerplate code or string you do not want to repeat each time. You will increase your efficiency dramatically with the help of snippets.