To build a pure keyboard working environment, a problem is how to select texts in terminal (then copy them). I've tried to solve this with select plugin of urxvt, but it can't work as expected from time to time.
The following solution use the terminal mode of neovim instead. Thus which terminal emulator (gnome-terminal, urxvt or xfce-terminal) to use is irrelevant. Most of the time we work in terminal mode, and swtich to normal mode to select, copy and paste texts.
To make the workflow smooth, I created the following script for this scenario, in which defined some runtime attributes, some convenient keyboard shortcuts, start terminal mode, turned on insert for receive user input:
cat << EOF > ~/.config/nvim-term.vim
set clipboard+=unnamedplus
set nobackup
set noswapfile
set incsearch
set nowrap
set nonumber
set laststatus=0
tnoremap <C-o> <C-\><C-n>
tnoremap <C-q> <C-\><C-n>:q<CR>
terminal
startinsert
EOF
Then modify the shortcut of starting terminal in i3 configuration:
bindsym $mod+Return exec gnome-terminal -- $HOME/.linuxbrew/bin/nvim -u $HOME/.config/nvim-term.vim
Notes:
Here
If you need
- go back to normal mode with
- run command
:tunmap <C-q>
Now you can use :q
.
For the i3 shortcut:
- The
--
followinggnome-terminal
is mandatory; - Absolute paths of executable and script must be used to avoid "file not found" error.