Convert single quote to double quotes.
parent
e909a2c826
commit
a5401bb9a8
|
@ -1,26 +1,26 @@
|
|||
local M = {}
|
||||
|
||||
function M.nvim_dap()
|
||||
local dap = require('dap')
|
||||
local key = 'codelldb'
|
||||
local dap = require("dap")
|
||||
local key = "codelldb"
|
||||
|
||||
dap.adapters[key] = {
|
||||
type = 'server',
|
||||
port = '${port}',
|
||||
type = "server",
|
||||
port = "${port}",
|
||||
executable = {
|
||||
command = 'codelldb',
|
||||
args = {'--port', '${port}'},
|
||||
command = "codelldb",
|
||||
args = { "--port", "${port}" },
|
||||
},
|
||||
}
|
||||
|
||||
local config = {
|
||||
name = 'Launch Executable',
|
||||
name = "Launch Executable",
|
||||
type = key,
|
||||
request = 'launch',
|
||||
request = "launch",
|
||||
program = function()
|
||||
return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file')
|
||||
return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/", "file")
|
||||
end,
|
||||
cwd = '${workspaceFolder}',
|
||||
cwd = "${workspaceFolder}",
|
||||
}
|
||||
|
||||
dap.configurations.c = dap.configurations.c or {}
|
||||
|
@ -31,7 +31,7 @@ function M.nvim_dap()
|
|||
end
|
||||
|
||||
function M.nvim_lspconfig()
|
||||
require('utils.lsp').setup(require('lspconfig').clangd) {}
|
||||
require("utils.lsp").setup(require("lspconfig").clangd) {}
|
||||
end
|
||||
|
||||
return M
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
local M = {}
|
||||
|
||||
function M.nvim_lspconfig()
|
||||
require('utils.lsp').setup(require('lspconfig').lua_ls) {
|
||||
require("utils.lsp").setup(require("lspconfig").lua_ls) {
|
||||
-- Provide completions, analysis, and location handling for plugins on the
|
||||
-- vim runtime path.
|
||||
-- https://github.com/neovim/nvim-lspconfig/blob/48347089666d5b77d054088aa72e4e0b58026e6e/doc/server_configurations.md#lua_ls
|
||||
on_init = function(client)
|
||||
local path = client.workspace_folders[1].name
|
||||
if (
|
||||
not vim.loop.fs_stat(path .. '/.luarc.json') and
|
||||
not vim.loop.fs_stat(path .. '/.luarc.jsonc')
|
||||
not vim.loop.fs_stat(path .. "/.luarc.json") and
|
||||
not vim.loop.fs_stat(path .. "/.luarc.jsonc")
|
||||
) then
|
||||
client.config.settings = vim.tbl_deep_extend(
|
||||
'force', client.config.settings, {
|
||||
"force", client.config.settings, {
|
||||
Lua = {
|
||||
runtime = {
|
||||
version = 'LuaJIT'
|
||||
version = "LuaJIT"
|
||||
},
|
||||
workspace = {
|
||||
checkThirdParty = false,
|
||||
|
|
|
@ -1,36 +1,36 @@
|
|||
local M = {}
|
||||
|
||||
function M.nvim_dap()
|
||||
local dap = require('dap')
|
||||
local key = 'debugpy'
|
||||
local dap = require("dap")
|
||||
local key = "debugpy"
|
||||
|
||||
dap.adapters[key] = {
|
||||
type = 'executable',
|
||||
command = 'python3',
|
||||
args = { '-m', 'debugpy.adapter' },
|
||||
type = "executable",
|
||||
command = "python3",
|
||||
args = { "-m", "debugpy.adapter" },
|
||||
options = {
|
||||
source_filetype = 'python',
|
||||
source_filetype = "python",
|
||||
},
|
||||
}
|
||||
|
||||
dap.configurations.python = dap.configurations.python or {}
|
||||
table.insert(dap.configurations.python, {
|
||||
name = 'Launch File',
|
||||
name = "Launch File",
|
||||
type = key,
|
||||
request = 'launch',
|
||||
program = '${file}',
|
||||
cwd = '${workspaceFolder}',
|
||||
request = "launch",
|
||||
program = "${file}",
|
||||
cwd = "${workspaceFolder}",
|
||||
})
|
||||
end
|
||||
|
||||
function M.nvim_lspconfig()
|
||||
require('utils.lsp').setup(require('lspconfig').pylsp) {
|
||||
require("utils.lsp").setup(require("lspconfig").pylsp) {
|
||||
settings = {
|
||||
pylsp = {
|
||||
-- `flake8` currently fails in some cases. Prefer the default set of
|
||||
-- utilities instead.
|
||||
-- https://github.com/python-lsp/python-lsp-server/pull/434
|
||||
configurationSources = 'pycodestyle',
|
||||
configurationSources = "pycodestyle",
|
||||
plugins = {
|
||||
autopep8 = { enabled = false },
|
||||
black = { enabled = true },
|
||||
|
|
|
@ -1,22 +1,22 @@
|
|||
local M = {}
|
||||
|
||||
local cmp = require('cmp')
|
||||
local cmp_buffer = require('cmp_buffer')
|
||||
local luasnip = require('luasnip')
|
||||
local types = require('cmp.types')
|
||||
local cmp = require("cmp")
|
||||
local cmp_buffer = require("cmp_buffer")
|
||||
local luasnip = require("luasnip")
|
||||
local types = require("cmp.types")
|
||||
|
||||
function M.setup()
|
||||
cmp.setup {
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
require('luasnip').lsp_expand(args.body)
|
||||
require("luasnip").lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
sources = {
|
||||
{ name = 'luasnip', option = { show_autosnippets = true } },
|
||||
{ name = 'nvim_lsp' },
|
||||
{ name = "luasnip", option = { show_autosnippets = true } },
|
||||
{ name = "nvim_lsp" },
|
||||
{
|
||||
name = 'buffer',
|
||||
name = "buffer",
|
||||
option = {
|
||||
-- Complete only on visible buffers.
|
||||
get_bufnrs = function()
|
||||
|
@ -51,23 +51,23 @@ function M.setup()
|
|||
},
|
||||
},
|
||||
mapping = {
|
||||
['<tab>'] = cmp.mapping(function(fallback)
|
||||
["<tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.confirm({ select = true })
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { 'i', 's' }),
|
||||
end, { "i", "s" }),
|
||||
|
||||
['<c-l>'] = cmp.mapping(function(fallback)
|
||||
["<c-l>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.abort()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { 'i', 's' }),
|
||||
end, { "i", "s" }),
|
||||
|
||||
['<c-n>'] = cmp.mapping(function(fallback)
|
||||
["<c-n>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
elseif luasnip.expand_or_locally_jumpable() then
|
||||
|
@ -75,9 +75,9 @@ function M.setup()
|
|||
else
|
||||
fallback()
|
||||
end
|
||||
end, { 'i', 's' }),
|
||||
end, { "i", "s" }),
|
||||
|
||||
['<c-p>'] = cmp.mapping(function(fallback)
|
||||
["<c-p>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
elseif luasnip.locally_jumpable(-1) then
|
||||
|
@ -85,7 +85,7 @@ function M.setup()
|
|||
else
|
||||
fallback()
|
||||
end
|
||||
end, { 'i', 's' }),
|
||||
end, { "i", "s" }),
|
||||
},
|
||||
}
|
||||
end
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
local M = {}
|
||||
|
||||
local dap = require('dap')
|
||||
local dap_ui = require('dap.ui')
|
||||
local dap_ui_widgets = require('dap.ui.widgets')
|
||||
local dap = require("dap")
|
||||
local dap_ui = require("dap.ui")
|
||||
local dap_ui_widgets = require("dap.ui.widgets")
|
||||
|
||||
local function query_launch()
|
||||
local command = vim.fn.input('Launch> ', vim.fn.getcwd() .. '/', 'file')
|
||||
vim.api.nvim_echo({ { '', 'None' } }, false, {})
|
||||
local command = vim.fn.input("Launch> ", vim.fn.getcwd() .. "/", "file")
|
||||
vim.api.nvim_echo({ { "", "None" } }, false, {})
|
||||
|
||||
local parts = vim.split(command, '%s+', { trimempty = true })
|
||||
local parts = vim.split(command, "%s+", { trimempty = true })
|
||||
if not parts[1] then
|
||||
vim.api.nvim_err_writeln('Invalid command specification.')
|
||||
vim.api.nvim_err_writeln("Invalid command specification.")
|
||||
return
|
||||
end
|
||||
|
||||
|
@ -19,19 +19,19 @@ end
|
|||
|
||||
-- Adaptation of https://github.com/mfussenegger/nvim-dap/blob/e154fdb6d70b3765d71f296e718b29d8b7026a63/lua/dap.lua#L413.
|
||||
local function select_config_and_run()
|
||||
local filetype = vim.api.nvim_buf_get_option(0, 'filetype')
|
||||
local filetype = vim.api.nvim_buf_get_option(0, "filetype")
|
||||
local configs = dap.configurations[filetype] or {}
|
||||
assert(
|
||||
vim.tbl_islist(configs),
|
||||
string.format(
|
||||
'`dap.configurations.%s` must be a list of configurations, got %s',
|
||||
"`dap.configurations.%s` must be a list of configurations, got %s",
|
||||
filetype,
|
||||
vim.inspect(configs)
|
||||
)
|
||||
)
|
||||
if not configs[1] then
|
||||
local msg = 'No configuration found for `%s`. You need to add configs ' ..
|
||||
'to `dap.configurations.%s` (See `:h dap-configuration`)'
|
||||
local msg = "No configuration found for `%s`. You need to add configs " ..
|
||||
"to `dap.configurations.%s` (See `:h dap-configuration`)"
|
||||
vim.api.nvim_err_writeln(string.format(msg, filetype, filetype))
|
||||
return
|
||||
end
|
||||
|
@ -41,17 +41,17 @@ local function select_config_and_run()
|
|||
|
||||
dap_ui.pick_if_many(
|
||||
configs,
|
||||
'Configuration: ',
|
||||
"Configuration: ",
|
||||
function(c) -- Label function
|
||||
return c.name
|
||||
end,
|
||||
function(c) -- Callback
|
||||
if not c then
|
||||
vim.api.nvim_err_writeln('No configuration selected.')
|
||||
vim.api.nvim_err_writeln("No configuration selected.")
|
||||
return
|
||||
end
|
||||
local copy = vim.deepcopy(c)
|
||||
if copy.request == 'launch' then
|
||||
if copy.request == "launch" then
|
||||
local program, args = query_launch()
|
||||
copy.program = program
|
||||
copy.args = args
|
||||
|
@ -93,21 +93,21 @@ function M.buffer_map()
|
|||
else
|
||||
local win_id = vim.fn.win_getid()
|
||||
vim.cmd.wincmd('t') -- Move to topleft-most window.
|
||||
vim.cmd(sidebar_any_open() and 'leftabove split' or 'vertical topleft split')
|
||||
vim.cmd(sidebar_any_open() and "leftabove split" or "vertical topleft split")
|
||||
sidebar.open()
|
||||
vim.fn.win_gotoid(win_id)
|
||||
-- Update state of windows.
|
||||
vim.api.nvim_win_set_option(sidebar.win, 'colorcolumn', '')
|
||||
vim.api.nvim_win_set_option(sidebar.win, 'list', false)
|
||||
vim.api.nvim_win_set_option(sidebar.win, 'wrap', false)
|
||||
vim.api.nvim_win_set_option(sidebar.win, 'winfixwidth', true)
|
||||
vim.api.nvim_win_set_option(sidebar.win, "colorcolumn", "")
|
||||
vim.api.nvim_win_set_option(sidebar.win, "list", false)
|
||||
vim.api.nvim_win_set_option(sidebar.win, "wrap", false)
|
||||
vim.api.nvim_win_set_option(sidebar.win, "winfixwidth", true)
|
||||
end
|
||||
end
|
||||
|
||||
local function sidebar_only(sidebar)
|
||||
for _, sb in pairs(sidebars) do
|
||||
if sb ~= sidebar and sidebar_is_open(sb) then
|
||||
sb.close({ mode = 'toggle' })
|
||||
sb.close({ mode = "toggle" })
|
||||
end
|
||||
end
|
||||
if not sidebar_is_open(sidebar) then
|
||||
|
@ -151,9 +151,9 @@ function M.buffer_map()
|
|||
local win_id = vim.fn.win_getid()
|
||||
vim.cmd.wincmd('b') -- Move to bottomright-most window.
|
||||
dap.repl.open({}, term_is_open() and
|
||||
'vertical rightbelow split' or
|
||||
string.format('rightbelow %dsplit', height))
|
||||
vim.api.nvim_win_set_option(0, 'winfixheight', true)
|
||||
"vertical rightbelow split" or
|
||||
string.format("rightbelow %dsplit", height))
|
||||
vim.api.nvim_win_set_option(0, "winfixheight", true)
|
||||
vim.fn.win_gotoid(win_id)
|
||||
end
|
||||
|
||||
|
@ -165,9 +165,9 @@ function M.buffer_map()
|
|||
local win_id = vim.fn.win_getid()
|
||||
vim.cmd.wincmd('b') -- Move to bottomright-most window.
|
||||
vim.cmd(repl_is_open() and
|
||||
'vertical rightbelow split' or
|
||||
string.format('rightbelow %dsplit', height))
|
||||
vim.api.nvim_win_set_option(0, 'winfixheight', true)
|
||||
"vertical rightbelow split" or
|
||||
string.format("rightbelow %dsplit", height))
|
||||
vim.api.nvim_win_set_option(0, "winfixheight", true)
|
||||
vim.api.nvim_win_set_buf(0, find_bufnr_by_pattern("^%[dap%-terminal]"))
|
||||
vim.fn.win_gotoid(win_id)
|
||||
end
|
||||
|
@ -196,43 +196,43 @@ function M.buffer_map()
|
|||
end
|
||||
|
||||
local function set_nnoremap(key, func)
|
||||
local input = string.format('<localleader>%s', key)
|
||||
vim.keymap.set('n', input, func, { buffer = true })
|
||||
local input = string.format("<localleader>%s", key)
|
||||
vim.keymap.set("n", input, func, { buffer = true })
|
||||
end
|
||||
|
||||
set_nnoremap('<localleader>', select_config_and_run)
|
||||
set_nnoremap('b', dap.toggle_breakpoint)
|
||||
set_nnoremap('c', function()
|
||||
if dap.status() == '' then
|
||||
vim.api.nvim_err_writeln('No active session.')
|
||||
set_nnoremap("<localleader>", select_config_and_run)
|
||||
set_nnoremap("b", dap.toggle_breakpoint)
|
||||
set_nnoremap("c", function()
|
||||
if dap.status() == "" then
|
||||
vim.api.nvim_err_writeln("No active session.")
|
||||
return
|
||||
end
|
||||
dap.continue()
|
||||
end)
|
||||
|
||||
set_nnoremap('d', dap.down)
|
||||
set_nnoremap('i', dap.step_into)
|
||||
set_nnoremap('n', dap.step_over)
|
||||
set_nnoremap('o', dap.step_out)
|
||||
set_nnoremap('q', dap.close)
|
||||
set_nnoremap('r', dap.run_to_cursor)
|
||||
set_nnoremap('u', dap.up)
|
||||
set_nnoremap('x', dap.clear_breakpoints)
|
||||
set_nnoremap("d", dap.down)
|
||||
set_nnoremap("i", dap.step_into)
|
||||
set_nnoremap("n", dap.step_over)
|
||||
set_nnoremap("o", dap.step_out)
|
||||
set_nnoremap("q", dap.close)
|
||||
set_nnoremap("r", dap.run_to_cursor)
|
||||
set_nnoremap("u", dap.up)
|
||||
set_nnoremap("x", dap.clear_breakpoints)
|
||||
|
||||
set_nnoremap('wf', function() sidebar_toggle(sidebars.frames) end)
|
||||
set_nnoremap('wh', function() sidebar_toggle(sidebars.threads) end)
|
||||
set_nnoremap('wr', function() repl_toggle({ height = 10 }) end)
|
||||
set_nnoremap('ws', function() sidebar_toggle(sidebars.scopes) end)
|
||||
set_nnoremap('wt', function() term_toggle({ height = 10 }) end)
|
||||
set_nnoremap("wf", function() sidebar_toggle(sidebars.frames) end)
|
||||
set_nnoremap("wh", function() sidebar_toggle(sidebars.threads) end)
|
||||
set_nnoremap("wr", function() repl_toggle({ height = 10 }) end)
|
||||
set_nnoremap("ws", function() sidebar_toggle(sidebars.scopes) end)
|
||||
set_nnoremap("wt", function() term_toggle({ height = 10 }) end)
|
||||
|
||||
set_nnoremap('wF', function() sidebar_only(sidebars.frames) end)
|
||||
set_nnoremap('wH', function() sidebar_only(sidebars.threads) end)
|
||||
set_nnoremap('wR', function()
|
||||
set_nnoremap("wF", function() sidebar_only(sidebars.frames) end)
|
||||
set_nnoremap("wH", function() sidebar_only(sidebars.threads) end)
|
||||
set_nnoremap("wR", function()
|
||||
term_close()
|
||||
repl_open({ height = 10 })
|
||||
end)
|
||||
set_nnoremap('wS', function() sidebar_only(sidebars.scopes) end)
|
||||
set_nnoremap('wT', function()
|
||||
set_nnoremap("wS", function() sidebar_only(sidebars.scopes) end)
|
||||
set_nnoremap("wT", function()
|
||||
repl_close()
|
||||
term_open({ height = 10 })
|
||||
end)
|
||||
|
|
|
@ -2,17 +2,17 @@ local M = {}
|
|||
|
||||
function M.on_attach(client, bufnr)
|
||||
local function set_nnoremap(key, func)
|
||||
vim.keymap.set('n', key, func, { buffer = bufnr })
|
||||
vim.keymap.set("n", key, func, { buffer = bufnr })
|
||||
end
|
||||
set_nnoremap('[d', vim.diagnostic.goto_prev)
|
||||
set_nnoremap(']d', vim.diagnostic.goto_next)
|
||||
set_nnoremap("[d", vim.diagnostic.goto_prev)
|
||||
set_nnoremap("]d", vim.diagnostic.goto_next)
|
||||
set_nnoremap('g"', vim.lsp.buf.code_action)
|
||||
set_nnoremap('g?', vim.diagnostic.open_float)
|
||||
set_nnoremap('gq', function() vim.lsp.buf.format { async = true } end)
|
||||
set_nnoremap('gr', vim.lsp.buf.rename)
|
||||
set_nnoremap("g?", vim.diagnostic.open_float)
|
||||
set_nnoremap("gq", function() vim.lsp.buf.format { async = true } end)
|
||||
set_nnoremap("gr", vim.lsp.buf.rename)
|
||||
end
|
||||
|
||||
M.capabilities = require('cmp_nvim_lsp').default_capabilities()
|
||||
M.capabilities = require("cmp_nvim_lsp").default_capabilities()
|
||||
|
||||
function M.setup(client)
|
||||
-- Return a nested function so that we can continue invoking `setup` in the
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
local M = {}
|
||||
|
||||
local luasnip = require('luasnip')
|
||||
local types = require('luasnip.util.types')
|
||||
local luasnip = require("luasnip")
|
||||
local types = require("luasnip.util.types")
|
||||
|
||||
function M.visual_isn(pos)
|
||||
local d = luasnip.dynamic_node
|
||||
|
@ -15,7 +15,7 @@ function M.visual_isn(pos)
|
|||
table.insert(res, ele)
|
||||
end
|
||||
return sn(nil, i(1, res))
|
||||
end), '$PARENT_INDENT\t')
|
||||
end), "$PARENT_INDENT\t")
|
||||
end
|
||||
|
||||
function M.choice_index(choice_node)
|
||||
|
@ -29,53 +29,53 @@ end
|
|||
|
||||
function M.setup()
|
||||
luasnip.config.setup {
|
||||
region_check_events = 'InsertEnter',
|
||||
delete_check_events = 'InsertLeave',
|
||||
store_selection_keys = '<tab>',
|
||||
region_check_events = "InsertEnter",
|
||||
delete_check_events = "InsertLeave",
|
||||
store_selection_keys = "<tab>",
|
||||
enable_autosnippets = true,
|
||||
ext_opts = {
|
||||
[types.snippet] = {
|
||||
active = {
|
||||
virt_text = { { '●', 'DiagnosticWarn' } },
|
||||
virt_text = { { "●", "DiagnosticWarn" } },
|
||||
},
|
||||
},
|
||||
[types.insertNode] = {
|
||||
passive = {
|
||||
hl_group = 'DiagnosticVirtualTextWarn',
|
||||
hl_group = "DiagnosticVirtualTextWarn",
|
||||
},
|
||||
},
|
||||
[types.choiceNode] = {
|
||||
active = {
|
||||
hl_group = 'DiagnosticVirtualTextHint',
|
||||
virt_text = { { '⧨', 'DiagnosticHint' } },
|
||||
hl_group = "DiagnosticVirtualTextHint",
|
||||
virt_text = { { "⧨", "DiagnosticHint" } },
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
-- Track where we are expanding the snippet.
|
||||
luasnip.env_namespace('INFO', {
|
||||
luasnip.env_namespace("INFO", {
|
||||
init = function(info) return { POS = info.pos } end,
|
||||
})
|
||||
|
||||
vim.keymap.set({ 'i', 's' }, '<c-e>', function()
|
||||
vim.keymap.set({ "i", "s" }, "<c-e>", function()
|
||||
if luasnip.choice_active() then
|
||||
return '<Plug>luasnip-next-choice'
|
||||
return "<Plug>luasnip-next-choice"
|
||||
else
|
||||
return '<c-e>'
|
||||
return "<c-e>"
|
||||
end
|
||||
end, { silent = true, expr = true, remap = true })
|
||||
|
||||
vim.keymap.set({ 'i', 's' }, '<c-y>', function()
|
||||
vim.keymap.set({ "i", "s" }, "<c-y>", function()
|
||||
if luasnip.choice_active() then
|
||||
return '<Plug>luasnip-prev-choice'
|
||||
return "<Plug>luasnip-prev-choice"
|
||||
else
|
||||
return '<c-y>'
|
||||
return "<c-y>"
|
||||
end
|
||||
end, { silent = true, expr = true, remap = true })
|
||||
|
||||
-- Allow aborting the active snippet at any point in time.
|
||||
vim.keymap.set({ 'n', 'i', 's' }, '<c-l>', '<cmd>LuaSnipUnlinkCurrent<cr>')
|
||||
vim.keymap.set({ "n", "i", "s" }, "<c-l>", "<cmd>LuaSnipUnlinkCurrent<cr>")
|
||||
|
||||
-- Allow toggling autoexpansion on and off. This is more or less the intended
|
||||
-- approach: https://github.com/L3MON4D3/LuaSnip/issues/832#issuecomment-1474993417
|
||||
|
@ -92,7 +92,7 @@ function M.setup()
|
|||
end
|
||||
|
||||
toggle_expand_auto()
|
||||
vim.keymap.set({ 'n', 'i', 's' }, '', toggle_expand_auto)
|
||||
vim.keymap.set({ "n", "i", "s" }, "", toggle_expand_auto)
|
||||
end
|
||||
|
||||
return M
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
local M = {}
|
||||
|
||||
function M.get_active_lsp()
|
||||
local buf_ft = vim.api.nvim_buf_get_option(0, 'filetype')
|
||||
local buf_ft = vim.api.nvim_buf_get_option(0, "filetype")
|
||||
local clients = vim.lsp.get_active_clients()
|
||||
if next(clients) == nil then
|
||||
return ""
|
||||
|
|
|
@ -2,55 +2,55 @@ local M = {}
|
|||
|
||||
local function set_telescope_map(key, picker)
|
||||
vim.keymap.set(
|
||||
'n',
|
||||
string.format('<c-;>%s', key),
|
||||
string.format('<cmd>Telescope %s<cr>', picker)
|
||||
"n",
|
||||
string.format("<c-;>%s", key),
|
||||
string.format("<cmd>Telescope %s<cr>", picker)
|
||||
)
|
||||
vim.keymap.set(
|
||||
'n',
|
||||
string.format('<c-;><c-%s>', key),
|
||||
string.format('<cmd>Telescope %s<cr>', picker)
|
||||
"n",
|
||||
string.format("<c-;><c-%s>", key),
|
||||
string.format("<cmd>Telescope %s<cr>", picker)
|
||||
)
|
||||
end
|
||||
|
||||
function M.setup()
|
||||
require('telescope').setup {
|
||||
require("telescope").setup {
|
||||
defaults = {
|
||||
mappings = {
|
||||
i = {
|
||||
['<c-s>'] = 'select_horizontal',
|
||||
['<c-t>'] = 'select_tab',
|
||||
['<c-v>'] = 'select_vertical',
|
||||
['<esc>'] = 'close',
|
||||
["<c-s>"] = "select_horizontal",
|
||||
["<c-t>"] = "select_tab",
|
||||
["<c-v>"] = "select_vertical",
|
||||
["<esc>"] = "close",
|
||||
},
|
||||
},
|
||||
},
|
||||
pickers = {
|
||||
buffers = { theme = 'ivy' },
|
||||
find_files = { theme = 'ivy' },
|
||||
live_grep = { theme = 'ivy' },
|
||||
lsp_definitions = { theme = 'cursor' },
|
||||
lsp_implementations = { theme = 'cursor' },
|
||||
lsp_type_definitions = { theme = 'cursor' },
|
||||
lsp_workspace_symbols = { theme = 'ivy' },
|
||||
buffers = { theme = "ivy" },
|
||||
find_files = { theme = "ivy" },
|
||||
live_grep = { theme = "ivy" },
|
||||
lsp_definitions = { theme = "cursor" },
|
||||
lsp_implementations = { theme = "cursor" },
|
||||
lsp_type_definitions = { theme = "cursor" },
|
||||
lsp_workspace_symbols = { theme = "ivy" },
|
||||
},
|
||||
}
|
||||
|
||||
-- General
|
||||
set_telescope_map(';', 'resume')
|
||||
set_telescope_map('b', 'buffers')
|
||||
set_telescope_map('f', 'find_files')
|
||||
set_telescope_map('g', 'live_grep')
|
||||
set_telescope_map(";", "resume")
|
||||
set_telescope_map("b", "buffers")
|
||||
set_telescope_map("f", "find_files")
|
||||
set_telescope_map("g", "live_grep")
|
||||
|
||||
-- LSP
|
||||
set_telescope_map('?', 'diagnostics')
|
||||
set_telescope_map(']', 'lsp_definitions')
|
||||
set_telescope_map('i', 'lsp_implementations')
|
||||
set_telescope_map('s', 'lsp_workspace_symbols')
|
||||
set_telescope_map('t', 'lsp_type_definitions')
|
||||
set_telescope_map("?", "diagnostics")
|
||||
set_telescope_map("]", "lsp_definitions")
|
||||
set_telescope_map("i", "lsp_implementations")
|
||||
set_telescope_map("s", "lsp_workspace_symbols")
|
||||
set_telescope_map("t", "lsp_type_definitions")
|
||||
|
||||
vim.api.nvim_create_autocmd('User', {
|
||||
pattern = 'TelescopePreviewerLoaded',
|
||||
vim.api.nvim_create_autocmd("User", {
|
||||
pattern = "TelescopePreviewerLoaded",
|
||||
callback = function()
|
||||
vim.wo.wrap = true
|
||||
end,
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
local M = {}
|
||||
|
||||
local configs = require('nvim-treesitter.configs')
|
||||
local configs = require("nvim-treesitter.configs")
|
||||
|
||||
function M.setup()
|
||||
configs.setup {
|
||||
|
|
|
@ -7,201 +7,201 @@ return {
|
|||
-- Superscripts
|
||||
s(
|
||||
{ trig = [[\^+]], wordTrig = false },
|
||||
t('⁺')
|
||||
t("⁺")
|
||||
),
|
||||
s(
|
||||
{ trig = [[\^-]], wordTrig = false },
|
||||
t('⁻')
|
||||
t("⁻")
|
||||
),
|
||||
s(
|
||||
{ trig = [[\^0]], wordTrig = false },
|
||||
t('⁰')
|
||||
t("⁰")
|
||||
),
|
||||
s(
|
||||
{ trig = [[\^1]], wordTrig = false },
|
||||
t('¹')
|
||||
t("¹")
|
||||
),
|
||||
s(
|
||||
{ trig = [[\^2]], wordTrig = false },
|
||||
t('²')
|
||||
t("²")
|
||||
),
|
||||
s(
|
||||
{ trig = [[\^3]], wordTrig = false },
|
||||
t('³')
|
||||
t("³")
|
||||
),
|
||||
s(
|
||||
{ trig = [[\^4]], wordTrig = false },
|
||||
t('⁴')
|
||||
t("⁴")
|
||||
),
|
||||
s(
|
||||
{ trig = [[\^5]], wordTrig = false },
|
||||
t('⁵')
|
||||
t("⁵")
|
||||
),
|
||||
s(
|
||||
{ trig = [[\^6]], wordTrig = false },
|
||||
t('⁶')
|
||||
t("⁶")
|
||||
),
|
||||
s(
|
||||
{ trig = [[\^7]], wordTrig = false },
|
||||
t('⁷')
|
||||
t("⁷")
|
||||
),
|
||||
s(
|
||||
{ trig = [[\^8]], wordTrig = false },
|
||||
t('⁸')
|
||||
t("⁸")
|
||||
),
|
||||
s(
|
||||
{ trig = [[\^9]], wordTrig = false },
|
||||
t('⁹')
|
||||
t("⁹")
|
||||
),
|
||||
|
||||
-- Subscripts
|
||||
s(
|
||||
{ trig = [[\_+]], wordTrig = false },
|
||||
t('₊')
|
||||
t("₊")
|
||||
),
|
||||
s(
|
||||
{ trig = [[\_-]], wordTrig = false },
|
||||
t('₋')
|
||||
t("₋")
|
||||
),
|
||||
s(
|
||||
{ trig = [[\_0]], wordTrig = false },
|
||||
t('₀')
|
||||
t("₀")
|
||||
),
|
||||
s(
|
||||
{ trig = [[\_1]], wordTrig = false },
|
||||
t('₁')
|
||||
t("₁")
|
||||
),
|
||||
s(
|
||||
{ trig = [[\_2]], wordTrig = false },
|
||||
t('₂')
|
||||
t("₂")
|
||||
),
|
||||
s(
|
||||
{ trig = [[\_3]], wordTrig = false },
|
||||
t('₃')
|
||||
t("₃")
|
||||
),
|
||||
s(
|
||||
{ trig = [[\_4]], wordTrig = false },
|
||||
t('₄')
|
||||
t("₄")
|
||||
),
|
||||
s(
|
||||
{ trig = [[\_5]], wordTrig = false },
|
||||
t('₅')
|
||||
t("₅")
|
||||
),
|
||||
s(
|
||||
{ trig = [[\_6]], wordTrig = false },
|
||||
t('₆')
|
||||
t("₆")
|
||||
),
|
||||
s(
|
||||
{ trig = [[\_7]], wordTrig = false },
|
||||
t('₇')
|
||||
t("₇")
|
||||
),
|
||||
s(
|
||||
{ trig = [[\_8]], wordTrig = false },
|
||||
t('₈')
|
||||
t("₈")
|
||||
),
|
||||
s(
|
||||
{ trig = [[\_9]], wordTrig = false },
|
||||
t('₉')
|
||||
t("₉")
|
||||
),
|
||||
s(
|
||||
{ trig = [[\_a]], wordTrig = false },
|
||||
t('ₐ')
|
||||
t("ₐ")
|
||||
),
|
||||
s(
|
||||
{ trig = [[\_i]], wordTrig = false },
|
||||
t('ᵢ')
|
||||
t("ᵢ")
|
||||
),
|
||||
s(
|
||||
{ trig = [[\_j]], wordTrig = false },
|
||||
t('ⱼ')
|
||||
t("ⱼ")
|
||||
),
|
||||
s(
|
||||
{ trig = [[\_k]], wordTrig = false },
|
||||
t('ₖ')
|
||||
t("ₖ")
|
||||
),
|
||||
s(
|
||||
{ trig = [[\_m]], wordTrig = false },
|
||||
t('ₘ')
|
||||
t("ₘ")
|
||||
),
|
||||
s(
|
||||
{ trig = [[\_n]], wordTrig = false },
|
||||
t('ₙ')
|
||||
t("ₙ")
|
||||
),
|
||||
|
||||
-- Lists
|
||||
s(
|
||||
{ trig = [[\.]], wordTrig = false },
|
||||
t('·')
|
||||
t("·")
|
||||
),
|
||||
s(
|
||||
{ trig = [[\circ]], wordTrig = false },
|
||||
t('∘')
|
||||
t("∘")
|
||||
),
|
||||
|
||||
-- Arrows
|
||||
s(
|
||||
{ trig = [[\d]], wordTrig = false },
|
||||
t('↓')
|
||||
t("↓")
|
||||
),
|
||||
s(
|
||||
{ trig = [[\l]], wordTrig = false },
|
||||
t('←')
|
||||
t("←")
|
||||
),
|
||||
s(
|
||||
{ trig = [[\lr]], wordTrig = false },
|
||||
t('↔')
|
||||
t("↔")
|
||||
),
|
||||
s(
|
||||
{ trig = [[←r]], wordTrig = false },
|
||||
t('↔')
|
||||
t("↔")
|
||||
),
|
||||
s(
|
||||
{ trig = [[\r]], wordTrig = false },
|
||||
t('→')
|
||||
t("→")
|
||||
),
|
||||
s(
|
||||
{ trig = [[\u]], wordTrig = false },
|
||||
t('↑')
|
||||
t("↑")
|
||||
),
|
||||
|
||||
-- Greek letters
|
||||
s(
|
||||
{ trig = [[\a]], wordTrig = false },
|
||||
t('α')
|
||||
t("α")
|
||||
),
|
||||
s(
|
||||
{ trig = [[\b]], wordTrig = false },
|
||||
t('β')
|
||||
t("β")
|
||||
),
|
||||
s(
|
||||
{ trig = [[\g]], wordTrig = false },
|
||||
t('γ')
|
||||
t("γ")
|
||||
),
|
||||
s(
|
||||
{ trig = [[\e]], wordTrig = false },
|
||||
t('ε')
|
||||
t("ε")
|
||||
),
|
||||
s(
|
||||
{ trig = [[\pi]], wordTrig = false },
|
||||
t('π')
|
||||
t("π")
|
||||
),
|
||||
s(
|
||||
{ trig = [[\s]], wordTrig = false },
|
||||
t('σ')
|
||||
t("σ")
|
||||
),
|
||||
s(
|
||||
{ trig = [[\z]], wordTrig = false },
|
||||
t('ζ')
|
||||
t("ζ")
|
||||
),
|
||||
|
||||
-- Other operators
|
||||
s(
|
||||
{ trig = [[\not]], wordTrig = false },
|
||||
t('¬')
|
||||
t("¬")
|
||||
),
|
||||
s(
|
||||
{ trig = [[\and]], wordTrig = false },
|
||||
t('∧')
|
||||
t("∧")
|
||||
),
|
||||
s(
|
||||
{ trig = [[αnd]], wordTrig = false },
|
||||
|
@ -209,50 +209,50 @@ return {
|
|||
),
|
||||
s(
|
||||
{ trig = [[\or]], wordTrig = false },
|
||||
t('∨')
|
||||
t("∨")
|
||||
),
|
||||
s(
|
||||
{ trig = [[\iff]], wordTrig = false },
|
||||
t('⇔')
|
||||
t("⇔")
|
||||
),
|
||||
s(
|
||||
{ trig = [[\imp]], wordTrig = false },
|
||||
t('⇒')
|
||||
t("⇒")
|
||||
),
|
||||
s(
|
||||
{ trig = [[\cap]], wordTrig = false },
|
||||
t('∩')
|
||||
t("∩")
|
||||
),
|
||||
s(
|
||||
{ trig = [[\cup]], wordTrig = false },
|
||||
t('∪')
|
||||
t("∪")
|
||||
),
|
||||
s(
|
||||
{ trig = [[\leq]], wordTrig = false },
|
||||
t('≤')
|
||||
t("≤")
|
||||
),
|
||||
s(
|
||||
{ trig = [[←eq]], wordTrig = false },
|
||||
t('≤')
|
||||
t("≤")
|
||||
),
|
||||
s(
|
||||
{ trig = [[\geq]], wordTrig = false },
|
||||
t('≥')
|
||||
t("≥")
|
||||
),
|
||||
s(
|
||||
{ trig = [[γeq]], wordTrig = false },
|
||||
t('≥')
|
||||
t("≥")
|
||||
),
|
||||
s(
|
||||
{ trig = [[\in]], wordTrig = false },
|
||||
t('∈')
|
||||
t("∈")
|
||||
),
|
||||
s(
|
||||
{ trig = [[\notin]], wordTrig = false },
|
||||
t('∉')
|
||||
t("∉")
|
||||
),
|
||||
s(
|
||||
{ trig = [[¬in]], wordTrig = false },
|
||||
t('∉')
|
||||
t("∉")
|
||||
),
|
||||
}
|
||||
|
|
|
@ -7,22 +7,22 @@ let
|
|||
"eb82712f86319272f4b7b9dbb4ec6df650e6987f"
|
||||
"EdenEast/nightfox.nvim";
|
||||
config = ''
|
||||
vim.cmd('colorscheme nordfox')
|
||||
vim.cmd("colorscheme nordfox")
|
||||
'';
|
||||
};
|
||||
|
||||
lualine = {
|
||||
plugin = pkgs.vimPlugins.lualine-nvim;
|
||||
config = ''
|
||||
require('lualine').setup {
|
||||
require("lualine").setup {
|
||||
sections = {
|
||||
lualine_x = {'encoding', 'filetype'},
|
||||
lualine_x = { "encoding", "filetype" },
|
||||
lualine_y = {
|
||||
require('utils.statusline').get_active_lsp,
|
||||
require('utils.statusline').get_dap_status,
|
||||
require('utils.statusline').get_autoexpand_status,
|
||||
require("utils.statusline").get_active_lsp,
|
||||
require("utils.statusline").get_dap_status,
|
||||
require("utils.statusline").get_autoexpand_status,
|
||||
},
|
||||
lualine_z = {'%c:%l:%%%p'},
|
||||
lualine_z = { "%c:%l:%%%p" },
|
||||
},
|
||||
}
|
||||
'';
|
||||
|
@ -31,8 +31,8 @@ let
|
|||
luasnip = {
|
||||
plugin = pkgs.vimPlugins.luasnip;
|
||||
config = ''
|
||||
require('utils.luasnip').setup()
|
||||
require('luasnip').add_snippets('all', require('utils.utf8'), {
|
||||
require("utils.luasnip").setup()
|
||||
require("luasnip").add_snippets("all", require("utils.utf8"), {
|
||||
type = "autosnippets",
|
||||
})
|
||||
'';
|
||||
|
@ -41,7 +41,7 @@ let
|
|||
nvim-cmp = {
|
||||
plugin = pkgs.vimPlugins.nvim-cmp;
|
||||
config = ''
|
||||
require('utils.cmp').setup()
|
||||
require("utils.cmp").setup()
|
||||
'';
|
||||
};
|
||||
|
||||
|
@ -68,7 +68,7 @@ let
|
|||
nvim-telescope = {
|
||||
plugin = pkgs.vimPlugins.telescope-nvim;
|
||||
config = ''
|
||||
require('utils.telescope').setup()
|
||||
require("utils.telescope").setup()
|
||||
'';
|
||||
};
|
||||
|
||||
|
@ -88,7 +88,7 @@ let
|
|||
]
|
||||
));
|
||||
config = ''
|
||||
require('utils.treesitter').setup()
|
||||
require("utils.treesitter").setup()
|
||||
'';
|
||||
};
|
||||
in
|
||||
|
@ -97,7 +97,7 @@ in
|
|||
nvim-dap = lib.mkOption {
|
||||
type = lib.types.lines;
|
||||
example = ''
|
||||
require('...').nvim_dap()
|
||||
require("...").nvim_dap()
|
||||
'';
|
||||
description = lib.mdDoc ''
|
||||
Language-specific configurations for the `nvim-dap` plugin.
|
||||
|
@ -107,7 +107,7 @@ in
|
|||
nvim-lspconfig = lib.mkOption {
|
||||
type = lib.types.lines;
|
||||
example = ''
|
||||
require('...').nvim_lspconfig()
|
||||
require("...").nvim_lspconfig()
|
||||
'';
|
||||
description = lib.mdDoc ''
|
||||
Language-specific configurations for the `nvim-lspconfig` plugin.
|
||||
|
@ -153,13 +153,13 @@ in
|
|||
# Extra Lua configuration to be prepended to `init.lua`. Extend the
|
||||
# Lua loader to search for our /nix/store/.../?.lua files.
|
||||
(lib.mkBefore ''
|
||||
package.path = '${config}/?.lua;' .. package.path
|
||||
package.path = "${config}/?.lua;" .. package.path
|
||||
'')
|
||||
# Extra Lua configuration to be appended to `init.lua`.
|
||||
(lib.mkAfter ''
|
||||
vim.g.mapleader = ' '
|
||||
vim.g.maplocalleader = '\\'
|
||||
vim.o.colorcolumn = '80,100'
|
||||
vim.g.mapleader = " "
|
||||
vim.g.maplocalleader = "\\"
|
||||
vim.o.colorcolumn = "80,100"
|
||||
vim.o.equalalways = false -- Disable auto window resize.
|
||||
vim.o.expandtab = true -- Spaces instead of tabs.
|
||||
vim.o.list = true -- Show hidden characters.
|
||||
|
|
Loading…
Reference in New Issue