migrate nvim config to .config/nvim
This commit is contained in:
parent
461f3d2469
commit
5cd96738ad
|
@ -0,0 +1,10 @@
|
||||||
|
{
|
||||||
|
"rust-analyzer.serverPath": "/usr/bin/rust-analyzer",
|
||||||
|
"rust-analyzer.inlayHints.chainingHints": true,
|
||||||
|
"languageserver": {
|
||||||
|
"kotlin": {
|
||||||
|
"command": "/usr/bin/kotlin-language-server",
|
||||||
|
"filetypes": ["kotlin", "kt"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,76 @@
|
||||||
|
filetype on
|
||||||
|
filetype plugin on
|
||||||
|
autocmd BufNewFile,BufRead *.vpy setfiletype python
|
||||||
|
autocmd BufNewFile,BufRead *.kt setfiletype kotlin
|
||||||
|
set hidden
|
||||||
|
|
||||||
|
set number
|
||||||
|
set showmatch
|
||||||
|
|
||||||
|
set hlsearch
|
||||||
|
set ignorecase
|
||||||
|
set smartcase
|
||||||
|
set incsearch
|
||||||
|
|
||||||
|
set autoindent
|
||||||
|
set cindent
|
||||||
|
set expandtab
|
||||||
|
set shiftwidth=2
|
||||||
|
set smartindent
|
||||||
|
set smarttab
|
||||||
|
set softtabstop=2
|
||||||
|
set relativenumber
|
||||||
|
|
||||||
|
" set beam cursor in insert mode
|
||||||
|
let &t_SI = "\<esc>[5 q"
|
||||||
|
let &t_SR = "\<esc>[5 q"
|
||||||
|
let &t_EI = "\<esc>[2 q"
|
||||||
|
|
||||||
|
set undolevels=1000
|
||||||
|
set backspace=indent,eol,start
|
||||||
|
|
||||||
|
set background=dark
|
||||||
|
let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"
|
||||||
|
let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"
|
||||||
|
set termguicolors
|
||||||
|
colorscheme monokai_pro
|
||||||
|
syntax on
|
||||||
|
|
||||||
|
let g:netrw_liststyle = 3
|
||||||
|
let g:netrw_banner = 0
|
||||||
|
let g:netrw_browse_split = 4
|
||||||
|
let g:netrw_winsize = 15
|
||||||
|
nmap <F2> :Vexplore<Return>
|
||||||
|
autocmd BufNewFile,BufRead *.rs nmap <C-A-L> :RustFmt<Return>
|
||||||
|
|
||||||
|
nnoremap <C-J> <C-W>j
|
||||||
|
nnoremap <C-K> <C-W>k
|
||||||
|
nnoremap <C-L> <C-W>l
|
||||||
|
nnoremap <C-H> <C-W>h
|
||||||
|
|
||||||
|
set splitbelow
|
||||||
|
set splitright
|
||||||
|
|
||||||
|
nmap <S-Tab> :Snippets<CR>
|
||||||
|
nmap <C-G> :Files<CR>
|
||||||
|
imap <C-G> <Esc>:Files<CR>
|
||||||
|
nmap <S-L> :BLines<CR>
|
||||||
|
nmap <C-F> :Lines<CR>
|
||||||
|
nmap <C-B> :Buffers<CR>
|
||||||
|
imap <C-B> <Esc>:Buffers<CR>
|
||||||
|
nmap <C-space> :RustHoverActions<CR>:RustHoverActions<CR>
|
||||||
|
|
||||||
|
let g:ackprg = 'rg --vimgrep --smart-case'
|
||||||
|
let g:ack_autoclose = 1
|
||||||
|
let g:ack_use_cword_for_empty_search = 1
|
||||||
|
nnoremap <Leader>/ :Ack!<Space>
|
||||||
|
|
||||||
|
set runtimepath^=~/.vim runtimepath+=~/.vim/after
|
||||||
|
let &packpath = &runtimepath
|
||||||
|
lua require('plugins')
|
||||||
|
lua require('lspstuff')
|
||||||
|
lua require('completion')
|
||||||
|
lua require('mason').setup()
|
||||||
|
|
||||||
|
set signcolumn=yes
|
||||||
|
autocmd CursorHold * lua vim.diagnostic.open_float(nil, { focusable = false })
|
|
@ -0,0 +1,56 @@
|
||||||
|
vim.opt.completeopt = {'menuone', 'noselect', 'noinsert'}
|
||||||
|
vim.opt.shortmess = vim.opt.shortmess + { c = true}
|
||||||
|
vim.api.nvim_set_option('updatetime', 300)
|
||||||
|
|
||||||
|
-- Completion Plugin Setup
|
||||||
|
local cmp = require'cmp'
|
||||||
|
cmp.setup({
|
||||||
|
-- Enable LSP snippets
|
||||||
|
snippet = {
|
||||||
|
expand = function(args)
|
||||||
|
vim.fn["vsnip#anonymous"](args.body)
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
mapping = {
|
||||||
|
['<C-p>'] = cmp.mapping.select_prev_item(),
|
||||||
|
['<C-n>'] = cmp.mapping.select_next_item(),
|
||||||
|
-- Add tab support
|
||||||
|
['<S-Tab>'] = cmp.mapping.select_prev_item(),
|
||||||
|
['<Tab>'] = cmp.mapping.select_next_item(),
|
||||||
|
['<C-d>'] = cmp.mapping.scroll_docs(-4),
|
||||||
|
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
||||||
|
['<C-e>'] = cmp.mapping.close(),
|
||||||
|
['<C-Space>'] = cmp.mapping.complete(),
|
||||||
|
['<CR>'] = cmp.mapping.confirm({
|
||||||
|
behavior = cmp.ConfirmBehavior.Insert,
|
||||||
|
select = true,
|
||||||
|
})
|
||||||
|
},
|
||||||
|
-- Installed sources:
|
||||||
|
sources = {
|
||||||
|
{ name = 'nvim_lsp', keyword_length = 1 }, -- from language server
|
||||||
|
{ name = 'path' }, -- file paths
|
||||||
|
{ name = 'nvim_lsp_signature_help' }, -- display function signatures with current parameter emphasized
|
||||||
|
{ name = 'nvim_lua', keyword_length = 1 }, -- complete neovim's Lua runtime API such vim.lsp.*
|
||||||
|
{ name = 'buffer', keyword_length = 1 }, -- source current buffer
|
||||||
|
{ name = 'vsnip', keyword_length = 2 }, -- nvim-cmp source for vim-vsnip
|
||||||
|
{ name = 'calc' }, -- source for math calculation
|
||||||
|
},
|
||||||
|
window = {
|
||||||
|
completion = cmp.config.window.bordered(),
|
||||||
|
documentation = cmp.config.window.bordered(),
|
||||||
|
},
|
||||||
|
formatting = {
|
||||||
|
fields = {'menu', 'abbr', 'kind'},
|
||||||
|
format = function(entry, item)
|
||||||
|
local menu_icon ={
|
||||||
|
nvim_lsp = 'λ',
|
||||||
|
vsnip = '⋗',
|
||||||
|
buffer = 'Ω',
|
||||||
|
path = '🖫',
|
||||||
|
}
|
||||||
|
item.menu = menu_icon[entry.source.name]
|
||||||
|
return item
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
})
|
|
@ -0,0 +1,55 @@
|
||||||
|
local rt = {
|
||||||
|
server = {
|
||||||
|
settings = {
|
||||||
|
on_attach = function(_, bufnr)
|
||||||
|
-- Hover actions
|
||||||
|
vim.keymap.set("n", "<C-a>", rt.hover_actions.hover_actions, { buffer = bufnr })
|
||||||
|
-- Code action groups
|
||||||
|
vim.keymap.set("n", "<Leader>a", rt.code_action_group.code_action_group, { buffer = bufnr })
|
||||||
|
require 'illuminate'.on_attach(client)
|
||||||
|
end,
|
||||||
|
["rust-analyzer"] = {
|
||||||
|
checkOnSave = {
|
||||||
|
command = "clippy"
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
require('rust-tools').setup(rt)
|
||||||
|
require('rust-tools').inlay_hints.enable()
|
||||||
|
|
||||||
|
local sign = function(opts)
|
||||||
|
vim.fn.sign_define(opts.name, {
|
||||||
|
texthl = opts.name,
|
||||||
|
text = opts.text,
|
||||||
|
numhl = ''
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
sign({name = 'DiagnosticSignError', text = ''})
|
||||||
|
sign({name = 'DiagnosticSignWarn', text = ''})
|
||||||
|
sign({name = 'DiagnosticSignHint', text = ''})
|
||||||
|
sign({name = 'DiagnosticSignInfo', text = ''})
|
||||||
|
|
||||||
|
local opts = { noremap=true, silent=true }
|
||||||
|
vim.keymap.set('n', '<space>e', vim.diagnostic.open_float, opts)
|
||||||
|
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, opts)
|
||||||
|
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, opts)
|
||||||
|
vim.keymap.set('n', '<space>q', vim.diagnostic.setloclist, opts)
|
||||||
|
|
||||||
|
-- Use an on_attach function to only map the following keys
|
||||||
|
-- after the language server attaches to the current buffer
|
||||||
|
local on_attach = function(client, bufnr)
|
||||||
|
local bufopts = { noremap=true, silent=true, buffer=bufnr }
|
||||||
|
vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, bufopts)
|
||||||
|
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, bufopts)
|
||||||
|
vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, bufopts)
|
||||||
|
vim.keymap.set('n', '<leader>rn', vim.lsp.buf.rename, bufopts)
|
||||||
|
vim.keymap.set('n', '<leader><space>', vim.lsp.buf.code_action, bufopts)
|
||||||
|
vim.keymap.set('n', 'gr', vim.lsp.buf.references, bufopts)
|
||||||
|
end
|
||||||
|
|
||||||
|
require('lspconfig')['rust_analyzer'].setup{
|
||||||
|
on_attach = on_attach,
|
||||||
|
}
|
|
@ -0,0 +1,32 @@
|
||||||
|
vim.cmd [[packadd packer.nvim]]
|
||||||
|
|
||||||
|
return require('packer').startup(function()
|
||||||
|
-- Visual
|
||||||
|
use 'phanviet/vim-monokai-pro'
|
||||||
|
use 'vim-airline/vim-airline'
|
||||||
|
|
||||||
|
-- Management
|
||||||
|
use 'williamboman/mason.nvim'
|
||||||
|
use 'williamboman/mason-lspconfig.nvim'
|
||||||
|
use 'neovim/nvim-lspconfig'
|
||||||
|
|
||||||
|
-- Completion
|
||||||
|
use 'hrsh7th/nvim-cmp'
|
||||||
|
use 'sirver/UltiSnips'
|
||||||
|
use 'honza/vim-snippets'
|
||||||
|
use 'hrsh7th/cmp-nvim-lsp'
|
||||||
|
use 'hrsh7th/cmp-nvim-lua'
|
||||||
|
use 'hrsh7th/cmp-nvim-lsp-signature-help'
|
||||||
|
use 'hrsh7th/cmp-path'
|
||||||
|
use 'hrsh7th/cmp-buffer'
|
||||||
|
use 'hrsh7th/vim-vsnip'
|
||||||
|
|
||||||
|
-- Languages
|
||||||
|
use 'simrat39/rust-tools.nvim'
|
||||||
|
use 'rust-lang/rust.vim'
|
||||||
|
|
||||||
|
-- Misc
|
||||||
|
use 'mileszs/ack.vim'
|
||||||
|
use 'lotabout/skim.vim'
|
||||||
|
use 'tpope/vim-fugitive'
|
||||||
|
end)
|
Loading…
Reference in New Issue
Block a user