nvim: swapped explorer and tagger for new lua plugins

master
tiyn 1 year ago
parent edd82ee7d9
commit a065c3d401

@ -66,4 +66,3 @@ require('keymap')
-- load general colorscheme -- load general colorscheme
require('colorscheme') require('colorscheme')

@ -13,96 +13,112 @@ extension = {
nim = 'nim', nim = 'nim',
py = 'python', py = 'python',
tex = 'tex', tex = 'tex',
}}) }
})
-- delete trailing whitespaces on save -- delete trailing whitespaces on save
vim.api.nvim_create_autocmd({ 'BufWritePre' }, vim.api.nvim_create_autocmd({ 'BufWritePre' },
{pattern = {'*'}, {
pattern = { '*' },
command = [[%s/\s\+$//e]], command = [[%s/\s\+$//e]],
}) })
-- settings for filetype: c -- settings for filetype: c
vim.api.nvim_create_autocmd({ 'VimLeave' }, vim.api.nvim_create_autocmd({ 'VimLeave' },
{pattern = {'c'}, {
pattern = { 'c' },
command = '!cclear' command = '!cclear'
}) })
vim.api.nvim_create_autocmd({ 'BufEnter', 'FileType' }, vim.api.nvim_create_autocmd({ 'BufEnter', 'FileType' },
{pattern = {'c'}, {
pattern = { 'c' },
command = 'set colorcolumn=80' command = 'set colorcolumn=80'
}) })
-- settings for filetype: java -- settings for filetype: java
vim.api.nvim_create_autocmd({ 'FileType' }, vim.api.nvim_create_autocmd({ 'FileType' },
{pattern = {'java'}, {
pattern = { 'java' },
command = 'setlocal shiftwidth=2 softtabstop=2', command = 'setlocal shiftwidth=2 softtabstop=2',
}) })
vim.api.nvim_create_autocmd({ 'BufEnter', 'FileType' }, vim.api.nvim_create_autocmd({ 'BufEnter', 'FileType' },
{pattern = {'java'}, {
pattern = { 'java' },
command = 'set colorcolumn=100' command = 'set colorcolumn=100'
}) })
-- settings for filetype: javascript -- settings for filetype: javascript
vim.api.nvim_create_autocmd({ 'FileType' }, vim.api.nvim_create_autocmd({ 'FileType' },
{pattern = {'javascript'}, {
pattern = { 'javascript' },
command = 'setlocal shiftwidth=2 softtabstop=2', command = 'setlocal shiftwidth=2 softtabstop=2',
}) })
-- settings for filetype: lua -- settings for filetype: lua
vim.api.nvim_create_autocmd({ 'FileType' }, vim.api.nvim_create_autocmd({ 'FileType' },
{pattern = {'lua'}, {
pattern = { 'lua' },
command = 'setlocal shiftwidth=2 softtabstop=2', command = 'setlocal shiftwidth=2 softtabstop=2',
}) })
vim.api.nvim_create_autocmd({ 'BufEnter', 'FileType' }, vim.api.nvim_create_autocmd({ 'BufEnter', 'FileType' },
{pattern = {'lua'}, {
pattern = { 'lua' },
command = 'set colorcolumn=100' command = 'set colorcolumn=100'
}) })
-- settings for filetype: markdown -- settings for filetype: markdown
vim.api.nvim_create_autocmd({ 'FileType' }, vim.api.nvim_create_autocmd({ 'FileType' },
{pattern = {'markdown'}, {
pattern = { 'markdown' },
command = 'setlocal shiftwidth=2 softtabstop=2', command = 'setlocal shiftwidth=2 softtabstop=2',
}) })
vim.api.nvim_create_autocmd({ 'BufEnter', 'FileType' }, vim.api.nvim_create_autocmd({ 'BufEnter', 'FileType' },
{pattern = {'markdown'}, {
pattern = { 'markdown' },
command = 'set colorcolumn=100' command = 'set colorcolumn=100'
}) })
vim.api.nvim_create_autocmd({ 'BufEnter', 'FileType' }, vim.api.nvim_create_autocmd({ 'BufEnter', 'FileType' },
{pattern = {'markdown'}, {
pattern = { 'markdown' },
command = 'set conceallevel=2' command = 'set conceallevel=2'
}) })
-- settings for filetype: nim -- settings for filetype: nim
vim.api.nvim_create_autocmd({ 'BufEnter', 'FileType' }, vim.api.nvim_create_autocmd({ 'BufEnter', 'FileType' },
{pattern = {'nim'}, {
pattern = { 'nim' },
command = 'set colorcolumn=80' command = 'set colorcolumn=80'
}) })
-- settings for filetype: python -- settings for filetype: python
vim.api.nvim_create_autocmd({ 'BufEnter', 'FileType' }, vim.api.nvim_create_autocmd({ 'BufEnter', 'FileType' },
{pattern = {'python'}, {
pattern = { 'python' },
command = 'set colorcolumn=80' command = 'set colorcolumn=80'
}) })
-- settings for filetype: tex -- settings for filetype: tex
vim.api.nvim_create_autocmd({ 'VimLeave' }, vim.api.nvim_create_autocmd({ 'VimLeave' },
{pattern = {'tex'}, {
pattern = { 'tex' },
command = '!texclear %' command = '!texclear %'
}) })
vim.api.nvim_create_autocmd({ 'BufEnter', 'FileType' }, vim.api.nvim_create_autocmd({ 'BufEnter', 'FileType' },
{pattern = {'tex'}, {
pattern = { 'tex' },
command = 'set colorcolumn=80' command = 'set colorcolumn=80'
}) })

@ -50,10 +50,10 @@ vim.api.nvim_set_keymap('n', '<leader>ss', ':%s//gI<Left><Left><Left>', {noremap
vim.api.nvim_set_keymap('n', '<leader>is', ':.w >> in<cr>dd', { noremap = true }) vim.api.nvim_set_keymap('n', '<leader>is', ':.w >> in<cr>dd', { noremap = true })
-- majutsushi/tagbar -- majutsushi/tagbar
vim.api.nvim_set_keymap('n', '<F3>', ':TagbarToggle<CR>', {}) vim.api.nvim_set_keymap('n', '<F3>', ':Navbuddy<CR>', {})
-- scrooloose/nerdtree -- scrooloose/nerdtree
vim.api.nvim_set_keymap('n', '<F2>', ':NERDTreeToggle<CR>', {}) vim.api.nvim_set_keymap('n', '<F2>', ':Neotree toggle<CR>', {})
-- tpope/vim-fugitive -- tpope/vim-fugitive
vim.api.nvim_set_keymap('n', '<leader>ga', ':Git add %:p<CR><CR>', { noremap = true }) vim.api.nvim_set_keymap('n', '<leader>ga', ':Git add %:p<CR><CR>', { noremap = true })

@ -27,14 +27,23 @@ return require("packer").startup(function(use)
use { 'itchyny/lightline.vim', use { 'itchyny/lightline.vim',
require = { "tiyn/vim-tccs" } } require = { "tiyn/vim-tccs" } }
-- show signature while typing
use { 'ray-x/lsp_signature.nvim' }
-- latex asynchronous pdf rendering -- latex asynchronous pdf rendering
use { 'donRaphaco/neotex', use { 'donRaphaco/neotex',
ft = { 'tex' } } ft = { 'tex' } }
-- navigating folders with a file tree -- fileexplorer on the side
use {'scrooloose/nerdtree', use {
cmd = 'NERDTreeToggle', "nvim-neo-tree/neo-tree.nvim",
requires = 'ryanoasis/vim-devicons'} branch = "v3.x",
requires = {
"nvim-lua/plenary.nvim",
"nvim-tree/nvim-web-devicons",
"MunifTanjim/nui.nvim",
}
}
-- nim language support -- nim language support
use { 'zah/nim.vim', use { 'zah/nim.vim',
@ -48,6 +57,7 @@ return require("packer").startup(function(use)
requires = { 'hrsh7th/cmp-buffer', requires = { 'hrsh7th/cmp-buffer',
'hrsh7th/cmp-path', 'hrsh7th/cmp-path',
'hrsh7th/cmp-nvim-lsp', 'hrsh7th/cmp-nvim-lsp',
'lukas-reineke/cmp-under-comparator',
'antoinemadec/fixcursorhold.nvim', 'antoinemadec/fixcursorhold.nvim',
'l3mon4d3/luasnip', 'l3mon4d3/luasnip',
'saadparwaiz1/cmp_luasnip', 'saadparwaiz1/cmp_luasnip',
@ -63,6 +73,16 @@ return require("packer").startup(function(use)
-- showing color of hex values, etc -- showing color of hex values, etc
use { 'norcalli/nvim-colorizer.lua' } use { 'norcalli/nvim-colorizer.lua' }
-- show tags
use {
"SmiteshP/nvim-navbuddy",
requires = {
"neovim/nvim-lspconfig",
"SmiteshP/nvim-navic",
"MunifTanjim/nui.nvim",
}
}
-- better language highlighting by improved parsing -- better language highlighting by improved parsing
use { 'nvim-treesitter/nvim-treesitter' } use { 'nvim-treesitter/nvim-treesitter' }
@ -73,10 +93,6 @@ return require("packer").startup(function(use)
-- colorful brackets -- colorful brackets
use { 'luochen1990/rainbow' } use { 'luochen1990/rainbow' }
-- show tags
use {'majutsushi/tagbar',
cmd = 'TagbarToggle'}
-- todo symbols and highlighting -- todo symbols and highlighting
use { 'folke/todo-comments.nvim', use { 'folke/todo-comments.nvim',
requires = { 'nvim-lua/plenary.nvim' } } requires = { 'nvim-lua/plenary.nvim' } }
@ -109,5 +125,4 @@ return require("packer").startup(function(use)
if packer_bootstrap then if packer_bootstrap then
require('packer').sync() require('packer').sync()
end end
end) end)

@ -1,2 +0,0 @@
-- scrooloose/nerdtree
vim.g.NERDTreeWinPos = 'left'

@ -1,12 +1,5 @@
-- hrsh7th/nvim-cmp -- hrsh7th/nvim-cmp
-- mason package manager
require("mason").setup()
require("mason-lspconfig").setup({
-- automatically install language servers setup below for lspconfig
automatic_setup = true,
})
-- jose-elias-alvarez/null-ls.nvim -- jose-elias-alvarez/null-ls.nvim
local null_ls = require("null-ls") local null_ls = require("null-ls")
@ -27,6 +20,14 @@ require("null-ls").setup({
}, },
}) })
-- mason package manager
require("mason").setup()
require("mason-lspconfig").setup({
-- automatically install language servers setup below for lspconfig
automatic_setup = true,
})
require("mason-null-ls").setup({ require("mason-null-ls").setup({
automatic_installation = true, automatic_installation = true,
ensure_installed = {} ensure_installed = {}
@ -43,6 +44,18 @@ local cmp = require("cmp")
local luasnip = require("luasnip") local luasnip = require("luasnip")
local lspkind = require("lspkind") local lspkind = require("lspkind")
cmp.setup { cmp.setup {
sorting = {
comparators = {
cmp.config.compare.offset,
cmp.config.compare.exact,
cmp.config.compare.score,
require "cmp-under-comparator".under,
cmp.config.compare.kind,
cmp.config.compare.sort_text,
cmp.config.compare.length,
cmp.config.compare.order,
},
},
snippet = { snippet = {
expand = function(args) expand = function(args)
luasnip.lsp_expand(args.body) luasnip.lsp_expand(args.body)
@ -71,7 +84,8 @@ cmp.setup {
['<CR>'] = cmp.mapping.confirm { ['<CR>'] = cmp.mapping.confirm {
behavior = cmp.ConfirmBehavior.Replace, behavior = cmp.ConfirmBehavior.Replace,
select = true, select = true,
}}, }
},
sources = { sources = {
{ name = 'nvim_lsp' }, { name = 'nvim_lsp' },
{ name = 'path' }, { name = 'path' },
@ -124,12 +138,25 @@ require("luasnip.loaders.from_snipmate").lazy_load()
-- neovim/nvim-lspconfig -- neovim/nvim-lspconfig
local nvim_lsp = require('lspconfig') local nvim_lsp = require('lspconfig')
require "lsp_signature".setup({
bind = true,
handler_opts = {
border = "rounded"
}
})
local navbuddy = require("nvim-navbuddy")
local attach_func = function(client, bufnr)
navbuddy.attach(client, bufnr)
end
-- Use a loop to conveniently call 'setup' on multiple servers and -- Use a loop to conveniently call 'setup' on multiple servers and
-- map buffer local keybindings when the language server attaches -- map buffer local keybindings when the language server attaches
local servers = { "pyright", "bashls", "texlab", "ccls", "nimls", "marksman" } local servers = { "pyright", "bashls", "texlab", "ccls", "nimls", "marksman" }
for _, lsp in ipairs(servers) do for _, lsp in ipairs(servers) do
nvim_lsp[lsp].setup { nvim_lsp[lsp].setup {
on_attach=on_attach, on_attach = attach_func,
capabilities = capabilities, capabilities = capabilities,
flags = { flags = {
debounce_text_changes = 150 debounce_text_changes = 150
@ -139,7 +166,7 @@ end
require 'lspconfig'.jdtls.setup { require 'lspconfig'.jdtls.setup {
on_attach=on_attach, on_attach = attach_func,
flags = { flags = {
debounce_text_changes = 150 debounce_text_changes = 150
}, },
@ -147,6 +174,7 @@ require'lspconfig'.jdtls.setup{
} }
require 'lspconfig'.lua_ls.setup { require 'lspconfig'.lua_ls.setup {
on_attach = attach_func,
settings = { settings = {
Lua = { Lua = {
runtime = { version = 'LuaJIT' }, runtime = { version = 'LuaJIT' },

@ -1,5 +1,5 @@
-- norcalli/nvim-colorizer.lua -- norcalli/nvim-colorizer.lua
require 'colorizer'.setup { require 'colorizer'.setup {
'*'; '*',
'!markdown'; '!markdown',
} }

Loading…
Cancel
Save