summaryrefslogtreecommitdiff
path: root/.config/nvim/lua
diff options
context:
space:
mode:
Diffstat (limited to '.config/nvim/lua')
-rw-r--r--.config/nvim/lua/binds.lua4
-rw-r--r--.config/nvim/lua/opts.lua55
-rw-r--r--.config/nvim/lua/plugins.lua22
3 files changed, 68 insertions, 13 deletions
diff --git a/.config/nvim/lua/binds.lua b/.config/nvim/lua/binds.lua
index aebde65..3f9c6a6 100644
--- a/.config/nvim/lua/binds.lua
+++ b/.config/nvim/lua/binds.lua
@@ -13,7 +13,9 @@ map('n', '<leader>h', ':wincmd h<CR>', opts)
map('n', '<leader>j', ':wincmd j<CR>', opts)
map('n', '<leader>k', ':wincmd k<CR>', opts)
map('n', '<leader>l', ':wincmd l<CR>', opts)
-map('n', '<leader>pv', ':30Lex<CR>', opts) -- open simple file explorer
+
+map('n', '<C-n>', ':NvimTreeToggle<CR>', opts)
+map('n', '<leader>n', ':NvimTreeFindFile<CR>', opts)
map('i', 'kj', '<Esc>', opts)
map('i', ',', ',<c-g>u', opts)
diff --git a/.config/nvim/lua/opts.lua b/.config/nvim/lua/opts.lua
index 259f460..126d6c4 100644
--- a/.config/nvim/lua/opts.lua
+++ b/.config/nvim/lua/opts.lua
@@ -1,19 +1,60 @@
+-- SNIPPETS
+local nvim_lsp = require('lspconfig')
+local capabilities = vim.lsp.protocol.make_client_capabilities()
+capabilities = require('cmp_nvim_lsp').update_capabilities(capabilities)
+
+local servers = { 'omnisharp', 'html', 'sumneko_lua', 'bashls', 'tsserver', 'cssls' }
+for _, lsp in ipairs(servers) do
+ nvim_lsp[lsp].setup {
+ capabilities = capabilities,
+ }
+end
+
+vim.o.completeopt = 'menuone,noselect'
+local luasnip = require 'luasnip'
+
-- CMP
local cmp = require 'cmp'
-
cmp.setup {
+ snippet = {
+ expand = function(args)
+ require('luasnip').lsp_expand(args.body)
+ end,
+ },
mapping = {
- ['<Tab>'] = cmp.mapping.select_next_item(),
- ['<S-Tab>'] = cmp.mapping.select_prev_item(),
+ ['<C-n>'] = cmp.mapping.select_next_item(),
+ ['<C-p>'] = cmp.mapping.select_prev_item(),
+ ['<C-f>'] = cmp.mapping.scroll_docs(4),
+ ['<C-d>'] = cmp.mapping.scroll_docs(-4),
+ ['<C-Space>'] = cmp.mapping.complete(),
['<C-e>'] = cmp.mapping.close(),
- ['<CR>'] = cmp.mapping.confirm({
+ ['<CR>'] = cmp.mapping.confirm {
behavior = cmp.ConfirmBehavior.Replace,
select = true,
- })
+ },
+ ['<Tab>'] = function(fallback)
+ if vim.fn.pumvisible() == 1 then
+ vim.fn.feedkeys(vim.api.nvim_replace_termcodes('<C-n>', true, true, true), 'n')
+ elseif luasnip.expand_or_jumpable() then
+ vim.fn.feedkeys(vim.api.nvim_replace_termcodes('<Plug>luasnip-expand-or-jump', true, true, true), '')
+ else
+ fallback()
+ end
+ end,
+ ['<S-Tab>'] = function(fallback)
+ if vim.fn.pumvisible() == 1 then
+ vim.fn.feedkeys(vim.api.nvim_replace_termcodes('<C-p>', true, true, true), 'n')
+ elseif luasnip.jumpable(-1) then
+ vim.fn.feedkeys(vim.api.nvim_replace_termcodes('<Plug>luasnip-jump-prev', true, true, true), '')
+ else
+ fallback()
+ end
+ end,
},
sources = {
{ name = 'nvim_lsp' },
- }
+ { name = 'luasnip' },
+ },
}
-- C#
@@ -69,4 +110,6 @@ require'nvim-treesitter.configs'.setup {
},
}
+-- Misc
require('kommentary.config').use_extended_mappings()
+vim.o.tabline = '%!v:lua.require\'luatab\'.tabline()'
diff --git a/.config/nvim/lua/plugins.lua b/.config/nvim/lua/plugins.lua
index 87e57ce..53ce20c 100644
--- a/.config/nvim/lua/plugins.lua
+++ b/.config/nvim/lua/plugins.lua
@@ -1,20 +1,22 @@
-return require('packer').startup(function()
+local use = require('packer').use
+require('packer').startup(function()
use 'wbthomason/packer.nvim'
use 'gruvbox-community/gruvbox'
use 'tpope/vim-fugitive'
+ use 'tpope/vim-surround'
use 'ThePrimeagen/vim-be-good'
-
use 'neovim/nvim-lspconfig'
use 'hrsh7th/nvim-cmp'
use 'hrsh7th/cmp-nvim-lsp'
use 'hrsh7th/cmp-buffer'
use 'hrsh7th/cmp-path'
-
+ use 'saadparwaiz1/cmp_luasnip'
+ use 'L3MON4D3/LuaSnip'
use 'kyazdani42/nvim-web-devicons'
use 'norcalli/nvim-colorizer.lua'
use 'b3nj5m1n/kommentary'
- use {
+ use {
'nvim-telescope/telescope.nvim',
requires = {
{'nvim-lua/popup.nvim'},
@@ -35,12 +37,20 @@ return require('packer').startup(function()
}
use {
+ 'nvim-treesitter/nvim-treesitter',
+ run = ':TSUpdate'
+ }
+
+ use { 'alvarosevilla95/luatab.nvim', requires='kyazdani42/nvim-web-devicons' }
+
+ use {
'hoob3rt/lualine.nvim',
requires = {'kyazdani42/nvim-web-devicons', opt = true}
}
use {
- 'nvim-treesitter/nvim-treesitter',
- run = ':TSUpdate'
+ 'kyazdani42/nvim-tree.lua',
+ requires = 'kyazdani42/nvim-web-devicons',
+ config = function() require'nvim-tree'.setup {} end
}
end)