]> src.twobees.de Git - dotfiles.git/commitdiff
try kickstart nvim
authorTobias Sachs <git-pngdhxpf-ts@twobees.de>
Thu, 29 Jun 2023 15:23:02 +0000 (17:23 +0200)
committerTobias Sachs <git-pngdhxpf-ts@twobees.de>
Thu, 29 Jun 2023 15:23:02 +0000 (17:23 +0200)
.gitignore
stow/nvim/.config/nvim/after/plugin/colors.lua [deleted file]
stow/nvim/.config/nvim/after/plugin/lspsetup.lua [deleted file]
stow/nvim/.config/nvim/after/plugin/treesitter.lua [deleted file]
stow/nvim/.config/nvim/init.lua
stow/nvim/.config/nvim/lua/autoformat.lua [new file with mode: 0644]
stow/nvim/.config/nvim/lua/mappings.lua [deleted file]
stow/nvim/.config/nvim/lua/plugin_mgr.lua [deleted file]
stow/nvim/.config/nvim/lua/set.lua [deleted file]
stow/oh-my-zsh/.oh-my-zsh

index 3ba4099e607c26dff9e01a534b6e075615e4a602..415e77616891fcd1392985266e4c846b2cab409a 100644 (file)
@@ -4,3 +4,4 @@ stow/vim/.vim/tmp/
 stow/vim/.vim/tmpnvim/
 *~
 stow/nvim/.config/nvim/plugin/packer_compiled.lua
