Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
dotfiles
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tim van Deurzen
dotfiles
Commits
b10c54d8
Commit
b10c54d8
authored
Nov 10, 2021
by
Tim van Deurzen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated keybindings and settings for Neovim.
parent
d58a3608
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
689 additions
and
449 deletions
+689
-449
neovim/lua/keybindings/compe.lua
neovim/lua/keybindings/compe.lua
+115
-41
neovim/lua/lsp/init.lua
neovim/lua/lsp/init.lua
+401
-179
neovim/lua/plugins/init.lua
neovim/lua/plugins/init.lua
+173
-229
No files found.
neovim/lua/keybindings/compe.lua
View file @
b10c54d8
local
t
=
function
(
str
)
return
vim
.
api
.
nvim_replace_termcodes
(
str
,
true
,
true
,
true
)
end
local
lspkind
=
require
(
"lspkind"
)
lspkind
.
init
()
local
check_back_space
=
function
()
local
col
=
vim
.
fn
.
col
(
'.'
)
-
1
if
col
==
0
or
vim
.
fn
.
getline
(
'.'
):
sub
(
col
,
col
):
match
(
'%s'
)
then
return
true
else
return
false
end
local
has_words_before
=
function
()
local
line
,
col
=
unpack
(
vim
.
api
.
nvim_win_get_cursor
(
0
))
return
col
~=
0
and
vim
.
api
.
nvim_buf_get_lines
(
0
,
line
-
1
,
line
,
true
)[
1
]:
sub
(
col
,
col
):
match
(
"%s"
)
==
nil
end
-- Use (s-)tab to:
--- move to prev/next item in completion menuone
--- jump to prev/next snippet's placeholder
_G
.
tab_complete
=
function
()
if
vim
.
fn
.
pumvisible
()
==
1
then
return
t
"<C-n>"
elseif
vim
.
fn
.
call
(
"vsnip#available"
,
{
1
})
==
1
then
return
t
"<Plug>(vsnip-expand-or-jump)"
elseif
check_back_space
()
then
return
t
"<Tab>"
else
return
vim
.
fn
[
'compe#complete'
]()
end
end
_G
.
s_tab_complete
=
function
()
if
vim
.
fn
.
pumvisible
()
==
1
then
return
t
"<C-p>"
elseif
vim
.
fn
.
call
(
"vsnip#jumpable"
,
{
-
1
})
==
1
then
return
t
"<Plug>(vsnip-jump-prev)"
else
return
t
"<S-Tab>"
end
end
local
luasnip
=
require
(
"luasnip"
)
local
cmp_autopairs
=
require
(
"nvim-autopairs.completion.cmp"
)
local
cmp
=
require
(
"cmp"
)
cmp
.
setup
({
completion
=
{
completeopt
=
"menu,menuone,noinsert"
,
},
mapping
=
{
[
"<C-d>"
]
=
cmp
.
mapping
.
scroll_docs
(
-
4
),
[
"<C-f>"
]
=
cmp
.
mapping
.
scroll_docs
(
2
),
[
"<C-e>"
]
=
cmp
.
mapping
.
close
(),
[
"<c-y>"
]
=
cmp
.
mapping
.
confirm
({
behavior
=
cmp
.
ConfirmBehavior
.
Insert
,
select
=
true
,
}),
[
"<c-q>"
]
=
cmp
.
mapping
.
confirm
({
behavior
=
cmp
.
ConfirmBehavior
.
Replace
,
select
=
true
,
}),
[
"<CR>"
]
=
cmp
.
mapping
.
confirm
({
select
=
true
}),
[
"<Tab>"
]
=
cmp
.
mapping
(
function
(
fallback
)
if
cmp
.
visible
()
then
cmp
.
select_next_item
()
elseif
luasnip
.
expand_or_jumpable
()
then
luasnip
.
expand_or_jump
()
elseif
has_words_before
()
then
cmp
.
complete
()
else
fallback
()
end
end
,
{
"i"
,
"s"
,
}),
[
"<S-Tab>"
]
=
cmp
.
mapping
(
function
(
fallback
)
if
cmp
.
visible
()
then
cmp
.
select_prev_item
()
elseif
luasnip
.
jumpable
(
-
1
)
then
luasnip
.
jump
(
-
1
)
else
fallback
()
end
end
,
{
"i"
,
"s"
,
}),
},
-- Youtube:
-- the order of your sources matter (by default). That gives them priority
-- you can configure:
-- keyword_length
-- priority
-- max_item_count
-- (more?)
sources
=
{
{
name
=
"nvim_lsp"
},
{
name
=
"nvim_lua"
},
{
name
=
"path"
},
{
name
=
"luasnip"
},
{
name
=
"buffer"
,
keyword_length
=
5
},
},
sorting
=
{
-- TODO: Would be cool to add stuff like "See variable names before method names" in rust, or something like that.
comparators
=
{
cmp
.
config
.
compare
.
offset
,
cmp
.
config
.
compare
.
exact
,
cmp
.
config
.
compare
.
score
,
cmp
.
config
.
compare
.
kind
,
cmp
.
config
.
compare
.
sort_text
,
cmp
.
config
.
compare
.
length
,
cmp
.
config
.
compare
.
order
,
},
},
snippet
=
{
expand
=
function
(
args
)
luasnip
.
lsp_expand
(
args
.
body
)
end
,
},
formatting
=
{
-- Youtube: How to set up nice formatting for your sources.
format
=
lspkind
.
cmp_format
({
with_text
=
true
,
menu
=
{
buffer
=
"[buf]"
,
nvim_lsp
=
"[LSP]"
,
nvim_lua
=
"[api]"
,
path
=
"[path]"
,
luasnip
=
"[snip]"
,
gh_issues
=
"[issues]"
,
},
}),
},
experimental
=
{
-- I like the new menu better! Nice work hrsh7th
native_menu
=
false
,
vim
.
api
.
nvim_set_keymap
(
"i"
,
"<Tab>"
,
"v:lua.tab_complete()"
,
{
expr
=
true
})
vim
.
api
.
nvim_set_keymap
(
"s"
,
"<Tab>"
,
"v:lua.tab_complete()"
,
{
expr
=
true
})
vim
.
api
.
nvim_set_keymap
(
"i"
,
"<S-Tab>"
,
"v:lua.s_tab_complete()"
,
{
expr
=
true
})
vim
.
api
.
nvim_set_keymap
(
"s"
,
"<S-Tab>"
,
"v:lua.s_tab_complete()"
,
{
expr
=
true
})
-- Let's play with this for a day or two
ghost_text
=
true
,
},
})
local
opts
=
{
noremap
=
true
,
silent
=
true
,
expr
=
true
}
vim
.
api
.
nvim_set_keymap
(
"i"
,
"<CR>"
,
[[compe#confirm({'keys': "\<Plug>delimitMateCR", 'mode': ''})]]
,
opts
)
vim
.
api
.
nvim_set_keymap
(
"i"
,
"<c-c>"
,
[[compe#complete()]]
,
opts
)
vim
.
api
.
nvim_set_keymap
(
"i"
,
"<c-e>"
,
[[compe#close('<c-e>')]]
,
opts
)
cmp
.
event
:
on
(
"confirm_done"
,
cmp_autopairs
.
on_confirm_done
({
map_char
=
{
tex
=
""
}
}))
neovim/lua/lsp/init.lua
View file @
b10c54d8
This diff is collapsed.
Click to expand it.
neovim/lua/plugins/init.lua
View file @
b10c54d8
return
require
(
'packer'
).
startup
(
function
()
use
'wbthomason/packer.nvim'
-- Color schemes
use
'morhetz/gruvbox'
use
'icymind/NeoSolarized'
use
'romgrk/doom-one.vim'
use
{
'tjdevries/gruvbuddy.nvim'
,
requires
=
{
'tjdevries/colorbuddy.vim'
},
config
=
function
()
--require('colorbuddy').colorscheme('gruvbox')
vim
.
cmd
[[colo gruvbox]]
end
}
-- UI
use
'ntpeters/vim-better-whitespace'
use
'Yggdroot/indentLine'
use
'haya14busa/incsearch.vim'
use
{
'junegunn/fzf.vim'
,
requires
=
{
'junegunn/fzf'
}
}
-- Look at feline for a leaner better maintained alternative.
use
{
'glepnir/galaxyline.nvim'
,
branch
=
'main'
,
config
=
function
()
require
(
'statusline'
)
end
,
requires
=
{
'kyazdani42/nvim-web-devicons'
}
}
use
'liuchengxu/vista.vim'
use
'kyazdani42/nvim-tree.lua'
use
{
'AckslD/nvim-whichkey-setup.lua'
,
requires
=
{
'liuchengxu/vim-which-key'
}
}
use
{
'akinsho/nvim-bufferline.lua'
,
requires
=
'kyazdani42/nvim-web-devicons'
,
config
=
function
()
require
(
'bufferline'
).
setup
{}
end
}
-- Utilities
use
'editorconfig/editorconfig-vim'
use
{
'nvim-treesitter/nvim-treesitter'
,
run
=
':TSUpdate'
,
requires
=
{
'nvim-treesitter/nvim-treesitter-refactor'
,
'nvim-treesitter/nvim-treesitter-textobjects'
},
}
use
{
'nvim-telescope/telescope.nvim'
,
requires
=
{
{
'nvim-lua/popup.nvim'
},
{
'nvim-lua/plenary.nvim'
},
{
'nvim-telescope/telescope-project.nvim'
}
},
config
=
function
()
require
(
'telescope'
).
load_extension
(
'project'
)
end
}
use
'Chiel92/vim-autoformat'
use
'Raimondi/delimitMate'
use
{
'Shougo/echodoc.vim'
,
config
=
function
()
vim
.
cmd
[[let g:echodoc#enable_at_start=1]]
end
}
-- Completion
use
{
'hrsh7th/nvim-compe'
,
config
=
function
()
require
(
'compe'
).
setup
{
enabled
=
true
;
autocomplete
=
true
;
debug
=
false
;
min_length
=
1
;
preselect
=
'enable'
;
throttle_time
=
80
;
source_timeout
=
200
;
incomplete_delay
=
400
;
max_abbr_width
=
100
;
max_kind_width
=
100
;
max_menu_width
=
100
;
documentation
=
true
;
source
=
{
path
=
true
;
buffer
=
true
;
calc
=
true
;
nvim_lsp
=
true
;
nvim_lua
=
true
;
vsnip
=
true
;
};
}
end
,
requires
=
{
{
'hrsh7th/vim-vsnip'
,
requires
=
{
'hrsh7th/vim-vsnip-integ'
}
}
}
}
-- LSP
use
'neovim/nvim-lspconfig'
use
{
'RishabhRD/nvim-lsputils'
,
requires
=
{
'RishabhRD/popfix'
},
disable
=
true
}
use
{
'glepnir/lspsaga.nvim'
,
requires
=
{
'neovim/nvim-lspconfig'
},
config
=
function
()
require
(
'lspsaga'
).
init_lsp_saga
{
error_sign
=
'•'
,
warn_sign
=
'•'
,
hint_sign
=
'•'
,
infor_sign
=
'•'
,
code_action_icon
=
'?'
,
border_style
=
2
,
code_action_prompt
=
{
enable
=
true
,
sign
=
true
,
sign_priority
=
20
,
virtual_text
=
false
,
},
code_action_keys
=
{
quit
=
'<esc>'
,
exec
=
'<CR>'
},
finder_action_keys
=
{
open
=
'o'
,
vsplit
=
's'
,
split
=
'i'
,
quit
=
'<esc>'
,
scroll_down
=
'<C-n>'
,
scroll_up
=
'<C-p>'
},
}
-- vim.api.nvim_command [[autocmd CursorHold,CursorHoldI * :lua require('lspsaga.signaturehelp').signature_help()]]
end
}
use
{
'nvim-lua/lsp_extensions.nvim'
,
requires
=
{
'neovim/nvim-lspconfig'
},
disable
=
true
,
config
=
function
()
require
(
'lsp_extensions'
).
inlay_hints
{
highlight
=
"Comment"
,
prefix
=
" » "
,
aligned
=
true
,
only_current_line
=
false
,
enabled
=
{
"ChainingHint"
}
}
end
}
use
{
"folke/lsp-trouble.nvim"
,
requires
=
"kyazdani42/nvim-web-devicons"
,
config
=
function
()
require
(
"trouble"
).
setup
{
-- your configuration comes here
-- or leave it empty to use the default settings
-- refer to the configuration section below
}
end
}
use
{
"ray-x/lsp_signature.nvim"
,
-- config = function()
-- end
}
use
{
'simrat39/rust-tools.nvim'
,
requires
=
{
'nvim-lua/popup.nvim'
}
}
use
{
'lewis6991/gitsigns.nvim'
,
requires
=
{
'nvim-lua/plenary.nvim'
},
config
=
function
()
require
(
'gitsigns'
).
setup
()
end
}
use
'tomlion/vim-solidity'
return
require
(
"packer"
).
startup
(
function
()
use
(
"wbthomason/packer.nvim"
)
-- Color schemes
use
(
"morhetz/gruvbox"
)
use
(
"icymind/NeoSolarized"
)
use
(
"romgrk/doom-one.vim"
)
use
({
"tjdevries/gruvbuddy.nvim"
,
requires
=
{
"tjdevries/colorbuddy.vim"
},
config
=
function
()
--require('colorbuddy').colorscheme('gruvbox')
vim
.
cmd
(
[[colo gruvbox]]
)
end
,
})
-- UI
use
(
"ntpeters/vim-better-whitespace"
)
use
(
"Yggdroot/indentLine"
)
use
(
"haya14busa/incsearch.vim"
)
use
({
"junegunn/fzf.vim"
,
requires
=
{
"junegunn/fzf"
},
})
-- Look at feline for a leaner better maintained alternative.
use
({
"glepnir/galaxyline.nvim"
,
branch
=
"main"
,
config
=
function
()
require
(
"statusline"
)
end
,
requires
=
{
"kyazdani42/nvim-web-devicons"
},
})
use
(
"liuchengxu/vista.vim"
)
use
({
"kyazdani42/nvim-tree.lua"
,
requires
=
"kyazdani42/nvim-web-devicons"
,
config
=
function
()
require
(
"nvim-tree"
).
setup
({})
end
,
})
use
({
"AckslD/nvim-whichkey-setup.lua"
,
requires
=
{
"liuchengxu/vim-which-key"
},
})
use
({
"akinsho/nvim-bufferline.lua"
,
requires
=
"kyazdani42/nvim-web-devicons"
,
config
=
function
()
require
(
"bufferline"
).
setup
({})
end
,
})
-- Utilities
use
(
"editorconfig/editorconfig-vim"
)
use
({
"nvim-treesitter/nvim-treesitter"
,
run
=
":TSUpdate"
,
requires
=
{
"nvim-treesitter/nvim-treesitter-refactor"
,
"nvim-treesitter/nvim-treesitter-textobjects"
,
},
})
use
({
"nvim-telescope/telescope.nvim"
,
requires
=
{
{
"nvim-lua/popup.nvim"
},
{
"nvim-lua/plenary.nvim"
},
{
"nvim-telescope/telescope-project.nvim"
},
},
config
=
function
()
require
(
"telescope"
).
load_extension
(
"project"
)
end
,
})
use
(
"Chiel92/vim-autoformat"
)
use
(
"Raimondi/delimitMate"
)
use
({
"Shougo/echodoc.vim"
,
config
=
function
()
vim
.
cmd
(
[[let g:echodoc#enable_at_start=1]]
)
end
,
})
-- LSP
use
(
"neovim/nvim-lspconfig"
)
use
({
"RishabhRD/nvim-lsputils"
,
requires
=
{
"RishabhRD/popfix"
},
disable
=
true
,
})
use
({
"nvim-lua/lsp_extensions.nvim"
,
requires
=
{
"neovim/nvim-lspconfig"
},
disable
=
true
,
config
=
function
()
require
(
"lsp_extensions"
).
inlay_hints
({
highlight
=
"Comment"
,
prefix
=
" » "
,
aligned
=
true
,
only_current_line
=
false
,
enabled
=
{
"ChainingHint"
},
})
end
,
})
use
({
"folke/lsp-trouble.nvim"
,
requires
=
"kyazdani42/nvim-web-devicons"
,
config
=
function
()
require
(
"trouble"
).
setup
({
-- your configuration comes here
-- or leave it empty to use the default settings
-- refer to the configuration section below
})
end
,
})
-- Completion
use
(
"onsails/lspkind-nvim"
)
use
(
"hrsh7th/cmp-buffer"
)
use
(
"hrsh7th/cmp-path"
)
use
(
"hrsh7th/cmp-nvim-lua"
)
use
(
"hrsh7th/cmp-nvim-lsp"
)
use
(
"hrsh7th/nvim-cmp"
)
use
({
"saadparwaiz1/cmp_luasnip"
,
requires
=
{
"L3MON4D3/LuaSnip"
,
},
})
-- use "hrsh7th/cmp-vsnip"
-- use "hrsh7th/vim-vsnip"
use
(
"windwp/nvim-autopairs"
)
use
({
"simrat39/rust-tools.nvim"
,
requires
=
{
"nvim-lua/popup.nvim"
,
},
})
use
({
"lewis6991/gitsigns.nvim"
,
requires
=
{
"nvim-lua/plenary.nvim"
,
},
config
=
function
()
require
(
"gitsigns"
).
setup
()
end
,
})
use
(
"tomlion/vim-solidity"
)
end
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment