Today when I try to move a file using shutil.move() on my Windows machine, I encounter an error message:

PermissionError: [WinError 32] The process cannot access the file because it is being used by another process

In this post, I will write about what I have learned from this error.

In this post, I will write about how to install and configure Neovim on Windows 101.

On Linux system, if we do not have root priviledge, we can not use package managers to install a package to its default location (usually under /usr). Besides, the packages installed by the package managers are often too old to have the latest features. Or, even if we have root priviledge, we do not want to mess up with the system-wide packages and just want to experiment with a package locally. On these ocassions, we may want to install the package to a custom location.

fzf is an interactive fuzzy file search tool on the command-line. It is fast and powerful. In this post, I will introduce its installation ans usage.

This is a post about how to configure Cygwin on Windows 10.

In this post, I compiled a list of questions related to Tmux during the process of learning how to use it.

If you connect your Android device to your Macbook, you will notice that your phone is not recognized. Unlike Windows, Apple’s Mac seems not so friendly to Android devices. Of course, you can install Android File Transfer provided by Google and connect your phone to Mac. But it is kind of cumbersome and does work so well. In this post, I will introduce several ways to transfer files between Android and Mac wirelessly.

In this post, I want to write about how to set up true color support in Tmux, Nvim and shell and make them work nicely together.

There are tons of disccusions on the internet regarding how to set up true color support to make Tmux, Nvim and terminal work together. Time flies and settings may change. There are also many people who do not really know the reason behind all the settings and give some ad-hoc settings. All these lead to chaos. It turns out setting up true color support is painfully difficult and wastes me several hours.

Today I want to use some regular expression for searching and replacing in my files. But I found that NVim’s regular expression engine has its own flavor, which is different from the regex engine used by Sublime Text.1 I ended up learning some of the basics of Nvim-style regex. In this post, I want to emphasize on how to use lookaround2 in Nvim.

Tmux is a great terminal multiplexer. The Tmux installed by yum is too old1 on my CentOS servers. So I decided to install the latest version of Tmux which supports true colors. Since I do not have root priviledge on the system, I have to build Tmux from source and install it to my custom directory. If that is also what you want to do, then go on reading.

Zsh is a powerful shell with better auto-completion and richer functions. There are also various plugins to enrich your experience of using shell. In this post, I will introduce the installation and simple configurations for zsh.

Recently I just bought a MacBook Pro 2018. While it is a good design overall, its built-in keyboard is not so great AFAIK. So I bought a mechanical keyboard ikbc c87. The mechanical keyboard is designed for Windows operating systems. I have to make a few tweaks to make my typing experience smooth.

In the past, I often use plain print() to display some statistics during the training process and validation process. But it is not convenient to save the statistics in a file for later inspection. Once the program is finished, we do not have an overview of the training process. I am aware that there are packages such as tensorboardX and visdom, which are specifically designed for inspecting the various statistics during running. Right now, I would rather keep the program plain simple and usable. So I decided to give Python logging pacakge a try.

TL;DR

If you want to set parameter’s default value to True, use

parser.add_argument('--param', action='store_false')


Otherwise, use

parser.add_argument('--param', action='store_true')


when we use argparse to manager program parameters and add a parameter, we often use the action options to set the parameter’s value to a boolean value. But I have previously misunderstood this options and made a mistake. In this post, I will explain how does this option work and how to use it correctly.

If you have a nerdtree file navigation window on the left of the current buffer and use :bd1, you will find that the nerdtree window will occupy the whole window. When you open another buffer, you have to manually resize the nerdtree window to a smaller size, which is super annoying.

How to prevent this behaviour?

When you want to find out where a method is used across your whole project, how do you do it in Nvim? Various tools are available, for example, ack, ag or rg. These are the 3 most popular tools to use. In the following post, I will introduce how to install and use these packages with Nvim.

I am a Neovim (or Nvim in abbreviation) user. In Nvim, we use Ctrl-W as prefix for window-related operations. But in tmux, the default prefix is Ctrl-B. As a result, when I want to change panes in tmux, I often mistakenly press Ctrl-W, which is annoying. Why not change tmux prefix to be more vim-like?

When we are using Neovim, we often open several files in a window. Each file correponds to a buffer. How to switch to a buffer quickly?