Code Monkey home page Code Monkey logo

nvim's Introduction

neovim config

Preview

image

depend on neovim/neovim: Vim-fork focused on extensibility and usability (github.com)

install

Windows

winget install Neovim.Neovim

Homebrew on macOS or Linux

brew install neovim

Or install the development version of Nvim:

brew install --HEAD neovim

To update the development version of Nvim:

brew upgrade neovim --fetch-HEAD

linux

curl -LO https://github.com/neovim/neovim/releases/latest/download/nvim.appimage
chmod u+x nvim.appimage
./nvim.appimage

If the ./nvim.appimage command fails, try:

./nvim.appimage --appimage-extract
./squashfs-root/AppRun --version

# Optional: exposing nvim globally.
sudo mv squashfs-root /
sudo ln -s /squashfs-root/AppRun /usr/bin/nvim
nvim

CentOS 8 / RHEL 8

Neovim is available through EPEL (Extra Packages for Enterprise Linux)

yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
yum install -y neovim python3-neovim

Clear Linux OS

Neovim is available through the neovim bundle

sudo swupd bundle-add neovim

nvim config

  1. create folder
mkdir -p ~/.config/nvim && cd  ~/.config/nvim &&  git clone https://github.com/congyukun/nvim.git 
  1. Go to directory
cd  ~/.config/nvim/lua/plugins

3.nvim edit plugins-setup.lua

nvim plugins-setup.lua

4.install plugins

<esc> :w 

5.wait a moment

key map

vim.g.mapleader = " "

local keymap = vim.keymap

-- <CR> = enter
-- ---------- 插入模式 insert ---------- ---
keymap.set("i", "kk", "<ESC>")
keymap.set("i", "<leader>q", "<ESC>:q!<CR>")
keymap.set("i", "<leader>wq", "<ESC>:wq<CR>")
keymap.set("i", "<leader>w", "<ESC>:w!<CR>")

-- 跳到行首行尾 Jump to the end of the first line
keymap.set('i', '<C-h>', '<Esc>I', opt)
keymap.set('i', '<C-l>', '<Esc>A', opt)

-- ---------- 视觉模式  Visual ---------- ---
-- 单行或多行移动 Single-line or multi-line movement
keymap.set("v", "<leader>j", ":m '>+1<CR>gv=gv")
keymap.set("v", "<leader>k", ":m '<-2<CR>gv=gv")

-- ---------- 正常模式 Normal---------- ---
-- 窗口
keymap.set("n", "<leader>d", "<C-w>v") -- 水平新增窗口 Horizontal new window
keymap.set("n", "<leader>D", "<C-w>s") -- 垂直新增窗口 Vertical new window
keymap.set("n", "<leader>sc", "<C-w>c", opt) -- sc 关闭当前分屏 Close current split screen  (s = close)
keymap.set("n", "<leader>so", "<C-w>o", opt) -- so 关闭其他分屏 Close other split screens (o = other)

-- Alt + hjkl 在窗口之间跳转 Jump between windows
keymap.set('n', '<C-h>', '<C-w>h', opt)
keymap.set('n', '<C-j>', '<C-w>j', opt)
keymap.set('n', '<C-k>', '<C-w>k', opt)
keymap.set('n', '<C-l>', '<C-w>l', opt)
-- 取消高亮 Unhighlight
keymap.set("n", "<leader>nh", ":nohl<CR>")

-- 切换buffer change buffer
keymap.set("n", "<C-L>", ":bnext<CR>")
keymap.set("n", "<C-H>", ":bprevious<CR>")

-- ---------- plugins ---------- ---
-- nvim-tree
keymap.set("n", "<leader>e", ":NvimTreeToggle<CR>")



-- <leader>t 开启终端 create new Terminal
keymap.set('n', '<leader>t', ':sp | terminal<CR>', opt)
keymap.set('n', '<leader>T', ':vsp | terminal<CR>', opt)
-- <Esc> 退出终端 quit Terminal
keymap.set('t', '<Esc>', '<C-\\><C-N>', opt)
-- 终端窗口中进行窗口切换 Window switching in terminal window
keymap.set('t', '<C-h>', [[ <C-\><C-N><C-w>h ]], opt)
keymap.set('t', '<C-j>', [[ <C-\><C-N><C-w>j ]], opt)
keymap.set('t', '<C-k>', [[ <C-\><C-N><C-w>k ]], opt)
keymap.set('t', '<C-l>', [[ <C-\><C-N><C-w>l ]], opt)



-- H 移动到行首(Move to the beginning of the line),L 移动到行尾(Move to end of line)
keymap.set('n', 'H', '^', opt)
keymap.set('n', 'L', 'g_', opt)

-- 上下滚动浏览(Scroll up and down)
keymap.set('n', '<C-U>', '4j', opt)
keymap.set('n', '<C-D>', '4k', opt)
-- 修改 Ctrl-u 和 Ctrl-d 的移动幅度 从默认的移动半瓶改为移动 9 行
keymap.set('n', '<C-u>', '9k', opt)
keymap.set('n', '<C-d>', '9j', opt)


-- 退出 quit
keymap.set('n', 'q', ':q<CR>', opt)
keymap.set('n', 'qq', ':q!<CR>', opt)
keymap.set('n', 'Q', ':qa!<CR>', opt)

nvim's People

Contributors

congyukun avatar

Stargazers

quarkball avatar Clake lee avatar hodge avatar RED avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.