+stow/nvim/.config/nvim/lazy-lock.json
diff --git a/stow/nvim/.config/nvim/after/plugin/colors.lua b/stow/nvim/.config/nvim/after/plugin/colors.lua
deleted file mode 100644 (file)
index 0379da2..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
--- local scheme = 'rose-pine'
--- require(scheme).setup({
---     disable_background = true
--- })
-local scheme = 'apprentice'
-
-function SetScheme(s)
-       vim.cmd.colorscheme(s)
-       vim.api.nvim_set_hl(0, "Normal", { bg = "none" })
-       vim.api.nvim_set_hl(0, "NormalFloat", { bg = "none" })
-
-end
-
-SetScheme(scheme)
diff --git a/stow/nvim/.config/nvim/after/plugin/lspsetup.lua b/stow/nvim/.config/nvim/after/plugin/lspsetup.lua
deleted file mode 100644 (file)
index 6a1fcb6..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-local lsp = require('lsp-zero')
-lsp.preset('recommended')
-
-lsp.configure('lua_ls', {
-    settings = {
-        Lua = {
-            diagnostics = {
-                globals = { 'vim' }
-            }
-        }
-    }
-})
-
-
-lsp.on_attach(function(client, bufnr)
-  lsp.default_keymaps({buffer = bufnr})
-     vim.keymap.set ("n", "<leader>r", vim.lsp.buf.rename, options)
-     vim.keymap.set ("n", "<leader>f", vim.lsp.buf.code_action, options)
-end)
-
-lsp.set_sign_icons({
-  error = '✘',
-  warn = '▲',
-  hint = '⚑',
-  info = '»'
-})
--- lsp.on_attach = function (_, bufnr)
---     print "attached"
---     local options = { buffer = bufnr, remap = false }
---     vim.keymap.set ("n", "K", vim.lsp.buf.hover, options) -- buffer=0 -> only in current buffer
---     vim.keymap.set ("n", "gd", vim.lsp.buf.definition, options) -- goto definition
---     vim.keymap.set ("n", "gT", vim.lsp.buf.type_definition, options) -- goto typedefinition
---     vim.keymap.set ("n", "gi", vim.lsp.buf.implementation, options) -- goto implementation
---     vim.keymap.set ("n", "dj", vim.diagnostic.goto_next, options) -- goto dignostic next
---     vim.keymap.set ("n", "dk", vim.diagnostic.goto_prev, options) -- goto diognostic prev
---     vim.keymap.set ("n", "dl", "<cmd>Telescope diagnostic", options) -- goto list failure
---     vim.keymap.set ("n", "<leader>r", vim.lsp.buf.rename, options)
---     vim.keymap.set ("n", "<leader>f", vim.lsp.buf.code_action, options)
--- end
-
-local cmp = require('cmp')
-local cmp_select = {behavior = cmp.SelectBehavior.Select}
-local cmp_mappings = lsp.defaults.cmp_mappings({
-    ['<C-p>'] = cmp.mapping.select_prev_item(cmp_select),
-    ['<C-n>'] = cmp.mapping.select_next_item(cmp_select),
-    ['<C-y>'] = cmp.mapping.confirm({ select = true }),
-    ["<C-Space>"] = cmp.mapping.complete(),
-})
-
-lsp.setup_nvim_cmp({
-    mapping = cmp_mappings,
-})
-
-cmp.setup({
-    experimental = { ghost_text = true },
-});
-
-
-lsp.setup()
-
-vim.diagnostic.config({
-  virtual_text = {
-    -- source = "always",  -- Or "if_many"
-    prefix = '●', -- Could be '■', '▎', 'x'
-  },
-  severity_sort = true,
-  float = {
-    source = "always",  -- Or "if_many"
-  },
-})
-
diff --git a/stow/nvim/.config/nvim/after/plugin/treesitter.lua b/stow/nvim/.config/nvim/after/plugin/treesitter.lua
deleted file mode 100644 (file)
index cf2bed1..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-require'nvim-treesitter.configs'.setup {
---    ensure_installed = "all",
-    sync_install = false,
-    auto_install = true,
-
-    highlight = {
-        enable = true,
-        additional_vim_regex_highlighting = false,
-    },
-    indent = { enable = true, },
-}
index f57bdd2b401340cf7821ba89ce483626778b8941..4e56abb6657d4b02d1189d273de2760b828d0243 100644 (file)
-local data_path = vim.fn.stdpath('data')
-vim.o.backupdir = data_path .. "/backup//"
-pcall (require 'plugin_mgr')
-pcall (require 'set')
-pcall (require 'mappings')
-
--- found in ThePrimagen dotfiles:
-local augroup = vim.api.nvim_create_augroup
-local yank_group = augroup('HighlightYank', {})
-local autocmd = vim.api.nvim_create_autocmd
-
-autocmd('TextYankPost', {
-    group = yank_group,
-    pattern = '*',
-    callback = function()
-        vim.highlight.on_yank({
-            higroup = 'IncSearch',
-            timeout = 40,
-        })
+vim.g.mapleader = ' '
+vim.g.maplocalleader = ' '
+
+-- Install package manager
+--    https://github.com/folke/lazy.nvim
+--    `:help lazy.nvim.txt` for more info
+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)
+
+require('lazy').setup({
+  -- NOTE: First, some plugins that don't require any configuration
+
+  -- Git related plugins
+  'tpope/vim-fugitive',
+  'tpope/vim-rhubarb',
+
+  -- Detect tabstop and shiftwidth automatically
+  'tpope/vim-sleuth',
+
+  -- NOTE: This is where your plugins related to LSP can be installed.
+  --  The configuration is done below. Search for lspconfig to find it below.
+  {
+    -- LSP Configuration & Plugins
+    'neovim/nvim-lspconfig',
+    dependencies = {
+      -- Automatically install LSPs to stdpath for neovim
+      { 'williamboman/mason.nvim', config = true },
+      'williamboman/mason-lspconfig.nvim',
+
+      -- Useful status updates for LSP
+      -- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})`
+      { 'j-hui/fidget.nvim',       opts = {} },
+
+      -- Additional lua configuration, makes nvim stuff amazing!
+      'folke/neodev.nvim',
+    },
+  },
+
+  {
+    -- Autocompletion
+    'hrsh7th/nvim-cmp',
+    dependencies = { 'hrsh7th/cmp-nvim-lsp', 'L3MON4D3/LuaSnip', 'saadparwaiz1/cmp_luasnip',
+      'rafamadriz/friendly-snippets' },
+  },
+
+  -- Useful plugin to show you pending keybinds.
+  { 'folke/which-key.nvim',     opts = {} },
+  {
+    -- Adds git releated signs to the gutter, as well as utilities for managing changes
+    'lewis6991/gitsigns.nvim',
+    opts = {
+      -- See `:help gitsigns.txt`
+      signs = {
+        add = { text = '+' },
+        change = { text = '~' },
+        delete = { text = '_' },
+        topdelete = { text = '‾' },
+        changedelete = { text = '~' },
+      },
+      on_attach = function(bufnr)
+        vim.keymap.set('n', '[c', require('gitsigns').prev_hunk, { buffer = bufnr, desc = 'Go to Previous Hunk' })
+        vim.keymap.set('n', ']c', require('gitsigns').next_hunk, { buffer = bufnr, desc = 'Go to Next Hunk' })
+        vim.keymap.set('n', '<leader>ph', require('gitsigns').preview_hunk, { buffer = bufnr, desc = '[P]review [H]unk' })
+      end,
+    },
+  },
+
+  { "ellisonleao/gruvbox.nvim", priority = 1000 },
+  {
+    -- Set lualine as statusline
+    'nvim-lualine/lualine.nvim',
+    -- See `:help lualine.txt`
+    opts = {
+      options = {
+        icons_enabled = false,
+        theme = 'gruvbox',
+        component_separators = '|',
+        section_separators = '',
+      },
+    },
+  },
+
+  {
+    -- Add indentation guides even on blank lines
+    'lukas-reineke/indent-blankline.nvim',
+    -- Enable `lukas-reineke/indent-blankline.nvim`
+    -- See `:help indent_blankline.txt`
+    opts = {
+      char = '┊',
+      show_trailing_blankline_indent = false,
+    },
+  },
+
+  -- "gc" to comment visual regions/lines
+  { 'numToStr/Comment.nvim',         opts = {} },
+
+  -- Fuzzy Finder (files, lsp, etc)
+  { 'nvim-telescope/telescope.nvim', branch = '0.1.x', dependencies = { 'nvim-lua/plenary.nvim' } },
+
+  -- Fuzzy Finder Algorithm which requires local dependencies to be built.
+  -- Only load if `make` is available. Make sure you have the system
+  -- requirements installed.
+  {
+    'nvim-telescope/telescope-fzf-native.nvim',
+    -- NOTE: If you are having trouble with this installation,
+    --       refer to the README for telescope-fzf-native for more instructions.
+    build = 'make',
+    cond = function()
+      return vim.fn.executable 'make' == 1
     end,
+  },
+
+  {
+    -- Highlight, edit, and navigate code
+    'nvim-treesitter/nvim-treesitter',
+    dependencies = {
+      'nvim-treesitter/nvim-treesitter-textobjects',
+    },
+    build = ':TSUpdate',
+  },
+
+  -- NOTE: Next Step on Your Neovim Journey: Add/Configure additional "plugins" for kickstart
+  --       These are some example plugins that I've included in the kickstart repository.
+  --       Uncomment any of the lines below to enable them.
+  require 'autoformat',
+  -- require 'kickstart.plugins.debug',
+
+  -- NOTE: The import below automatically adds your own plugins, configuration, etc from `lua/custom/plugins/*.lua`
+  --    You can use this folder to prevent any conflicts with this init.lua if you're interested in keeping
+  --    up-to-date with whatever is in the kickstart repo.
+  --
+  --    For additional information see: https://github.com/folke/lazy.nvim#-structuring-your-plugins
+  --
+  --    An additional note is that if you only copied in the `init.lua`, you can just comment this line
+  --    to get rid of the warning telling you that there are not plugins in `lua/custom/plugins/`.
+  -- { import = 'plugins' },
+}, {})
+
+-- [[ Setting options ]]
+-- See `:help vim.o`
+
+-- Set highlight on search
+vim.o.hlsearch = false
+
+-- Make line numbers default
+vim.wo.relativenumber = true
+
+-- Enable mouse mode
+vim.o.mouse = 'a'
+
+vim.opt.scrolloff = 8
+
+-- Sync clipboard between OS and Neovim.
+--  Remove this option if you want your OS clipboard to remain independent.
+--  See `:help 'clipboard'`
+vim.o.clipboard = 'unnamedplus'
+
+-- Enable break indent
+vim.o.breakindent = true
+
+-- Save undo history
+vim.o.undofile = true
+
+-- Case insensitive searching UNLESS /C or capital in search
+vim.o.ignorecase = true
+vim.o.smartcase = true
+
+-- Keep signcolumn on by default
+vim.wo.signcolumn = 'yes'
+
+-- Decrease update time
+vim.o.updatetime = 250
+vim.o.timeout = true
+vim.o.timeoutlen = 300
+
+-- Set completeopt to have a better completion experience
+vim.o.completeopt = 'menuone,noselect'
+
+-- NOTE: You should make sure your terminal supports this
+vim.o.termguicolors = true
+
+vim.o.background = "light" -- or "light" for light mode
+vim.cmd([[colorscheme gruvbox]])
+
+-- [[ Basic Keymaps ]]
+
+-- Keymaps for better default experience
+-- See `:help vim.keymap.set()`
+vim.keymap.set({ 'n', 'v' }, '<Space>', '<Nop>', { silent = true })
+
+-- Remap for dealing with word wrap
+vim.keymap.set('n', 'k', "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true })
+vim.keymap.set('n', 'j', "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true })
+
+-- [[ Highlight on yank ]]
+-- See `:help vim.highlight.on_yank()`
+local highlight_group = vim.api.nvim_create_augroup('YankHighlight', { clear = true })
+vim.api.nvim_create_autocmd('TextYankPost', {
+  callback = function()
+    vim.highlight.on_yank()
+  end,
+  group = highlight_group,
+  pattern = '*',
 })
+
+-- [[ Configure Telescope ]]
+-- See `:help telescope` and `:help telescope.setup()`
+require('telescope').setup {
+  defaults = {
+    mappings = {
+      i = {
+        ['<C-u>'] = false,
+        ['<C-d>'] = false,
+      },
+    },
+  },
+}
+
+-- Enable telescope fzf native, if installed
+pcall(require('telescope').load_extension, 'fzf')
+
+-- See `:help telescope.builtin`
+vim.keymap.set('n', '<leader>?', require('telescope.builtin').oldfiles, { desc = '[?] Find recently opened files' })
+vim.keymap.set('n', '<leader><space>', require('telescope.builtin').buffers, { desc = '[ ] Find existing buffers' })
+vim.keymap.set('n', '<leader>/', function()
+  -- You can pass additional configuration to telescope to change theme, layout, etc.
+  require('telescope.builtin').current_buffer_fuzzy_find(require('telescope.themes').get_dropdown {
+    winblend = 10,
+    previewer = false,
+  })
+end, { desc = '[/] Fuzzily search in current buffer' })
+
+vim.keymap.set('n', '<leader>gf', require('telescope.builtin').git_files, { desc = 'Search [G]it [F]iles' })
+vim.keymap.set('n', '<leader>sf', require('telescope.builtin').find_files, { desc = '[S]earch [F]iles' })
+vim.keymap.set('n', '<leader>sh', require('telescope.builtin').help_tags, { desc = '[S]earch [H]elp' })
+vim.keymap.set('n', '<leader>sw', require('telescope.builtin').grep_string, { desc = '[S]earch current [W]ord' })
+vim.keymap.set('n', '<leader>sg', require('telescope.builtin').live_grep, { desc = '[S]earch by [G]rep' })
+vim.keymap.set('n', '<leader>sd', require('telescope.builtin').diagnostics, { desc = '[S]earch [D]iagnostics' })
+
+vim.keymap.set('i', 'kj', '<Esc>')
+vim.keymap.set("n", "<tab>", "<cmd>bn<CR>")
+vim.keymap.set("n", "<S-tab>", "<cmd>bp<CR>")
+
+vim.cmd [[
+augroup jumplast
+    autocmd BufReadPost *
+          \ if line("'\"") >= 1 && line("'\"") <= line("$") && &ft !~# 'commit'
+          \ |   exe "normal! g`\""
+          \ | endif
+augroup END
+]]
+
+-- [[ Configure Treesitter ]]
+-- See `:help nvim-treesitter`
+require('nvim-treesitter.configs').setup {
+  -- Add languages to be installed here that you want installed for treesitter
+  ensure_installed = { 'c', 'cpp', 'go', 'lua', 'python', 'rust', 'tsx', 'typescript', 'vimdoc', 'vim', 'html',
+    'c_sharp', 'perl' },
+
+  -- Autoinstall languages that are not installed. Defaults to false (but you can change for yourself!)
+  auto_install = false,
+
+  highlight = { enable = true },
+  indent = { enable = true, disable = { 'python' } },
+  incremental_selection = {
+    enable = true,
+    keymaps = {
+      init_selection = '<c-space>',
+      node_incremental = '<c-space>',
+      scope_incremental = '<c-s>',
+      node_decremental = '<M-space>',
+    },
+  },
+  textobjects = {
+    select = {
+      enable = true,
+      lookahead = true, -- Automatically jump forward to textobj, similar to targets.vim
+      keymaps = {
+        -- You can use the capture groups defined in textobjects.scm
+        ['aa'] = '@parameter.outer',
+        ['ia'] = '@parameter.inner',
+        ['af'] = '@function.outer',
+        ['if'] = '@function.inner',
+        ['ac'] = '@class.outer',
+        ['ic'] = '@class.inner',
+      },
+    },
+    move = {
+      enable = true,
+      set_jumps = true, -- whether to set jumps in the jumplist
+      goto_next_start = {
+        [']m'] = '@function.outer',
+        [']]'] = '@class.outer',
+      },
+      goto_next_end = {
+        [']M'] = '@function.outer',
+        [']['] = '@class.outer',
+      },
+      goto_previous_start = {
+        ['[m'] = '@function.outer',
+        ['[['] = '@class.outer',
+      },
+      goto_previous_end = {
+        ['[M'] = '@function.outer',
+        ['[]'] = '@class.outer',
+      },
+    },
+    swap = {
+      enable = true,
+      swap_previous = {
+        ['<leader>A'] = '@parameter.inner',
+      },
+      swap_next = {
+        ['<leader>a'] = '@parameter.inner',
+      },
+    },
+  },
+}
+
+-- Diagnostic keymaps
+vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = 'Go to previous diagnostic message' })
+vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = 'Go to next diagnostic message' })
+vim.keymap.set('n', '<leader>e', vim.diagnostic.open_float, { desc = 'Open floating diagnostic message' })
+vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagnostics list' })
+
+-- LSP settings.
+--  This function gets run when an LSP connects to a particular buffer.
+local on_attach = function(_, bufnr)
+  -- NOTE: Remember that lua is a real programming language, and as such it is possible
+  -- to define small helper and utility functions so you don't have to repeat yourself
+  -- many times.
+  -- for LSP related items. It sets the mode, buffer and description for us each time.
+  local nmap = function(keys, func, desc)
+    if desc then
+      desc = 'LSP: ' .. desc
+    end
+
+    vim.keymap.set('n', keys, func, { buffer = bufnr, desc = desc })
+  end
+
+  nmap('<leader>rn', vim.lsp.buf.rename, '[R]e[n]ame')
+  nmap('<leader>ca', vim.lsp.buf.code_action, '[C]ode [A]ction')
+
+  nmap('gd', vim.lsp.buf.definition, '[G]oto [D]efinition')
+  nmap('gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences')
+  nmap('gI', vim.lsp.buf.implementation, '[G]oto [I]mplementation')
+  nmap('<leader>D', vim.lsp.buf.type_definition, 'Type [D]efinition')
+  nmap('<leader>ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols')
+  nmap('<leader>ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols')
+
+  -- See `:help K` for why this keymap
+  nmap('K', vim.lsp.buf.hover, 'Hover Documentation')
+  nmap('<C-k>', vim.lsp.buf.signature_help, 'Signature Documentation')
+
+  -- Lesser used LSP functionality
+  nmap('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration')
+  nmap('<leader>wa', vim.lsp.buf.add_workspace_folder, '[W]orkspace [A]dd Folder')
+  nmap('<leader>wr', vim.lsp.buf.remove_workspace_folder, '[W]orkspace [R]emove Folder')
+  nmap('<leader>wl', function()
+    print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
+  end, '[W]orkspace [L]ist Folders')
+
+  -- Create a command `:Format` local to the LSP buffer
+  vim.api.nvim_buf_create_user_command(bufnr, 'Format', function(_)
+    vim.lsp.buf.format()
+  end, { desc = 'Format current buffer with LSP' })
+end
+
+-- Enable the following language servers
+--  Feel free to add/remove any LSPs that you want here. They will automatically be installed.
+--
+--  Add any additional override configuration in the following tables. They will be passed to
+--  the `settings` field of the server config. You must look up that documentation yourself.
+local servers = {
+  -- clangd = {},
+  -- gopls = {},
+  -- pyright = {},
+  -- rust_analyzer = {},
+  tsserver = {},
+  lua_ls = {
+    Lua = {
+      workspace = { checkThirdParty = false },
+      telemetry = { enable = false },
+    },
+  },
+}
+
+-- Setup neovim lua configuration
+require('neodev').setup()
+
+-- nvim-cmp supports additional completion capabilities, so broadcast that to servers
+local capabilities = vim.lsp.protocol.make_client_capabilities()
+capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities)
+
+-- Ensure the servers above are installed
+local mason_lspconfig = require 'mason-lspconfig'
+
+mason_lspconfig.setup {
+  ensure_installed = vim.tbl_keys(servers),
+}
+
+mason_lspconfig.setup_handlers {
+  function(server_name)
+    require('lspconfig')[server_name].setup {
+      capabilities = capabilities,
+      on_attach = on_attach,
+      settings = servers[server_name],
+    }
+  end,
+}
+
+-- nvim-cmp setup
+local cmp = require 'cmp'
+local luasnip = require 'luasnip'
+require('luasnip.loaders.from_vscode').lazy_load()
+luasnip.config.setup {}
+
+cmp.setup {
+  snippet = {
+    expand = function(args)
+      luasnip.lsp_expand(args.body)
+    end,
+  },
+  mapping = cmp.mapping.preset.insert {
+    ['<C-n>'] = cmp.mapping.select_next_item(),
+    ['<C-p>'] = cmp.mapping.select_prev_item(),
+    ['<C-d>'] = cmp.mapping.scroll_docs(-4),
+    ['<C-f>'] = cmp.mapping.scroll_docs(4),
+    ['<C-Space>'] = cmp.mapping.complete {},
+    ['<CR>'] = cmp.mapping.confirm {
+      behavior = cmp.ConfirmBehavior.Replace,
+      select = true,
+    },
+    ['<Tab>'] = cmp.mapping(function(fallback)
+      if cmp.visible() then
+        cmp.select_next_item()
+      elseif luasnip.expand_or_locally_jumpable() then
+        luasnip.expand_or_jump()
+      else
+        fallback()
+      end
+    end, { 'i', 's' }),
+    ['<S-Tab>'] = cmp.mapping(function(fallback)
+      if cmp.visible() then
+        cmp.select_prev_item()
+      elseif luasnip.locally_jumpable(-1) then
+        luasnip.jump(-1)
+      else
+        fallback()
+      end
+    end, { 'i', 's' }),
+  },
+  sources = {
+    { name = 'nvim_lsp' },
+    { name = 'luasnip' },
+  },
+}
+
+-- The line beneath this is called `modeline`. See `:help modeline`
+-- vim: ts=2 sts=2 sw=2 et
diff --git a/stow/nvim/.config/nvim/lua/autoformat.lua b/stow/nvim/.config/nvim/lua/autoformat.lua
new file mode 100644 (file)
index 0000000..7d49be7
--- /dev/null
@@ -0,0 +1,74 @@
+-- autoformat.lua
+--
+-- Use your language server to automatically format your code on save.
+-- Adds additional commands as well to manage the behavior
+
+return {
+  'neovim/nvim-lspconfig',
+  config = function()
+    -- Switch for controlling whether you want autoformatting.
+    --  Use :KickstartFormatToggle to toggle autoformatting on or off
+    local format_is_enabled = true
+    vim.api.nvim_create_user_command('KickstartFormatToggle', function()
+      format_is_enabled = not format_is_enabled
+      print('Setting autoformatting to: ' .. tostring(format_is_enabled))
+    end, {})
+
+    -- Create an augroup that is used for managing our formatting autocmds.
+    --      We need one augroup per client to make sure that multiple clients
+    --      can attach to the same buffer without interfering with each other.
+    local _augroups = {}
+    local get_augroup = function(client)
+      if not _augroups[client.id] then
+        local group_name = 'kickstart-lsp-format-' .. client.name
+        local id = vim.api.nvim_create_augroup(group_name, { clear = true })
+        _augroups[client.id] = id
+      end
+
+      return _augroups[client.id]
+    end
+
+    -- Whenever an LSP attaches to a buffer, we will run this function.
+    --
+    -- See `:help LspAttach` for more information about this autocmd event.
+    vim.api.nvim_create_autocmd('LspAttach', {
+      group = vim.api.nvim_create_augroup('kickstart-lsp-attach-format', { clear = true }),
+      -- This is where we attach the autoformatting for reasonable clients
+      callback = function(args)
+        local client_id = args.data.client_id
+        local client = vim.lsp.get_client_by_id(client_id)
+        local bufnr = args.buf
+
+        -- Only attach to clients that support document formatting
+        if not client.server_capabilities.documentFormattingProvider then
+          return
+        end
+
+        -- Tsserver usually works poorly. Sorry you work with bad languages
+        -- You can remove this line if you know what you're doing :)
+        --  if client.name == 'tsserver' then
+        --    return
+        --  end
+
+        -- Create an autocmd that will run *before* we save the buffer.
+        --  Run the formatting command for the LSP that has just attached.
+        vim.api.nvim_create_autocmd('BufWritePre', {
+          group = get_augroup(client),
+          buffer = bufnr,
+          callback = function()
+            if not format_is_enabled then
+              return
+            end
+
+            vim.lsp.buf.format {
+              async = false,
+              filter = function(c)
+                return c.id == client.id
+              end,
+            }
+          end,
+        })
+      end,
+    })
+  end,
+}
diff --git a/stow/nvim/.config/nvim/lua/mappings.lua b/stow/nvim/.config/nvim/lua/mappings.lua
deleted file mode 100644 (file)
index dd19630..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-vim.g.mapleader = " "
-vim.keymap.set("n", "<F8>", "]s")
-vim.keymap.set("n", "<S-F8>", "[s")
-vim.keymap.set("n", "Z", "Y")
-vim.keymap.set("n", "<leader>-", "i•")
-vim.keymap.set("n", "<Leader>i", "a'\" <<  << \"' <Esc>6hi")
-vim.keymap.set("n", "<Leader>a", "a'{}' <Esc>2hi")
-vim.keymap.set("n", "J", "mzJ`z")
-vim.keymap.set("n", "<Leader>A", "a'\"+  +\"' <Esc>4hi")
-vim.keymap.set("n", "<Leader>fd", "msgg=G`s")
-vim.keymap.set("i", "kj", "<Esc>")
-vim.keymap.set("n", "n", "nzz")
-vim.keymap.set("n", "N", "Nzz")
-vim.keymap.set("n", "<C-d>", "<C-d>zz")
-vim.keymap.set("n", "<C-u>", "<C-u>zz")
-vim.keymap.set("n", "<leader>j", ":bprev<CR>")
-vim.keymap.set("n", "<leader>k", ":bnext<CR>")
-vim.keymap.set("n", "<C-l>", "<C-W>l")
-vim.keymap.set("v", "<leader>c", "\"*y")
-vim.keymap.set("n", "<leader>v", "\"*p")
-vim.keymap.set("n", "<leader>E", ":Explore<CR>")
-vim.keymap.set("x", "<leader>p", "\"_dP")
-vim.keymap.set("v", "K", ":m '<-2<CR>gv=gv")
-vim.keymap.set("v", "J", ":m '>+1<CR>gv=gv")
-vim.keymap.set("n", "<S-Right>", ">>")
-vim.keymap.set("v", "<S-Right>", ":><CR>gv")
-vim.keymap.set("v", "<S-Left>", " :<<CR>gv")
-vim.keymap.set("n", "<S-Left>", "<<")
-vim.keymap.set("n", "<leader>w", ":w<CR>")
-vim.keymap.set("n", "<leader>wj", ":wa<CR>")
-vim.keymap.set("n", "<leader>wk", ":xall<CR>")
-vim.keymap.set("v", ".", ":normal.<CR>")
-vim.keymap.set("n", "<Leader>s", "yiw/<C-R>/\\|<C-R>\"<cr>")
-vim.keymap.set("v", "<Leader>s", "y/<C-R>/\\|<C-R>\"<cr>")
-vim.keymap.set("n", "<Leader>ll", "iprint_log(\"\");<Esc>V=0f(la")
-vim.keymap.set("n", "<leader><tab>", ":Files<cr>")
-vim.keymap.set("i", "<F4>", "<Esc>:Explore<CR>")
-vim.keymap.set("n", "<F4>", ":Explore<CR>")
-vim.keymap.set("n", "<leader>s", [[:%s/\<<C-r><C-w>\>/<C-r><C-w>/gI<Left><Left><Left>]])
-
-vim.keymap.set("n", "<S-Right>", ">>")
-vim.keymap.set("v", "<S-Right>", ":><CR>gv")
-vim.keymap.set("v", "<S-Left>", " :<<CR>gv")
-vim.keymap.set("n", "<S-Left>", "<<")
-vim.keymap.set("n", "<Leader>r", ":Reload<CR>:echom 'config relaoded!'<CR>")
-vim.keymap.set("n", "<leader>e", ":tabedit $MYVIMRC<CR>:lcd %:p:h<cr>")
-
-vim.keymap.set('n', "<Leader>r", function ()
-    for k in pairs(package.loaded) do
-        package.loaded[k] = nil
-    end
-    vim.cmd [[ :source $MYVIMRC ]]
-    print ('config reloaded!')
-end
-)
-
-
--- Quickfix nav
-vim.keymap.set("n", "<C-k>", "<cmd>cnext<CR>zz")
-vim.keymap.set("n", "<C-j>", "<cmd>cprev<CR>zz")
-vim.keymap.set("n", "<leader>k", "<cmd>lnext<CR>zz")
-vim.keymap.set("n", "<leader>j", "<cmd>lprev<CR>zz")
-vim.keymap.set("n", "<tab>", "<cmd>bn<CR>")
-vim.keymap.set("n", "<S-tab>", "<cmd>bp<CR>")
-
--- telescope
-local builtin = require('telescope.builtin')
-vim.keymap.set('n', '<leader>ff', builtin.find_files, {})
-vim.keymap.set('n', '<leader>fg', builtin.live_grep, {})
-vim.keymap.set('n', '<leader>fb', builtin.buffers, {})
-vim.keymap.set('n', '<leader>fh', builtin.help_tags, {})
diff --git a/stow/nvim/.config/nvim/lua/plugin_mgr.lua b/stow/nvim/.config/nvim/lua/plugin_mgr.lua
deleted file mode 100644 (file)
index d338931..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-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)
-    use { 'wbthomason/packer.nvim' }
-    use({
-        'rose-pine/neovim',
-        as = 'rose-pine',
-        config = function()
-            vim.cmd('colorscheme rose-pine')
-        end
-    })
-    use { 'romainl/Apprentice' }
-    use { 'folke/tokyonight.nvim' }
-    use { 'unblevable/quick-scope'}
-    use { 'onsails/lspkind.nvim' }
-    use
-    {
-        'nvim-treesitter/nvim-treesitter',
-        run = ':TSUpdate'
-    }
-    use {
-        'VonHeikemen/lsp-zero.nvim',
-        requires = {
-            -- LSP Support
-            {'neovim/nvim-lspconfig'},
-            {'williamboman/mason.nvim'},
-            {'williamboman/mason-lspconfig.nvim'},
-
-            -- Autocompletion
-            {'hrsh7th/nvim-cmp'},
-            {'hrsh7th/cmp-buffer'},
-            {'hrsh7th/cmp-path'},
-            {'saadparwaiz1/cmp_luasnip'},
-            {'hrsh7th/cmp-nvim-lsp'},
-            {'hrsh7th/cmp-nvim-lua'},
-
-            -- Snippets
-            {'L3MON4D3/LuaSnip'},
-            {'rafamadriz/friendly-snippets'},
-
-        }
-    }
-
-    -- git 
-    use { 'tpope/vim-fugitive' }
-
-    -- format
-    use { 'sbdchd/neoformat' }
-
-    use {
-        'nvim-telescope/telescope.nvim', branch = '0.1.x',
-        requires = { {'nvim-lua/plenary.nvim'} }
-    }
-
-    -- Automatically set up configuration after cloning packer.nvim
-    if packer_bootstrap then
-        require('packer').sync()
-    end
-end)
diff --git a/stow/nvim/.config/nvim/lua/set.lua b/stow/nvim/.config/nvim/lua/set.lua
deleted file mode 100644 (file)
index 211c293..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-vim.opt.backspace = "indent,eol,start"
-vim.opt.lazyredraw = true
-vim.opt.number = true
-vim.opt.relativenumber = true
-vim.opt.scrolloff = 8
-vim.opt.showmatch = true
-vim.opt.expandtab = true
-vim.opt.tabstop = 4
-vim.opt.softtabstop = 4 -- <BS> deletes 4 spacesj
-vim.opt.shiftwidth = 4
-vim.opt.pastetoggle = "<F3>"
-vim.opt.termguicolors = true
-vim.opt.encoding = "utf-8"
-vim.opt.modeline = true
-vim.opt.history = 50
-vim.opt.errorbells = false
-vim.opt.visualbell  = false
-vim.opt.hidden = true
-vim.opt.joinspaces = false
-vim.opt.nrformats = ""
-vim.opt.mouse = "a"
-vim.opt.undofile = true
-vim.opt.wildmode = "longest:full"
-vim.opt.wildmenu = true
-vim.opt.wildignore = "*.pdf,*.fo,"
-vim.opt.title = true
-vim.opt.ruler = true
-vim.opt.showmode = true
-vim.opt.showcmd = true
-vim.opt.laststatus = 2
-vim.opt.hlsearch = true
-vim.opt.incsearch = true
-vim.opt.ignorecase = true
-vim.opt.smartcase = true
-vim.opt.background = "dark"
-vim.opt.autoindent = true
-vim.opt.listchars.tab = "→\\ "
-vim.opt.listchars.trail = "·"
-vim.opt.cursorline = true
-
-vim.opt.signcolumn = "yes"
-vim.opt.colorcolumn = "80"
-
-vim.opt.wrap = false
-
-vim.cmd [[
-let g:qs_highlight_on_keys = ['f', 'F', 't', 'T']
-augroup qs_colors
-    autocmd!
-    autocmd ColorScheme * highlight QuickScopePrimary guifg='#afff5f' gui=underline ctermfg=155 cterm=underline
-    autocmd ColorScheme * highlight QuickScopeSecondary guifg='#5fffff' gui=underline ctermfg=81 cterm=underline
-augroup END
-]]
-
-vim.cmd [[
-augroup jumplast
-    autocmd BufReadPost *
-          \ if line("'\"") >= 1 && line("'\"") <= line("$") && &ft !~# 'commit'
-          \ |   exe "normal! g`\""
-          \ | endif
-augroup END
-]]
index f01eea76da194fef6005f53a281b6f5a998db126..b5be2d39e2d2a598f7bba26d0bae2cce8c7d3d64 160000 (submodule)
@@ -1 +1 @@
-Subproject commit f01eea76da194fef6005f53a281b6f5a998db126
+Subproject commit b5be2d39e2d2a598f7bba26d0bae2cce8c7d3d64