mirror of https://github.com/fredrikekre/.dotfiles
13 changed files with 374 additions and 302 deletions
@ -0,0 +1,74 @@
@@ -0,0 +1,74 @@
|
||||
-- Leader have to be set before any plugins are loaded |
||||
vim.g.mapleader = " " |
||||
|
||||
-- Various mappings |
||||
vim.keymap.set("i", "jk", "<Esc>") |
||||
|
||||
-- Enable termguicolors |
||||
vim.opt.termguicolors = true |
||||
|
||||
-- Line numbers |
||||
vim.opt.number = true |
||||
vim.opt.relativenumber = true |
||||
|
||||
|
||||
-- Use OS clipboard for yank/paste |
||||
vim.opt.clipboard = "unnamedplus" |
||||
|
||||
-- Tab and indent settings |
||||
vim.opt.tabstop = 4 |
||||
vim.opt.softtabstop = 4 |
||||
vim.opt.shiftwidth = 4 |
||||
vim.opt.expandtab = true |
||||
vim.opt.smarttab = true |
||||
vim.opt.autoindent = true |
||||
|
||||
-- Highlight without moving |
||||
vim.keymap.set("n", "*", "*``") |
||||
|
||||
-- More natural split directions |
||||
vim.opt.splitbelow = true |
||||
vim.opt.splitright = true |
||||
|
||||
-- Auto-resize splits when terminal window changes size |
||||
-- (e.g. when splitting or zooming with tmux) |
||||
vim.api.nvim_create_autocmd( {"VimResized"}, {pattern = "*", command = "wincmd ="}) |
||||
|
||||
-- Keep some lines above/below cursor |
||||
vim.opt.scrolloff = 10 |
||||
|
||||
-- Disable mouse (default on since neovim 0.8) |
||||
vim.opt.mouse = "" |
||||
|
||||
-- Show trailing whitespace etc |
||||
vim.opt.list = true |
||||
vim.opt.listchars = {tab = ">-", trail = "-", nbsp = "+"} |
||||
|
||||
-- Autocommands |
||||
local augroup_julia = vim.api.nvim_create_augroup("FileTypeJulia", {}) |
||||
vim.api.nvim_create_autocmd( |
||||
{"FileType"}, |
||||
{ |
||||
group = augroup_julia, |
||||
pattern = "julia", |
||||
callback = function(ev) |
||||
vim.opt_local.textwidth = 92 |
||||
vim.opt_local.colorcolumn = "93" |
||||
end, |
||||
} |
||||
) |
||||
|
||||
-- Bootstrap lazy.nvim |
||||
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" |
||||
if not (vim.uv or vim.loop).fs_stat(lazypath) then |
||||
local lazyrepo = "https://github.com/folke/lazy.nvim.git" |
||||
vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath }) |
||||
end |
||||
vim.opt.rtp:prepend(lazypath) |
||||
|
||||
-- Load lazy and configure plugins |
||||
require("lazy").setup({ |
||||
spec = {import = "plugins"}, |
||||
install = {colorscheme = {"catppuccin-mocha"}}, |
||||
change_detection = {notify = false}, |
||||
}) |
||||
@ -1,163 +0,0 @@
@@ -1,163 +0,0 @@
|
||||
set runtimepath^=~/.vim runtimepath+=~/.vim/after |
||||
let &packpath = &runtimepath |
||||
source ~/.vimrc |
||||
|
||||
lua << EOF |
||||
|
||||
-- Setup nvim-cmp. |
||||
vim.opt.completeopt = {"menu", "menuone", "noselect"} |
||||
|
||||
local cmp = require('cmp') |
||||
local cmp_types = require('cmp.types') |
||||
local source_mapping = {buffer = '[Buffer]', nvim_lsp = '[LSP]'} |
||||
|
||||
cmp.setup({ |
||||
snippet = { |
||||
expand = function(args) |
||||
require('luasnip').lsp_expand(args.body) -- For `luasnip` users. |
||||
end, |
||||
}, |
||||
mapping = cmp.mapping.preset.insert({ |
||||
-- ['<C-n>'] = cmp.mapping(cmp.mapping.select_next_item({ behavior = cmp_types.cmp.SelectBehavior.Insert })), |
||||
-- This is to make <C-n> the hotkey for both initiating completion and select next item |
||||
['<C-n>'] = function(fallback) |
||||
if cmp.visible() then |
||||
cmp.select_next_item({ behavior = cmp_types.cmp.SelectBehavior.Insert }) |
||||
elseif (function() |
||||
local line, col = 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)() then |
||||
cmp.complete() |
||||
else |
||||
fallback() |
||||
end |
||||
end, |
||||
['<C-p>'] = cmp.mapping.select_prev_item({ behavior = cmp_types.cmp.SelectBehavior.Insert }), |
||||
['<C-f>'] = cmp.mapping.scroll_docs( 4), |
||||
['<C-b>'] = cmp.mapping.scroll_docs(-4), |
||||
['<C-Space>'] = cmp.mapping.complete(), -- same as <C-n> above |
||||
['<C-e>'] = cmp.mapping.abort(), |
||||
['<CR>'] = cmp.mapping.confirm({ select = false }), |
||||
}), |
||||
sources = cmp.config.sources({ |
||||
{ name = 'nvim_lsp' }, |
||||
{ name = 'luasnip' }, |
||||
}, |
||||
{ |
||||
{ name = 'buffer' }, |
||||
}), |
||||
completion = {keyword_length = 4}, |
||||
formatting = { |
||||
format = function(entry, vim_item) |
||||
vim_item.menu = source_mapping[entry.source.name] |
||||
return vim_item |
||||
end, |
||||
}, |
||||
}) |
||||
|
||||
-- Setup lspconfig: capabilities is passed to lspconfig.$server.setup |
||||
local capabilities = require('cmp_nvim_lsp').default_capabilities() |
||||
|
||||
-- Set LSP keymappings in on_attach (i.e. only in buffers with LSP active) |
||||
local on_attach = function(client, bufnr) |
||||
local opts = { noremap=true, silent=true } |
||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', 'K', '<cmd>lua vim.lsp.buf.hover()<CR>', opts) |
||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gd', '<cmd>lua vim.lsp.buf.definition()<CR>', opts) |
||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<leader>lrn', '<cmd>lua vim.lsp.buf.rename()<CR>', opts) |
||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<leader>lrr', '<cmd>lua vim.lsp.buf.references()<CR>', opts) |
||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<leader>lca', '<cmd>lua vim.lsp.buf.code_action({apply = true})<CR>', opts) |
||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<leader>lqf', '<cmd>lua vim.lsp.buf.code_action({apply = true})<CR>', opts) |
||||
vim.api.nvim_buf_set_keymap(bufnr, 'i', '<C-h>', '<cmd>lua vim.lsp.buf.signature_help()<CR>', opts) |
||||
end |
||||
|
||||
-- Julia LSP (LanguageServer.jl) |
||||
local REVISE_LANGUAGESERVER = false |
||||
require'lspconfig'.julials.setup({ |
||||
on_new_config = function(new_config, _) |
||||
local julia = vim.fn.expand("~/.julia/environments/nvim-lspconfig/bin/julia") |
||||
if REVISE_LANGUAGESERVER then |
||||
new_config.cmd[5] = (new_config.cmd[5]):gsub("using LanguageServer", "using Revise; using LanguageServer; LanguageServer.USE_REVISE[] = true") |
||||
elseif require'lspconfig'.util.path.is_file(julia) then |
||||
new_config.cmd[1] = julia |
||||
end |
||||
end, |
||||
-- This just adds dirname(fname) as a fallback (see nvim-lspconfig#1768). |
||||
root_dir = function(fname) |
||||
local util = require'lspconfig.util' |
||||
return util.root_pattern 'Project.toml'(fname) or util.find_git_ancestor(fname) or |
||||
util.path.dirname(fname) |
||||
end, |
||||
on_attach = function(client, bufnr) |
||||
on_attach(client, bufnr) |
||||
-- Disable automatic formatexpr since the LS.jl formatter isn't so nice. |
||||
vim.bo[bufnr].formatexpr = '' |
||||
end, |
||||
capabilities = capabilities, |
||||
}) |
||||
|
||||
-- Rust LSP (rust_analyzer) |
||||
require('lspconfig').rust_analyzer.setup({ |
||||
on_attach = on_attach, |
||||
capabilities = capabilities, |
||||
}) |
||||
|
||||
-- C/++ LSP (clangd) |
||||
require('lspconfig').clangd.setup({ |
||||
on_attach = on_attach, |
||||
capabilities = capabilities, |
||||
}) |
||||
|
||||
-- null-ls |
||||
require("null-ls").setup({ |
||||
sources = { |
||||
require("null-ls").builtins.diagnostics.shellcheck, |
||||
}, |
||||
}) |
||||
|
||||
-- Go LSP (gopls) |
||||
require('lspconfig').gopls.setup({ |
||||
on_attach = on_attach, |
||||
capabilities = capabilities, |
||||
}) |
||||
|
||||
-- YAML LSP (yaml-language-server) |
||||
require('lspconfig').yamlls.setup({ |
||||
on_attach = on_attach, |
||||
capabilities = capabilities, |
||||
}) |
||||
|
||||
-- Ansible LSP (ansible-language-server) |
||||
require'lspconfig'.ansiblels.setup({ |
||||
on_attach = on_attach, |
||||
capabilities = capabilities, |
||||
}) |
||||
|
||||
-- Terraform LSP (terraform-ls) |
||||
require'lspconfig'.terraformls.setup({ |
||||
on_attach = on_attach, |
||||
capabilities = capabilities, |
||||
}) |
||||
|
||||
|
||||
require('gitsigns').setup({ |
||||
signs = { |
||||
add = { text = '+'}, |
||||
change = { text = '±'}, |
||||
}, |
||||
on_attach = function(bufnr) |
||||
-- Hunk navigation |
||||
local opts = { expr=true, noremap=true, silent=true, } |
||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', ']c', "&diff ? ']c' : '<cmd>Gitsigns next_hunk<CR>'", opts) |
||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', '[c', "&diff ? '[c' : '<cmd>Gitsigns prev_hunk<CR>'", opts) |
||||
-- Hunk actions |
||||
local opts = { noremap=true, silent=true, } |
||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<leader>hs', '<cmd>Gitsigns stage_hunk<CR>', opts) |
||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<leader>hr', '<cmd>Gitsigns reset_hunk<CR>', opts) |
||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<leader>hp', '<cmd>Gitsigns preview_hunk<CR>', opts) |
||||
end, |
||||
attach_to_untracked = false, |
||||
}) |
||||
|
||||
-- require('coverage').setup() |
||||
|
||||
EOF |
||||
@ -0,0 +1,13 @@
@@ -0,0 +1,13 @@
|
||||
-- Plugins that don't require any advanced config |
||||
return { |
||||
"vim-airline/vim-airline", |
||||
config = function() |
||||
vim.g["airline_theme"] = "bubblegum" |
||||
vim.g["airline#extensions#tabline#enabled"] = 1 |
||||
vim.g["airline_skip_empty_sections"] = 1 |
||||
vim.opt.showmode = false |
||||
end, |
||||
dependencies = { |
||||
{"vim-airline/vim-airline-themes"}, |
||||
}, |
||||
} |
||||
@ -0,0 +1,10 @@
@@ -0,0 +1,10 @@
|
||||
-- catppuccin colorscheme |
||||
-- https://github.com/catppuccin/nvim |
||||
return { |
||||
"catppuccin/nvim", |
||||
name = "catppuccin", |
||||
priority = 1000, |
||||
config = function() |
||||
vim.cmd("colorscheme catppuccin-mocha") |
||||
end, |
||||
} |
||||
@ -0,0 +1,80 @@
@@ -0,0 +1,80 @@
|
||||
-- Completions with nvim-cmp and friends |
||||
-- https://github.com/hrsh7th/nvim-cmp |
||||
|
||||
local function configure_cmp() |
||||
|
||||
local cmp = require("cmp") |
||||
local cmp_types = require("cmp.types") |
||||
|
||||
local source_mapping = { |
||||
nvim_lsp = "[LSP]", |
||||
luasnip = "[LuaSnip]", |
||||
path = "[Path]", |
||||
buffer = "[Buffer]", |
||||
} |
||||
|
||||
cmp.setup({ |
||||
-- Expand snippets with cmp_luasnip |
||||
snippet = { |
||||
expand = function(args) |
||||
require("luasnip").lsp_expand(args.body) |
||||
end, |
||||
}, |
||||
-- Keybindings |
||||
mapping = cmp.mapping.preset.insert({ |
||||
-- ["<C-n>"] = cmp.mapping(cmp.mapping.select_next_item({ behavior = cmp_types.cmp.SelectBehavior.Insert })), |
||||
-- This is to make <C-n> the hotkey for both initiating completion and select next item |
||||
["<C-n>"] = function(fallback) |
||||
if cmp.visible() then |
||||
cmp.select_next_item({ behavior = cmp_types.cmp.SelectBehavior.Insert }) |
||||
elseif (function() |
||||
local line, col = 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)() then |
||||
cmp.complete() |
||||
else |
||||
fallback() |
||||
end |
||||
end, |
||||
["<C-p>"] = cmp.mapping.select_prev_item({ behavior = cmp_types.cmp.SelectBehavior.Insert }), |
||||
["<C-f>"] = cmp.mapping.scroll_docs( 4), |
||||
["<C-b>"] = cmp.mapping.scroll_docs(-4), |
||||
["<C-Space>"] = cmp.mapping.complete(), -- same as <C-n> above |
||||
["<C-e>"] = cmp.mapping.abort(), |
||||
["<CR>"] = cmp.mapping.confirm({ select = false }), |
||||
}), |
||||
-- TODO: Why are these separate? Priority? |
||||
sources = cmp.config.sources( |
||||
{ |
||||
{ name = "nvim_lsp" }, |
||||
{ name = "luasnip" }, |
||||
{ name = "path" }, |
||||
}, { |
||||
{ name = "buffer" }, |
||||
} |
||||
), |
||||
completion = { |
||||
keyword_length = 4, |
||||
completeopt = "menu,menuone,noselect", |
||||
}, |
||||
formatting = { |
||||
format = function(entry, vim_item) |
||||
vim_item.menu = source_mapping[entry.source.name] |
||||
return vim_item |
||||
end, |
||||
}, |
||||
}) |
||||
end |
||||
|
||||
return { |
||||
"hrsh7th/nvim-cmp", |
||||
dependencies = { |
||||
{"hrsh7th/cmp-nvim-lsp"}, |
||||
{"hrsh7th/cmp-buffer"}, |
||||
{"hrsh7th/cmp-path"}, |
||||
-- Snippet engine(s) required for nvim-cmp (expands things from LS) |
||||
{"L3MON4D3/LuaSnip"}, |
||||
{"saadparwaiz1/cmp_luasnip"}, |
||||
}, |
||||
config = configure_cmp, |
||||
} |
||||
@ -0,0 +1,12 @@
@@ -0,0 +1,12 @@
|
||||
-- https://github.com/github/copilot.vim |
||||
|
||||
return { |
||||
"github/copilot.vim", |
||||
config = function() |
||||
vim.g.copilot_filetypes = { |
||||
["*"] = false, |
||||
julia = true, |
||||
markdown = true, |
||||
} |
||||
end, |
||||
} |
||||
@ -0,0 +1,16 @@
@@ -0,0 +1,16 @@
|
||||
-- fzf.vim, fzf |
||||
-- https://github.com/junegunn/fzf.vim |
||||
-- https://github.com/junegunn/fzf |
||||
|
||||
return { |
||||
"junegunn/fzf.vim", |
||||
commit = "1e054c1d075d87903647db9320116d360eb8b024", |
||||
config = function() |
||||
vim.keymap.set("n", "<C-F>", ":Rg!<CR>") |
||||
-- TODO: Use vim.keymap.set |
||||
vim.cmd("nnoremap <expr> <C-p> len(system('git rev-parse')) ? ':Files!<CR>' : ':GFiles!<CR>'") |
||||
end, |
||||
dependencies = { |
||||
{"junegunn/fzf", commit = "952b6af4454ed55626d78e3845c6b5b640ac831d"}, |
||||
}, |
||||
} |
||||
@ -0,0 +1,35 @@
@@ -0,0 +1,35 @@
|
||||
-- https://github.com/lewis6991/gitsigns.nvim |
||||
|
||||
local function configure_gitsigns() |
||||
local gitsigns = require("gitsigns") |
||||
gitsigns.setup({ |
||||
on_attach = function(bufnr) |
||||
local opts = {buffer = bufnr, silent = true} |
||||
-- Hunk navigation |
||||
for _, x in pairs({{key = "]c", dir = "next"}, {key = "[c", dir = "prev"}}) do |
||||
vim.keymap.set( |
||||
"n", x.key, |
||||
function() |
||||
if vim.wo.diff then |
||||
vim.cmd.normal({x.key, bang = true}) |
||||
else |
||||
gitsigns.nav_hunk(x.dir) |
||||
end |
||||
end, |
||||
opts |
||||
) |
||||
end |
||||
-- Hunk actions |
||||
vim.keymap.set("n", "<leader>hs", gitsigns.stage_hunk) |
||||
vim.keymap.set("n", "<leader>hr", gitsigns.reset_hunk) |
||||
-- vim.keymap.set("v", "<leader>hs", function() gitsigns.stage_hunk {vim.fn.line("."), vim.fn.line("v")} end) |
||||
-- vim.keymap.set("v", "<leader>hr", function() gitsigns.reset_hunk {vim.fn.line("."), vim.fn.line("v")} end) |
||||
vim.keymap.set("n", "<leader>hp", gitsigns.preview_hunk) |
||||
end |
||||
}) |
||||
end |
||||
|
||||
return { |
||||
"lewis6991/gitsigns.nvim", |
||||
config = configure_gitsigns, |
||||
} |
||||
@ -0,0 +1,17 @@
@@ -0,0 +1,17 @@
|
||||
-- Plugins that don't require any advanced config |
||||
return { |
||||
-- https://github.com/christoomey/vim-tmux-navigator |
||||
{"christoomey/vim-tmux-navigator"}, |
||||
-- https://github.com/JuliaEditorSupport/julia-vim |
||||
{"JuliaEditorSupport/julia-vim"}, |
||||
-- https://github.com/tpope/vim-commentary |
||||
{"tpope/vim-commentary"}, |
||||
-- https://github.com/tpope/vim-fugitive |
||||
{"tpope/vim-fugitive"}, |
||||
-- https://github.com/tpope/vim-rhubarb |
||||
{"tpope/vim-rhubarb"}, |
||||
-- https://github.com/nvim-lua/plenary.nvim |
||||
{"nvim-lua/plenary.nvim"}, |
||||
-- https://github.com/andythigpen/nvim-coverage |
||||
{"andythigpen/nvim-coverage"}, |
||||
} |
||||
@ -0,0 +1,78 @@
@@ -0,0 +1,78 @@
|
||||
-- nvim-lspconfig, https://github.com/neovim/nvim-lspconfig |
||||
|
||||
-- Set LSP keymappings in on_attach (i.e. only in buffers with LSP active) |
||||
-- TODO: lspconfig recommend doing this in an LspAttach autocommand instead |
||||
local on_attach = function(client, bufnr) |
||||
local opts = { buffer = bufnr, silent = true } |
||||
vim.keymap.set("n", "K", vim.lsp.buf.hover, opts) |
||||
vim.keymap.set("n", "gd", vim.lsp.buf.definition, opts) |
||||
vim.keymap.set("n", "<leader>lrn", vim.lsp.buf.rename, opts) |
||||
vim.keymap.set("n", "<leader>lrr", vim.lsp.buf.references, opts) |
||||
vim.keymap.set("n", "<leader>lca", function() vim.lsp.buf.code_action({apply = true}) end, opts) |
||||
vim.keymap.set("n", "<leader>lqf", function() vim.lsp.buf.code_action({apply = true}) end, opts) |
||||
vim.keymap.set("i", "<C-h>", vim.lsp.buf.signature_help, opts) |
||||
vim.keymap.set("v", "<leader>lfmt", function() vim.lsp.buf.format({timeout_ms = 1000000}) end, opts) |
||||
end |
||||
|
||||
-- Setup lspconfig: capabilities is passed to lspconfig.$server.setup |
||||
-- TODO: Why don't I have to make_client_capabilities and extend? |
||||
local capabilities = require("cmp_nvim_lsp").default_capabilities() |
||||
|
||||
local default_opts = { |
||||
on_attach = on_attach, |
||||
capabilities = capabilities, |
||||
} |
||||
|
||||
local servers = { |
||||
-- Rust LSP (rust_analyzer) |
||||
rust_analyzer = default_opts, |
||||
-- C/C++ LSP (clangd) |
||||
clangd = default_opts, |
||||
-- Go LSP (gopls) |
||||
gopls = default_opts, |
||||
-- YAML LSP (yaml-language-server) |
||||
yamlls = default_opts, |
||||
-- Ansible LSP (ansible-language-server) |
||||
ansiblels = default_opts, |
||||
-- Terraform LSP (terraform-ls) |
||||
terraformls = default_opts, |
||||
-- Julia LSP (LanguageServer.jl) |
||||
julials = vim.tbl_extend( |
||||
"force", |
||||
default_opts, |
||||
{ |
||||
on_new_config = function(new_config, _) |
||||
local julia = vim.fn.expand("~/.julia/environments/nvim-lspconfig/bin/julia") |
||||
local REVISE_LANGUAGESERVER = false |
||||
if REVISE_LANGUAGESERVER then |
||||
new_config.cmd[5] = (new_config.cmd[5]):gsub("using LanguageServer", "using Revise; using LanguageServer; LanguageServer.USE_REVISE[] = true") |
||||
elseif require(lspconfig).util.path.is_file(julia) then |
||||
new_config.cmd[1] = julia |
||||
end |
||||
end, |
||||
-- This just adds dirname(fname) as a fallback (see nvim-lspconfig#1768). |
||||
root_dir = function(fname) |
||||
local util = require("lspconfig.util") |
||||
return util.root_pattern "Project.toml"(fname) or util.find_git_ancestor(fname) or |
||||
util.path.dirname(fname) |
||||
end, |
||||
on_attach = function(client, bufnr) |
||||
on_attach(client, bufnr) |
||||
-- Disable automatic formatexpr since the LS.jl formatter isn't so nice. |
||||
vim.bo[bufnr].formatexpr = "" |
||||
end, |
||||
} |
||||
), |
||||
} |
||||
|
||||
local function configure_lsp() |
||||
lspconfig = require("lspconfig") |
||||
for name, opts in pairs(servers) do |
||||
lspconfig[name].setup(opts) |
||||
end |
||||
end |
||||
|
||||
return { |
||||
"neovim/nvim-lspconfig", |
||||
config = configure_lsp, |
||||
} |
||||
@ -0,0 +1,16 @@
@@ -0,0 +1,16 @@
|
||||
-- https://github.com/jose-elias-alvarez/null-ls.nvim |
||||
return { |
||||
"jose-elias-alvarez/null-ls.nvim", |
||||
dependencies = { |
||||
{"nvim-lua/plenary.nvim"}, |
||||
}, |
||||
config = function() |
||||
local null_ls = require("null-ls") |
||||
local opts = { |
||||
sources = { |
||||
null_ls.builtins.diagnostics.shellcheck, |
||||
}, |
||||
} |
||||
null_ls.setup(opts) |
||||
end, |
||||
} |
||||
@ -0,0 +1,23 @@
@@ -0,0 +1,23 @@
|
||||
-- vim-slime, https://github.com/jpalardy/vim-slime |
||||
|
||||
-- This expands {last} to a fixed pane id. This is done in the override function |
||||
-- in order to delay the expansion until first usage instead of when Vim starts. |
||||
-- TODO: Luaify this? Define this as a lua function, register it to be called |
||||
-- from vimscript by the plugin? |
||||
vim.cmd([[ |
||||
function! SlimeOverrideConfig() |
||||
let l:last_pane_id = trim(system('tmux display -pt "{last}" "#{pane_id}"')) |
||||
let b:slime_config = {"socket_name": "default", "target_pane": l:last_pane_id} |
||||
endfunction |
||||
]] |
||||
) |
||||
|
||||
return { |
||||
"jpalardy/vim-slime", |
||||
config = function() |
||||
vim.g["slime_target"] = "tmux" |
||||
vim.g["slime_bracketed_paste"] = 1 |
||||
vim.keymap.set("n", "<S-CR>", "<Plug>SlimeParagraphSend") |
||||
vim.keymap.set("x", "<S-CR>", "<Plug>SlimeRegionSend") |
||||
end, |
||||
} |
||||
Loading…
Reference in new issue