2022-12-11 09:26:14 +03:00
|
|
|
filetype plugin indent on
|
|
|
|
set showmatch
|
|
|
|
set hlsearch
|
|
|
|
set incsearch
|
|
|
|
set autoindent
|
|
|
|
set expandtab
|
|
|
|
set tabstop=4
|
|
|
|
set shiftwidth=4
|
|
|
|
set number
|
|
|
|
set wildmode=longest, list
|
|
|
|
set cc=80
|
|
|
|
syntax on
|
|
|
|
set noswapfile
|
|
|
|
set backupdir=~/.cache/vim
|
|
|
|
set completeopt=noinsert,menuone,noselect
|
|
|
|
set cursorline
|
|
|
|
set relativenumber
|
|
|
|
|
2022-12-22 21:46:01 +03:00
|
|
|
call plug#begin()
|
|
|
|
Plug 'catppuccin/nvim', { 'as': 'catppuccin' }
|
2022-12-23 10:43:43 +03:00
|
|
|
Plug 'neovim/nvim-lspconfig'
|
|
|
|
Plug 'simrat39/rust-tools.nvim'
|
|
|
|
Plug 'nvim-lua/plenary.nvim'
|
|
|
|
Plug 'saecki/crates.nvim', { 'tag': 'v0.3.0' }
|
|
|
|
Plug 'neovim/nvim-lspconfig'
|
|
|
|
Plug 'hrsh7th/cmp-nvim-lsp'
|
|
|
|
Plug 'hrsh7th/cmp-buffer'
|
|
|
|
Plug 'hrsh7th/cmp-path'
|
|
|
|
Plug 'hrsh7th/cmp-cmdline'
|
|
|
|
Plug 'hrsh7th/nvim-cmp'
|
|
|
|
Plug 'saadparwaiz1/cmp_luasnip'
|
|
|
|
Plug 'L3MON4D3/LuaSnip'
|
|
|
|
Plug 'ahmedkhalf/project.nvim'
|
|
|
|
Plug 'lewis6991/gitsigns.nvim'
|
|
|
|
Plug 'nvim-neo-tree/neo-tree.nvim'
|
|
|
|
Plug 'nvim-lua/plenary.nvim'
|
|
|
|
Plug 'MunifTanjim/nui.nvim'
|
|
|
|
Plug 'nvim-tree/nvim-web-devicons'
|
2022-12-22 21:46:01 +03:00
|
|
|
call plug#end()
|
2022-12-23 10:43:43 +03:00
|
|
|
colorscheme catppuccin-macchiato
|
|
|
|
lua require('crates').setup()
|
|
|
|
lua require('gitsigns').setup()
|
2022-12-22 21:47:59 +03:00
|
|
|
|
2022-12-23 10:43:43 +03:00
|
|
|
set completeopt=menu,menuone,noselect
|
|
|
|
|
|
|
|
lua << EOF
|
|
|
|
require("project_nvim").setup {
|
|
|
|
patterns = { ".git", "Makefile", "*.sln", "build/env.sh" }
|
|
|
|
}
|
|
|
|
EOF
|
|
|
|
|
|
|
|
lua <<EOF
|
|
|
|
-- Set up nvim-cmp.
|
|
|
|
local cmp = require'cmp'
|
|
|
|
|
|
|
|
cmp.setup({
|
|
|
|
snippet = {
|
|
|
|
expand = function(args)
|
|
|
|
require('luasnip').lsp_expand(args.body)
|
|
|
|
end,
|
|
|
|
},
|
|
|
|
window = {
|
|
|
|
-- completion = cmp.config.window.bordered(),
|
|
|
|
-- documentation = cmp.config.window.bordered(),
|
|
|
|
},
|
|
|
|
mapping = cmp.mapping.preset.insert({
|
|
|
|
['<C-b>'] = cmp.mapping.scroll_docs(-4),
|
|
|
|
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
|
|
|
['<C-Space>'] = cmp.mapping.complete(),
|
|
|
|
['<C-e>'] = cmp.mapping.abort(),
|
|
|
|
['<CR>'] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
|
|
|
|
}),
|
|
|
|
sources = cmp.config.sources({
|
|
|
|
{ name = 'nvim_lsp' },
|
|
|
|
{ name = 'luasnip' },
|
|
|
|
{ name = "crates" },
|
|
|
|
}, {
|
|
|
|
{ name = 'buffer' },
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
cmp.setup.filetype('gitcommit', {
|
|
|
|
sources = cmp.config.sources({
|
|
|
|
{ name = 'cmp_git' },
|
|
|
|
}, {
|
|
|
|
{ name = 'buffer' },
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
cmp.setup.cmdline({ '/', '?' }, {
|
|
|
|
mapping = cmp.mapping.preset.cmdline(),
|
|
|
|
sources = {
|
|
|
|
{ name = 'buffer' }
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
cmp.setup.cmdline(':', {
|
|
|
|
mapping = cmp.mapping.preset.cmdline(),
|
|
|
|
sources = cmp.config.sources({
|
|
|
|
{ name = 'path' }
|
|
|
|
}, {
|
|
|
|
{ name = 'cmdline' }
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
local capabilities = require('cmp_nvim_lsp').default_capabilities()
|
|
|
|
require('lspconfig')['luasnip'].setup {
|
|
|
|
capabilities = capabilities
|
|
|
|
}
|
|
|
|
EOF
|
|
|
|
|
|
|
|
lua <<EOF
|
|
|
|
local rt = require("rust-tools")
|
|
|
|
|
|
|
|
rt.setup({
|
|
|
|
server = {
|
|
|
|
on_attach = function(_, bufnr)
|
|
|
|
-- Hover actions
|
|
|
|
vim.keymap.set("n", "<C-space>", 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 })
|
|
|
|
end,
|
|
|
|
},
|
|
|
|
})
|
|
|
|
EOF
|