Skip to content
This repository has been archived by the owner on Mar 13, 2024. It is now read-only.

Rogerskelamen/nvim

Repository files navigation

the Usage of My Neovim

Notice!! Now I'm using lua version for my neovim configuration and management :)

If you want to copy My neovim configuration, this readme tutorial may help you a lot.

Also, this configuration help me to remember the forgotten function. After all, the configuration is so much.

If you use neovim-win64, you may want to apply this branch

Installation

  1. Of course you have to install Neovim:
  • for Windows:

    choco install neovim
  • for Linux:

    apt install neovim
  • for MacOS:

    brew install neovim

if you don't know what Neovim is, please see here and here

  1. clone the repo into your $HOME/.config/
git clone https://github.com/Rogerskelamen/nvim.git
mv ./nvim $HOME/.config/
  1. get into your neovim and add plugin: :PlugInstall(optional but recommended)

  2. (optional)if you want to use semshi, you have to run :UpdateRemotePlugins(see #60)

Dependencies

  • python3

  • node

  • clang

  • ctags

Plugin Management

My neovim use vim-plug as default plugin manager

You can change it into other plugin manager as you wish

Code Completion

I use the coc.nvim as default code completion tool

the extensions in Conquer of Completion

  • coc-explorer

  • coc-yank

  • coc-vimlsp

  • coc-syntax

  • coc-snippets

  • coc-marketplace

  • coc-json

  • coc-html

  • coc-emmet

  • coc-vetur

  • coc-tsserver

  • coc-jedi

  • coc-java

  • coc-go

  • coc-css

  • coc-clangd

  • coc-markmap

  • coc-translator

  • coc-tabnine

  • coc-calc

You can easily change one of them by adding the following settings:

let g:coc_global_extensions = ['coc-explorer']

Theme

My Neovim now use the everforest as default

There are some other options to choose:

If your terminal support 24-bit(true color), you can use this command below to make your Neovim also use 24-bit:

set termguicolors
let $NVIM_TUI_ENABLE_TRUE_COLOR=1

ps: and I have set it for you

You may find all the color scheme have their transparent background, but it is actually configured by Neovim. You can release the certain line to turn on/off the effect:

autocmd vimenter * hi Normal guibg=NONE ctermbg=NONE

All of these has coded into the init.vim, you can turn on one of them by release the certain comment

the Cursor

my neovim makes the cursor as a block when you in normal mode, and it will changes into a slim line once you insert some content

Basic Usage

First of all, My LEADER key is Space, do remember

Save and Quit

S for Save, and Q for Quit

Ctrl+q for Quit All!

the basic movement: J, K, H, L

These four has been changed into move 5 lines or 5 columns

use m to jump to the end or start of the line

Windows Open and Move

  • <LEADER> + movement key

    Move toward the exact direction that you press the key between different windows.

  • direction key (UP...)

    Expand or shrink the windows size according to your direction key

  • <LEADER> + v or + s

    Create a split window, v for vertical, s for no vertical

  • sv, sh

    split vertically, split horizontally

    Change the format of current split window, sv for vertical one, sh for horizontal one.

Quick select and change

Since I integrated the wildfire and vim-surround, it becomes easy to select a code block and change it into other code blocks(or surrounded by other brackets).

  • Enter+S": select the code block and make it surrounded by "

  • cs'": change ' bracket into "

Tab Usage

  • tu: open a new tab

  • th, tl: move to a left/right tab

Indentation Usage

use only one > or < to indent the line

Some LEADER key functions

  • <LEADER>rc: open the $NVIM/init.vim with nvim.

  • <LEADER>sc: open the Spell Check function

  • <LEADER>y: open the clipboard history

  • <LEADER>o: toggle fold

Others

the default s key has been disabled. You can either transform it into some other key function

  • <LEADER> + /: make the highlight disabled

  • \v: visual mode make to line end

  • \s: the global replace

  • double press <LEADER>

    Press space twice to jump to the next '<++>' and edit it, this is a little trick to make your coding more sufficiently

UI Performance

Line number is shown at left, cursorline is also able. And if you want to turn on the relativenumber, please set set relativenumber

I have made the neovim shows the | when you press Tab (polyglot support), and the when you press Space as long as the cursor at end of the line.


Also, when you open a file, I make the neovim to put your cursor on the position the last place you closed the file.


In addition, when you scroll you screen, the cursor will stay 5 lines above the bottom of the screen and 5 lines below the top of the screen.

Startify

Now I use a static neovim logo

I use figlet to draw the 3D-ascii, so you have to get figlet installed in your machine if you want the ascii picture.

As well, you have to add 3d.flf to figlet which makes sure the command works well.

Run Function

you can run your code just simply press r key, and the supported languages are listed below:

  • c

  • c++

  • java

  • shell

  • python

  • html

  • markdown

  • tex

  • javascript

  • go

Of course you have to get the correct compiler first

Plugin Hot Key

  • Ctrl+i or Tab: open coc-explorer

  • tt: open the Tagbar

  • <LEADER>c<LEADER>: comment or discomment one line or a block

  • <LEADER>f: open the fzf in neovim

  • <LEADER>b: open the buffers view window

  • <LEADER>rg: open the ranger in neovim

  • <LEADER>m: open the cmus controller in neovim

  • <LEADER>g: open the lazygit interface

  • <LEADER>e: open the chinese translator

  • <LEADER>x: calculate out the result of current expression

  • <LEADER>u: toggle the UndoTree

  • g]: go to the next error place

  • g[: go to the previous error place

  • gd: go to the definition

  • gy: go to the type definition

  • gi: go to the implementation

  • gr: go to the references

  • Ctrl+h: show document

  • <LEADER>H: preview the Git Change

  • <LEADER>gf: fold git Gutter

  • g-: go to previous git change

  • g=: go to next git change

The Ctrl+i has been mapped as coc-explorer, so I map the Ctrl+l to return the next changed area

Terminal Usage

Use LEADER+Enter to open a terminal below your edit workspace

  • Ctrl+n: quit inputting in terminal

  • Ctrl+o: quick back to editing file

Warning: by now you could only use one terminal for your editing session, I will continue to improve it.

Markdown Usage

For a better experience of markdown writing, you should add a file named .ctags in your $HOME directory. It contains following content:

--langdef=markdown
--langmap=markdown:.md
--regex-markdown=/^(#+)[ \t]+([^#]*)/\1 \2/h,header,Markdown Headers/
--regex-markdown=/\[([^\[]+)\]\(([^\)]+)\)/\1/l,link,Markdown Links/
--regex-markdown=/!\[\]\(.*[\/ ](.*\.[a-z]{3})\)/\1/i,image,Markdown Image/

Then you could press tt to call your ctags to show markdown outline.

Make sure that you have installed ctags

  • ,b: bold text

  • ,i: italic text

  • ,u: underline text

  • ,k: keyboard text

  • ,$: latex math text

  • ,c: code block

  • st: toggle markdown table mode

  • <LEADER>z: open the markmap in browser

About

My NeoVim config repo

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages