Update readme, add some key bindings for vim tabs
This commit is contained in:
parent
2088c5e6be
commit
3b13afa8a2
25
README.md
25
README.md
@ -1,2 +1,27 @@
|
|||||||
# vim
|
# vim
|
||||||
|
|
||||||
|
My Vim configuration
|
||||||
|
|
||||||
|
## vim-plug
|
||||||
|
#### Vim
|
||||||
|
|
||||||
|
###### Unix
|
||||||
|
```sh
|
||||||
|
curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
|
||||||
|
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
|
||||||
|
```
|
||||||
|
#### Neovim
|
||||||
|
###### Linux
|
||||||
|
```sh
|
||||||
|
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'
|
||||||
|
```
|
||||||
|
## Conquer of Completion
|
||||||
|
|
||||||
|
Run commands in NeoVim/Vim:
|
||||||
|
```
|
||||||
|
:CocInstall coc-json coc-tsserver
|
||||||
|
:CocInstall coc-snippets
|
||||||
|
:CocInstall coc-vimtex
|
||||||
|
:CocInstall coc-pairs
|
||||||
|
```
|
||||||
|
58
init.vim
Normal file → Executable file
58
init.vim
Normal file → Executable file
@ -1,8 +1,8 @@
|
|||||||
syntax on
|
syntax on
|
||||||
set number
|
set number
|
||||||
set cursorline
|
set cursorline
|
||||||
set expandtab smarttab tabstop=4 shiftwidth=4 softtabstop=4
|
set expandtab tabstop=4 shiftwidth=4 softtabstop=4
|
||||||
set autoindent smartindent
|
set autoindent
|
||||||
|
|
||||||
|
|
||||||
" Fold
|
" Fold
|
||||||
@ -30,33 +30,20 @@ Plug 'vim-airline/vim-airline'
|
|||||||
Plug 'vim-airline/vim-airline-themes'
|
Plug 'vim-airline/vim-airline-themes'
|
||||||
Plug 'cocopon/iceberg.vim'
|
Plug 'cocopon/iceberg.vim'
|
||||||
Plug 'kevinhwang91/nvim-bqf'
|
Plug 'kevinhwang91/nvim-bqf'
|
||||||
|
Plug 'morhetz/gruvbox'
|
||||||
call plug#end()
|
call plug#end()
|
||||||
|
|
||||||
"Color scheme
|
"Color scheme
|
||||||
colorscheme iceberg
|
"colorscheme iceberg
|
||||||
|
colorscheme gruvbox
|
||||||
set background=light
|
set background=light
|
||||||
|
let g:gruvbox_contrast_light = 'hard'
|
||||||
|
|
||||||
|
|
||||||
"Open NERDTree
|
"Open NERDTree
|
||||||
:nnoremap <silent> <expr> <F2> g:NERDTree.IsOpen() ? "\:NERDTreeClose<CR>" : bufexists(expand('%')) ? "\:NERDTreeFind<CR>" : "\:NERDTree<CR>"
|
:nnoremap <silent> <expr> <F2> g:NERDTree.IsOpen() ? "\:NERDTreeClose<CR>" : bufexists(expand('%')) ? "\:NERDTreeFind<CR>" : "\:NERDTree<CR>"
|
||||||
|
|
||||||
"Coc.nvim
|
"Coc.nvim
|
||||||
:set completeopt=longest,menuone
|
|
||||||
:inoremap <expr> <CR> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"
|
|
||||||
inoremap <expr> <C-n> pumvisible() ? '<C-n>' :
|
|
||||||
\ '<C-n><C-r>=pumvisible() ? "\<lt>Down>" : ""<CR>'
|
|
||||||
|
|
||||||
inoremap <expr> <M-,> pumvisible() ? '<C-n>' :
|
|
||||||
\ '<C-x><C-o><C-n><C-p><C-r>=pumvisible() ? "\<lt>Down>" : ""<CR>'
|
|
||||||
" open omni completion menu closing previous if open and opening new menu without changing the text
|
|
||||||
inoremap <expr> <C-Space> (pumvisible() ? (col('.') > 1 ? '<Esc>i<Right>' : '<Esc>i') : '') .
|
|
||||||
\ '<C-x><C-o><C-r>=pumvisible() ? "\<lt>C-n>\<lt>C-p>\<lt>Down>" : ""<CR>'
|
|
||||||
" open user completion menu closing previous if open and opening new menu without changing the text
|
|
||||||
inoremap <expr> <S-Space> (pumvisible() ? (col('.') > 1 ? '<Esc>i<Right>' : '<Esc>i') : '') .
|
|
||||||
\ '<C-x><C-u><C-r>=pumvisible() ? "\<lt>C-n>\<lt>C-p>\<lt>Down>" : ""<CR>'
|
|
||||||
|
|
||||||
"Autocomplete with the first option if pop up menu is open.
|
|
||||||
"inoremap <silent><expr> <TAB> pumvisible() ? coc#_select_confirm() : "\<C-g>u\<TAB>"
|
|
||||||
inoremap <silent><expr> <cr> pumvisible() ? coc#_select_confirm() : "\<C-g>u\<cr>"
|
inoremap <silent><expr> <cr> pumvisible() ? coc#_select_confirm() : "\<C-g>u\<cr>"
|
||||||
inoremap <silent><expr> <TAB>
|
inoremap <silent><expr> <TAB>
|
||||||
\ pumvisible() ? coc#_select_confirm() :
|
\ pumvisible() ? coc#_select_confirm() :
|
||||||
@ -70,7 +57,7 @@ function! s:check_back_space() abort
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
let g:coc_snippet_next = '<tab>'
|
let g:coc_snippet_next = '<tab>'
|
||||||
nnoremap <leader>s :CocCommand snippets.editSnippets<CR>
|
nnoremap <leader>e :CocCommand snippets.editSnippets<CR>
|
||||||
|
|
||||||
" Comments
|
" Comments
|
||||||
let mapleader = ","
|
let mapleader = ","
|
||||||
@ -87,9 +74,23 @@ nnoremap <C-Left> <C-W>h
|
|||||||
nnoremap <C-Down> <C-W>j
|
nnoremap <C-Down> <C-W>j
|
||||||
nnoremap <C-Up> <C-W>k
|
nnoremap <C-Up> <C-W>k
|
||||||
nnoremap <C-Right> <C-W>l
|
nnoremap <C-Right> <C-W>l
|
||||||
nnoremap <leader>o :tabonly<CR>
|
nnoremap <leader>to :tabonly<CR>
|
||||||
|
nnoremap <leader>o :only<CR>
|
||||||
|
nnoremap <tab> :tabn<CR>
|
||||||
|
nnoremap <S-tab> :tabp<CR>
|
||||||
|
nnoremap <BS> <C-O>
|
||||||
|
|
||||||
|
"set clipboard+=unnamedplus
|
||||||
|
" " Copy to clipboard
|
||||||
|
vnoremap <leader>y "+y
|
||||||
|
nnoremap <leader>Y "+yg_
|
||||||
|
nnoremap <leader>y "+y
|
||||||
|
nnoremap <leader>yy "+yy
|
||||||
|
|
||||||
|
" " Paste from clipboard
|
||||||
|
nnoremap <leader>p "+p
|
||||||
|
nnoremap <leader>P "+P
|
||||||
|
|
||||||
set clipboard+=unnamedplus
|
|
||||||
|
|
||||||
" FZF key mapping
|
" FZF key mapping
|
||||||
nnoremap <silent> <Leader>b :Buffers<CR>
|
nnoremap <silent> <Leader>b :Buffers<CR>
|
||||||
@ -102,17 +103,6 @@ filetype plugin on
|
|||||||
set splitright
|
set splitright
|
||||||
set splitbelow
|
set splitbelow
|
||||||
|
|
||||||
" " Copy to clipboard
|
|
||||||
vnoremap <leader>y "+y
|
|
||||||
nnoremap <leader>Y "+yg_
|
|
||||||
nnoremap <leader>y "+y
|
|
||||||
nnoremap <leader>yy "+yy
|
|
||||||
|
|
||||||
" " Paste from clipboard
|
|
||||||
nnoremap <leader>p "+p
|
|
||||||
nnoremap <leader>P "+P
|
|
||||||
vnoremap <leader>p "+p
|
|
||||||
vnoremap <leader>P "+P
|
|
||||||
|
|
||||||
function! IBusOff()
|
function! IBusOff()
|
||||||
" Lưu engine hiện tại
|
" Lưu engine hiện tại
|
||||||
@ -154,7 +144,7 @@ silent call IBusOff()
|
|||||||
"Language tool
|
"Language tool
|
||||||
let b:ale_linter_aliases = ['tex', 'text', 'html']
|
let b:ale_linter_aliases = ['tex', 'text', 'html']
|
||||||
let g:ale_languagetool_executable = "java"
|
let g:ale_languagetool_executable = "java"
|
||||||
let g:ale_languagetool_options = "-jar /data/runtimes/languagetool/languagetool-commandline.jar --languagemodel /data/runtimes/languagemodel/ --word2vecmodel /data/runtimes/word2vec/ --disable WHITESPACE_RULE,COMMA_PARENTHESIS_WHITESPACE,CURRENCY[1]"
|
let g:ale_languagetool_options = "-jar /data/runtimes/languagetool/languagetool-commandline.jar --languagemodel /data/runtimes/languagemodel/ --word2vecmodel /data/runtimes/word2vec/ --disable WHITESPACE_RULE,COMMA_PARENTHESIS_WHITESPACE"
|
||||||
let g:ale_disable_lsp = 1
|
let g:ale_disable_lsp = 1
|
||||||
map <F3> :ALEToggle<CR>
|
map <F3> :ALEToggle<CR>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user