==================== Neovim and Tmux ==================== Install Neovim ============== Neovim ------ macOS: .. code-block:: bash brew install neovim Linux 等平台参考 `Neovim 官方安装说明 `_。 快速版要求 Neovim 0.10+,日常版要求 0.12+。 Neovim 配置依赖 --------------- 快速版不需要 Node.js、Python provider、编译器或 Tree-sitter CLI。 日常版的按需安装说明见下面“两套独立配置”。 Install Tmux ============ .. tab-set:: .. tab-item:: MacOS .. code-block:: bash brew install tmux .. tab-item:: Linux (APT) .. code-block:: bash apt install tmux .. tab-item:: Linux (Source) First, please keep \ :code:`~/.local/bin`\ in the \ :code:`PATH`\, then \ :code:`make && make install`\ in the \ :code:`tmp/`\ dir. .. code-block:: bash mkdir tmp cd tmp/ curl -OL https://invisible-island.net/datafiles/release/ncurses.tar.gz tar -xvf ncurses.tar.gz LOC=$(curl -s https://api.github.com/repos/libevent/libevent/releases/latest | grep "browser_download_url"| awk '{ print $2 }' | awk -F '[\"\"]' '{print $2}' | grep tar.gz$ ) ; curl -OLl $LOC LOC=$(curl -s https://api.github.com/repos/tmux/tmux/releases/latest | grep "browser_download_url" | awk '{ print $2 }' | awk -F '[\"\"]' '{print $2}'); curl -OL $LOC # install libevent mkdir $HOME/.local cd $HOME/tmp tar -zxf libevent*.tar.gz cd libevent-*/ ./configure --prefix=$HOME/.local --enable-shared make && make install cd $HOME/tmp tar -zxf ncurses*.tar.gz cd ncurses*/ ./configure --prefix=$HOME/.local --with-shared --with-termlib --enable-pc-files --with-pkg-config-libdir=$HOME/.local/lib/pkgconfig make && make install # install tmux cd $HOME/tmp tar -zxf tmux-*.tar.gz cd tmux-*/ PKG_CONFIG_PATH=$HOME/.local/lib/pkgconfig ./configure --prefix=$HOME/.local make && make install .. include:: ../../nvim/readme.rst Why tmux instead of Zellij ========================== 其实我还真的挺喜欢\ :literal:`Rust`\的,但是对于\ :literal:`Zellij`\的使用体验确实不太好。 所以最后还是选用了\ :literal:`tmux`\. 具体的启用包括复制下面的config到\ :code:`~/.tmux.conf`\,然后\ :code:`tmux source-file .tmux.conf`\即可。 .. code-block:: bash curl -SL https://raw.githubusercontent.com/hotchilipowder/my_config/refs/heads/main/tmux/.tmux.conf -o ~/.tmux.conf tmux source-file ~/.tmux.conf .. dropdown:: \ :code:`~/.tmux.conf`\ .. literalinclude:: ../../tmux/.tmux.conf :language: bash Tmux with Neovim ================ The basic useful for my tmux with neovim is `vim-tmux-navigator `_, 但是这个最大的问题就是其中 \ :code:``\ 和 \ `toggleterm.nvim `_\ 设置的快捷键冲突了, 所以只能取消了。 .. attention:: 使用 \ :code:`:nmap `\ 就能看出来了 + :code:`:nmap` for normal mode mappings + :code:`:vmap` for visual mode mappings + :code:`:imap` for insert mode mappings .. tab-set:: .. tab-item:: Lazy.nvim .. code-block:: bash { 'christoomey/vim-tmux-navigator', keys={ {'', ':TmuxNavigateLeft'}, {'', ':TmuxNavigateDown'}, {'', ':TmuxNavigateUp'}, {'', ':TmuxNavigateRight'}, }, }, .. tab-item:: Plug .. code-block:: bash Plug 'christoomey/vim-tmux-navigator', let g:tmux_navigator_no_mappings = 1 noremap {Left-Mapping} :TmuxNavigateLeft noremap {Down-Mapping} :TmuxNavigateDown noremap {Up-Mapping} :TmuxNavigateUp noremap {Right-Mapping} :TmuxNavigateRight