mirror of
https://github.com/MaskRay/ccls.git
synced 2025-02-16 21:58:08 +00:00
Port hanjianl's wiki page
parent
f01b9dad9e
commit
bc6d916b77
69
Neovim.md
Normal file
69
Neovim.md
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
## [[Getting started]]
|
||||||
|
|
||||||
|
## Install [LanguageClient-neovim](https://github.com/autozimu/LanguageClient-neovim)
|
||||||
|
Need [vim-plug](https://github.com/junegunn/vim-plug#unix-1)
|
||||||
|
|
||||||
|
### /home/YOUR_USERNAME/.config/nvim/init.vim
|
||||||
|
```vim
|
||||||
|
" LanguageClient-neovim
|
||||||
|
call plug#begin('~/.local/share/nvim/plugged')
|
||||||
|
Plug 'autozimu/LanguageClient-neovim', {
|
||||||
|
\ 'branch': 'next',
|
||||||
|
\ 'do': 'bash install.sh',
|
||||||
|
\ }
|
||||||
|
|
||||||
|
" Multi-entry selection UI. FZF
|
||||||
|
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
|
||||||
|
Plug 'junegunn/fzf.vim'
|
||||||
|
|
||||||
|
call plug#end()
|
||||||
|
```
|
||||||
|
|
||||||
|
### bash
|
||||||
|
```bash
|
||||||
|
nvim +PlugInstall +UpdateRemotePlugins +qa
|
||||||
|
```
|
||||||
|
|
||||||
|
### /home/YOUR_USERNAME/.config/nvim/settings.json
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"initializationOptions": {
|
||||||
|
"cacheDirectory": "/tmp/ccls"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### /home/YOUR_USERNAME/.config/nvim/init.vim
|
||||||
|
```vim
|
||||||
|
let g:LanguageClient_serverCommands = {
|
||||||
|
\ 'cpp': ['ccls', '--log-file=/tmp/cq.log'],
|
||||||
|
\ 'c': ['ccls', '--log-file=/tmp/cq.log'],
|
||||||
|
\ }
|
||||||
|
|
||||||
|
let g:LanguageClient_loadSettings = 1 " Use an absolute configuration path if you want system-wide settings
|
||||||
|
let g:LanguageClient_settingsPath = '/home/YOUR_USERNAME/.config/nvim/settings.json'
|
||||||
|
set completefunc=LanguageClient#complete
|
||||||
|
set formatexpr=LanguageClient_textDocument_rangeFormatting()
|
||||||
|
|
||||||
|
nnoremap <silent> gh :call LanguageClient_textDocument_hover()<CR>
|
||||||
|
nnoremap <silent> gd :call LanguageClient_textDocument_definition()<CR>
|
||||||
|
nnoremap <silent> gr :call LanguageClient_textDocument_references()<CR>
|
||||||
|
nnoremap <silent> gs :call LanguageClient_textDocument_documentSymbol()<CR>
|
||||||
|
nnoremap <silent> <F2> :call LanguageClient_textDocument_rename()<CR>
|
||||||
|
```
|
||||||
|
|
||||||
|
### In your Project Directory NEED compile_commands.json
|
||||||
|
|
||||||
|
[[compile_commands.json]]
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bear make #If you like Makefile
|
||||||
|
```
|
||||||
|
|
||||||
|
or
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bear gcc x.c -o x
|
||||||
|
```
|
||||||
|
|
||||||
|
or any other
|
Loading…
Reference in New Issue
Block a user