revamped nvim config with lazy.nvim
This commit is contained in:
parent
7ecd56df02
commit
bc3d990481
13 changed files with 217 additions and 313 deletions
|
@ -1,69 +1,11 @@
|
||||||
-- disable netrw at the very start of your init.lua (strongly advised)
|
vim.g.mapleader = " "
|
||||||
vim.g.loaded_netrw = 1
|
vim.g.maplocalleader = "\\"
|
||||||
vim.g.loaded_netrwPlugin = 1
|
|
||||||
----------------------
|
|
||||||
-- general settings --
|
|
||||||
----------------------
|
|
||||||
local set = vim.opt
|
|
||||||
|
|
||||||
set.foldmethod = 'marker'
|
require("config.options")
|
||||||
|
require("config.lazy")
|
||||||
|
|
||||||
set.wrap = true
|
-- mappings
|
||||||
set.linebreak = true
|
vim.keymap.set("n", "<leader><leader>", "/<++><CR>ca>")
|
||||||
set.breakindent = true
|
vim.keymap.set("n", "s", "<Nop>")
|
||||||
set.breakindentopt = {'shift:2', 'sbr'}
|
|
||||||
set.showbreak = ' >'
|
|
||||||
|
|
||||||
set.number = true
|
|
||||||
set.relativenumber = true
|
|
||||||
set.encoding = "utf-8"
|
|
||||||
|
|
||||||
-- search
|
|
||||||
set.hlsearch = true
|
|
||||||
set.ignorecase = true
|
|
||||||
set.smartcase = true
|
|
||||||
|
|
||||||
-- indentation
|
|
||||||
set.smarttab = true
|
|
||||||
set.expandtab = false
|
|
||||||
set.copyindent = true
|
|
||||||
set.preserveindent = true
|
|
||||||
set.tabstop = 4
|
|
||||||
set.shiftwidth = 4
|
|
||||||
set.softtabstop = 0
|
|
||||||
|
|
||||||
local mdgroup = vim.api.nvim_create_augroup("WrapMarkdown", { clear = true })
|
|
||||||
vim.api.nvim_create_autocmd("FileType", {
|
|
||||||
pattern = "markdown,txt",
|
|
||||||
callback = function()
|
|
||||||
vim.opt_local.colorcolumn = "85"
|
|
||||||
vim.opt_local.textwidth = 85
|
|
||||||
end,
|
|
||||||
group = WrapMarkdown,
|
|
||||||
})
|
|
||||||
vim.api.nvim_create_autocmd("FileType", {
|
|
||||||
pattern = "latex,tex",
|
|
||||||
callback = function()
|
|
||||||
vim.opt_local.shiftwidth = 2
|
|
||||||
vim.opt_local.tabstop = 2
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
vim.api.nvim_create_autocmd("TextYankPost", {
|
|
||||||
command = "silent! lua vim.highlight.on_yank()",
|
|
||||||
})
|
|
||||||
|
|
||||||
vim.cmd [[
|
|
||||||
let g:vim_markdown_folding_disabled=1
|
|
||||||
]]
|
|
||||||
|
|
||||||
-- removes the background color to have it transparent
|
|
||||||
vim.api.nvim_create_autocmd({"ColorScheme"}, {
|
|
||||||
pattern = {"*"},
|
|
||||||
command = "hi Normal ctermbg=none guibg=none",
|
|
||||||
})
|
|
||||||
vim.cmd("colorscheme kanagawa")
|
|
||||||
|
|
||||||
require('plugins')
|
|
||||||
--require('core.colors')
|
|
||||||
require('core.mappings')
|
|
||||||
|
|
||||||
|
vim.cmd[[colorscheme tokyonight]]
|
||||||
|
|
37
.config/nvim/lua/config/lazy.lua
Normal file
37
.config/nvim/lua/config/lazy.lua
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||||
|
if not (vim.uv or vim.loop).fs_stat(lazypath) then
|
||||||
|
local lazyrepo = "https://github.com/folke/lazy.nvim.git"
|
||||||
|
local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
|
||||||
|
if vim.v.shell_error ~= 0 then
|
||||||
|
vim.api.nvim_echo({
|
||||||
|
{ "Failed to clone lazy.nvim:\n", "ErrorMsg" },
|
||||||
|
{ out, "WarningMsg" },
|
||||||
|
{ "\nPress any key to exit..." },
|
||||||
|
}, true, {})
|
||||||
|
vim.fn.getchar()
|
||||||
|
os.exit(1)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
vim.opt.rtp:prepend(lazypath)
|
||||||
|
|
||||||
|
-- Setup lazy.nvim
|
||||||
|
require("lazy").setup({
|
||||||
|
spec = {
|
||||||
|
-- import your plugins
|
||||||
|
{ "folke/which-key.nvim", lazy = true },
|
||||||
|
{
|
||||||
|
'windwp/nvim-autopairs',
|
||||||
|
event = "InsertEnter",
|
||||||
|
config = true
|
||||||
|
-- use opts = {} for passing setup options
|
||||||
|
-- this is equivalent to setup({}) function
|
||||||
|
},
|
||||||
|
{ "christoomey/vim-tmux-navigator" },
|
||||||
|
{ import = "plugins" },
|
||||||
|
},
|
||||||
|
-- Configure any other settings here. See the documentation for more details.
|
||||||
|
-- colorscheme that will be used when installing plugins.
|
||||||
|
install = { colorscheme = { "tokyonight" } },
|
||||||
|
-- automatically check for plugin updates
|
||||||
|
checker = { enabled = true },
|
||||||
|
})
|
32
.config/nvim/lua/config/options.lua
Normal file
32
.config/nvim/lua/config/options.lua
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
vim.opt.wrap = true
|
||||||
|
vim.opt.linebreak = true
|
||||||
|
vim.opt.breakindent = true
|
||||||
|
vim.opt.breakindentopt = {'shift:2', 'sbr'}
|
||||||
|
vim.opt.showbreak = ' >'
|
||||||
|
|
||||||
|
vim.opt.number = true
|
||||||
|
vim.opt.relativenumber = true
|
||||||
|
vim.opt.encoding = "utf-8"
|
||||||
|
|
||||||
|
-- search
|
||||||
|
vim.opt.hlsearch = true
|
||||||
|
vim.opt.ignorecase = true
|
||||||
|
vim.opt.smartcase = true
|
||||||
|
|
||||||
|
-- indentation
|
||||||
|
vim.opt.smarttab = true
|
||||||
|
vim.opt.expandtab = false
|
||||||
|
vim.opt.copyindent = true
|
||||||
|
vim.opt.preserveindent = true
|
||||||
|
vim.opt.tabstop = 2
|
||||||
|
vim.opt.shiftwidth = 2
|
||||||
|
vim.opt.softtabstop = 0
|
||||||
|
|
||||||
|
vim.api.nvim_create_autocmd('FileType', {
|
||||||
|
pattern = { "*.py" },
|
||||||
|
callback = function()
|
||||||
|
vim.opt.expandtab = true
|
||||||
|
vim.opt.tabstop = 4
|
||||||
|
vim.opt.shiftwidth = 4
|
||||||
|
end
|
||||||
|
})
|
|
@ -1,14 +0,0 @@
|
||||||
--------------
|
|
||||||
-- mappings --
|
|
||||||
--------------
|
|
||||||
local map = vim.api.nvim_set_keymap
|
|
||||||
|
|
||||||
vim.g.mapleader = ' '
|
|
||||||
map('n', '<Space>', '', {})
|
|
||||||
map('n', '<Leader>n', '<cmd>:bnext<CR>', {})
|
|
||||||
map('n', '<Leader>p', '<cmd>:bprevious<CR>', {})
|
|
||||||
map('n', '<Leader>h', '<cmd>:nohlsearch<CR>', {})
|
|
||||||
|
|
||||||
-- nvim-tree mappings
|
|
||||||
map('n', '<Leader>t', '<cmd>:NvimTreeToggle<CR>', {})
|
|
||||||
map('n', '<Leader>z', '<cmd>:ZenMode<CR>', {})
|
|
15
.config/nvim/lua/plugins/colorscheme.lua
Normal file
15
.config/nvim/lua/plugins/colorscheme.lua
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
return {
|
||||||
|
-- the colorscheme should be available when starting Neovim
|
||||||
|
{
|
||||||
|
"folke/tokyonight.nvim",
|
||||||
|
lazy = false,
|
||||||
|
priority = 1000,
|
||||||
|
opts = {
|
||||||
|
transparent = true,
|
||||||
|
styles = {
|
||||||
|
sidebars = "transparent",
|
||||||
|
floats = "transparent",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,95 +0,0 @@
|
||||||
-------------
|
|
||||||
-- plugins --
|
|
||||||
-------------
|
|
||||||
require "paq" {
|
|
||||||
"savq/paq-nvim"; -- Let Paq manage itself
|
|
||||||
-- general plugins
|
|
||||||
"nvim-lualine/lualine.nvim";
|
|
||||||
--{ 'nvim-tree/nvim-web-devicons', opt=true };
|
|
||||||
'nvim-tree/nvim-web-devicons';
|
|
||||||
'romgrk/barbar.nvim';
|
|
||||||
'ggandor/lightspeed.nvim';
|
|
||||||
'L3MON4D3/LuaSnip'; -- Snippets plugin
|
|
||||||
'saadparwaiz1/cmp_luasnip'; -- Snippets 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';
|
|
||||||
|
|
||||||
-- writing
|
|
||||||
'dhruvasagar/vim-table-mode';
|
|
||||||
'folke/zen-mode.nvim';
|
|
||||||
'folke/twilight.nvim';
|
|
||||||
}
|
|
||||||
|
|
||||||
-- looks like tablemode for vim-table-mode in markdown
|
|
||||||
vim.cmd [[
|
|
||||||
function! s:isAtStartOfLine(mapping)
|
|
||||||
let text_before_cursor = getline('.')[0 : col('.')-1]
|
|
||||||
let mapping_pattern = '\V' . escape(a:mapping, '\')
|
|
||||||
let comment_pattern = '\V' . escape(substitute(&l:commentstring, '%s.*$', '', ''), '\')
|
|
||||||
return (text_before_cursor =~? '^' . ('\v(' . comment_pattern . '\v)?') . '\s*\v' . mapping_pattern . '\v$')
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
inoreabbrev <expr> <bar><bar>
|
|
||||||
\ <SID>isAtStartOfLine('\|\|') ?
|
|
||||||
\ '<c-o>:TableModeEnable<cr><bar><space><bar><left><left>' : '<bar><bar>'
|
|
||||||
inoreabbrev <expr> __
|
|
||||||
\ <SID>isAtStartOfLine('__') ?
|
|
||||||
\ '<c-o>:silent! TableModeDisable<cr>' : '__'
|
|
||||||
]]
|
|
||||||
|
|
||||||
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,
|
|
||||||
}
|
|
||||||
require'nvim-web-devicons'.setup{
|
|
||||||
color_icons = true;
|
|
||||||
default = true;
|
|
||||||
}
|
|
||||||
-- setup barbar
|
|
||||||
require'bufferline'.setup{
|
|
||||||
icons = true,
|
|
||||||
}
|
|
||||||
|
|
||||||
require'zen-mode'.setup{
|
|
||||||
window = {
|
|
||||||
width = 85,
|
|
||||||
},
|
|
||||||
plugins = {
|
|
||||||
options = {
|
|
||||||
enabled = true,
|
|
||||||
},
|
|
||||||
kitty = {
|
|
||||||
enabled = true,
|
|
||||||
font = "+4",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
require'twilight'.setup{
|
|
||||||
dimming = {
|
|
||||||
alpha = 0.80,
|
|
||||||
},
|
|
||||||
}
|
|
|
@ -1,28 +0,0 @@
|
||||||
require'lualine'.setup {
|
|
||||||
options = {
|
|
||||||
icons_enabled = true,
|
|
||||||
theme = 'auto',
|
|
||||||
component_separators = { left = '', right = ''},
|
|
||||||
section_separators = { left = '', right = ''},
|
|
||||||
disabled_filetypes = {},
|
|
||||||
always_divide_middle = true,
|
|
||||||
},
|
|
||||||
sections = {
|
|
||||||
lualine_a = {'mode'},
|
|
||||||
lualine_b = {'branch', 'diff', 'diagnostics'},
|
|
||||||
lualine_c = {'filename'},
|
|
||||||
lualine_x = {'encoding', 'fileformat', 'filetype'},
|
|
||||||
lualine_y = {'progress'},
|
|
||||||
lualine_z = {'location'}
|
|
||||||
},
|
|
||||||
inactive_sections = {
|
|
||||||
lualine_a = {},
|
|
||||||
lualine_b = {},
|
|
||||||
lualine_c = {'filename'},
|
|
||||||
lualine_x = {'location'},
|
|
||||||
lualine_y = {},
|
|
||||||
lualine_z = {}
|
|
||||||
},
|
|
||||||
tabline = {},
|
|
||||||
extensions = {}
|
|
||||||
}
|
|
21
.config/nvim/lua/plugins/mini.lua
Normal file
21
.config/nvim/lua/plugins/mini.lua
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
return{
|
||||||
|
{'echasnovski/mini.nvim', version = '*'},
|
||||||
|
{
|
||||||
|
'echasnovski/mini.surround',
|
||||||
|
version = '*',
|
||||||
|
opts = {
|
||||||
|
mappings = {
|
||||||
|
add = 'sa', -- Add surrounding in Normal and Visual modes
|
||||||
|
delete = 'sd', -- Delete surrounding
|
||||||
|
find = 'sf', -- Find surrounding (to the right)
|
||||||
|
find_left = 'sF', -- Find surrounding (to the left)
|
||||||
|
highlight = 'sh', -- Highlight surrounding
|
||||||
|
replace = 'sr', -- Replace surrounding
|
||||||
|
update_n_lines = 'sn', -- Update `n_lines`
|
||||||
|
|
||||||
|
suffix_last = 'l', -- Suffix to search with "prev" method
|
||||||
|
suffix_next = 'n', -- Suffix to search with "next" method
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
|
@ -1,74 +0,0 @@
|
||||||
local luasnip = require 'luasnip'
|
|
||||||
local cmp = require 'cmp'
|
|
||||||
cmp.setup {
|
|
||||||
snippet = {
|
|
||||||
expand = function(args)
|
|
||||||
luasnip.lsp_expand(args.body)
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
mapping = {
|
|
||||||
['<C-p>'] = cmp.mapping.select_prev_item(),
|
|
||||||
['<C-n>'] = cmp.mapping.select_next_item(),
|
|
||||||
['<C-d>'] = cmp.mapping.scroll_docs(-4),
|
|
||||||
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
|
||||||
['<C-Space>'] = cmp.mapping.complete(),
|
|
||||||
['<C-e>'] = cmp.mapping.close(),
|
|
||||||
['<CR>'] = cmp.mapping.confirm {
|
|
||||||
behavior = cmp.ConfirmBehavior.Replace,
|
|
||||||
select = true,
|
|
||||||
},
|
|
||||||
['<Tab>'] = function(fallback)
|
|
||||||
if cmp.visible() then
|
|
||||||
cmp.select_next_item()
|
|
||||||
elseif luasnip.expand_or_jumpable() then
|
|
||||||
luasnip.expand_or_jump()
|
|
||||||
else
|
|
||||||
fallback()
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
['<S-Tab>'] = function(fallback)
|
|
||||||
if cmp.visible() then
|
|
||||||
cmp.select_prev_item()
|
|
||||||
elseif luasnip.jumpable(-1) then
|
|
||||||
luasnip.jump(-1)
|
|
||||||
else
|
|
||||||
fallback()
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
sources = {
|
|
||||||
{ name = 'path'},
|
|
||||||
{ name = 'nvim_lsp', keywordlength=3 },
|
|
||||||
{ name = 'buffer', keywordlength=3 },
|
|
||||||
{ name = 'luasnip', keywordlength=2 },
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
require('nvim-autopairs').setup{}
|
|
||||||
cmp.event:on(
|
|
||||||
'confirm_done',
|
|
||||||
require('nvim-autopairs.completion.cmp').on_confirm_done({
|
|
||||||
map_char = { tex = '' }
|
|
||||||
})
|
|
||||||
)
|
|
||||||
|
|
||||||
--------------------
|
|
||||||
-- Configure LSPs --
|
|
||||||
--------------------
|
|
||||||
-- require'lspconfig'.pylsp.setup{}
|
|
||||||
|
|
||||||
-- Add additional capabilities supported by nvim-cmp
|
|
||||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
|
||||||
capabilities = require('cmp_nvim_lsp').default_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', 'jdtls' }
|
|
||||||
for _, lsp in ipairs(servers) do
|
|
||||||
lspconfig[lsp].setup {
|
|
||||||
capabilities = capabilities,
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
vim.opt.completeopt = {'menu', 'menuone', 'noselect'}
|
|
|
@ -1,15 +0,0 @@
|
||||||
require'nvim-treesitter.configs'.setup {
|
|
||||||
-- A list of parser names, or "all"
|
|
||||||
ensure_installed = { "lua", "python", "java" },
|
|
||||||
|
|
||||||
-- Install parsers synchronously (only applied to `ensure_installed`)
|
|
||||||
sync_install = false,
|
|
||||||
|
|
||||||
highlight = {
|
|
||||||
-- `false` will disable the whole extension
|
|
||||||
enable = true,
|
|
||||||
|
|
||||||
-- Using this option may slow down your editor, and you may see some duplicate highlights.
|
|
||||||
additional_vim_regex_highlighting = false,
|
|
||||||
},
|
|
||||||
}
|
|
43
.config/nvim/lua/plugins/tabout.lua
Normal file
43
.config/nvim/lua/plugins/tabout.lua
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
'abecodes/tabout.nvim',
|
||||||
|
lazy = false,
|
||||||
|
config = function()
|
||||||
|
require('tabout').setup {
|
||||||
|
tabkey = '<Tab>', -- key to trigger tabout, set to an empty string to disable
|
||||||
|
backwards_tabkey = '<S-Tab>', -- key to trigger backwards tabout, set to an empty string to disable
|
||||||
|
act_as_tab = true, -- shift content if tab out is not possible
|
||||||
|
act_as_shift_tab = false, -- reverse shift content if tab out is not possible (if your keyboard/terminal supports <S-Tab>)
|
||||||
|
default_tab = '<C-t>', -- shift default action (only at the beginning of a line, otherwise <TAB> is used)
|
||||||
|
default_shift_tab = '<C-d>', -- reverse shift default action,
|
||||||
|
enable_backwards = true, -- well ...
|
||||||
|
completion = false, -- if the tabkey is used in a completion pum
|
||||||
|
tabouts = {
|
||||||
|
{ open = "'", close = "'" },
|
||||||
|
{ open = '"', close = '"' },
|
||||||
|
{ open = '`', close = '`' },
|
||||||
|
{ open = '(', close = ')' },
|
||||||
|
{ open = '[', close = ']' },
|
||||||
|
{ open = '{', close = '}' }
|
||||||
|
},
|
||||||
|
ignore_beginning = true, --[[ if the cursor is at the beginning of a filled element it will rather tab out than shift the content ]]
|
||||||
|
exclude = {} -- tabout will ignore these filetypes
|
||||||
|
}
|
||||||
|
end,
|
||||||
|
dependencies = { -- These are optional
|
||||||
|
"nvim-treesitter/nvim-treesitter",
|
||||||
|
-- "L3MON4D3/LuaSnip",
|
||||||
|
-- "hrsh7th/nvim-cmp"
|
||||||
|
},
|
||||||
|
opt = true, -- Set this to true if the plugin is optional
|
||||||
|
event = 'InsertCharPre', -- Set the event to 'InsertCharPre' for better compatibility
|
||||||
|
priority = 1000,
|
||||||
|
},
|
||||||
|
-- {
|
||||||
|
-- "L3MON4D3/LuaSnip",
|
||||||
|
-- keys = function()
|
||||||
|
-- -- Disable default tab keybinding in LuaSnip
|
||||||
|
-- return {}
|
||||||
|
-- end,
|
||||||
|
-- },
|
||||||
|
}
|
|
@ -1,22 +1,16 @@
|
||||||
require('telescope').setup{
|
return { -- fuzzy find
|
||||||
defaults = {
|
{
|
||||||
-- Default configuration for telescope goes here:
|
"nvim-telescope/telescope.nvim",
|
||||||
-- config_key = value,
|
dependencies = {
|
||||||
mappings = {
|
{"nvim-lua/plenary.nvim"},
|
||||||
i = {
|
{"nvim-tree/nvim-web-devicons"}
|
||||||
-- map actions.which_key to <C-h> (default: <C-/>)
|
},
|
||||||
-- actions.which_key shows the mappings for your picker,
|
config = function()
|
||||||
-- e.g. git_{create, delete, ...}_branch for the git_branches picker
|
local builtin = require('telescope.builtin')
|
||||||
["<C-h>"] = "which_key"
|
vim.keymap.set('n', '<leader>ff', builtin.find_files, { desc = 'Telescope find files' })
|
||||||
}
|
vim.keymap.set('n', '<leader>fg', builtin.live_grep, { desc = 'Telescope live grep' })
|
||||||
}
|
vim.keymap.set('n', '<leader>fb', builtin.buffers, { desc = 'Telescope buffers' })
|
||||||
},
|
vim.keymap.set('n', '<leader>fh', builtin.help_tags, { desc = 'Telescope help tags' })
|
||||||
|
end,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
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, {})
|
|
||||||
|
|
46
.config/nvim/lua/plugins/treesitter.lua
Normal file
46
.config/nvim/lua/plugins/treesitter.lua
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
"nvim-treesitter/nvim-treesitter",
|
||||||
|
build = ":TSUpdate",
|
||||||
|
event = { "BufReadPre", "BufNewFile" },
|
||||||
|
lazy = vim.fn.argc(-1) == 0,
|
||||||
|
cmd = { "TSUpdateSync", "TSUpdate", "TSInstall" },
|
||||||
|
keys = {
|
||||||
|
{ "<c-space>", desc = "Increment Selection" },
|
||||||
|
{ "<bs>", desc = "Decrement Selection", mode = "x" },
|
||||||
|
},
|
||||||
|
opts_extend = { "ensure_installed" },
|
||||||
|
---@type TSConfig
|
||||||
|
---@diagnostic disable-next-line: missing-fields
|
||||||
|
opts = {
|
||||||
|
highlight = { enable = true },
|
||||||
|
indent = { enable = true },
|
||||||
|
ensure_installed = {
|
||||||
|
"bash",
|
||||||
|
"c",
|
||||||
|
"diff",
|
||||||
|
"html",
|
||||||
|
"lua",
|
||||||
|
"markdown",
|
||||||
|
"markdown_inline",
|
||||||
|
"python",
|
||||||
|
"query",
|
||||||
|
"vim",
|
||||||
|
"vimdoc",
|
||||||
|
"yaml"
|
||||||
|
},
|
||||||
|
incremental_selection = {
|
||||||
|
enable = true,
|
||||||
|
keymaps = {
|
||||||
|
init_selection = "<C-space>",
|
||||||
|
node_incremental = "<C-space>",
|
||||||
|
scope_incremental = false,
|
||||||
|
node_decremental = "<bs>",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
config = function(_, opts)
|
||||||
|
require("nvim-treesitter.configs").setup(opts)
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue