From 42af051a2339acdc893d11014b0543aabf4c08da Mon Sep 17 00:00:00 2001 From: Adam Stück Date: Wed, 28 Aug 2024 08:58:46 +0200 Subject: nvim: add nvim-conf git submodule --- .config/nvim | 1 + .config/nvim/init.lua | 5 - .config/nvim/lua/mappings.lua | 61 --------- .config/nvim/lua/options.lua | 75 ----------- .config/nvim/lua/plugins.lua | 187 ---------------------------- .config/nvim/lua/post.lua | 2 - .config/nvim/lua/pre.lua | 1 - .config/nvim/lua/setup/bufferline.lua | 14 --- .config/nvim/lua/setup/fugitive.lua | 6 - .config/nvim/lua/setup/gitsigns.lua | 8 -- .config/nvim/lua/setup/indent-blankline.lua | 19 --- .config/nvim/lua/setup/kommentary.lua | 3 - .config/nvim/lua/setup/lsp_signature.lua | 3 - .config/nvim/lua/setup/lspconfig.lua | 28 ----- .config/nvim/lua/setup/lualine.lua | 44 ------- .config/nvim/lua/setup/nvim-cmp.lua | 52 -------- .config/nvim/lua/setup/nvim-tree.lua | 26 ---- .config/nvim/lua/setup/nvim-treesitter.lua | 5 - .config/nvim/lua/setup/onedark.lua | 2 - .config/nvim/lua/setup/telescope.lua | 32 ----- 20 files changed, 1 insertion(+), 573 deletions(-) create mode 160000 .config/nvim delete mode 100644 .config/nvim/init.lua delete mode 100644 .config/nvim/lua/mappings.lua delete mode 100644 .config/nvim/lua/options.lua delete mode 100644 .config/nvim/lua/plugins.lua delete mode 100644 .config/nvim/lua/post.lua delete mode 100644 .config/nvim/lua/pre.lua delete mode 100644 .config/nvim/lua/setup/bufferline.lua delete mode 100644 .config/nvim/lua/setup/fugitive.lua delete mode 100644 .config/nvim/lua/setup/gitsigns.lua delete mode 100644 .config/nvim/lua/setup/indent-blankline.lua delete mode 100644 .config/nvim/lua/setup/kommentary.lua delete mode 100644 .config/nvim/lua/setup/lsp_signature.lua delete mode 100644 .config/nvim/lua/setup/lspconfig.lua delete mode 100644 .config/nvim/lua/setup/lualine.lua delete mode 100644 .config/nvim/lua/setup/nvim-cmp.lua delete mode 100644 .config/nvim/lua/setup/nvim-tree.lua delete mode 100644 .config/nvim/lua/setup/nvim-treesitter.lua delete mode 100644 .config/nvim/lua/setup/onedark.lua delete mode 100644 .config/nvim/lua/setup/telescope.lua (limited to '.config/nvim') diff --git a/.config/nvim b/.config/nvim new file mode 160000 index 0000000..0d3f613 --- /dev/null +++ b/.config/nvim @@ -0,0 +1 @@ +Subproject commit 0d3f6134b5d35ac39deb631a8a3433b89998c14d diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua deleted file mode 100644 index 9d125a7..0000000 --- a/.config/nvim/init.lua +++ /dev/null @@ -1,5 +0,0 @@ -require('pre') -require('plugins') -require('options') -require('mappings') -require('post') diff --git a/.config/nvim/lua/mappings.lua b/.config/nvim/lua/mappings.lua deleted file mode 100644 index 3d554cd..0000000 --- a/.config/nvim/lua/mappings.lua +++ /dev/null @@ -1,61 +0,0 @@ -vim.g.mapleader = ' ' -vim.b.mapleader = ' ' - -local map = vim.api.nvim_set_keymap -local opts = { noremap = true, silent = true } - -map('n', '', ':nohl', opts) -map('n', 'n', 'nzzzv', opts) -map('n', 'N', 'Nzzzv', opts) --- map('i', 'kj', '', opts) --- map('t', 'kj', '', { noremap = true }) -map('t', '', '', { noremap = true }) - -map('i', ',', ',u', opts) -map('i', '.', '.u', opts) -map('i', '[', '[u', opts) -map('i', '!', '!u', opts) -map('i', '?', '?u', opts) - -map('v', 'J', ":m '>+1gv=gv", opts) -map('v', 'K', ":m '<-2gv=gv", opts) - -map('n', 'h', ':wincmd h', opts) -map('n', 'j', ':wincmd j', opts) -map('n', 'k', ':wincmd k', opts) -map('n', 'l', ':wincmd l', opts) -map('n', '', ':wincmd h', opts) -map('n', '', ':wincmd j', opts) -map('n', '', ':wincmd k', opts) -map('n', '', ':wincmd l', opts) - -map('n', 'p', 'Telescope find_files', opts) -map('n', 'b', 'Telescope buffers', opts) -map('n', 'h', 'Telescope help_tags', opts) -map('n', 'lg', 'Telescope live_grep', opts) - -map('n', 'ds', 'Telescope lsp_document_symbols', opts) -map('n', 'ws', 'Telescope lsp_workspace_symbols', opts) -map('n', 'gd', 'Telescope lsp_definitions', opts) -map('n', 'gD', 'Telescope lsp_declarations', opts) -map('n', 'gr', 'Telescope lsp_references', opts) -map('n', 'gi', 'Telescope lsp_implementations', opts) -map('n', 'K', 'lua vim.lsp.buf.hover()', opts) -map('n', '', 'lua vim.lsp.buf.signature_help()', opts) -map('n', 'rn', 'lua vim.lsp.buf.rename()', opts) -map('n', 'xn', 'lua vim.diagnostic.goto_next()', opts) -map('n', 'xN', 'lua vim.diagnostic.goto_prev()', opts) -map('n', 'xx', 'Telescope lsp_code_actions', opts) -map('n', 'xX', 'Telescope lsp_range_code_actions', opts) - -map('n', ']b', ':bnext', opts) -map('n', '[b', ':bprevious', opts) -map('n', '[B', ':bfirst', opts) -map('n', ']B', ':blast', opts) -map('n', '', ':buffer #', opts) - -map('n', 'co', ':cwindow', opts) -map('n', ']q', ':cnext', opts) -map('n', '[q', ':cprevious', opts) -map('n', '[Q', ':cfirst', opts) -map('n', ']Q', ':clast', opts) diff --git a/.config/nvim/lua/options.lua b/.config/nvim/lua/options.lua deleted file mode 100644 index cf19c11..0000000 --- a/.config/nvim/lua/options.lua +++ /dev/null @@ -1,75 +0,0 @@ -vim.cmd('syntax enable') -vim.cmd('set undodir=$XDG_CACHE_HOME/nvim/undo') -vim.cmd('set undofile') - -local set = vim.opt -set.mouse = "a" -set.hidden = true -set.wildmenu = true -set.wildignorecase = true -set.fileignorecase = true -set.showcmd = true -set.hlsearch = true -set.ignorecase = true -set.smartcase = true -set.incsearch = true -set.backspace = 'indent,eol,start' -set.pastetoggle = '' -set.confirm = true -set.number = true -set.relativenumber = true -set.shiftwidth = 4 -set.softtabstop = 4 -set.autoindent = true -set.expandtab = true --- set.showmode = false --- set.ruler = false -set.timeout = false -set.ttimeoutlen = 200 -set.wrap = false --- set.fcs = 'eob: ' -set.swapfile = false -set.pumblend = 0 -set.splitright = true -set.splitbelow = true -set.cursorline = true -set.signcolumn = 'auto' -set.title = true --- set.cmdheight = 0 -set.winbar = '%=%m %f' - -vim.cmd([[ -augroup CursorLine - au! - au VimEnter,WinEnter,BufWinEnter * setlocal cursorline - au WinLeave * setlocal nocursorline -augroup END - -autocmd FileType TelescopePrompt setl nocursorline -]]) - --- Disable default vim plugins -local disabled_built_ins = { - "netrw", - "netrwPlugin", - "netrwSettings", - "netrwFileHandlers", - "gzip", - "zip", - "zipPlugin", - "tar", - "tarPlugin", - "getscript", - "getscriptPlugin", - "vimball", - "vimballPlugin", - "2html_plugin", - "logipat", - "rrhelper", - "spellfile_plugin", - "matchit" -} - -for _, plugin in pairs(disabled_built_ins) do - vim.g["loaded_" .. plugin] = 1 -end diff --git a/.config/nvim/lua/plugins.lua b/.config/nvim/lua/plugins.lua deleted file mode 100644 index 24c911b..0000000 --- a/.config/nvim/lua/plugins.lua +++ /dev/null @@ -1,187 +0,0 @@ -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 - Packer_bootstrap = fn.system({ 'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', - install_path }) - vim.cmd [[packadd packer.nvim]] -end - -return require('packer').startup(function(use) - - use { "wbthomason/packer.nvim" } - - use { - "nvim-lua/plenary.nvim", - opt = true, - } - - use { - "lewis6991/impatient.nvim", - config = function() - require("impatient") - end, - } - - use { - "navarasu/onedark.nvim", - event = "VimEnter", - config = function() - require 'setup.onedark' - end, - } - - use { - "kyazdani42/nvim-web-devicons", - -- after = "onedark.nvim" - } - - use { - "nvim-lualine/lualine.nvim", - after = "onedark.nvim", - config = function() - require "setup.lualine" - end, - } - - use { - "lukas-reineke/indent-blankline.nvim", - event = { "BufRead", "BufNewFile" }, - config = function() - require "setup.indent-blankline" - end, - } - - -- use { - -- "kyazdani42/nvim-tree.lua", - -- cmd = { "NvimTreeToggle", "NvimTreeFindFile" }, - -- config = function() - -- require "setup.nvim-tree" - -- end, - -- } - - use { - "nvim-treesitter/nvim-treesitter", - event = { "BufRead", "BufNewFile" }, - config = function() - require "setup.nvim-treesitter" - end, - run = ':TSUpdate', - } - - use { - "lewis6991/gitsigns.nvim", - event = { "BufRead", "BufNewFile" }, - wants = "plenary.nvim", - config = function() - require 'setup.gitsigns' - end, - } - - use { - "neovim/nvim-lspconfig", - event = { "BufRead", "BufNewFile" }, - config = function() - require "setup.lspconfig" - end, - } - - use { - "ray-x/lsp_signature.nvim", - event = "User lspAttached", - config = function() - require "setup.lsp_signature" - end - } - - use { - "hrsh7th/nvim-cmp", - event = "User lspAttached", - config = function() - require "setup.nvim-cmp" - end, - } - - use { - "hrsh7th/cmp-nvim-lsp", - after = "nvim-cmp", - } - - use { - "saadparwaiz1/cmp_luasnip", - after = { "LuaSnip", "nvim-cmp" } - } - - use { - "L3MON4D3/LuaSnip", - after = "nvim-cmp", - wants = "friendly-snippets", - config = function() - require("luasnip/loaders/from_vscode").lazy_load() - end, - } - - use { - "rafamadriz/friendly-snippets", - module = "cmp_nvim_lsp", - } - - use { - "tpope/vim-surround", - event = { "BufRead", "BufNewFile" }, - } - - -- use { - -- "tpope/vim-fugitive", - -- cmd = { 'G', 'Ggrep' }, - -- config = function() - -- require "setup.fugitive" - -- end, - -- } - - use { - "b3nj5m1n/kommentary", - event = { "BufRead", "BufNewFile" }, - config = function() - require "setup.kommentary" - end, - } - - use { - "BurntSushi/ripgrep", - opt = true, - } - - use { - "nvim-telescope/telescope-fzf-native.nvim", - opt = true, - } - - use { - "nvim-telescope/telescope.nvim", - module = "telescope", - cmd = "Telescope", - wants = { "ripgrep", "telescope-fzf-native.nvim", "plenary.nvim" }, - config = function() - require "setup.telescope" - end - } - - -- use { - -- "norcalli/nvim-colorizer.lua", - -- cmd = { "ColorizerToggle" }, - -- config = function() - -- require "colorizer".setup() - -- end, - -- } - - -- use { "iamcco/markdown-preview.nvim", - -- ft = "markdown", - -- run = function() - -- vim.fn['mkdp#util#install']() - -- end, - -- } - - if Packer_bootstrap then - require('packer').sync() - end -end) diff --git a/.config/nvim/lua/post.lua b/.config/nvim/lua/post.lua deleted file mode 100644 index d183424..0000000 --- a/.config/nvim/lua/post.lua +++ /dev/null @@ -1,2 +0,0 @@ --- vim.diagnostic.config({virtual_text = false}) -vim.opt.shadafile = "" diff --git a/.config/nvim/lua/pre.lua b/.config/nvim/lua/pre.lua deleted file mode 100644 index 5e6a458..0000000 --- a/.config/nvim/lua/pre.lua +++ /dev/null @@ -1 +0,0 @@ -vim.opt.shadafile = "NONE" diff --git a/.config/nvim/lua/setup/bufferline.lua b/.config/nvim/lua/setup/bufferline.lua deleted file mode 100644 index 09f1234..0000000 --- a/.config/nvim/lua/setup/bufferline.lua +++ /dev/null @@ -1,14 +0,0 @@ -require("bufferline").setup { - options = { - offsets = { { - filetype = "NvimTree", - padding = 1, - } }, - diagnostics = "nvim_lsp", - max_name_length = 14, - max_prefix_length = 13, - tab_size = 20, - separator_style = "thin", - show_close_icon = false, - }, -} diff --git a/.config/nvim/lua/setup/fugitive.lua b/.config/nvim/lua/setup/fugitive.lua deleted file mode 100644 index b48b4a9..0000000 --- a/.config/nvim/lua/setup/fugitive.lua +++ /dev/null @@ -1,6 +0,0 @@ -vim.cmd([[ -silent !in-git-repo -if v:shell_error - call FugitiveDetect('~/.cfg') -endif -]]) diff --git a/.config/nvim/lua/setup/gitsigns.lua b/.config/nvim/lua/setup/gitsigns.lua deleted file mode 100644 index dcfec15..0000000 --- a/.config/nvim/lua/setup/gitsigns.lua +++ /dev/null @@ -1,8 +0,0 @@ -require('gitsigns').setup { - worktrees = { - { - toplevel = vim.env.HOME, - gitdir = vim.env.HOME .. '/.config/dots' - } - } -} diff --git a/.config/nvim/lua/setup/indent-blankline.lua b/.config/nvim/lua/setup/indent-blankline.lua deleted file mode 100644 index 543ded8..0000000 --- a/.config/nvim/lua/setup/indent-blankline.lua +++ /dev/null @@ -1,19 +0,0 @@ -vim.cmd('highlight IndentBlanklineChar guifg=#3b414c gui=nocombine') - -require("ibl").setup { - char = "┊", - show_trailing_blankline_indent = false, - filetype_exclude = { - "help", - "terminal", - "alpha", - "packer", - "lspinfo", - "TelescopePrompt", - "TelescopeResults", - "lsp-installer", - "NvimTree", - "", - }, - buftype_exclude = { "terminal", "NvimTree" }, -} diff --git a/.config/nvim/lua/setup/kommentary.lua b/.config/nvim/lua/setup/kommentary.lua deleted file mode 100644 index 3ca608d..0000000 --- a/.config/nvim/lua/setup/kommentary.lua +++ /dev/null @@ -1,3 +0,0 @@ -require('kommentary.config').configure_language("default", { - prefer_single_line_comments = true, -}) diff --git a/.config/nvim/lua/setup/lsp_signature.lua b/.config/nvim/lua/setup/lsp_signature.lua deleted file mode 100644 index 65f7070..0000000 --- a/.config/nvim/lua/setup/lsp_signature.lua +++ /dev/null @@ -1,3 +0,0 @@ -require'lsp_signature'.setup { - floating_window = false -} diff --git a/.config/nvim/lua/setup/lspconfig.lua b/.config/nvim/lua/setup/lspconfig.lua deleted file mode 100644 index 8b83e47..0000000 --- a/.config/nvim/lua/setup/lspconfig.lua +++ /dev/null @@ -1,28 +0,0 @@ -local lspconfig = require("lspconfig") - -local function on_attach() - vim.cmd("doautocmd User lspAttached") -end - -lspconfig.lua_ls.setup { - on_attach = on_attach, - settings = { - Lua = { - diagnostics = { - globals = { 'vim' } - } - } - } -} -lspconfig.bashls.setup { - on_attach = on_attach, -} -lspconfig.pyright.setup{ - on_attach = on_attach, -} - --- local signs = { Error = " ", Warn = " ", Hint = " ", Info = " " } --- for type, icon in pairs(signs) do --- local hl = "DiagnosticSign" .. type --- vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl }) --- end diff --git a/.config/nvim/lua/setup/lualine.lua b/.config/nvim/lua/setup/lualine.lua deleted file mode 100644 index 087a301..0000000 --- a/.config/nvim/lua/setup/lualine.lua +++ /dev/null @@ -1,44 +0,0 @@ -local lualine = require 'lualine' - -local config = { - options = { - icons_enabled = true, - theme = 'onedark', - component_separators = { left = '', right = '' }, - section_separators = { left = '', right = '' }, - globalstatus = true, - }, - sections = { - lualine_a = { 'mode' }, - lualine_b = { 'branch' }, - lualine_c = { 'filename', 'diagnostics' }, - lualine_x = { 'encoding', 'filetype' }, - lualine_y = { 'progress' }, - lualine_z = { 'location' }, - }, -} - -local function ins_right(component) - table.insert(config.sections.lualine_x, 1, component) -end - -ins_right { - -- LSP Indicator - function() - local msg = '' - local buf_ft = vim.api.nvim_buf_get_option(0, 'filetype') - local clients = vim.lsp.get_active_clients() - if next(clients) == nil then - return msg - end - for _, client in ipairs(clients) do - local filetypes = client.config.filetypes - if filetypes and vim.fn.index(filetypes, buf_ft) ~= -1 then - return ' ' - end - end - return msg - end, -} - -lualine.setup(config) diff --git a/.config/nvim/lua/setup/nvim-cmp.lua b/.config/nvim/lua/setup/nvim-cmp.lua deleted file mode 100644 index 9e6ae05..0000000 --- a/.config/nvim/lua/setup/nvim-cmp.lua +++ /dev/null @@ -1,52 +0,0 @@ -table.unpack = table.unpack or unpack -- 5.1 compatibility - -local has_words_before = function() - local line, col = table.unpack(vim.api.nvim_win_get_cursor(0)) - return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil -end - -local luasnip = require("luasnip") -local cmp = require("cmp") -require("luasnip/loaders/from_vscode").lazy_load() -vim.o.completeopt = 'menuone,noselect' - -cmp.setup { - snippet = { - expand = function(args) - require('luasnip').lsp_expand(args.body) - end, - }, - mapping = cmp.mapping.preset.insert({ - [''] = cmp.mapping.confirm({ select = true }), - [''] = cmp.mapping.select_next_item(), - [''] = cmp.mapping.select_prev_item(), - [''] = cmp.mapping.scroll_docs(4), - [''] = cmp.mapping.scroll_docs(-4), - [''] = cmp.mapping.close(), - [""] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_next_item() - elseif luasnip.expand_or_jumpable() then - luasnip.expand_or_jump() - elseif has_words_before() then - cmp.complete() - else - fallback() - end - end, { "i", "s" }), - - [""] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_prev_item() - elseif luasnip.jumpable(-1) then - luasnip.jump(-1) - else - fallback() - end - end, { "i", "s" }), - }), - sources = { - { name = 'nvim_lsp' }, - { name = 'luasnip' }, - }, -} diff --git a/.config/nvim/lua/setup/nvim-tree.lua b/.config/nvim/lua/setup/nvim-tree.lua deleted file mode 100644 index 2903fb0..0000000 --- a/.config/nvim/lua/setup/nvim-tree.lua +++ /dev/null @@ -1,26 +0,0 @@ -vim.cmd('highlight NvimTreeIndentMarker guifg=#3b414c gui=nocombine') - -require 'nvim-tree'.setup { - hijack_cursor = true, - renderer = { - icons = { - webdev_colors = true, - }, - indent_markers = { - enable = true, - }, - }, - view = { - side = "left", - hide_root_folder = true, - }, - git = { - enable = false, - ignore = false, - }, - actions = { - open_file = { - resize_window = true, - }, - }, -} diff --git a/.config/nvim/lua/setup/nvim-treesitter.lua b/.config/nvim/lua/setup/nvim-treesitter.lua deleted file mode 100644 index 7bccf73..0000000 --- a/.config/nvim/lua/setup/nvim-treesitter.lua +++ /dev/null @@ -1,5 +0,0 @@ -require 'nvim-treesitter.configs'.setup { - highlight = { - enable = true, - }, -} diff --git a/.config/nvim/lua/setup/onedark.lua b/.config/nvim/lua/setup/onedark.lua deleted file mode 100644 index f571f09..0000000 --- a/.config/nvim/lua/setup/onedark.lua +++ /dev/null @@ -1,2 +0,0 @@ -require('onedark').load() -vim.cmd('highlight CursorLineNr gui=bold guifg=#51afef') diff --git a/.config/nvim/lua/setup/telescope.lua b/.config/nvim/lua/setup/telescope.lua deleted file mode 100644 index da7a3ed..0000000 --- a/.config/nvim/lua/setup/telescope.lua +++ /dev/null @@ -1,32 +0,0 @@ -require("telescope").setup { - defaults = { - path_display = { - truncate = 3, - }, - prompt_prefix = "  ", - selection_caret = " ", - entry_prefix = " ", - -- initial_mode = "insert", - -- selection_strategy = "reset", - -- sorting_strategy = "ascending", - -- layout_strategy = "horizontal", - -- layout_config = { - -- horizontal = { - -- prompt_position = "top", - -- preview_width = 0.55, - -- results_width = 0.8, - -- }, - -- vertical = { - -- mirror = false, - -- }, - -- width = 0.87, - -- height = 0.80, - -- preview_cutoff = 120, - -- }, - file_ignore_patterns = { "node_modules" }, - winblend = 0, - border = {}, - borderchars = { '─', '│', '─', '│', '┌', '┐', '┘', '└' }, - color_devicons = true, - }, -} -- cgit v1.2.3-70-g09d2