summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Stück <adam@adast.dk>2024-08-28 08:58:46 +0200
committerAdam Stück <adam@adast.dk>2024-08-28 08:58:46 +0200
commit42af051a2339acdc893d11014b0543aabf4c08da (patch)
treea09726f5151f05a05f0374a93776837f0d9e1e1f
parent163b8df4567aa7afb94ed311a178a16496d8f602 (diff)
nvim: add nvim-conf git submodule
m---------.config/nvim0
-rw-r--r--.config/nvim/init.lua5
-rw-r--r--.config/nvim/lua/mappings.lua61
-rw-r--r--.config/nvim/lua/options.lua75
-rw-r--r--.config/nvim/lua/plugins.lua187
-rw-r--r--.config/nvim/lua/post.lua2
-rw-r--r--.config/nvim/lua/pre.lua1
-rw-r--r--.config/nvim/lua/setup/bufferline.lua14
-rw-r--r--.config/nvim/lua/setup/fugitive.lua6
-rw-r--r--.config/nvim/lua/setup/gitsigns.lua8
-rw-r--r--.config/nvim/lua/setup/indent-blankline.lua19
-rw-r--r--.config/nvim/lua/setup/kommentary.lua3
-rw-r--r--.config/nvim/lua/setup/lsp_signature.lua3
-rw-r--r--.config/nvim/lua/setup/lspconfig.lua28
-rw-r--r--.config/nvim/lua/setup/lualine.lua44
-rw-r--r--.config/nvim/lua/setup/nvim-cmp.lua52
-rw-r--r--.config/nvim/lua/setup/nvim-tree.lua26
-rw-r--r--.config/nvim/lua/setup/nvim-treesitter.lua5
-rw-r--r--.config/nvim/lua/setup/onedark.lua2
-rw-r--r--.config/nvim/lua/setup/telescope.lua32
-rw-r--r--.gitmodules3
21 files changed, 3 insertions, 573 deletions
diff --git a/.config/nvim b/.config/nvim
new file mode 160000
+Subproject 0d3f6134b5d35ac39deb631a8a3433b89998c14
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', '<C-L>', ':nohl<CR><C-L>', opts)
-map('n', 'n', 'nzzzv', opts)
-map('n', 'N', 'Nzzzv', opts)
--- map('i', 'kj', '<Esc>', opts)
--- map('t', 'kj', '<C-\\><C-n>', { noremap = true })
-map('t', '<C-\\>', '<C-\\><C-n>', { noremap = true })
-
-map('i', ',', ',<c-g>u', opts)
-map('i', '.', '.<c-g>u', opts)
-map('i', '[', '[<c-g>u', opts)
-map('i', '!', '!<c-g>u', opts)
-map('i', '?', '?<c-g>u', opts)
-
-map('v', 'J', ":m '>+1<CR>gv=gv", opts)
-map('v', 'K', ":m '<-2<CR>gv=gv", opts)
-
-map('n', '<leader>h', ':wincmd h<CR>', opts)
-map('n', '<leader>j', ':wincmd j<CR>', opts)
-map('n', '<leader>k', ':wincmd k<CR>', opts)
-map('n', '<leader>l', ':wincmd l<CR>', opts)
-map('n', '<leader><left>', ':wincmd h<CR>', opts)
-map('n', '<leader><down>', ':wincmd j<CR>', opts)
-map('n', '<leader><up>', ':wincmd k<CR>', opts)
-map('n', '<leader><right>', ':wincmd l<CR>', opts)
-
-map('n', '<leader>p', '<cmd>Telescope find_files<cr>', opts)
-map('n', '<leader>b', '<cmd>Telescope buffers<cr>', opts)
-map('n', '<leader>h', '<cmd>Telescope help_tags<cr>', opts)
-map('n', '<leader>lg', '<cmd>Telescope live_grep<cr>', opts)
-
-map('n', '<leader>ds', '<cmd>Telescope lsp_document_symbols<cr>', opts)
-map('n', '<leader>ws', '<cmd>Telescope lsp_workspace_symbols<cr>', opts)
-map('n', '<leader>gd', '<cmd>Telescope lsp_definitions<cr>', opts)
-map('n', '<leader>gD', '<cmd>Telescope lsp_declarations<cr>', opts)
-map('n', '<leader>gr', '<cmd>Telescope lsp_references<cr>', opts)
-map('n', '<leader>gi', '<cmd>Telescope lsp_implementations<cr>', opts)
-map('n', 'K', '<cmd>lua vim.lsp.buf.hover()<cr>', opts)
-map('n', '<C-k>', '<cmd>lua vim.lsp.buf.signature_help()<cr>', opts)
-map('n', '<leader>rn', '<cmd>lua vim.lsp.buf.rename()<cr>', opts)
-map('n', '<leader>xn', '<cmd>lua vim.diagnostic.goto_next()<cr>', opts)
-map('n', '<leader>xN', '<cmd>lua vim.diagnostic.goto_prev()<cr>', opts)
-map('n', '<leader>xx', '<cmd>Telescope lsp_code_actions<cr>', opts)
-map('n', '<leader>xX', '<cmd>Telescope lsp_range_code_actions<cr>', opts)
-
-map('n', ']b', ':bnext<CR>', opts)
-map('n', '[b', ':bprevious<CR>', opts)
-map('n', '[B', ':bfirst<CR>', opts)
-map('n', ']B', ':blast<CR>', opts)
-map('n', '<A-t>', ':buffer #<CR>', opts)
-
-map('n', '<leader>co', ':cwindow<CR>', opts)
-map('n', ']q', ':cnext<CR>', opts)
-map('n', '[q', ':cprevious<CR>', opts)
-map('n', '[Q', ':cfirst<CR>', opts)
-map('n', ']Q', ':clast<CR>', 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 = '<F11>'
-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({
- ['<CR>'] = cmp.mapping.confirm({ select = true }),
- ['<C-n>'] = cmp.mapping.select_next_item(),
- ['<C-p>'] = cmp.mapping.select_prev_item(),
- ['<C-f>'] = cmp.mapping.scroll_docs(4),
- ['<C-d>'] = cmp.mapping.scroll_docs(-4),
- ['<C-e>'] = cmp.mapping.close(),
- ["<Tab>"] = 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" }),
-
- ["<S-Tab>"] = 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,
- },
-}
diff --git a/.gitmodules b/.gitmodules
new file mode 100644
index 0000000..6588564
--- /dev/null
+++ b/.gitmodules
@@ -0,0 +1,3 @@
+[submodule ".config/nvim"]
+ path = .config/nvim
+ url = https://git.sr.ht/~adamski/nvim-conf