diff --git a/.config/nvim/after/ftplugin/cmake.lua b/.config/nvim/after/ftplugin/cmake.lua new file mode 100644 index 0000000..cce7648 --- /dev/null +++ b/.config/nvim/after/ftplugin/cmake.lua @@ -0,0 +1,4 @@ +vim.opt.tabstop = 2 +vim.opt.softtabstop = 2 +vim.opt.shiftwidth = 2 +vim.opt.expandtab = true diff --git a/.config/nvim/after/ftplugin/cpp.lua b/.config/nvim/after/ftplugin/cpp.lua new file mode 100644 index 0000000..adec580 --- /dev/null +++ b/.config/nvim/after/ftplugin/cpp.lua @@ -0,0 +1 @@ +vim.opt_local.shiftwidth = 2 diff --git a/.config/nvim/after/ftplugin/rst.lua b/.config/nvim/after/ftplugin/rst.lua new file mode 100644 index 0000000..d2911eb --- /dev/null +++ b/.config/nvim/after/ftplugin/rst.lua @@ -0,0 +1,6 @@ +vim.opt.wrap = true -- softwrap the text +vim.opt.linebreak = true -- do not break in the middle of words +vim.opt.tabstop = 3 +vim.opt.softtabstop = 3 +vim.opt.shiftwidth = 3 +vim.opt.expandtab = true diff --git a/.config/nvim/after/plugin/color.lua b/.config/nvim/after/plugin/color.lua deleted file mode 100644 index 6c3e1c5..0000000 --- a/.config/nvim/after/plugin/color.lua +++ /dev/null @@ -1,6 +0,0 @@ -function ColorMyPencils(color) - color = color or "rose-pine" - vim.cmd.colorscheme(color) -end - -ColorMyPencils() diff --git a/.config/nvim/after/plugin/lualsp.lua b/.config/nvim/after/plugin/lualsp.lua new file mode 100644 index 0000000..41d28aa --- /dev/null +++ b/.config/nvim/after/plugin/lualsp.lua @@ -0,0 +1,14 @@ +local lspconfig = require('lspconfig') + +lspconfig.lua_ls.setup({ + settings = { + Lua = { + diagnostics = { + globals = { + 'vim', + 'require', + }, + }, + }, + }, +}) diff --git a/.config/nvim/after/plugin/neotree.lua b/.config/nvim/after/plugin/neotree.lua new file mode 100644 index 0000000..28c5488 --- /dev/null +++ b/.config/nvim/after/plugin/neotree.lua @@ -0,0 +1,2 @@ +vim.keymap.set('n', 'nf', 'Neotree') +vim.keymap.set('n', 'nb', 'Neotree source=buffers') diff --git a/.config/nvim/after/plugin/treesitter.lua b/.config/nvim/after/plugin/treesitter.lua index 5a8068b..efbc8a8 100644 --- a/.config/nvim/after/plugin/treesitter.lua +++ b/.config/nvim/after/plugin/treesitter.lua @@ -1,35 +1,35 @@ require('nvim-treesitter.configs').setup { - -- A list of parser names, or "all" (the five listed parsers should always be installed) - ensure_installed = { "c", "lua", "vim", "vimdoc", "query", "cpp", "python", "yaml" }, + -- A list of parser names, or "all" (the five listed parsers should always be installed) + ensure_installed = { "c", "lua", "vim", "vimdoc", "query", "cpp", "python", "yaml" }, - -- Install parsers synchronously (only applied to `ensure_installed`) - sync_install = false, + -- 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, + -- 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" }, + -- 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")! + ---- 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 = { - enable = true, - -- 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, + highlight = { + enable = true, + -- 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 = false, - }, + -- 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 = false, + }, } diff --git a/.config/nvim/lua/lennartalff/init.lua b/.config/nvim/lua/lennartalff/init.lua index 5d8957e..10f1499 100644 --- a/.config/nvim/lua/lennartalff/init.lua +++ b/.config/nvim/lua/lennartalff/init.lua @@ -1,5 +1,4 @@ require('lennartalff.remap') require('lennartalff.set') --- vim.cmd('colorscheme rose-pine') vim.o.termguicolors = true vim.cmd.colorscheme 'catppuccin-frappe' diff --git a/.config/nvim/lua/lennartalff/packer.lua b/.config/nvim/lua/lennartalff/packer.lua deleted file mode 100644 index 70b9c01..0000000 --- a/.config/nvim/lua/lennartalff/packer.lua +++ /dev/null @@ -1,65 +0,0 @@ --- packer bootstrapping -local ensure_packer = function() - local fn = vim.fn - local install_path = fn.stdpath('data') .. '/site/pack/packer/start/packer.nvim' - if fn.empty(fn.glob(install_path)) > 0 then - fn.system({ 'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path }) - vim.cmd [[packadd packer.nvim]] - return true - end - return false -end - -local packer_bootstrap = ensure_packer() - -return require('packer').startup(function(use) - -- Packer can manage itself - use 'wbthomason/packer.nvim' - use 'lewis6991/gitsigns.nvim' - use { - 'nvim-telescope/telescope.nvim', tag = '0.1.1', - -- or , branch = '0.1.x', - requires = { { 'nvim-lua/plenary.nvim' } } - } - use({ 'rose-pine/neovim', as = 'rose-pine' }) - - use { - 'nvim-treesitter/nvim-treesitter', - run = function() - local ts_update = require('nvim-treesitter.install').update({ with_sync = true }) - ts_update() - end, - } - use 'tpope/vim-fugitive' - use { - 'VonHeikemen/lsp-zero.nvim', - branch = 'v2.x', - requires = { - -- LSP Support - { 'neovim/nvim-lspconfig' }, -- Required - { -- Optional - 'williamboman/mason.nvim', - run = function() - pcall(vim.cmd, 'MasonUpdate') - end, - }, - { 'williamboman/mason-lspconfig.nvim' }, -- Optional - - -- Autocompletion - { 'hrsh7th/nvim-cmp' }, -- Required - { 'hrsh7th/cmp-nvim-lsp' }, -- Required - { 'L3MON4D3/LuaSnip' }, -- Required - { 'mhartington/formatter.nvim' }, - } - } - use { - "ThePrimeagen/refactoring.nvim", - requires = { - { "nvim-lua/plenary.nvim" }, - { "nvim-treesitter/nvim-treesitter" } - } - } - if packer_bootstrap then - require('packer').sync() - end -end) diff --git a/.config/nvim/lua/lennartalff/set.lua b/.config/nvim/lua/lennartalff/set.lua index 78e9bb4..eeb1cb0 100644 --- a/.config/nvim/lua/lennartalff/set.lua +++ b/.config/nvim/lua/lennartalff/set.lua @@ -19,14 +19,6 @@ vim.opt.smartindent = true vim.opt.wrap = false -vim.api.nvim_create_autocmd("FileType", { - pattern = "cpp", - callback = function() - vim.opt_local.shiftwidth = 2 - vim.opt_local.tabstop = 2 - end -}) - vim.api.nvim_create_autocmd('FileType', { pattern = 'Makefile', callback = function () @@ -38,16 +30,3 @@ vim.opt.scrolloff = 8 vim.opt.signcolumn = 'yes' vim.opt.updatetime = 500 vim.opt.colorcolumn = '80' - -vim.api.nvim_create_autocmd('FileType', { - pattern = 'rst', - callback = function() - vim.opt.wrap = true -- softwrap the text - vim.opt.linebreak = true -- do not break in the middle of words - -- rst uses 3 space indents - vim.opt.tabstop = 3 - vim.opt.softtabstop = 3 - vim.opt.shiftwidth = 3 - vim.opt.expandtab = true - end -}) diff --git a/.config/nvim/lua/plugins/init.lua b/.config/nvim/lua/plugins/init.lua index c3df057..6d1910e 100644 --- a/.config/nvim/lua/plugins/init.lua +++ b/.config/nvim/lua/plugins/init.lua @@ -2,7 +2,7 @@ return { { 'nvim-treesitter/nvim-treesitter', build = ':TSUpdate' }, { 'L3MON4D3/LuaSnip', - tag = 'v2.*', + version = "v2.*", build = 'make install_jsregexp', }, 'lewis6991/gitsigns.nvim', @@ -11,9 +11,15 @@ return { dependencies = { { 'nvim-lua/plenary.nvim' } } }, - { 'rose-pine/neovim', name = 'rose-pine' }, - { 'catppuccin/nvim', name = 'catppuccin', priority = 1000 }, - { 'tpope/vim-fugitive', name = 'fugitive' }, + { + 'catppuccin/nvim', + name = 'catppuccin', + priority = 1000 + }, + { + 'tpope/vim-fugitive', + name = 'fugitive' + }, { 'ThePrimeagen/harpoon', dependencies = { @@ -37,4 +43,7 @@ return { main = 'ibl', opts = {}, }, + { + 'jiangmiao/auto-pairs', + }, } diff --git a/.config/nvim/lua/plugins/lsp/init.lua b/.config/nvim/lua/plugins/lsp/init.lua index 721a826..dc55c72 100644 --- a/.config/nvim/lua/plugins/lsp/init.lua +++ b/.config/nvim/lua/plugins/lsp/init.lua @@ -7,6 +7,13 @@ -- require('cmp_nvim_lsp').default_capabilities() --) +vim.api.nvim_create_autocmd('FileType', { + pattern = 'tex', + callback = function() + require('cmp').setup.buffer { sources = {{ name = 'omni' }} } + end, +}) + vim.api.nvim_create_autocmd('LspAttach', { desc = 'LSP actions', callback = function(event) diff --git a/.config/nvim/lua/plugins/neotree.lua b/.config/nvim/lua/plugins/neotree.lua new file mode 100644 index 0000000..46adb5c --- /dev/null +++ b/.config/nvim/lua/plugins/neotree.lua @@ -0,0 +1,18 @@ +return { + { + 'nvim-neo-tree/neo-tree.nvim', + branch = 'v3.x', + dependencies = { + 'nvim-lua/plenary.nvim', + 'nvim-tree/nvim-web-devicons', + 'MunifTanjim/nui.nvim', + }, + opts = { + filesystem = { + follow_current_file = { + enabled = true, + }, + } + }, + }, +}