nvim

字数 401 · 2021-08-20

migration

~/.vimrc -> ~/.config/nvim/init.vim

Python

1
python3 -m pip install --user --upgrade pynvim

Term

1
2
nnoremap <leader>t :bo sp term://zsh<CR>i<CR>
tnoremap <ESC><ESC> <C-\><C-n><C-w>:hide<CR> 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
:nnoremap <leader>t :call ToggleTerm("term-slider", 1)<CR>i
:tnoremap <ESC><ESC> <C-\><C-n><C-w>:call ToggleTerm("term-slider", 1)<CR>
:nnoremap <ESC><ESC> <C-\><C-n><C-w>:call ToggleTerm("term-slider", 1)<CR>i

function! ToggleTerm(termname, slider)
    let pane = bufwinnr(a:termname)
    let buf = bufexists(a:termname)
    if pane > 0
        " pane is visible
        if a:slider > 0
            :exe pane . ":hide"
        else
            :exe "e #"
        endif
    elseif buf > 0
        " buffer is not in pane
        if a:slider
            :exe "bo sp"
        endif
        :exe "buffer " . a:termname
    else
        " buffer is not loaded, create
        if a:slider
            :exe "bo sp"
        endif
        :terminal
        :exe "f " a:termname
    endif
endfunction

Plugins

Awesome List https://github.com/rockerBOO/awesome-neovim

Plug

1
2
sh -c 'curl -fLo "${XDG_DATA_HOME:-$HOME/.local/share}"/nvim/site/autoload/plug.vim --create-dirs \
       https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'

defx

https://github.com/Shougo/defx.nvim

Lsp

https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md

Telescope

1
2
-- call extension with opts
:lua require("telescope").extensions.heading.heading({sorting_strategy="ascending"})