From e0a69b7ae934f9ee8a87bcfee041e4cdf2972463 Mon Sep 17 00:00:00 2001 From: stev Date: Wed, 19 Oct 2022 20:32:49 +0200 Subject: [PATCH] added plugins to nvim --- .config/nvim/init.lua | 3 ++ .config/nvim/lua/core/mappings.lua | 3 ++ .config/nvim/lua/plugins/init.lua | 43 ++++++++++++++------ .config/nvim/lua/plugins/nvim-cmp.lua | 13 ++++-- .config/nvim/lua/plugins/nvim-treesitter.lua | 2 +- .config/nvim/lua/plugins/telescope.lua | 22 ++++++++++ 6 files changed, 69 insertions(+), 17 deletions(-) create mode 100644 .config/nvim/lua/plugins/telescope.lua diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua index 428df79..d96902f 100644 --- a/.config/nvim/init.lua +++ b/.config/nvim/init.lua @@ -1,3 +1,6 @@ +-- disable netrw at the very start of your init.lua (strongly advised) +vim.g.loaded_netrw = 1 +vim.g.loaded_netrwPlugin = 1 ---------------------- -- general settings -- ---------------------- diff --git a/.config/nvim/lua/core/mappings.lua b/.config/nvim/lua/core/mappings.lua index e85f487..bd3b46a 100644 --- a/.config/nvim/lua/core/mappings.lua +++ b/.config/nvim/lua/core/mappings.lua @@ -8,3 +8,6 @@ map('n', '', '', {}) map('n', 'n', ':bNext', {}) map('n', 'p', ':bprevious', {}) map('n', 'h', ':nohlsearch', {}) + +-- nvim-tree mappings +map('n', 't', ':NvimTreeToggle', {}) diff --git a/.config/nvim/lua/plugins/init.lua b/.config/nvim/lua/plugins/init.lua index 4e1f109..dfb8248 100644 --- a/.config/nvim/lua/plugins/init.lua +++ b/.config/nvim/lua/plugins/init.lua @@ -3,27 +3,36 @@ ------------- require "paq" { "savq/paq-nvim"; -- Let Paq manage itself + -- general plugins "nvim-lualine/lualine.nvim"; { 'kyazdani42/nvim-web-devicons', opt=true }; + 'romgrk/barbar.nvim'; + 'ggandor/lightspeed.nvim'; - 'neovim/nvim-lspconfig'; -- Configs for Nvim LSP - 'hrsh7th/nvim-cmp'; -- Autocompletion plugin - 'hrsh7th/cmp-nvim-lsp'; -- LSP source for nvim-cmp + -- colorschemes -- + 'rebelot/kanagawa.nvim'; + 'folke/tokyonight.nvim'; + + -- code related -- + 'neovim/nvim-lspconfig'; -- Configs for Nvim LSP + 'hrsh7th/nvim-cmp'; -- Autocompletion plugin + 'hrsh7th/cmp-nvim-lsp'; -- LSP source for nvim-cmp + + 'nvim-lua/plenary.nvim'; -- Dependency for telescope + 'nvim-telescope/telescope.nvim'; -- Fuzzy finder + {'nvim-telescope/telescope-fzf-native.nvim', run='make' }; + 'nvim-treesitter/nvim-treesitter'; -- Better syntax highlighting + 'nvim-tree/nvim-tree.lua'; -- File Explorer + 'numToStr/Comment.nvim'; -- Quickly comment lines + 'windwp/nvim-autopairs'; + 'tpope/vim-surround'; + 'lukas-reineke/indent-blankline.nvim'; + 'ap/vim-css-color'; 'L3MON4D3/LuaSnip'; -- Snippets plugin 'saadparwaiz1/cmp_luasnip'; -- Snippets source for nvim-cmp - 'nvim-treesitter/nvim-treesitter'; -- Better syntax highlighting - - 'windwp/nvim-autopairs'; - 'tpope/vim-surround'; 'dhruvasagar/vim-table-mode'; - 'lukas-reineke/indent-blankline.nvim'; - - 'ap/vim-css-color'; - 'rebelot/kanagawa.nvim'; - 'folke/tokyonight.nvim'; - --'elkowar/yuck.vim'; } -- looks like tablemode for vim-table-mode in markdown @@ -46,6 +55,14 @@ inoreabbrev __ require'plugins.lualine' require'plugins.nvim-treesitter' require'plugins.nvim-cmp' +require'plugins.telescope' + +require'Comment'.setup() +require'nvim-tree'.setup() require'indent_blankline'.setup{ show_current_context = true, } +-- setup barbar +require'bufferline'.setup{ + icons = false, +} diff --git a/.config/nvim/lua/plugins/nvim-cmp.lua b/.config/nvim/lua/plugins/nvim-cmp.lua index 93a5dc3..12eb888 100644 --- a/.config/nvim/lua/plugins/nvim-cmp.lua +++ b/.config/nvim/lua/plugins/nvim-cmp.lua @@ -37,8 +37,10 @@ cmp.setup { end, }, sources = { - { name = 'nvim_lsp' }, - { name = 'luasnip' }, + { name = 'path'}, + { name = 'nvim_lsp', keywordlength=3 }, + { name = 'buffer', keywordlength=3 }, + { name = 'luasnip', keywordlength=2 }, }, } @@ -50,6 +52,9 @@ cmp.event:on( }) ) +-------------------- +-- Configure LSPs -- +-------------------- -- require'lspconfig'.pylsp.setup{} -- Add additional capabilities supported by nvim-cmp @@ -59,9 +64,11 @@ capabilities = require('cmp_nvim_lsp').update_capabilities(capabilities) local lspconfig = require('lspconfig') -- Enable some language servers with the additional completion capabilities offered by nvim-cmp -local servers = { 'clangd', 'rust_analyzer', 'pylsp', 'tsserver' } +local servers = { 'clangd', 'rust_analyzer', 'pylsp', 'tsserver', 'jdtls' } for _, lsp in ipairs(servers) do lspconfig[lsp].setup { capabilities = capabilities, } end + +vim.opt.completeopt = {'menu', 'menuone', 'noselect'} diff --git a/.config/nvim/lua/plugins/nvim-treesitter.lua b/.config/nvim/lua/plugins/nvim-treesitter.lua index db95e1d..adf3161 100644 --- a/.config/nvim/lua/plugins/nvim-treesitter.lua +++ b/.config/nvim/lua/plugins/nvim-treesitter.lua @@ -1,6 +1,6 @@ require'nvim-treesitter.configs'.setup { -- A list of parser names, or "all" - ensure_installed = { "lua", "python" }, + ensure_installed = { "lua", "python", "java" }, -- Install parsers synchronously (only applied to `ensure_installed`) sync_install = false, diff --git a/.config/nvim/lua/plugins/telescope.lua b/.config/nvim/lua/plugins/telescope.lua new file mode 100644 index 0000000..02d8e7b --- /dev/null +++ b/.config/nvim/lua/plugins/telescope.lua @@ -0,0 +1,22 @@ +require('telescope').setup{ + defaults = { + -- Default configuration for telescope goes here: + -- config_key = value, + mappings = { + i = { + -- map actions.which_key to (default: ) + -- actions.which_key shows the mappings for your picker, + -- e.g. git_{create, delete, ...}_branch for the git_branches picker + [""] = "which_key" + } + } + }, +} +require('telescope').load_extension('fzf') + +-- mappings -- +local builtin = require('telescope.builtin') +vim.keymap.set('n', 'ff', builtin.find_files, {}) +vim.keymap.set('n', 'fg', builtin.live_grep, {}) +vim.keymap.set('n', 'fb', builtin.buffers, {}) +vim.keymap.set('n', 'fh', builtin.help_tags, {})