summaryrefslogtreecommitdiff
path: root/neovim/.config/nvim/lua
diff options
context:
space:
mode:
Diffstat (limited to 'neovim/.config/nvim/lua')
-rw-r--r--neovim/.config/nvim/lua/.luarc.json43
-rw-r--r--neovim/.config/nvim/lua/config/colourscheme.lua6
-rw-r--r--neovim/.config/nvim/lua/config/colourscheme_dark.lua6
-rw-r--r--neovim/.config/nvim/lua/config/colourscheme_light.lua6
-rw-r--r--neovim/.config/nvim/lua/config/galaxyline.lua209
-rw-r--r--neovim/.config/nvim/lua/config/gitsigns.lua40
-rw-r--r--neovim/.config/nvim/lua/config/goyo.lua30
-rw-r--r--neovim/.config/nvim/lua/config/indent_blankline.lua3
-rw-r--r--neovim/.config/nvim/lua/config/lspsaga.lua18
-rw-r--r--neovim/.config/nvim/lua/config/neogit.lua25
-rw-r--r--neovim/.config/nvim/lua/config/nvim_cmp.lua47
-rw-r--r--neovim/.config/nvim/lua/config/nvim_dap.lua82
-rw-r--r--neovim/.config/nvim/lua/config/nvim_lspconfig.lua71
-rw-r--r--neovim/.config/nvim/lua/config/nvim_treesitter.lua25
-rw-r--r--neovim/.config/nvim/lua/config/tabby.lua30
-rw-r--r--neovim/.config/nvim/lua/config/vimux.lua15
-rw-r--r--neovim/.config/nvim/lua/plugins.lua200
-rw-r--r--neovim/.config/nvim/lua/settings.lua150
18 files changed, 1006 insertions, 0 deletions
diff --git a/neovim/.config/nvim/lua/.luarc.json b/neovim/.config/nvim/lua/.luarc.json
new file mode 100644
index 0000000..c157c38
--- /dev/null
+++ b/neovim/.config/nvim/lua/.luarc.json
@@ -0,0 +1,43 @@
+{
+ "workspace.library": [
+ "/home/gid/.config/nvim",
+ "/etc/xdg/nvim",
+ "/home/gid/.local/share/nvim/site",
+ "/home/gid/.local/share/nvim/site/pack/packer/start/cmp-buffer",
+ "/home/gid/.local/share/nvim/site/pack/packer/start/cmp-cmdline",
+ "/home/gid/.local/share/nvim/site/pack/packer/start/cmp-nvim-lsp",
+ "/home/gid/.local/share/nvim/site/pack/packer/start/cmp-path",
+ "/home/gid/.local/share/nvim/site/pack/packer/start/cmp-vsnip",
+ "/home/gid/.local/share/nvim/site/pack/packer/start/diffview.nvim",
+ "/home/gid/.local/share/nvim/site/pack/packer/start/gitsigns.nvim",
+ "/home/gid/.local/share/nvim/site/pack/packer/start/indent-blankline.nvim",
+ "/home/gid/.local/share/nvim/site/pack/packer/start/lsp-status.nvim",
+ "/home/gid/.local/share/nvim/site/pack/packer/start/lspsaga.nvim",
+ "/home/gid/.local/share/nvim/site/pack/packer/start/nerdcommenter",
+ "/home/gid/.local/share/nvim/site/pack/packer/start/nvim-cmp",
+ "/home/gid/.local/share/nvim/site/pack/packer/start/nvim-lspconfig",
+ "/home/gid/.local/share/nvim/site/pack/packer/start/nvim-treesitter",
+ "/home/gid/.local/share/nvim/site/pack/packer/start/packer.nvim",
+ "/home/gid/.local/share/nvim/site/pack/packer/start/plenary.nvim",
+ "/home/gid/.local/share/nvim/site/pack/packer/start/tabular",
+ "/home/gid/.local/share/nvim/site/pack/packer/start/telescope.nvim",
+ "/home/gid/.local/share/nvim/site/pack/packer/start/tokyonight.nvim",
+ "/home/gid/.local/share/nvim/site/pack/packer/start/ultisnips",
+ "/home/gid/.local/share/nvim/site/pack/packer/start/vim-devicons",
+ "/home/gid/.local/share/nvim/site/pack/packer/start/vim-plug",
+ "/home/gid/.local/share/nvim/site/pack/packer/start/vim-vsnip",
+ "/usr/share/nvim/runtime",
+ "/usr/share/nvim/runtime/pack/dist/opt/matchit",
+ "/usr/lib/nvim",
+ "/home/gid/.local/share/nvim/site/pack/packer/start/cmp-buffer/after",
+ "/home/gid/.local/share/nvim/site/pack/packer/start/cmp-cmdline/after",
+ "/home/gid/.local/share/nvim/site/pack/packer/start/cmp-nvim-lsp/after",
+ "/home/gid/.local/share/nvim/site/pack/packer/start/cmp-path/after",
+ "/home/gid/.local/share/nvim/site/pack/packer/start/cmp-vsnip/after",
+ "/home/gid/.local/share/nvim/site/pack/packer/start/tabular/after",
+ "/home/gid/.local/share/nvim/site/pack/packer/start/ultisnips/after",
+ "/usr/share/vim/vimfiles",
+ "${3rd}/luassert/library",
+ "${3rd}/luv/library"
+ ]
+} \ No newline at end of file
diff --git a/neovim/.config/nvim/lua/config/colourscheme.lua b/neovim/.config/nvim/lua/config/colourscheme.lua
new file mode 100644
index 0000000..62f453a
--- /dev/null
+++ b/neovim/.config/nvim/lua/config/colourscheme.lua
@@ -0,0 +1,6 @@
+local colorscheme = "adwaita"
+vim.o.background = "light" -- or "light" for light mode
+local ok, _ = pcall(vim.cmd, "colorscheme " .. colorscheme)
+if not ok then
+ vim.notify("colorscheme " .. colorscheme .. " not found!")
+end
diff --git a/neovim/.config/nvim/lua/config/colourscheme_dark.lua b/neovim/.config/nvim/lua/config/colourscheme_dark.lua
new file mode 100644
index 0000000..7588132
--- /dev/null
+++ b/neovim/.config/nvim/lua/config/colourscheme_dark.lua
@@ -0,0 +1,6 @@
+local colorscheme = "adwaita"
+vim.o.background = "dark" -- or "light" for light mode
+local ok, _ = pcall(vim.cmd, "colorscheme " .. colorscheme)
+if not ok then
+ vim.notify("colorscheme " .. colorscheme .. " not found!")
+end
diff --git a/neovim/.config/nvim/lua/config/colourscheme_light.lua b/neovim/.config/nvim/lua/config/colourscheme_light.lua
new file mode 100644
index 0000000..62f453a
--- /dev/null
+++ b/neovim/.config/nvim/lua/config/colourscheme_light.lua
@@ -0,0 +1,6 @@
+local colorscheme = "adwaita"
+vim.o.background = "light" -- or "light" for light mode
+local ok, _ = pcall(vim.cmd, "colorscheme " .. colorscheme)
+if not ok then
+ vim.notify("colorscheme " .. colorscheme .. " not found!")
+end
diff --git a/neovim/.config/nvim/lua/config/galaxyline.lua b/neovim/.config/nvim/lua/config/galaxyline.lua
new file mode 100644
index 0000000..a4bdf05
--- /dev/null
+++ b/neovim/.config/nvim/lua/config/galaxyline.lua
@@ -0,0 +1,209 @@
+local gl = require('galaxyline')
+local colors = {
+ yellow = vim.g.terminal_color_11,
+ cyan = vim.g.terminal_color_14,
+ darkblue = vim.g.terminal_color_4,
+ green = vim.g.terminal_color_10,
+ orange = vim.g.terminal_color_3,
+ violet = vim.g.terminal_color_5,
+ magenta = vim.g.terminal_color_13,
+ blue = vim.g.terminal_color_12,
+ red = vim.g.terminal_color_9,
+}
+local condition = require('galaxyline.condition')
+local gls = gl.section
+local lsp = require('galaxyline.provider_lsp')
+gl.short_line_list = {'nerdtree', 'NeogitStatus', 'vim-plug', 'lspsagaoutline'}
+
+gls.left[1] = {
+ RainbowBlue = {
+ provider = function() return '▊ ' end,
+ highlight = {colors.blue, 'StatusLine'}
+ },
+}
+gls.left[2] = {
+ ViMode = {
+ provider = function()
+ -- auto change color according the vim mode
+ local mode_color = {n = colors.red, i = colors.green,v=colors.blue,
+ ['^V'] = colors.blue,V=colors.blue,
+ c = colors.magenta,no = colors.red,s = colors.orange,
+ S=colors.orange,['^S'] = colors.orange,
+ ic = colors.yellow,R = colors.violet,Rv = colors.violet,
+ cv = colors.red,ce=colors.red, r = colors.cyan,
+ rm = colors.cyan, ['r?'] = colors.cyan,
+ ['!'] = colors.red,t = colors.red}
+ vim.api.nvim_command('hi GalaxyViMode guifg='..mode_color[vim.fn.mode()])
+ return ' '
+ end,
+ highlight = {colors.red, 'StatusLine', 'bold'},
+ },
+}
+
+gls.left[3] = {
+ FileSize = {
+ provider = 'FileSize',
+ condition = condition.buffer_not_empty,
+ highlight = {'StatusLine', 'StatusLine'},
+ }
+}
+gls.left[4] ={
+ FileIcon = {
+ provider = 'FileIcon',
+ condition = function()
+ if vim.g.GtkGuiLoaded ~= nil and condition.buffer_not_empty() then
+ return true
+ end
+ return false
+ end,
+ highlight = {require('galaxyline.provider_fileinfo').get_file_icon_color, 'StatusLine'},
+ },
+}
+
+gls.left[5] = {
+ FileName = {
+ provider = 'FileName',
+ condition = condition.buffer_not_empty,
+ highlight = {colors.magenta, 'StatusLine', 'bold'}
+ }
+}
+
+gls.left[6] = {
+ LineInfo = {
+ provider = 'LineColumn',
+ separator = ' ',
+ separator_highlight = {'NONE', 'StatusLine'},
+ highlight = {'NONE', 'StatusLine'},
+ },
+}
+
+gls.left[7] = {
+ PerCent = {
+ provider = 'LinePercent',
+ separator = ' ',
+ separator_highlight = {'NONE', 'StatusLine'},
+ highlight = {'NONE', 'StatusLine', 'bold'},
+ }
+}
+
+gls.left[8] = {
+ DiagnosticError = {
+ provider = 'DiagnosticError',
+ icon = '  ',
+ highlight = {colors.red, 'StatusLine'}
+ }
+}
+gls.left[9] = {
+ DiagnosticWarn = {
+ provider = 'DiagnosticWarn',
+ icon = '  ',
+ highlight = {colors.yellow, 'StatusLine'},
+ }
+}
+
+gls.left[10] = {
+ DiagnosticHint = {
+ provider = 'DiagnosticHint',
+ icon = '  ',
+ highlight = {colors.cyan, 'StatusLine'},
+ }
+}
+
+gls.left[11] = {
+ DiagnosticInfo = {
+ provider = 'DiagnosticInfo',
+ icon = '  ',
+ highlight = {colors.blue, 'StatusLine'},
+ }
+}
+
+gls.mid[1] = {
+ ShowLspClient = {
+ provider = 'GetLspClient',
+ condition = function ()
+ local tbl = {['dashboard'] = true,['']=true}
+ if tbl[vim.bo.filetype] then
+ return false
+ elseif lsp.get_lsp_client() == 'No Active Lsp' then
+ return false
+ end
+ return true
+ end,
+ icon = '⚙ LSP:',
+ highlight = {colors.cyan, 'StatusLine','bold'}
+ }
+}
+
+gls.right[1] = {
+ GitIcon = {
+ provider = function() return '  ' end,
+ condition = condition.check_git_workspace,
+ separator = ' ',
+ separator_highlight = {'NONE', 'StatusLine'},
+ highlight = {colors.violet, 'StatusLine', 'bold'},
+ }
+}
+
+gls.right[2] = {
+ GitBranch = {
+ provider = 'GitBranch',
+ condition = condition.check_git_workspace,
+ highlight = {colors.violet, 'StatusLine', 'bold'},
+ }
+}
+
+gls.right[3] = {
+ DiffAdd = {
+ provider = 'DiffAdd',
+ condition = condition.hide_in_width,
+ icon = ' +',
+ highlight = {colors.green, 'StatusLine'},
+ }
+}
+gls.right[4] = {
+ DiffModified = {
+ provider = 'DiffModified',
+ condition = condition.hide_in_width,
+ icon = ' ±',
+ highlight = {colors.orange, 'StatusLine'},
+ }
+}
+gls.right[5] = {
+ DiffRemove = {
+ provider = 'DiffRemove',
+ condition = condition.hide_in_width,
+ icon = ' -',
+ highlight = {colors.red, 'StatusLine'},
+ }
+}
+
+gls.right[6] = {
+ RainbowBlue = {
+ provider = function() return ' ▊' end,
+ highlight = {colors.blue, 'StatusLine'}
+ },
+}
+
+gls.short_line_left[1] = {
+ BufferType = {
+ provider = 'FileTypeName',
+ separator = ' ',
+ separator_highlight = {'NONE', 'StatusLine'},
+ highlight = {colors.blue, 'StatusLine', 'bold'}
+ }
+}
+
+gls.short_line_left[2] = {
+ SFileName = {
+ provider = 'SFileName',
+ condition = condition.buffer_not_empty,
+ highlight = {'StatusLine', 'StatusLine', 'bold'}
+ }
+}
+
+gls.short_line_right[1] = {
+ BufferIcon = {
+ provider= 'BufferIcon',
+ highlight = {'StatusLine', 'StatusLine'},
+ }
+}
diff --git a/neovim/.config/nvim/lua/config/gitsigns.lua b/neovim/.config/nvim/lua/config/gitsigns.lua
new file mode 100644
index 0000000..4f4e25c
--- /dev/null
+++ b/neovim/.config/nvim/lua/config/gitsigns.lua
@@ -0,0 +1,40 @@
+require('gitsigns').setup {
+ 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 '<Ignore>'
+ end, {expr=true})
+
+ map('n', '[c', function()
+ if vim.wo.diff then return '[c' end
+ vim.schedule(function() gs.prev_hunk() end)
+ return '<Ignore>'
+ end, {expr=true})
+
+ -- Actions
+ map({'n', 'v'}, '<leader>hs', ':Gitsigns stage_hunk<CR>')
+ map({'n', 'v'}, '<leader>hr', ':Gitsigns reset_hunk<CR>')
+ map('n', '<leader>hS', gs.stage_buffer)
+ map('n', '<leader>hu', gs.undo_stage_hunk)
+ map('n', '<leader>hR', gs.reset_buffer)
+ map('n', '<leader>hp', gs.preview_hunk)
+ map('n', '<leader>hb', function() gs.blame_line{full=true} end)
+ map('n', '<leader>tb', gs.toggle_current_line_blame)
+ map('n', '<leader>hd', gs.diffthis)
+ map('n', '<leader>hD', function() gs.diffthis('~') end)
+ map('n', '<leader>td', gs.toggle_deleted)
+
+ -- Text object
+ map({'o', 'x'}, 'ih', ':<C-U>Gitsigns select_hunk<CR>')
+ end
+}
diff --git a/neovim/.config/nvim/lua/config/goyo.lua b/neovim/.config/nvim/lua/config/goyo.lua
new file mode 100644
index 0000000..dcb7134
--- /dev/null
+++ b/neovim/.config/nvim/lua/config/goyo.lua
@@ -0,0 +1,30 @@
+vim.keymap.set('', '<Leader>z', '<cmd>Goyo<CR><CR>', {})
+vim.keymap.set('x', '<Leader>z', '<cmd>Goyo<CR>', {})
+
+local goyo_enter = function()
+ vim.opt.showmode = false
+ vim.opt.showcmd = false
+ vim.opt.scrolloff = 999
+ vim.cmd('Limelight')
+end
+
+local goyo_leave = function()
+ vim.opt.showmode = true
+ vim.opt.showcmd = true
+ vim.opt.scrolloff = 5
+ vim.cmd('Limelight!')
+end
+
+local goyo_augroup = vim.api.nvim_create_augroup('Goyo', { clear = true })
+vim.api.nvim_create_autocmd('User',
+ {
+ pattern = 'GoyoEnter',
+ group = goyo_augroup,
+ callback = goyo_enter,
+ })
+vim.api.nvim_create_autocmd('User',
+ {
+ pattern = 'GoyoLeave',
+ group = goyo_augroup,
+ callback = goyo_leave,
+ })
diff --git a/neovim/.config/nvim/lua/config/indent_blankline.lua b/neovim/.config/nvim/lua/config/indent_blankline.lua
new file mode 100644
index 0000000..16972b7
--- /dev/null
+++ b/neovim/.config/nvim/lua/config/indent_blankline.lua
@@ -0,0 +1,3 @@
+require "ibl".setup({
+ indent = { char = '▏' },
+})
diff --git a/neovim/.config/nvim/lua/config/lspsaga.lua b/neovim/.config/nvim/lua/config/lspsaga.lua
new file mode 100644
index 0000000..64a2624
--- /dev/null
+++ b/neovim/.config/nvim/lua/config/lspsaga.lua
@@ -0,0 +1,18 @@
+local lspsaga = require 'lspsaga'
+lspsaga.setup({
+ symbol_in_winbar = {
+ respect_root = true,
+ },
+})
+
+vim.keymap.set("n", "gh", "<cmd>Lspsaga finder<CR>", { silent = true })
+-- code action
+vim.keymap.set("n", "<leader>cx", "<cmd>Lspsaga code_action<CR>", { silent = true })
+vim.keymap.set("v", "<leader>cx", "<cmd><C-U>Lspsaga range_code_action<CR>", { silent = true })
+-- hover doc
+vim.keymap.set("n", "K", "<cmd>Lspsaga hover_doc<CR>", { silent = true })
+-- rename
+vim.keymap.set("n", "<leader>rn", "<cmd>Lspsaga rename<CR>", { silent = true })
+-- jump to diagnostics
+vim.keymap.set("n", "[g", "<cmd>Lspsaga diagnostic_jump_next<CR>", { silent = true })
+vim.keymap.set("n", "]g", "<cmd>Lspsaga diagnostic_jump_prev<CR>", { silent = true })
diff --git a/neovim/.config/nvim/lua/config/neogit.lua b/neovim/.config/nvim/lua/config/neogit.lua
new file mode 100644
index 0000000..6c4a36a
--- /dev/null
+++ b/neovim/.config/nvim/lua/config/neogit.lua
@@ -0,0 +1,25 @@
+local neogit = require("neogit")
+
+neogit.setup {
+ disable_commit_confirmation = true,
+ auto_refresh = true,
+ kind = 'tab',
+ commit_editor = {
+ kind = 'auto',
+ },
+ integrations = {
+ -- Neogit only provides inline diffs. If you want a more traditional way to look at diffs, you can use `sindrets/diffview.nvim`.
+ -- The diffview integration enables the diff popup, which is a wrapper around `sindrets/diffview.nvim`.
+ --
+ -- Requires you to have `sindrets/diffview.nvim` installed.
+ -- use {
+ -- 'TimUntersberger/neogit',
+ -- requires = {
+ -- 'nvim-lua/plenary.nvim',
+ -- 'sindrets/diffview.nvim'
+ -- }
+ -- }
+ --
+ diffview = true
+ }
+}
diff --git a/neovim/.config/nvim/lua/config/nvim_cmp.lua b/neovim/.config/nvim/lua/config/nvim_cmp.lua
new file mode 100644
index 0000000..2fe93f5
--- /dev/null
+++ b/neovim/.config/nvim/lua/config/nvim_cmp.lua
@@ -0,0 +1,47 @@
+local cmp = require'cmp'
+
+cmp.setup({
+ snippet = {
+ -- REQUIRED - you must specify a snippet engine
+ expand = function(args)
+ vim.fn["vsnip#anonymous"](args.body) -- For `vsnip` users.
+ end,
+ },
+ view = {
+ entries = {name = 'custom', selection_order = 'near_cursor' }
+ },
+ mapping = cmp.mapping.preset.insert({
+ ['<C-b>'] = cmp.mapping.scroll_docs(-4),
+ ['<C-f>'] = cmp.mapping.scroll_docs(4),
+ ['<C-Space>'] = cmp.mapping.complete(),
+ ['<C-e>'] = cmp.mapping.abort(),
+ ['<CR>'] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
+ }),
+ sources = cmp.config.sources({
+ { name = 'nvim_lsp' },
+ { name = 'nvim_lsp_signature_help' },
+ { name = 'vsnip' }, -- For vsnip users.
+ }, {
+ { name = 'buffer' },
+ }, {
+ { name = 'tmux' },
+ })
+})
+
+-- Use buffer source for `/` (if you enabled `native_menu`, this won't work anymore).
+cmp.setup.cmdline('/', {
+ sources = cmp.config.sources({
+ { name = 'nvim_lsp_document_symbol' }
+ }, {
+ { name = 'buffer' }
+ })
+})
+
+-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
+cmp.setup.cmdline(':', {
+ sources = cmp.config.sources({
+ { name = 'path' }
+ }, {
+ { name = 'cmdline' }
+ })
+})
diff --git a/neovim/.config/nvim/lua/config/nvim_dap.lua b/neovim/.config/nvim/lua/config/nvim_dap.lua
new file mode 100644
index 0000000..4d0180b
--- /dev/null
+++ b/neovim/.config/nvim/lua/config/nvim_dap.lua
@@ -0,0 +1,82 @@
+local dap = require'dap'
+vim.fn.sign_define('DapBreakpoint', {
+ text = '⬤',
+ texthl = 'ErrorMsg',
+ linehl = '',
+ numhl = 'ErrorMsg'
+})
+
+vim.fn.sign_define('DapBreakpointCondition', {
+ text = '⬤',
+ texthl = 'ErrorMsg',
+ linehl = '',
+ numhl = 'SpellBad'
+})
+
+local pythonPath = function()
+ local cwd = vim.loop.cwd()
+ if vim.fn.executable(cwd .. '/venv/bin/python') == 1 then
+ return cwd .. '/venv/bin/python'
+ else
+ return '/Users/michael/.pyenv/shims/python3'
+ end
+end
+
+local set_python_dap = function()
+ require('dap-python').setup() -- earlier so setup the various defaults ready to be replaced
+ dap.configurations.python = {
+ {
+ type = 'python';
+ request = 'launch';
+ name = "Launch file";
+ program = "${file}";
+ pythonPath = pythonPath()
+ },
+ {
+ type = 'python',
+ request = 'launch',
+ name = 'DAP Django',
+ program = vim.loop.cwd() .. '/manage.py',
+ args = {'runserver', '--noreload'},
+ justMyCode = true,
+ django = true,
+ console = "integratedTerminal",
+ },
+ {
+ type = 'python';
+ request = 'attach';
+ name = 'Attach remote';
+ connect = function()
+ return {
+ host = '127.0.0.1',
+ port = 5678
+ }
+ end;
+ },
+ {
+ type = 'python';
+ request = 'launch';
+ name = 'Launch file with arguments';
+ program = '${file}';
+ args = function()
+ local args_string = vim.fn.input('Arguments: ')
+ return vim.split(args_string, " +")
+ end;
+ console = "integratedTerminal",
+ pythonPath = pythonPath()
+ }
+ }
+
+ dap.adapters.python = {
+ type = 'executable',
+ command = pythonPath(),
+ args = {'-m', 'debugpy.adapter'}
+ }
+end
+
+set_python_dap()
+vim.api.nvim_create_autocmd({"DirChanged"}, {
+ callback = function() set_python_dap() end,
+})
+
+require("dapui").setup()
diff --git a/neovim/.config/nvim/lua/config/nvim_lspconfig.lua b/neovim/.config/nvim/lua/config/nvim_lspconfig.lua
new file mode 100644
index 0000000..abbf878
--- /dev/null
+++ b/neovim/.config/nvim/lua/config/nvim_lspconfig.lua
@@ -0,0 +1,71 @@
+local nvim_lsp = require('lspconfig')
+local capabilities = require('cmp_nvim_lsp').default_capabilities()
+-- Use a loop to conveniently call 'setup' on multiple servers and
+-- map buffer local keybindings when the language server attaches
+local servers = { "bashls", "clangd", "cssls", "gopls", "html", "jsonls", "pylsp", "rust_analyzer", "yamlls" }
+for _, lsp in ipairs(servers) do
+ nvim_lsp[lsp].setup {
+ capabilities = capabilities,
+ flags = {
+ debounce_text_changes = 150,
+ }
+ }
+end
+
+require'lspconfig'.lua_ls.setup {
+ on_init = function(client)
+ local path = client.workspace_folders[1].name
+ if vim.loop.fs_stat(path..'/.luarc.json') or vim.loop.fs_stat(path..'/.luarc.jsonc') then
+ return
+ end
+
+ client.config.settings.Lua = vim.tbl_deep_extend('force', client.config.settings.Lua, {
+ runtime = {
+ -- Tell the language server which version of Lua you're using
+ -- (most likely LuaJIT in the case of Neovim)
+ version = 'LuaJIT'
+ },
+ -- Make the server aware of Neovim runtime files
+ workspace = {
+ checkThirdParty = false,
+ library = {
+ vim.env.VIMRUNTIME
+ -- Depending on the usage, you might want to add additional paths here.
+ -- "${3rd}/luv/library"
+ -- "${3rd}/busted/library",
+ }
+ -- or pull in all of 'runtimepath'. NOTE: this is a lot slower
+ -- library = vim.api.nvim_get_runtime_file("", true)
+ }
+ })
+ end,
+ settings = {
+ Lua = {}
+ },
+ capabilities = capabilities,
+}
+
+require'lspconfig'.tsserver.setup {
+ filetypes = { 'typescript', 'typescriptreact', 'typescript.tsx' },
+ capabilities = capabilities,
+ flags = {
+ debounce_text_changes = 150,
+ },
+}
+
+-- Use LspAttach autocommand to only map the following keys
+-- after the language server attaches to the current buffer
+vim.api.nvim_create_autocmd('LspAttach', {
+ group = vim.api.nvim_create_augroup('UserLspConfig', {}),
+ callback = function(ev)
+ -- Enable completion triggered by <c-x><c-o>
+ vim.bo[ev.buf].omnifunc = 'v:lua.vim.lsp.omnifunc'
+
+ local opts = { buffer = ev.buf }
+ vim.keymap.set('n', 'gd', '<cmd>lua vim.lsp.buf.definition()<CR>', { noremap = true })
+ vim.keymap.set('x', '<leader>f', '<cmd>lua vim.lsp.buf.range_formatting()<CR>', {})
+ vim.keymap.set('n', '<leader>f', function()
+ vim.lsp.buf.format { async = true }
+ end, opts)
+ end,
+})
diff --git a/neovim/.config/nvim/lua/config/nvim_treesitter.lua b/neovim/.config/nvim/lua/config/nvim_treesitter.lua
new file mode 100644
index 0000000..0a3a71f
--- /dev/null
+++ b/neovim/.config/nvim/lua/config/nvim_treesitter.lua
@@ -0,0 +1,25 @@
+require'nvim-treesitter.configs'.setup {
+ ensure_installed = { "bash", "c", "cmake", "cpp", "css", "go", "html", "json", "lua", "make", "markdown", "markdown_inline", "python", "rust", "toml", "typescript", "vim" }, -- one of "all", "maintained" (parsers with maintainers), or a list of languages
+ ignore_install = {}, -- List of parsers to ignore installing
+ highlight = {
+ enable = true, -- false will disable the whole extension
+ disable = {}, -- list of language that will be disabled
+ -- 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,
+ },
+ incremental_selection = {
+ enable = true,
+ keymaps = {
+ init_selection = "gnn",
+ node_incremental = "grn",
+ scope_incremental = "grc",
+ node_decremental = "grm",
+ },
+ },
+ indent = {
+ enable = true
+ }
+}
diff --git a/neovim/.config/nvim/lua/config/tabby.lua b/neovim/.config/nvim/lua/config/tabby.lua
new file mode 100644
index 0000000..1b64ac6
--- /dev/null
+++ b/neovim/.config/nvim/lua/config/tabby.lua
@@ -0,0 +1,30 @@
+local theme = {
+ fill = 'TabLineFill',
+ -- Also you can do this: fill = { fg='#f2e9de', bg='#907aa9', style='italic' }
+ head = 'TabLine',
+ current_tab = 'TabLineSel',
+ tab = 'TabLine',
+ win = 'TabLine',
+ tail = 'TabLine',
+}
+require('tabby.tabline').set(function(line)
+ return {
+ {
+ line.sep('', theme.head, theme.fill),
+ },
+ line.tabs().foreach(function(tab)
+ local hl = tab.is_current() and theme.current_tab or theme.tab
+ return {
+ line.sep('', hl, theme.fill),
+ tab.is_current() and '' or '',
+ tab.number(),
+ tab.name(),
+ tab.close_btn(''),
+ line.sep('', hl, theme.fill),
+ hl = hl,
+ margin = ' ',
+ }
+ end),
+ hl = theme.fill,
+ }
+end)
diff --git a/neovim/.config/nvim/lua/config/vimux.lua b/neovim/.config/nvim/lua/config/vimux.lua
new file mode 100644
index 0000000..16348dc
--- /dev/null
+++ b/neovim/.config/nvim/lua/config/vimux.lua
@@ -0,0 +1,15 @@
+vim.g.VimuxUseNearest = 0
+vim.gVimuxResetSequence = ""
+
+-- Prompt for a command to run
+vim.keymap.set('', '<Leader>vp', '<cmd>VimuxPromptCommand<CR>', {})
+-- Run last command executed by VimuxRunCommand
+vim.keymap.set('', '<Leader>vl', '<cmd>VimuxRunLastCommand<CR>', {})
+-- Inspect runner pane
+vim.keymap.set('', '<Leader>vi', '<cmd>VimuxInspectRunner<CR>', {})
+-- Close vim tmux runner opened by VimuxRunCommand
+vim.keymap.set('', '<Leader>vq', '<cmd>VimuxCloseRunner<CR>', {})
+-- Interrupt any command running in the runner pane
+vim.keymap.set('', '<Leader>vx', '<cmd>VimuxPromptInterruptRunner<CR>', {})
+-- Zoom the runner pane (use <bind-key> z to restore runner pane)
+vim.keymap.set('', '<Leader>vz', '<cmd>call VimuxZoomRunner()<CR>', {})
diff --git a/neovim/.config/nvim/lua/plugins.lua b/neovim/.config/nvim/lua/plugins.lua
new file mode 100644
index 0000000..83afc45
--- /dev/null
+++ b/neovim/.config/nvim/lua/plugins.lua
@@ -0,0 +1,200 @@
+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 {
+ 'luisjure/csound-vim',
+ ft = 'csound',
+ }
+ use {
+ 'nvimdev/galaxyline.nvim',
+ branch = 'main',
+ requires = { { 'nvim-tree/nvim-web-devicons', opt = true } },
+ config = [[require('config.galaxyline')]],
+ after = { 'vim-colors-xcode' },
+ }
+ use {
+ 'lewis6991/gitsigns.nvim',
+ config = [[require('config.gitsigns')]],
+ }
+ use {
+ 'junegunn/goyo.vim',
+ cond = function() return vim.fn.exists('g:GtkGuiLoaded') == 1 end,
+ requires = {
+ {
+ 'junegunn/limelight.vim',
+ cond = function() return vim.fn.exists('g:GtkGuiLoaded') == 1 end,
+ },
+ },
+ config = [[require('config.goyo')]],
+ }
+ use {
+ 'lukas-reineke/indent-blankline.nvim',
+ config = [[require('config.indent_blankline')]],
+ }
+ use {
+ 'nvimdev/lspsaga.nvim',
+ after = { 'nvim-lspconfig' },
+ requires = { { 'nvim-tree/nvim-web-devicons' } },
+ config = [[require('config.lspsaga')]],
+ }
+ use 'preservim/nerdcommenter'
+ use {
+ "nvim-neo-tree/neo-tree.nvim",
+ branch = "v3.x",
+ requires = {
+ "nvim-lua/plenary.nvim",
+ "nvim-tree/nvim-web-devicons", -- not strictly required, but recommended
+ "MunifTanjim/nui.nvim",
+ -- "3rd/image.nvim", -- Optional image support in preview window: See `# Preview Mode` for more information
+ },
+ setup = function ()
+ vim.keymap.set('', '<F8>', '<cmd>Neotree toggle<CR>', { noremap = true })
+ end
+ }
+ use {
+ 'NeogitOrg/neogit',
+ cmd = 'Neogit',
+ requires = { { 'nvim-lua/plenary.nvim' }, { 'sindrets/diffview.nvim' } },
+ config = [[require('config.neogit')]],
+ setup = function()
+ vim.keymap.set('', '<leader>g', '<cmd>Neogit<CR>', {})
+ end,
+ }
+ use {
+ 'hrsh7th/nvim-cmp',
+ requires = {
+ {
+ 'andersevenrud/cmp-tmux',
+ cond = function() return vim.fn.exists('g:GtkGuiLoaded') == 0 end
+ },
+ {
+ 'hrsh7th/cmp-nvim-lsp'
+ },
+ {
+ 'hrsh7th/cmp-nvim-lsp-signature-help'
+ },
+ {
+ 'hrsh7th/cmp-nvim-lsp-document-symbol'
+ },
+ {
+ 'hrsh7th/cmp-buffer'
+ },
+ {
+ 'hrsh7th/cmp-path'
+ },
+ {
+ 'hrsh7th/cmp-cmdline'
+ },
+ {
+ 'hrsh7th/cmp-vsnip',
+ requires = 'hrsh7th/vim-vsnip'
+ }
+ },
+ config = [[require('config.nvim_cmp')]],
+ }
+ use {
+ 'arzg/vim-colors-xcode',
+ config = 'vim.cmd[[colorscheme xcode]]'
+ }
+ use {
+ 'mfussenegger/nvim-dap',
+ requires = { { 'mfussenegger/nvim-dap-python', 'rcarriga/nvim-dap-ui', 'nvim-neotest/nvim-nio' } },
+ config = [[require('config.nvim_dap')]],
+ }
+ use {
+ 'neovim/nvim-lspconfig',
+ config = [[require('config.nvim_lspconfig')]],
+ }
+ use {
+ 'prettier/vim-prettier',
+ }
+ use {
+ 'nvim-treesitter/nvim-treesitter',
+ run = ':TSUpdate',
+ config = [[require('config.nvim_treesitter')]],
+ }
+ use 'wbthomason/packer.nvim'
+ use {
+ 'nvim-telescope/telescope.nvim',
+ requires = { { 'nvim-lua/plenary.nvim' } },
+ config = function()
+ vim.keymap.set('n', '<F3>', '<cmd>Telescope buffers<CR>', { noremap = true })
+ vim.keymap.set('n', '<F4>', '<cmd>Telescope find_files<CR>', { noremap = true })
+ vim.keymap.set('n', '<F6>', '<cmd>Telescope live_grep<CR>', { noremap = true })
+ end,
+ }
+ use {
+ 'supercollider/scvim',
+ config = function()
+ vim.g.scFlash = 1
+ end,
+ ft = 'supercollider',
+ }
+ use {
+ 'nanozuki/tabby.nvim',
+ requires = {
+ {
+ 'nvim-tree/nvim-web-devicons',
+ }
+ },
+ config = [[require('config.tabby')]],
+ cond = function() return vim.fn.has('gui_running') == 0 end,
+ }
+ use 'godlygeek/tabular'
+ use {
+ 'mbbill/undotree',
+ cmd = 'UndotreeToggle',
+ setup = function()
+ vim.keymap.set('n', '<F5>', '<cmd>UndotreeToggle<CR>', { noremap = true })
+ end,
+ }
+ use {
+ 'linux-cultist/venv-selector.nvim',
+ branch = 'regexp',
+ config = function ()
+ require'venv-selector'.setup()
+ vim.keymap.set('n', ',v', '<cmd>VenvSelect<CR>', { noremap = true })
+ end
+ }
+ use 'ryanoasis/vim-devicons'
+ use {
+ 'Glench/Vim-Jinja2-Syntax',
+ ft = 'jinja',
+ }
+ use {
+ 'plasticboy/vim-markdown',
+ config = function()
+ vim.g.vim_markdown_folding_disabled = 1
+ end,
+ ft = 'markdown',
+ }
+ use 'junegunn/vim-plug'
+ use {
+ 'tmux-plugins/vim-tmux',
+ cond = function() return vim.fn.exists('g:GtkGuiLoaded') == 0 end,
+ }
+ use {
+ 'tmux-plugins/vim-tmux-focus-events',
+ cond = function() return vim.fn.exists('g:GtkGuiLoaded') == 0 end,
+ }
+ use {
+ 'benmills/vimux',
+ cond = function() return vim.fn.exists('g:GtkGuiLoaded') == 0 end,
+ config = [[require('config.vimux')]],
+ }
+
+ if packer_bootstrap then
+ require('packer').sync()
+ end
+end)
diff --git a/neovim/.config/nvim/lua/settings.lua b/neovim/.config/nvim/lua/settings.lua
new file mode 100644
index 0000000..7afe46f
--- /dev/null
+++ b/neovim/.config/nvim/lua/settings.lua
@@ -0,0 +1,150 @@
+require('config.colourscheme')
+-- General settings
+
+vim.g.loaded_python_provider = 1
+vim.g.python3_host_prog = '/Users/michael/.pyenv/shims/python3'
+vim.g.loaded_perl_provider = 0
+vim.g.loaded_ruby_provider = 0
+
+vim.opt.rnu = true
+vim.opt.number = true
+vim.opt.hlsearch = true
+vim.opt.incsearch = true
+vim.opt.backspace = { 'indent', 'eol', 'start' }
+vim.opt.visualbell = true
+vim.opt.clipboard:append { 'unnamedplus' }
+vim.opt.completeopt = { 'menuone', 'noselect' }
+vim.opt.cmdheight = 0
+vim.opt.expandtab = true
+vim.opt.wrap = false
+vim.opt.shiftwidth = 4
+vim.opt.softtabstop = 4
+vim.opt.smarttab = true
+vim.opt.encoding = 'utf-8'
+vim.opt.foldenable = false
+vim.opt.linebreak = true
+vim.opt.showbreak = '↪ '
+vim.opt.breakindent = true
+vim.opt.termguicolors = true
+vim.cmd[[
+syntax on
+ filetype on
+ filetype plugin on
+ filetype plugin indent on
+ highlight Comment cterm=italic gui=italic
+]]
+vim.opt.backup = false
+vim.opt.writebackup = false
+vim.opt.updatetime = 300
+vim.opt.shortmess:append 'c'
+vim.opt.signcolumn = 'yes'
+
+vim.keymap.set("", "<A-{>", "<cmd>tabprevious<CR>", { noremap=true })
+vim.keymap.set("", "<A-}>", "<cmd>tabnext<CR>", { noremap=true })
+
+-- Autocommands
+
+local indent_rules_augroup = vim.api.nvim_create_augroup('Indents', {})
+vim.api.nvim_create_autocmd( { 'FileType' }, {
+ pattern = { 'make', 'sh' },
+ group = indent_rules_augroup,
+ callback = function()
+ vim.opt_local.tabstop = 8
+ vim.opt_local.shiftwidth = 8
+ vim.opt_local.softtabstop = 0
+ vim.opt_local.expandtab = false
+ end
+})
+vim.api.nvim_create_autocmd( { 'FileType' }, {
+ pattern = { 'go' },
+ group = indent_rules_augroup,
+ callback = function()
+ vim.opt_local.tabstop = 4
+ vim.opt_local.shiftwidth = 4
+ vim.opt_local.softtabstop = 0
+ vim.opt_local.expandtab = false
+ end
+})
+vim.api.nvim_create_autocmd( { 'FileType' }, {
+ pattern = { 'javascript', 'lua' },
+ group = indent_rules_augroup,
+ callback = function()
+ vim.opt_local.tabstop = 2
+ vim.opt_local.shiftwidth = 2
+ vim.opt_local.softtabstop = 2
+ end
+})
+
+local wrap_rules_augroup = vim.api.nvim_create_augroup('Wrap', {})
+vim.api.nvim_create_autocmd( { 'FileType' }, {
+ pattern = { 'markdown', 'rst', 'text' },
+ group = wrap_rules_augroup,
+ callback = function()
+ vim.opt_local.wrap = true
+ end
+})
+
+local terminal_rules_augroup = vim.api.nvim_create_augroup('Terminal', {})
+vim.api.nvim_create_autocmd( { 'TermOpen' }, {
+ pattern = { '*' },
+ group = terminal_rules_augroup,
+ callback = function()
+ vim.cmd('startinsert')
+ vim.opt_local.scrollback = 100000
+ vim.opt_local.modified = true
+ vim.opt_local.bufhidden = 'hide'
+ vim.opt_local.statusline = vim.api.nvim_buf_get_var(0, 'term_title')
+ vim.opt_local.number = false
+ vim.opt_local.rnu = false
+ vim.cmd('match Errormsg ""')
+ end
+})
+
+-- Terminal
+vim.cmd[[
+ tnoremap <Esc> <C-\><C-n>
+ tnoremap <A-h> <C-\><C-N><C-w>h
+ tnoremap <A-j> <C-\><C-N><C-w>j
+ tnoremap <A-k> <C-\><C-N><C-w>k
+ tnoremap <A-l> <C-\><C-N><C-w>l
+ inoremap <A-h> <C-\><C-N><C-w>h
+ inoremap <A-j> <C-\><C-N><C-w>j
+ inoremap <A-k> <C-\><C-N><C-w>k
+ inoremap <A-l> <C-\><C-N><C-w>l
+ nnoremap <A-h> <C-w>h
+ nnoremap <A-j> <C-w>j
+ nnoremap <A-k> <C-w>k
+ nnoremap <A-l> <C-w>l
+
+ let g:term_buf = 0
+ let g:term_win = 0
+
+ function! Term_toggle(height)
+ if win_gotoid(g:term_win)
+ hide
+ else
+ botright new
+ exec "resize ". a:height
+ try
+ exec "buffer " . g:term_buf
+ catch
+ call termopen($SHELL, {"detach": 0})
+ keepalt file Terminal
+ let g:term_buf = bufnr("")
+ endtry
+ let g:term_win = win_getid()
+ endif
+ endfunction
+
+ nnoremap <Leader>t :call Term_toggle(15)<CR>
+]]
+
+-- Tab navigation in gui
+if vim.fn.has('gui_running') == 1 then
+ vim.keymap.set('n', '<A-{>', '<cmd>tabp<CR>', { noremap = true, silent = true })
+ vim.keymap.set('v', '<A-{>', '<cmd>tabp<CR>', { noremap = true, silent = true })
+ vim.keymap.set('i', '<A-{>', '<Esc><cmd>tabp<CR>', { noremap = true, silent = true })
+ vim.keymap.set('n', '<A-}>', '<cmd>tabn<CR>', { noremap = true, silent = true })
+ vim.keymap.set('v', '<A-}>', '<cmd>tabn<CR>', { noremap = true, silent = true })
+ vim.keymap.set('i', '<A-}>', '<Esc><cmd>tabn<CR>', { noremap = true, silent = true })
+end