From 27544731399dc7484004fb9bde199ea95db8e864 Mon Sep 17 00:00:00 2001 From: Maciej Lebiest Date: Sun, 12 Feb 2023 18:26:24 +0100 Subject: [PATCH] finish basic files refactor --- README.md | 22 ++- init.lua | 31 ++-- lua/conf-bufferline.lua | 45 ------ lua/conf-gitsigns.lua | 80 ----------- lua/conf-hlslens.lua | 16 --- lua/conf-indent-blankline.lua | 5 - lua/conf-lualine.lua | 47 ------ lua/conf-nvim-cmp.lua | 71 ---------- lua/conf-nvim-tree.lua | 69 --------- lua/conf-treesitter.lua | 42 ------ lua/general.lua | 14 ++ lua/initializer.lua | 25 ---- lua/{lazy-setup.lua => lazy-load.lua} | 50 ++++--- lua/my-lint.lua | 37 ----- lua/my-lspconfig.lua | 193 ------------------------- lua/plugins/bufferline.lua | 47 ++++++ lua/plugins/gitsigns.lua | 82 +++++++++++ lua/plugins/hlslens.lua | 4 + lua/plugins/indent-blankline.lua | 7 + lua/plugins/lualine.lua | 49 +++++++ lua/plugins/mason-lspconfig.lua | 2 +- lua/plugins/nerdcommenter.lua | 6 + lua/plugins/nvim-cmp.lua | 75 ++++++++++ lua/plugins/nvim-lint.lua | 41 ++++++ lua/plugins/nvim-lspconfig.lua | 197 ++++++++++++++++++++++++++ lua/plugins/nvim-notify.lua | 5 + lua/plugins/nvim-tree.lua | 75 ++++++++++ lua/plugins/treesitter.lua | 44 ++++++ 28 files changed, 715 insertions(+), 666 deletions(-) delete mode 100644 lua/conf-bufferline.lua delete mode 100644 lua/conf-gitsigns.lua delete mode 100644 lua/conf-hlslens.lua delete mode 100644 lua/conf-indent-blankline.lua delete mode 100644 lua/conf-lualine.lua delete mode 100644 lua/conf-nvim-cmp.lua delete mode 100644 lua/conf-nvim-tree.lua delete mode 100644 lua/conf-treesitter.lua delete mode 100644 lua/initializer.lua rename lua/{lazy-setup.lua => lazy-load.lua} (87%) delete mode 100644 lua/my-lint.lua delete mode 100644 lua/my-lspconfig.lua create mode 100644 lua/plugins/bufferline.lua create mode 100644 lua/plugins/gitsigns.lua create mode 100644 lua/plugins/hlslens.lua create mode 100644 lua/plugins/indent-blankline.lua create mode 100644 lua/plugins/lualine.lua create mode 100644 lua/plugins/nerdcommenter.lua create mode 100644 lua/plugins/nvim-cmp.lua create mode 100644 lua/plugins/nvim-lint.lua create mode 100644 lua/plugins/nvim-lspconfig.lua create mode 100644 lua/plugins/nvim-notify.lua create mode 100644 lua/plugins/nvim-tree.lua create mode 100644 lua/plugins/treesitter.lua diff --git a/README.md b/README.md index 216fa3c..cf87883 100644 --- a/README.md +++ b/README.md @@ -74,6 +74,11 @@ Mason installs stuff in `.local/share/nvim/mason/packages` so they are independe :SudaWrite /etc/profile ``` +##### General + +
<leader>l +disable (search) highlighting
+ ##### Opened files navigation:
<leader> m m @@ -227,9 +232,24 @@ GitSings provides some commands for displaying git stuff: list workspace folders
-##### +##### LSP diagnostics, etc: +
<leader>xx +Open diagnostics window +
<leader>xwworkspace diagnostics +
<leader>xddocument diagnostics +
<leader>xlloclist
<leader>xqquickfix
gR +lsp references +
+ ##### Sessions To save **new** session on specific path, just use `:SaveSession`, then when opening nvim there, without arguments, the session will be restored. + +##### Notifications + +
:Notifications +show recent notifications +
:Telescope notify +show recent notifications in telescope gui
diff --git a/init.lua b/init.lua index 998724c..632ae3a 100644 --- a/init.lua +++ b/init.lua @@ -1,13 +1,20 @@ -require("initializer") -vim.opt.mouse = "c" -- set mouse in command line mode -vim.opt.colorcolumn = "80" -- highlight this column -vim.opt.relativenumber = true -vim.opt.number = true -vim.opt.clipboard = "unnamedplus" -- synchronize with system clipboard -vim.opt.swapfile = false -vim.opt.cursorline = true +--make sure Lazy is installed +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +if not vim.loop.fs_stat(lazypath) then + vim.fn.system({ + "git", + "clone", + "--filter=blob:none", + "https://github.com/folke/lazy.nvim.git", + "--branch=stable", -- latest stable release + lazypath, + }) +end +vim.opt.rtp:prepend(lazypath) + vim.opt.termguicolors = true -vim.cmd [[ - highlight clear - colorscheme dracula -]] + +-- load all plugins +require("lazy-load") +-- load general config +require("general") diff --git a/lua/conf-bufferline.lua b/lua/conf-bufferline.lua deleted file mode 100644 index 98bc489..0000000 --- a/lua/conf-bufferline.lua +++ /dev/null @@ -1,45 +0,0 @@ -require('bufferline').setup { - options = { - mode = "buffers", -- set to "tabs" to only show tabpages instead - numbers = "buffer_id", - close_command = "bdelete! %d", -- can be a string | function, see "Mouse actions" - right_mouse_command = "bdelete! %d", -- can be a string | function, see "Mouse actions" - left_mouse_command = "buffer %d", -- can be a string | function, see "Mouse actions" - middle_mouse_command = nil, -- can be a string | function, see "Mouse actions" - indicator = { - icon = '>', -- this should be omitted if indicator style is not 'icon' - style = 'icon', - }, - buffer_close_icon = '', - modified_icon = '●', - close_icon = '', - left_trunc_marker = '', - right_trunc_marker = '', - max_name_length = 18, - max_prefix_length = 15, -- prefix used when a buffer is de-duplicated - truncate_names = true, -- whether or not tab names should be truncated - tab_size = 18, - diagnostics = "coc", - diagnostics_update_in_insert = false, - -- The diagnostics indicator can be set to nil to keep the buffer name highlight but delete the highlighting - color_icons = true, -- whether or not to add the filetype icon highlights - show_buffer_icons = true, -- disable filetype icons for buffers - show_buffer_close_icons = true, - show_buffer_default_icon = true, -- whether or not an unrecognised filetype should show a default icon - show_close_icon = false, - show_tab_indicators = true, - show_duplicate_prefix = true, -- whether to show duplicate buffer prefix - persist_buffer_sort = true, -- whether or not custom sorted buffers should persist - -- can also be a table containing 2 custom separators - -- [focused and unfocused]. eg: { '|', '|' } - separator_style = "thick", - enforce_regular_tabs = false, - always_show_bufferline = true, - hover = { - enabled = true, - delay = 200, - reveal = { 'close' } - }, - sort_by = 'tabs', - } -} diff --git a/lua/conf-gitsigns.lua b/lua/conf-gitsigns.lua deleted file mode 100644 index f97f2ec..0000000 --- a/lua/conf-gitsigns.lua +++ /dev/null @@ -1,80 +0,0 @@ -require('gitsigns').setup { - signs = { - add = { hl = 'GitSignsAdd', text = '│', numhl = 'GitSignsAddNr', linehl = 'GitSignsAddLn' }, - change = { hl = 'GitSignsChange', text = '│', numhl = 'GitSignsChangeNr', linehl = 'GitSignsChangeLn' }, - delete = { hl = 'GitSignsDelete', text = '_', numhl = 'GitSignsDeleteNr', linehl = 'GitSignsDeleteLn' }, - topdelete = { hl = 'GitSignsDelete', text = '‾', numhl = 'GitSignsDeleteNr', linehl = 'GitSignsDeleteLn' }, - changedelete = { hl = 'GitSignsChange', text = '~', numhl = 'GitSignsChangeNr', linehl = 'GitSignsChangeLn' }, - untracked = { hl = 'GitSignsAdd', text = '┆', numhl = 'GitSignsAddNr', linehl = 'GitSignsAddLn' }, - }, - signcolumn = true, -- Toggle with `:Gitsigns toggle_signs` - numhl = false, -- Toggle with `:Gitsigns toggle_numhl` - linehl = false, -- Toggle with `:Gitsigns toggle_linehl` - word_diff = false, -- Toggle with `:Gitsigns toggle_word_diff` - watch_gitdir = { - interval = 1000, - follow_files = true - }, - attach_to_untracked = true, - current_line_blame = true, -- Toggle with `:Gitsigns toggle_current_line_blame` - current_line_blame_opts = { - virt_text = true, - virt_text_pos = 'eol', -- 'eol' | 'overlay' | 'right_align' - delay = 1000, - ignore_whitespace = false, - }, - current_line_blame_formatter = ', - ', - sign_priority = 6, - update_debounce = 100, - status_formatter = nil, -- Use default - max_file_length = 40000, -- Disable if file is longer than this (in lines) - preview_config = { - -- Options passed to nvim_open_win - border = 'single', - style = 'minimal', - relative = 'cursor', - row = 0, - col = 1 - }, - yadm = { - enable = false - }, - on_attach = function(bufnr) - local gs = package.loaded.gitsigns - - local function map(mode, l, r, opts) - opts = opts or {} - opts.buffer = bufnr - vim.keymap.set(mode, l, r, opts) - end - - -- Navigation - map('n', ']c', function() - if vim.wo.diff then return ']c' end - vim.schedule(function() gs.next_hunk() end) - return '' - end, { expr = true }) - - map('n', '[c', function() - if vim.wo.diff then return '[c' end - vim.schedule(function() gs.prev_hunk() end) - return '' - end, { expr = true }) - - -- Actions - map({ 'n', 'v' }, 'hs', ':Gitsigns stage_hunk') - map({ 'n', 'v' }, 'hr', ':Gitsigns reset_hunk') - map('n', 'hS', gs.stage_buffer) - map('n', 'hu', gs.undo_stage_hunk) - map('n', 'hR', gs.reset_buffer) - map('n', '', gs.preview_hunk) - map('n', 'hb', function() gs.blame_line { full = true } end) - map('n', 'tb', gs.toggle_current_line_blame) - map('n', 'hd', gs.diffthis) - map('n', 'hD', function() gs.diffthis('~') end) - map('n', 'td', gs.toggle_deleted) - - -- Text object - map({ 'o', 'x' }, 'ih', ':Gitsigns select_hunk') - end -} diff --git a/lua/conf-hlslens.lua b/lua/conf-hlslens.lua deleted file mode 100644 index 0f1de67..0000000 --- a/lua/conf-hlslens.lua +++ /dev/null @@ -1,16 +0,0 @@ -require('hlslens').setup() - -local kopts = { noremap = true, silent = true } - -vim.api.nvim_set_keymap('n', 'n', - [[execute('normal! ' . v:count1 . 'n')lua require('hlslens').start()]], - kopts) -vim.api.nvim_set_keymap('n', 'N', - [[execute('normal! ' . v:count1 . 'N')lua require('hlslens').start()]], - kopts) -vim.api.nvim_set_keymap('n', '*', [[*lua require('hlslens').start()]], kopts) -vim.api.nvim_set_keymap('n', '#', [[#lua require('hlslens').start()]], kopts) -vim.api.nvim_set_keymap('n', 'g*', [[g*lua require('hlslens').start()]], kopts) -vim.api.nvim_set_keymap('n', 'g#', [[g#lua require('hlslens').start()]], kopts) - -vim.api.nvim_set_keymap('n', 'l', ':noh', kopts) diff --git a/lua/conf-indent-blankline.lua b/lua/conf-indent-blankline.lua deleted file mode 100644 index 03d0b87..0000000 --- a/lua/conf-indent-blankline.lua +++ /dev/null @@ -1,5 +0,0 @@ -require("indent_blankline").setup { - space_char_blankline = " ", - show_current_context = true, - show_current_context_start = true, -} diff --git a/lua/conf-lualine.lua b/lua/conf-lualine.lua deleted file mode 100644 index b3b1bfe..0000000 --- a/lua/conf-lualine.lua +++ /dev/null @@ -1,47 +0,0 @@ -require('lualine').setup { - options = { - icons_enabled = true, - theme = 'dracula', - component_separators = { left = '', right = '' }, - section_separators = { left = '', right = '' }, - disabled_filetypes = { - statusline = {}, - winbar = {}, - }, - ignore_focus = {}, - always_divide_middle = true, - globalstatus = false, - refresh = { - statusline = 1000, - tabline = 1000, - winbar = 1000, - } - }, - sections = { - lualine_a = { 'mode' }, - lualine_b = { 'branch', 'diff', 'diagnostics' }, - lualine_c = { 'filename' }, - lualine_x = { 'encoding', 'fileformat', 'filetype' }, - lualine_y = { 'progress' }, - lualine_z = { 'tabs' } - }, - inactive_sections = { - lualine_a = {}, - lualine_b = {}, - lualine_c = { 'filename' }, - lualine_x = { 'location' }, - lualine_y = {}, - lualine_z = {} - }, - tabline = {}, - winbar = {}, - inactive_winbar = {}, - extensions = { - 'quickfix', - 'nvim-tree', - 'symbols-outline', - 'fugitive', - 'man' - } - -} diff --git a/lua/conf-nvim-cmp.lua b/lua/conf-nvim-cmp.lua deleted file mode 100644 index 0b0adba..0000000 --- a/lua/conf-nvim-cmp.lua +++ /dev/null @@ -1,71 +0,0 @@ -local cmp = require 'cmp' -local lspkind = require('lspkind') - -cmp.setup({ - snippet = { - -- REQUIRED - you must specify a snippet engine - expand = function(args) - require('luasnip').lsp_expand(args.body) -- For `luasnip` users. - end, - }, - window = { - completion = cmp.config.window.bordered(), - documentation = cmp.config.window.bordered(), - }, - mapping = cmp.mapping.preset.insert({ - [''] = cmp.mapping.scroll_docs(-4), - [''] = cmp.mapping.scroll_docs(4), - [''] = cmp.mapping.complete(), - [''] = cmp.mapping.abort(), - [''] = cmp.mapping.confirm({ select = false }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. - }), - sources = cmp.config.sources({ - { name = 'nvim_lsp' }, - --{ name = 'vsnip' }, -- For vsnip users. - { name = 'luasnip' }, -- For luasnip users. - -- { name = 'ultisnips' }, -- For ultisnips users. - -- { name = 'snippy' }, -- For snippy users. - }, { - { name = 'buffer' }, - { name = 'path' }, - }), - formatting = { - format = lspkind.cmp_format({ - --mode = 'symbol', -- show only symbol annotations - maxwidth = 50, -- prevent the popup from showing more than provided characters (e.g 50 will not show more than 50 characters) - ellipsis_char = '...', -- when popup menu exceed maxwidth, the truncated part would show ellipsis_char instead (must define maxwidth first) - }) - } -}) - --- 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 `/` and `?` (if you enabled `native_menu`, this won't work anymore). -cmp.setup.cmdline({ '/', '?' }, { - mapping = cmp.mapping.preset.cmdline(), - sources = { - { name = 'buffer' } - } -}) - --- `:` cmdline setup. -cmp.setup.cmdline(':', { - mapping = cmp.mapping.preset.cmdline(), - sources = cmp.config.sources({ - { name = 'path' } - }, { - { - name = 'cmdline', - option = { - ignore_cmds = { 'Man', '!' } - } - } - }) -}) diff --git a/lua/conf-nvim-tree.lua b/lua/conf-nvim-tree.lua deleted file mode 100644 index 1f69797..0000000 --- a/lua/conf-nvim-tree.lua +++ /dev/null @@ -1,69 +0,0 @@ -require("nvim-tree").setup({ - hijack_cursor = true, - sync_root_with_cwd = true, - view = { - adaptive_size = true, - }, - renderer = { - full_name = true, - group_empty = true, - special_files = {}, - symlink_destination = false, - indent_markers = { - enable = true, - }, - icons = { - git_placement = "signcolumn", - show = { - file = true, - folder = true, - folder_arrow = true, - git = true, - }, - }, - }, - update_focused_file = { - enable = true, - update_root = true, - ignore_list = { "help" }, - }, - diagnostics = { - enable = true, - show_on_dirs = true, - }, - filters = { - custom = {}, - dotfiles = false, - }, - actions = { - change_dir = { - enable = false, - restrict_above_cwd = true, - }, - open_file = { - resize_window = true, - }, - remove_file = { - close_window = false, - }, - }, - log = { - enable = false, - truncate = true, - types = { - all = false, - config = false, - copy_paste = false, - diagnostics = false, - git = false, - profile = false, - watcher = false, - }, - }, - git = { - enable = true, - ignore = false, - show_on_dirs = true, - timeout = 400, - }, -}) diff --git a/lua/conf-treesitter.lua b/lua/conf-treesitter.lua deleted file mode 100644 index ccc933b..0000000 --- a/lua/conf-treesitter.lua +++ /dev/null @@ -1,42 +0,0 @@ -require'nvim-treesitter.configs'.setup { - -- A list of parser names, or "all" - ensure_installed = { "html", "dockerfile", "cpp", "css", "markdown", "c", "gitcommit", "bash", "phpdoc", "comment", "python", "http", "php", "regex", "json5", "lua", "gitattributes", "gitignore", "json", "git_rebase", "javascript", "perl", "sql", "yaml" }, - - -- Install parsers synchronously (only applied to `ensure_installed`) - sync_install = true, - - -- Automatically install missing parsers when entering buffer - -- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally - auto_install = true, - - -- List of parsers to ignore installing (for "all") - --ignore_install = { "javascript" }, - - ---- If you need to change the installation directory of the parsers (see -> Advanced Setup) - -- parser_install_dir = "/some/path/to/store/parsers", -- Remember to run vim.opt.runtimepath:append("/some/path/to/store/parsers")! - - highlight = { - -- `false` will disable the whole extension - enable = true, - - -- NOTE: these are the names of the parsers and not the filetype. (for example if you want to - -- disable highlighting for the `tex` filetype, you need to include `latex` in this list as this is - -- the name of the parser) - -- list of language that will be disabled - --disable = { "c", "rust" }, - -- Or use a function for more flexibility, e.g. to disable slow treesitter highlight for large files - --disable = function(lang, buf) - --local max_filesize = 100 * 1024 -- 100 KB - --local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf)) - --if ok and stats and stats.size > max_filesize then - --return true - --end - --end, - - -- Setting this to true will run `:h syntax` and tree-sitter at the same time. - -- Set this to `true` if you depend on 'syntax' being enabled (like for indentation). - -- Using this option may slow down your editor, and you may see some duplicate highlights. - -- Instead of true it can also be a list of languages - additional_vim_regex_highlighting = true, -- default=false - }, -} diff --git a/lua/general.lua b/lua/general.lua index 0863fdd..2b23e9b 100644 --- a/lua/general.lua +++ b/lua/general.lua @@ -27,3 +27,17 @@ map("i", "", "<", ">>") map("v", "", ">gv") map("v", "", "n", "NvimTreeFocus" }, - { "", "NvimTreeToggle" } - } }, + config = require('plugins.nvim-tree').config, + keys = require('plugins.nvim-tree').keys }, -- neovim lsp plugins and depencencies - { 'neovim/nvim-lspconfig' }, + { 'neovim/nvim-lspconfig', + init = require('plugins.nvim-lspconfig').init }, { 'hrsh7th/cmp-nvim-lsp' }, { 'hrsh7th/cmp-buffer' }, { 'hrsh7th/cmp-cmdline' }, { 'hrsh7th/cmp-path' }, - { 'hrsh7th/nvim-cmp' }, + { 'hrsh7th/nvim-cmp', + init = require('plugins.nvim-cmp').init, + dependencies = { { 'onsails/lspkind.nvim' } } }, { 'williamboman/mason.nvim', config = {} }, { 'williamboman/mason-lspconfig.nvim', config = require('plugins.mason-lspconfig').config, dependencies = { 'williamboman/mason.nvim' } }, - { 'mfussenegger/nvim-lint' }, - { 'onsails/lspkind.nvim' }, + { 'mfussenegger/nvim-lint', + init = require('plugins.nvim-lint').init }, + {}, { 'folke/trouble.nvim', config = require('plugins.trouble').config, keys = require("plugins.trouble").keys }, -- various plugins - { 'lewis6991/gitsigns.nvim' }, + { 'lewis6991/gitsigns.nvim', + config = require('plugins.gitsigns').config }, { 'petertriho/nvim-scrollbar', config = {} }, - { 'kevinhwang91/nvim-hlslens' }, - { 'L3MON4D3/LuaSnip', version = '*' }, + { 'kevinhwang91/nvim-hlslens', config = {}, + keys = require('plugins.hlslens').keys }, + { 'L3MON4D3/LuaSnip', version = '*' }, { 'saadparwaiz1/cmp_luasnip' }, { 'lambdalisue/suda.vim' }, - { 'akinsho/bufferline.nvim', version = '*' }, + { 'akinsho/bufferline.nvim', version = '*', + config = require('plugins.bufferline').config }, { 'gorbit99/codewindow.nvim', config = require('plugins.codewindow').config, init = require('plugins.codewindow').build }, { 'preservim/nerdcommenter', - keys = { - { "", "NERDCommenterToggle", mode = "v" }, - { "", "NERDCommenterToggle", mode = "n" } - } }, + keys = require('plugins.nerdcommenter').keys }, { 'rmagatti/auto-session' }, { 'tpope/vim-fugitive' }, { 'Glench/Vim-Jinja2-Syntax' }, { 'vmware-archive/salt-vim' }, - { 'stephpy/vim-yaml' }, - { 'lukas-reineke/indent-blankline.nvim' }, + { 'stephpy/vim-yaml' }, -- for proper sls syntax highlighting when jinja + { 'lukas-reineke/indent-blankline.nvim', + config = require('plugins.indent-blankline').config }, { 'MunifTanjim/nui.nvim' }, { 'folke/noice.nvim', config = require("plugins.noice").config, @@ -59,8 +62,9 @@ require("lazy").setup({ -- `nvim-notify` is only needed, if you want to use the notification view. -- If not available, we use `mini` as the fallback "rcarriga/nvim-notify", } }, - - { 'nvim-lualine/lualine.nvim' }, + { 'rcarriga/nvim-notify', config = require('plugins.nvim-notify').config }, + { 'nvim-lualine/lualine.nvim', + config = require('plugins.lualine').config }, { 'RRethy/vim-illuminate' }, { 'sheerun/vim-polyglot' }, @@ -90,7 +94,9 @@ require("lazy").setup({ }, { 'BurntSushi/ripgrep' }, - { 'nvim-treesitter/nvim-treesitter', build = ':TSUpdate' }, + { 'nvim-treesitter/nvim-treesitter', + config = require('plugins.treesitter').config, + build = ':TSUpdate' }, }, { diff --git a/lua/my-lint.lua b/lua/my-lint.lua deleted file mode 100644 index 2d67635..0000000 --- a/lua/my-lint.lua +++ /dev/null @@ -1,37 +0,0 @@ -require('lint').linters_by_ft = { - --python = { - --'ruff' - --'flake8', - --'pylint', - --'pycodestyle', - --'pydocstyle' - --}, - php = { 'phpcs' }, - markdown = { 'markdownlint' } -} - ---local pydocstyle = require('lint.linters.pydocstyle') ---pydocstyle.args = { - --'--ignore=D100,D203,D213', -- disable missing module docstring info - ---- disable one line before class docstring required - ---- disable multiline docstring summary - ---- should start at the second line ---} ---local pylint = require('lint.linters.pylint') ---pylint.args = { - --'-f', - --'json', - --'--disable=C0114', -- disable missing module docstring info ---} - ---vim.api.nvim_create_autocmd({ "BufWritePost" }, { - --callback = function() - --require("lint").try_lint() - --end, ---}) - -vim.api.nvim_create_autocmd({ "BufEnter" }, { - callback = function() - require("lint").try_lint() - end, -}) diff --git a/lua/my-lspconfig.lua b/lua/my-lspconfig.lua deleted file mode 100644 index cef3222..0000000 --- a/lua/my-lspconfig.lua +++ /dev/null @@ -1,193 +0,0 @@ --- setup nvim-lspconfig --- Mappings. --- See `:help vim.diagnostic.*` for documentation on any of the below functions -local opts = { noremap = true, silent = true } -vim.keymap.set('n', 'e', vim.diagnostic.open_float, opts) -vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, opts) -vim.keymap.set('n', ']d', vim.diagnostic.goto_next, opts) -vim.keymap.set('n', 'q', vim.diagnostic.setloclist, opts) - --- Use an on_attach function to only map the following keys --- after the language server attaches to the current buffer -local on_attach = function(_, bufnr) - -- Enable completion triggered by - vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc') - - -- Mappings. - -- See `:help vim.lsp.*` for documentation on any of the below functions - local bufopts = { noremap = true, silent = true, buffer = bufnr } - vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, bufopts) - vim.keymap.set('n', 'gd', vim.lsp.buf.definition, bufopts) - vim.keymap.set('n', 'k', vim.lsp.buf.hover, bufopts) - vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, bufopts) - vim.keymap.set('n', '', vim.lsp.buf.signature_help, bufopts) - vim.keymap.set('n', 'wa', vim.lsp.buf.add_workspace_folder, bufopts) - vim.keymap.set('n', 'wr', vim.lsp.buf.remove_workspace_folder, bufopts) - vim.keymap.set('n', 'wl', function() - print(vim.inspect(vim.lsp.buf.list_workspace_folders())) - end, bufopts) - vim.keymap.set('n', 'D', vim.lsp.buf.type_definition, bufopts) - vim.keymap.set('n', 'rn', vim.lsp.buf.rename, bufopts) - vim.keymap.set('n', 'ca', vim.lsp.buf.code_action, bufopts) - vim.keymap.set('n', 'gr', vim.lsp.buf.references, bufopts) - vim.keymap.set('n', 'f', function() vim.lsp.buf.format { async = true } end, bufopts) -end - -local capabilities = require('cmp_nvim_lsp').default_capabilities() - - ------------------ --- attaching all lsp servers, order matters (for example in autocompletion) ------------------ -require 'lspconfig'.pylsp.setup { - on_attach = on_attach, - capabilities = capabilities - , settings = { - pylsp = { - plugins = { - rope_autoimport = { enabled = false, memory = true }, - rope_completion = { enabled = false, eager = true }, - jedi_completion = { - enabled = true, - include_params = true, - include_class_objects = true, - include_function_objects = true, - fuzzy = true, - eager = true, - - }, - jedi_hover = { enabled = true }, - jedi_references = { enabled = true }, - jedi_signature_help = { enabled = true }, - jedi_symbols = { enabled = true }, - --ruff = { enabled = true }, - flake8 = { - enabled = false -- ruff_lsp - }, - pylint = { - enabled = true, - args = { - -- disable missing module docstring info - -- and temporarilt false cannot import errors - '--disable=C0114,E0401' - } - }, - yapf = { - enabled = true - }, - autopep8 = { - enabled = false - }, - pyflakes = { enabled = false }, -- ruff_lsp - pyodestyle = { enabled = false }, -- ruff_lsp - pydocstyle = { - enabled = true, - ignore = { - 'D100', -- disable missing module docstring info - 'D203', -- disable one line before class docstring required - 'D213' -- disable multiline docstring summary - -- should start at the second line - } - }, - } - } - } -} -require'lspconfig'.ruff_lsp.setup{ -on_attach = on_attach, -capabilities = capabilities, -} -require 'lspconfig'.pyright.setup { -on_attach = on_attach, -capabilities = capabilities, -} -require 'lspconfig'.sourcekit.setup { - on_attach = on_attach, - capabilities = capabilities, -} -require 'lspconfig'.bashls.setup { - on_attach = on_attach, - capabilities = capabilities, -} -require 'lspconfig'.dockerls.setup { - on_attach = on_attach, - capabilities = capabilities, -} -require 'lspconfig'.intelephense.setup { - on_attach = on_attach, - capabilities = capabilities, -} -require 'lspconfig'.eslint.setup { - on_attach = on_attach, - capabilities = capabilities, -} -require 'lspconfig'.tsserver.setup { - on_attach = on_attach, - capabilities = capabilities, -} -require 'lspconfig'.perlnavigator.setup { - settings = { - perlnavigator = { - perlPath = 'perl', - enableWarnings = true, - perltidyProfile = '', - perlcriticProfile = '', - perlcriticEnabled = true, - } - }, - on_attach = on_attach, - capabilities = capabilities, -} - -require 'lspconfig'.cssls.setup { - on_attach = on_attach, - capabilities = capabilities, -} - -require 'lspconfig'.cssmodules_ls.setup { - on_attach = on_attach, - capabilities = capabilities, -} - -require 'lspconfig'.diagnosticls.setup { - on_attach = on_attach, - capabilities = capabilities, -} - -require 'lspconfig'.jsonls.setup { - on_attach = on_attach, - capabilities = capabilities, -} - -require 'lspconfig'.sumneko_lua.setup { - on_attach = on_attach, - capabilities = capabilities, - settings = { - Lua = { - diagnostics = { - -- Get the language server to recognize the `vim` global - globals = { 'vim' }, - }, - }, - }, -} - -require 'lspconfig'.sqlls.setup { - on_attach = on_attach, - capabilities = capabilities, -} - -require 'lspconfig'.yamlls.setup { - on_attach = on_attach, - capabilities = capabilities, -} - -require 'lspconfig'.lemminx.setup { - on_attach = on_attach, - capabilities = capabilities, -} - -require 'lspconfig'.marksman.setup { - on_attach = on_attach, - capabilities = capabilities, -} diff --git a/lua/plugins/bufferline.lua b/lua/plugins/bufferline.lua new file mode 100644 index 0000000..5044a76 --- /dev/null +++ b/lua/plugins/bufferline.lua @@ -0,0 +1,47 @@ +return { + config = { + options = { + mode = "buffers", -- set to "tabs" to only show tabpages instead + numbers = "buffer_id", + close_command = "bdelete! %d", -- can be a string | function, see "Mouse actions" + right_mouse_command = "bdelete! %d", -- can be a string | function, see "Mouse actions" + left_mouse_command = "buffer %d", -- can be a string | function, see "Mouse actions" + middle_mouse_command = nil, -- can be a string | function, see "Mouse actions" + indicator = { + icon = '>', -- this should be omitted if indicator style is not 'icon' + style = 'icon', + }, + buffer_close_icon = '', + modified_icon = '●', + close_icon = '', + left_trunc_marker = '', + right_trunc_marker = '', + max_name_length = 18, + max_prefix_length = 15, -- prefix used when a buffer is de-duplicated + truncate_names = true, -- whether or not tab names should be truncated + tab_size = 18, + diagnostics = "coc", + diagnostics_update_in_insert = false, + -- The diagnostics indicator can be set to nil to keep the buffer name highlight but delete the highlighting + color_icons = true, -- whether or not to add the filetype icon highlights + show_buffer_icons = true, -- disable filetype icons for buffers + show_buffer_close_icons = true, + show_buffer_default_icon = true, -- whether or not an unrecognised filetype should show a default icon + show_close_icon = false, + show_tab_indicators = true, + show_duplicate_prefix = true, -- whether to show duplicate buffer prefix + persist_buffer_sort = true, -- whether or not custom sorted buffers should persist + -- can also be a table containing 2 custom separators + -- [focused and unfocused]. eg: { '|', '|' } + separator_style = "thick", + enforce_regular_tabs = false, + always_show_bufferline = true, + hover = { + enabled = true, + delay = 200, + reveal = { 'close' } + }, + sort_by = 'tabs', + } + } +} diff --git a/lua/plugins/gitsigns.lua b/lua/plugins/gitsigns.lua new file mode 100644 index 0000000..4e07f3d --- /dev/null +++ b/lua/plugins/gitsigns.lua @@ -0,0 +1,82 @@ +return { + config = { + signs = { + add = { hl = 'GitSignsAdd', text = '│', numhl = 'GitSignsAddNr', linehl = 'GitSignsAddLn' }, + change = { hl = 'GitSignsChange', text = '│', numhl = 'GitSignsChangeNr', linehl = 'GitSignsChangeLn' }, + delete = { hl = 'GitSignsDelete', text = '_', numhl = 'GitSignsDeleteNr', linehl = 'GitSignsDeleteLn' }, + topdelete = { hl = 'GitSignsDelete', text = '‾', numhl = 'GitSignsDeleteNr', linehl = 'GitSignsDeleteLn' }, + changedelete = { hl = 'GitSignsChange', text = '~', numhl = 'GitSignsChangeNr', linehl = 'GitSignsChangeLn' }, + untracked = { hl = 'GitSignsAdd', text = '┆', numhl = 'GitSignsAddNr', linehl = 'GitSignsAddLn' }, + }, + signcolumn = true, -- Toggle with `:Gitsigns toggle_signs` + numhl = false, -- Toggle with `:Gitsigns toggle_numhl` + linehl = false, -- Toggle with `:Gitsigns toggle_linehl` + word_diff = false, -- Toggle with `:Gitsigns toggle_word_diff` + watch_gitdir = { + interval = 1000, + follow_files = true + }, + attach_to_untracked = true, + current_line_blame = true, -- Toggle with `:Gitsigns toggle_current_line_blame` + current_line_blame_opts = { + virt_text = true, + virt_text_pos = 'eol', -- 'eol' | 'overlay' | 'right_align' + delay = 1000, + ignore_whitespace = false, + }, + current_line_blame_formatter = ', - ', + sign_priority = 6, + update_debounce = 100, + status_formatter = nil, -- Use default + max_file_length = 40000, -- Disable if file is longer than this (in lines) + preview_config = { + -- Options passed to nvim_open_win + border = 'single', + style = 'minimal', + relative = 'cursor', + row = 0, + col = 1 + }, + yadm = { + enable = false + }, + on_attach = function(bufnr) + local gs = package.loaded.gitsigns + + local function map(mode, l, r, opts) + opts = opts or {} + opts.buffer = bufnr + vim.keymap.set(mode, l, r, opts) + end + + -- Navigation + map('n', ']c', function() + if vim.wo.diff then return ']c' end + vim.schedule(function() gs.next_hunk() end) + return '' + end, { expr = true }) + + map('n', '[c', function() + if vim.wo.diff then return '[c' end + vim.schedule(function() gs.prev_hunk() end) + return '' + end, { expr = true }) + + -- Actions + map({ 'n', 'v' }, 'hs', ':Gitsigns stage_hunk') + map({ 'n', 'v' }, 'hr', ':Gitsigns reset_hunk') + map('n', 'hS', gs.stage_buffer) + map('n', 'hu', gs.undo_stage_hunk) + map('n', 'hR', gs.reset_buffer) + map('n', '', gs.preview_hunk) + map('n', 'hb', function() gs.blame_line { full = true } end) + map('n', 'tb', gs.toggle_current_line_blame) + map('n', 'hd', gs.diffthis) + map('n', 'hD', function() gs.diffthis('~') end) + map('n', 'td', gs.toggle_deleted) + + -- Text object + map({ 'o', 'x' }, 'ih', ':Gitsigns select_hunk') + end + } +} diff --git a/lua/plugins/hlslens.lua b/lua/plugins/hlslens.lua new file mode 100644 index 0000000..9fdf598 --- /dev/null +++ b/lua/plugins/hlslens.lua @@ -0,0 +1,4 @@ +return { + keys = { + { 'l', 'nohl' } } +} diff --git a/lua/plugins/indent-blankline.lua b/lua/plugins/indent-blankline.lua new file mode 100644 index 0000000..1440ae6 --- /dev/null +++ b/lua/plugins/indent-blankline.lua @@ -0,0 +1,7 @@ +return { + config = { + space_char_blankline = " ", + show_current_context = true, + show_current_context_start = true, + } +} diff --git a/lua/plugins/lualine.lua b/lua/plugins/lualine.lua new file mode 100644 index 0000000..b799590 --- /dev/null +++ b/lua/plugins/lualine.lua @@ -0,0 +1,49 @@ +return { + config = { + options = { + icons_enabled = true, + theme = 'dracula', + component_separators = { left = '', right = '' }, + section_separators = { left = '', right = '' }, + disabled_filetypes = { + statusline = {}, + winbar = {}, + }, + ignore_focus = {}, + always_divide_middle = true, + globalstatus = false, + refresh = { + statusline = 1000, + tabline = 1000, + winbar = 1000, + } + }, + sections = { + lualine_a = { 'mode' }, + lualine_b = { 'branch', 'diff', 'diagnostics' }, + lualine_c = { 'filename' }, + lualine_x = { 'encoding', 'fileformat', 'filetype' }, + lualine_y = { 'progress' }, + lualine_z = { 'tabs' } + }, + inactive_sections = { + lualine_a = {}, + lualine_b = {}, + lualine_c = { 'filename' }, + lualine_x = { 'location' }, + lualine_y = {}, + lualine_z = {} + }, + tabline = {}, + winbar = {}, + inactive_winbar = {}, + extensions = { + 'quickfix', + 'nvim-tree', + 'symbols-outline', + 'fugitive', + 'man' + } + + } +} diff --git a/lua/plugins/mason-lspconfig.lua b/lua/plugins/mason-lspconfig.lua index 7ecce09..0e90bdf 100644 --- a/lua/plugins/mason-lspconfig.lua +++ b/lua/plugins/mason-lspconfig.lua @@ -15,7 +15,7 @@ return { "cssmodules_ls", "diagnosticls", "jsonls", - "sumneko_lua", + "lua_ls", "sqlls", "yamlls", "lemminx", diff --git a/lua/plugins/nerdcommenter.lua b/lua/plugins/nerdcommenter.lua new file mode 100644 index 0000000..dd09158 --- /dev/null +++ b/lua/plugins/nerdcommenter.lua @@ -0,0 +1,6 @@ +return { + keys = { + { "", "NERDCommenterToggle", mode = "v" }, + { "", "NERDCommenterToggle", mode = "n" } + } +} diff --git a/lua/plugins/nvim-cmp.lua b/lua/plugins/nvim-cmp.lua new file mode 100644 index 0000000..bb99c83 --- /dev/null +++ b/lua/plugins/nvim-cmp.lua @@ -0,0 +1,75 @@ +return { + init = function() + local cmp = require 'cmp' + local lspkind = require('lspkind') + + cmp.setup({ + snippet = { + -- REQUIRED - you must specify a snippet engine + expand = function(args) + require('luasnip').lsp_expand(args.body) -- For `luasnip` users. + end, + }, + window = { + completion = cmp.config.window.bordered(), + documentation = cmp.config.window.bordered(), + }, + mapping = cmp.mapping.preset.insert({ + [''] = cmp.mapping.scroll_docs( -4), + [''] = cmp.mapping.scroll_docs(4), + [''] = cmp.mapping.complete(), + [''] = cmp.mapping.abort(), + [''] = cmp.mapping.confirm({ select = false }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. + }), + sources = cmp.config.sources({ + { name = 'nvim_lsp' }, + --{ name = 'vsnip' }, -- For vsnip users. + { name = 'luasnip' }, -- For luasnip users. + -- { name = 'ultisnips' }, -- For ultisnips users. + -- { name = 'snippy' }, -- For snippy users. + }, { + { name = 'buffer' }, + { name = 'path' }, + }), + formatting = { + format = lspkind.cmp_format({ + --mode = 'symbol', -- show only symbol annotations + maxwidth = 50, -- prevent the popup from showing more than provided characters (e.g 50 will not show more than 50 characters) + ellipsis_char = '...', -- when popup menu exceed maxwidth, the truncated part would show ellipsis_char instead (must define maxwidth first) + }) + } + }) + + -- 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 `/` and `?` (if you enabled `native_menu`, this won't work anymore). + cmp.setup.cmdline({ '/', '?' }, { + mapping = cmp.mapping.preset.cmdline(), + sources = { + { name = 'buffer' } + } + }) + + -- `:` cmdline setup. + cmp.setup.cmdline(':', { + mapping = cmp.mapping.preset.cmdline(), + sources = cmp.config.sources({ + { name = 'path' } + }, { + { + name = 'cmdline', + option = { + ignore_cmds = { 'Man', '!' } + } + } + }) + }) + end +} diff --git a/lua/plugins/nvim-lint.lua b/lua/plugins/nvim-lint.lua new file mode 100644 index 0000000..3449a46 --- /dev/null +++ b/lua/plugins/nvim-lint.lua @@ -0,0 +1,41 @@ +return { + init = function() + require('lint').linters_by_ft = { + --python = { + --'ruff' + --'flake8', + --'pylint', + --'pycodestyle', + --'pydocstyle' + --}, + php = { 'phpcs' }, + markdown = { 'markdownlint' } + } + + --local pydocstyle = require('lint.linters.pydocstyle') + --pydocstyle.args = { + --'--ignore=D100,D203,D213', -- disable missing module docstring info + ---- disable one line before class docstring required + ---- disable multiline docstring summary + ---- should start at the second line + --} + --local pylint = require('lint.linters.pylint') + --pylint.args = { + --'-f', + --'json', + --'--disable=C0114', -- disable missing module docstring info + --} + + --vim.api.nvim_create_autocmd({ "BufWritePost" }, { + --callback = function() + --require("lint").try_lint() + --end, + --}) + + vim.api.nvim_create_autocmd({ "BufEnter" }, { + callback = function() + require("lint").try_lint() + end, + }) + end +} diff --git a/lua/plugins/nvim-lspconfig.lua b/lua/plugins/nvim-lspconfig.lua new file mode 100644 index 0000000..a1adc79 --- /dev/null +++ b/lua/plugins/nvim-lspconfig.lua @@ -0,0 +1,197 @@ +return { + init = function() + -- setup nvim-lspconfig + -- Mappings. + -- See `:help vim.diagnostic.*` for documentation on any of the below functions + local opts = { noremap = true, silent = true } + vim.keymap.set('n', 'e', vim.diagnostic.open_float, opts) + vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, opts) + vim.keymap.set('n', ']d', vim.diagnostic.goto_next, opts) + vim.keymap.set('n', 'q', vim.diagnostic.setloclist, opts) + + -- Use an on_attach function to only map the following keys + -- after the language server attaches to the current buffer + local on_attach = function(_, bufnr) + -- Enable completion triggered by + vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc') + + -- Mappings. + -- See `:help vim.lsp.*` for documentation on any of the below functions + local bufopts = { noremap = true, silent = true, buffer = bufnr } + vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, bufopts) + vim.keymap.set('n', 'gd', vim.lsp.buf.definition, bufopts) + vim.keymap.set('n', 'k', vim.lsp.buf.hover, bufopts) + vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, bufopts) + vim.keymap.set('n', '', vim.lsp.buf.signature_help, bufopts) + vim.keymap.set('n', 'wa', vim.lsp.buf.add_workspace_folder, bufopts) + vim.keymap.set('n', 'wr', vim.lsp.buf.remove_workspace_folder, bufopts) + vim.keymap.set('n', 'wl', function() + print(vim.inspect(vim.lsp.buf.list_workspace_folders())) + end, bufopts) + vim.keymap.set('n', 'D', vim.lsp.buf.type_definition, bufopts) + vim.keymap.set('n', 'rn', vim.lsp.buf.rename, bufopts) + vim.keymap.set('n', 'ca', vim.lsp.buf.code_action, bufopts) + vim.keymap.set('n', 'gr', vim.lsp.buf.references, bufopts) + vim.keymap.set('n', 'f', function() vim.lsp.buf.format { async = true } end, bufopts) + end + + local capabilities = require('cmp_nvim_lsp').default_capabilities() + + + ----------------- + -- attaching all lsp servers, order matters (for example in autocompletion) + ----------------- + require 'lspconfig'.pylsp.setup { + on_attach = on_attach, + capabilities = capabilities + , settings = { + pylsp = { + plugins = { + rope_autoimport = { enabled = false, memory = true }, + rope_completion = { enabled = false, eager = true }, + jedi_completion = { + enabled = true, + include_params = true, + include_class_objects = true, + include_function_objects = true, + fuzzy = true, + eager = true, + + }, + jedi_hover = { enabled = true }, + jedi_references = { enabled = true }, + jedi_signature_help = { enabled = true }, + jedi_symbols = { enabled = true }, + --ruff = { enabled = true }, + flake8 = { + enabled = false -- ruff_lsp + }, + pylint = { + enabled = true, + args = { + -- disable missing module docstring info + -- and temporarilt false cannot import errors + '--disable=C0114,E0401' + } + }, + yapf = { + enabled = true + }, + autopep8 = { + enabled = false + }, + pyflakes = { enabled = false }, -- ruff_lsp + pyodestyle = { enabled = false }, -- ruff_lsp + pydocstyle = { + enabled = true, + ignore = { + 'D100', -- disable missing module docstring info + 'D203', -- disable one line before class docstring required + 'D213' -- disable multiline docstring summary + -- should start at the second line + } + }, + } + } + } + } + require 'lspconfig'.ruff_lsp.setup { + on_attach = on_attach, + capabilities = capabilities, + } + require 'lspconfig'.pyright.setup { + on_attach = on_attach, + capabilities = capabilities, + } + require 'lspconfig'.sourcekit.setup { + on_attach = on_attach, + capabilities = capabilities, + } + require 'lspconfig'.bashls.setup { + on_attach = on_attach, + capabilities = capabilities, + } + require 'lspconfig'.dockerls.setup { + on_attach = on_attach, + capabilities = capabilities, + } + require 'lspconfig'.intelephense.setup { + on_attach = on_attach, + capabilities = capabilities, + } + require 'lspconfig'.eslint.setup { + on_attach = on_attach, + capabilities = capabilities, + } + require 'lspconfig'.tsserver.setup { + on_attach = on_attach, + capabilities = capabilities, + } + require 'lspconfig'.perlnavigator.setup { + settings = { + perlnavigator = { + perlPath = 'perl', + enableWarnings = true, + perltidyProfile = '', + perlcriticProfile = '', + perlcriticEnabled = true, + } + }, + on_attach = on_attach, + capabilities = capabilities, + } + + require 'lspconfig'.cssls.setup { + on_attach = on_attach, + capabilities = capabilities, + } + + require 'lspconfig'.cssmodules_ls.setup { + on_attach = on_attach, + capabilities = capabilities, + } + + require 'lspconfig'.diagnosticls.setup { + on_attach = on_attach, + capabilities = capabilities, + } + + require 'lspconfig'.jsonls.setup { + on_attach = on_attach, + capabilities = capabilities, + } + + require 'lspconfig'.lua_ls.setup { + on_attach = on_attach, + capabilities = capabilities, + settings = { + Lua = { + diagnostics = { + -- Get the language server to recognize the `vim` global + globals = { 'vim' }, + }, + }, + }, + } + + require 'lspconfig'.sqlls.setup { + on_attach = on_attach, + capabilities = capabilities, + } + + require 'lspconfig'.yamlls.setup { + on_attach = on_attach, + capabilities = capabilities, + } + + require 'lspconfig'.lemminx.setup { + on_attach = on_attach, + capabilities = capabilities, + } + + require 'lspconfig'.marksman.setup { + on_attach = on_attach, + capabilities = capabilities, + } + end +} diff --git a/lua/plugins/nvim-notify.lua b/lua/plugins/nvim-notify.lua new file mode 100644 index 0000000..92b332d --- /dev/null +++ b/lua/plugins/nvim-notify.lua @@ -0,0 +1,5 @@ +return { + config = { + timeout = 2500 + } +} diff --git a/lua/plugins/nvim-tree.lua b/lua/plugins/nvim-tree.lua new file mode 100644 index 0000000..ff414a3 --- /dev/null +++ b/lua/plugins/nvim-tree.lua @@ -0,0 +1,75 @@ +return { + config = { + hijack_cursor = true, + sync_root_with_cwd = true, + view = { + adaptive_size = true, + }, + renderer = { + full_name = true, + group_empty = true, + special_files = {}, + symlink_destination = false, + indent_markers = { + enable = true, + }, + icons = { + git_placement = "signcolumn", + show = { + file = true, + folder = true, + folder_arrow = true, + git = true, + }, + }, + }, + update_focused_file = { + enable = true, + update_root = true, + ignore_list = { "help" }, + }, + diagnostics = { + enable = true, + show_on_dirs = true, + }, + filters = { + custom = {}, + dotfiles = false, + }, + actions = { + change_dir = { + enable = false, + restrict_above_cwd = true, + }, + open_file = { + resize_window = true, + }, + remove_file = { + close_window = false, + }, + }, + log = { + enable = false, + truncate = true, + types = { + all = false, + config = false, + copy_paste = false, + diagnostics = false, + git = false, + profile = false, + watcher = false, + }, + }, + git = { + enable = true, + ignore = false, + show_on_dirs = true, + timeout = 400, + }, + }, + keys = { + { "n", "NvimTreeFocus" }, + { "", "NvimTreeToggle" } + } +} diff --git a/lua/plugins/treesitter.lua b/lua/plugins/treesitter.lua new file mode 100644 index 0000000..49ec4bd --- /dev/null +++ b/lua/plugins/treesitter.lua @@ -0,0 +1,44 @@ +return { + config = { + -- A list of parser names, or "all" + ensure_installed = { "html", "dockerfile", "cpp", "css", "markdown", "c", "gitcommit", "bash", "phpdoc", "comment", "python", "http", "php", "regex", "json5", "lua", "gitattributes", "gitignore", "json", "git_rebase", "javascript", "perl", "sql", "yaml" }, + + -- Install parsers synchronously (only applied to `ensure_installed`) + sync_install = false, + + -- Automatically install missing parsers when entering buffer + -- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally + auto_install = true, + + -- List of parsers to ignore installing (for "all") + --ignore_install = { "javascript" }, + + ---- If you need to change the installation directory of the parsers (see -> Advanced Setup) + -- parser_install_dir = "/some/path/to/store/parsers", -- Remember to run vim.opt.runtimepath:append("/some/path/to/store/parsers")! + + highlight = { + -- `false` will disable the whole extension + enable = true, + + -- NOTE: these are the names of the parsers and not the filetype. (for example if you want to + -- disable highlighting for the `tex` filetype, you need to include `latex` in this list as this is + -- the name of the parser) + -- list of language that will be disabled + --disable = { "c", "rust" }, + -- Or use a function for more flexibility, e.g. to disable slow treesitter highlight for large files + --disable = function(lang, buf) + --local max_filesize = 100 * 1024 -- 100 KB + --local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf)) + --if ok and stats and stats.size > max_filesize then + --return true + --end + --end, + + -- Setting this to true will run `:h syntax` and tree-sitter at the same time. + -- Set this to `true` if you depend on 'syntax' being enabled (like for indentation). + -- Using this option may slow down your editor, and you may see some duplicate highlights. + -- Instead of true it can also be a list of languages + additional_vim_regex_highlighting = true, -- default=false + }, + } +}