finished up init.lua configuration, mostly

This commit is contained in:
tomit4 2022-04-23 13:07:47 -07:00
parent e48c506796
commit 3d63e6c15b
3 changed files with 95 additions and 7 deletions

View file

@ -3,6 +3,82 @@ keymap = vim.api.nvim_set_keymap
-- Enable ColorScheme
vim.cmd[[colorscheme nord]]
-- nvim-treesiter configuration: -- setup with all defaults
require'nvim-treesitter.configs'.setup{
ensure_installed = {"bash", "c", "c_sharp", "cmake", "cpp", "css", "dockerfile", "go", "html", "http", "java", "javascript", "json", "json5", "jsonc", "lua", "make", "markdown", "perl", "php", "pug", "python", "regex", "ruby", "toml", "tsx", "typescript", "vim", "vue", "wgsl", "yaml",},
highlight = { enable = 'true' }
}
-- To enable basic vim folding methods/expressions:
--
-- vim.opt.foldmethod = "expr"
-- vim.opt.foldexpr = "nvim_treesitter#foldexpr()"
local lsp_installer = require("nvim-lsp-installer")
lsp_installer.on_server_ready(function(server)
local opts = {}
-- This setup() function will take the provided server configuration and decorate it with the necessary properties
-- before passing it onwards to lspconfig.
-- Refer to https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md
server:setup(opts)
end)
-- Setup nvim-cmp.
local cmp = require'cmp'
cmp.setup({
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 = 'buffer' },
})
})
-- Set configuration for specific filetype.
cmp.setup.filetype('gitcommit', {
sources = cmp.config.sources({
{ name = 'cmp_git' }, -- You can specify the `cmp_git` source if you were installed it.
}, {
{ name = 'buffer' },
})
})
-- Use buffer source for `/` (if you enabled `native_menu`, this won't work anymore).
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' }
})
})
-- Setup lspconfig.
local capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities())
-- Replace <YOUR_LSP_SERVER> with each lsp server you've enabled.
local lspconfig =require'lspconfig'
-- Enable some language servers with the additional completion capabilities offered by nvim-cmp
local servers = { 'sumneko_lua', 'eslint', 'pyright', 'bashls', 'clangd', 'volar', 'zk' }
for _, lsp in ipairs(servers) do
lspconfig[lsp].setup {
capabilities = capabilities,
}
end
-- Nvim_Tree configuration: -- setup with all defaults
-- each of these are documented in `:help nvim-tree.OPTION_NAME`
require'nvim-tree'.setup { -- BEGIN_DEFAULT_OPTS

View file

@ -10,8 +10,7 @@ keymap('n', '<a-left>', '<c-w>:tabprevious<CR>', {})
keymap('n', '<a-right>', '<c-w>:tabnext<CR>', {})
-- Use ctrl- [hl] to select the active split!
keymap('n', '<c-h>', '<c-w>:wincmd h<CR>', {})
keymap('n', '<c-l>', '<c-w>:wincmd l<CR>', {})
keymap('n', '<c-h>', '<c-w>:wincmd h<CR>', {}) keymap('n', '<c-l>', '<c-w>:wincmd l<CR>', {})
-- Toggle NERDCommenter with Ctrl + c
vim.cmd[[:map <C-c> <Plug>NERDCommenterToggle]]

View file

@ -1,20 +1,33 @@
-- Packages installed using 'packer', install using :PackerSync
-- packer.nvim requires nvim-packer-git package
-- paru -S nvim-packer-git
-- call Plug for MarkDownPreview
-- vim.cmd[[call plug#begin('~/.vim/plugged') Plug 'iamcco/markdown-preview.nvim', {'do': { -> mkdp#util#install() }}]]
-- Packages installed using 'packer', install using :PackerSync
-- Remove packages by deleting (or commenting out) use line below and running :PackerClean
require('packer').startup(function()
use 'wbthomason/packer.nvim'
use {'nvim-treesitter/nvim-treesitter', run = ':TSUpdate'}
-- :TSInstall <language_to_install>
-- :TSUpdate all
use 'neovim/nvim-lspconfig'
use 'williamboman/nvim-lsp-installer'
-- :LspInstallInfo (use i to install, u to upgrade, r to uninstall)
-- :LspUninstall [--sync] <server> ...
-- NVim Completion packages
use 'hrsh7th/cmp-nvim-lsp'
use 'hrsh7th/cmp-buffer'
use 'hrsh7th/cmp-path'
use 'hrsh7th/cmp-cmdline'
use 'hrsh7th/nvim-cmp'
use 'kyazdani42/nvim-web-devicons' -- for file icons
use 'kyazdani42/nvim-tree.lua'
use {'nvim-lualine/lualine.nvim', requires = { 'kyazdani42/nvim-web-devicons', opt = true }}
use 'shaunsingh/nord.nvim'
use 'psliwka/vim-smoothie'
-- use 'mattn/emmet-vim'
-- use 'ap/vim-css-color'
-- use 'airblade/vim-gitgutter'
use 'ctrlpvim/ctrlp.vim' -- fuzzy find files
-- use {'junegunn/fzf', run = ':call fzf#installo()'}--{ 'do': { -> fzf#install() } }
use 'preservim/nerdcommenter'
use 'Yggdroot/indentLine'
use 'mg979/vim-visual-multi'-- {'branch': 'master'}