Files
dot/nvim/lua/plugins_vim.lua
2023-03-04 15:09:33 +01:00

192 lines
5.3 KiB
Lua

local Plug = vim.fn['plug#']
vim.call('plug#begin', '~/.local/share/nvim/site/plugins')
-- enhanced commenting
Plug 'tpope/vim-commentary'
-- enhanced single-repeat '.'
Plug 'tpope/vim-repeat'
-- enhanced surrounding
Plug 'tpope/vim-surround'
-- session management
Plug 'tpope/vim-obsession'
-- enhanced text objects
Plug 'wellle/targets.vim'
-- enhanced yank
Plug 'gbprod/yanky.nvim'
-- auto close brackets
Plug 'Raimondi/delimitMate'
-- start page
Plug 'mhinz/vim-startify'
-- alignment
Plug 'junegunn/vim-easy-align'
-- swap windows
Plug 'wesQ3/vim-windowswap'
-- LSP
Plug 'neovim/nvim-lspconfig'
Plug('nvim-treesitter/nvim-treesitter', {['do'] = ':TSUpdate'})
-- command completion
Plug 'hrsh7th/cmp-nvim-lsp'
Plug 'hrsh7th/cmp-buffer'
Plug 'hrsh7th/cmp-path'
Plug 'hrsh7th/cmp-cmdline'
Plug 'hrsh7th/nvim-cmp'
-- prettify command completion
Plug 'onsails/lspkind.nvim'
-- snippets
Plug 'hrsh7th/cmp-vsnip'
Plug 'hrsh7th/vim-vsnip'
-- fuzzy finder
Plug 'nvim-lua/plenary.nvim'
Plug('nvim-telescope/telescope.nvim', {branch = '0.1.x'})
-- status line and theme
Plug 'bling/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'jonathanfilip/vim-lucius'
Plug 'altercation/vim-colors-solarized'
-- filetype
Plug 'towolf/vim-helm'
vim.call('plug#end')
-- " Plug 'mhinz/neovim-remote'
-- Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' } | Plug 'junegunn/fzf.vim'
-- Plug 'rking/ag.vim'
local cmp = require('cmp')
local lspkind = require('lspkind')
cmp.setup {
-- As currently, i am not using any snippet manager, thus disabled it.
-- snippet = {
-- expand = function(args)
-- require("luasnip").lsp_expand(args.body)
-- end,
-- },
-- mapping = {
-- ["<C-d>"] = cmp.mapping.scroll_docs(-4),
-- ["<C-f>"] = cmp.mapping.scroll_docs(4),
-- ["<C-e>"] = cmp.mapping.close(),
-- ["<c-y>"] = cmp.mapping.confirm {
-- behavior = cmp.ConfirmBehavior.Insert,
-- select = true,
-- },
-- }
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.
}),
formatting = {
format = lspkind.cmp_format {
mode = 'symbol_text',
menu = {
buffer = "[buf]",
nvim_lsp = "[LSP]",
path = "[path]",
},
},
},
sources = {
{ name = "nvim_lsp"},
{ name = "path" },
{ name = "buffer" , keyword_length = 2},
},
experimental = {
ghost_text = true
}
}
cmp.setup.cmdline({ '/', '?' }, {
mapping = cmp.mapping.preset.cmdline(),
sources = {
{ name = 'buffer' }
}
})
-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
cmp.setup.cmdline(':', {
mapping = cmp.mapping.preset.cmdline(),
sources = cmp.config.sources({
{ name = 'path' }
}, {
{ name = 'cmdline' }
})
})
require'nvim-treesitter.configs'.setup {
-- A list of parser names, or "all" (the four listed parsers should always be installed)
ensure_installed = { "lua", "vim", "help" },
-- Install parsers synchronously (only applied to `ensure_installed`)
sync_install = false,
-- Automatically install missing parsers when entering buffer
-- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally
auto_install = false,
---- If you need to change the installation directory of the parsers (see -> Advanced Setup)
-- parser_install_dir = "/some/path/to/store/parsers", -- Remember to run vim.opt.runtimepath:append("/some/path/to/store/parsers")!
highlight = {
-- `false` will disable the whole extension
enable = true,
-- NOTE: these are the names of the parsers and not the filetype. (for example if you want to
-- disable highlighting for the `tex` filetype, you need to include `latex` in this list as this is
-- the name of the parser)
-- list of language that will be disabled
-- disable = { "c", "rust" },
-- Or use a function for more flexibility, e.g. to disable slow treesitter highlight for large files
disable = function(lang, buf)
local max_filesize = 100 * 1024 -- 100 KB
local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf))
if ok and stats and stats.size > max_filesize then
return true
end
end,
-- Setting this to true will run `:h syntax` and tree-sitter at the same time.
-- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
-- Using this option may slow down your editor, and you may see some duplicate highlights.
-- Instead of true it can also be a list of languages
additional_vim_regex_highlighting = false,
},
}
require("yanky").setup({
ring = {
history_length = 100,
storage = "shada",
sync_with_numbered_registers = true,
cancel_event = "update",
},
system_clipboard = {
sync_with_ring = true,
},
preserve_cursor_position = {
enabled = true,
},
})
--
require("telescope").load_extension("yank_history")