Skip to content

Commit 4161d5f

Browse files
committed
nvim: more nvim lsp setup for clang and rust
1 parent a2ae12a commit 4161d5f

File tree

4 files changed

+81
-6
lines changed

4 files changed

+81
-6
lines changed

.gitmodules

+3
Original file line numberDiff line numberDiff line change
@@ -97,3 +97,6 @@
9797
[submodule "local/share/nvim/plugged/clangd_extensions.nvim"]
9898
path = local/share/nvim/plugged/clangd_extensions.nvim
9999
url = https://github.com/p00f/clangd_extensions.nvim.git
100+
[submodule "local/share/nvim/plugged/rust-tools.nvim"]
101+
path = local/share/nvim/plugged/rust-tools.nvim
102+
url = https://github.com/simrat39/rust-tools.nvim.git

config/nvim/init.vim

+23-6
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,36 @@ set nocompatible
44
filetype plugin on
55
syntax on
66
set background=light
7+
set nu
8+
set laststatus=2
9+
set tabstop=4
10+
set softtabstop=0
11+
set expandtab
12+
set shiftwidth=4
13+
set smarttab
14+
set ruler
15+
set list
16+
17+
" If you search for something containing uppercase characters, it will do a case sensitive search;
18+
" if you search for something purely lowercase, it will do a case insensitive search.
19+
" NOTE: ignorecase affects substitutions as well as searches.
20+
set ignorecase
21+
set smartcase
22+
23+
" keep 5 lines context on curosr... eg. when searching
24+
set scrolloff=5
725

826

927
call plug#begin()
1028

11-
" color...
12-
Plug 'folke/tokyonight.nvim'
13-
1429
Plug 'hrsh7th/cmp-nvim-lsp'
1530
Plug 'hrsh7th/nvim-cmp'
1631
Plug 'hrsh7th/vim-vsnip'
1732

1833
Plug 'nvim-lua/plenary.nvim'
1934
Plug 'scalameta/nvim-metals'
35+
Plug 'neovim/nvim-lspconfig'
36+
Plug 'p00f/clangd_extensions.nvim'
2037

2138
" Fuzzy finding
2239
Plug 'junegunn/fzf'
@@ -30,9 +47,9 @@ Plug 'tpope/vim-repeat'
3047

3148
Plug 'lukas-reineke/indent-blankline.nvim'
3249

33-
call plug#end()
34-
50+
" rust lsp
51+
Plug 'simrat39/rust-tools.nvim'
3552

36-
colorscheme tokyonight-night
53+
call plug#end()
3754

3855

config/nvim/plugin/lsp.lua

+54
Original file line numberDiff line numberDiff line change
@@ -90,3 +90,57 @@ api.nvim_create_autocmd("FileType", {
9090
group = nvim_metals_group,
9191
})
9292

93+
94+
----------------------------------
95+
-- clangd Setup -------------------
96+
----------------------------------
97+
98+
require("lspconfig").clangd.setup({})
99+
100+
require("clangd_extensions").setup({
101+
inlay_hints = {
102+
inline = vim.fn.has("nvim-0.10") == 1,
103+
-- Options other than `highlight' and `priority' only work
104+
-- if `inline' is disabled
105+
-- Only show inlay hints for the current line
106+
only_current_line = false,
107+
-- Event which triggers a refresh of the inlay hints.
108+
-- You can make this { "CursorMoved" } or { "CursorMoved,CursorMovedI" } but
109+
-- not that this may cause higher CPU usage.
110+
-- This option is only respected when only_current_line and
111+
-- autoSetHints both are true.
112+
only_current_line_autocmd = { "CursorHold" },
113+
-- whether to show parameter hints with the inlay hints or not
114+
show_parameter_hints = true,
115+
-- prefix for parameter hints
116+
parameter_hints_prefix = "<- ",
117+
-- prefix for all the other hints (type, chaining)
118+
other_hints_prefix = "=> ",
119+
-- whether to align to the length of the longest line in the file
120+
max_len_align = false,
121+
-- padding from the left if max_len_align is true
122+
max_len_align_padding = 1,
123+
-- whether to align to the extreme right or not
124+
right_align = false,
125+
-- padding from the right if right_align is true
126+
right_align_padding = 7,
127+
-- The color of the hints
128+
highlight = "DiagnosticHint",
129+
-- The highlight group priority for extmark
130+
priority = 100,
131+
},
132+
memory_usage = {
133+
border = "none",
134+
},
135+
symbol_info = {
136+
border = "none",
137+
},
138+
})
139+
140+
require("clangd_extensions.inlay_hints").setup_autocmd()
141+
require("clangd_extensions.inlay_hints").set_inlay_hints()
142+
143+
144+
require("rust-tools").setup()
145+
require('rust-tools').inlay_hints.enable()
146+
Submodule rust-tools.nvim added at 0cc8ada

0 commit comments

Comments
 (0)