-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnvim
95 lines (71 loc) · 2.69 KB
/
nvim
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
" ======================
" Basic Configuration
" ======================
set number relativenumber
set colorcolumn=99,100
set scrolloff=10
" Match Gruvbox theme
hi FgCocErrorFloatBgCocFloating ctermfg=15 ctermbg=1 guifg=White guibg=Red
hi Pmenu ctermbg=242 guibg=DarkGrey
filetype plugin on
" Highlight current selected word. Space key to activate in visual mode
noremap <space> viw
" Split the current file on `\` + `v`
noremap <leader>v :vsplit<CR>
noremap <S-h> <C-w>h
noremap <S-l> <C-w>l
" Quick yank (copy) paste of words `<shift>` + `y` or `p` respectively
noremap <S-p> viwpviwy
noremap <S-y> viwy
" =====================
" On file read evenets
" =====================
" ==== .toml =========
autocmd BufReadPost *.toml set tabstop=2
autocmd BufReadPost *.toml set shiftwidth=2
" ==== .rs ==========
autocmd BufReadPost *.rs set tabstop=4
autocmd BufReadPost *.rs set shiftwidth=4
autocmd BufReadPost *.rs set colorcolumn=80,100
autocmd BufReadPost *.rs set shiftwidth=2
" =====================
" On file write evenets
" =====================
" ======================
" Package Manager
" ======================
call plug#begin('~/.vim/plugged')
" ==== Plugins =========
Plug 'neoclide/coc.nvim', {'branch': 'release'}
Plug 'rust-lang/rust.vim'
Plug 'iamcco/coc-spell-checker'
Plug 'cloudhead/neovim-fuzzy'
" Readme viewer `:MarkdownPreview` to start and `"MarkdownPreviewStop` to stop
Plug 'iamcco/markdown-preview.nvim', { 'do': { -> mkdp#util#install() }, 'for': ['markdown', 'vim-plug']}
" ==== Config =========
" coc.nvim Enter to select when nothing is highlighted
inoremap <silent><expr> <cr> pumvisible() ? coc#_select_confirm() : "\<C-g>u\<CR>"
" tab to navigate the completion list
inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
" Shift tab to navigate the completion list backwards
inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"
" Code formatting on save
augroup mygroup
autocmd!
" Setup formatexpr specified filetype(s).
autocmd FileType typescript,json,rs setl formatexpr=CocAction('formatSelected')
" Update signature help on jump placeholder.
autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp')
augroup end
let g:rustfmt_autosave = 1
" Coc Spell check. Map to `\` + `a` when selected
vmap <leader>a <Plug>(coc-codeaction-selected)
nmap <leader>a <Plug>(coc-codeaction-selected)
" Will split the current screen horizontally and open up the definition of the highlighted text
" with `\` + `v`
noremap <leader>o :call CocAction('jumpDefinition', 'vsplit')<CR>
" Fuzzy filesearch and grep on `\` + `f` or `e` respectively.
" This keeps the shortcuts similar to default vim
noremap <leader>e :FuzzyOpen<CR>
noremap <leader>f :FuzzyGrep<CR>
call plug#end()