Compare commits
No commits in common. "819c41de456af695629a1807eeb00dcaf0a1e48a" and "8ce45fc87cc3d3496e816a00b33e9b592cb0668e" have entirely different histories.
819c41de45
...
8ce45fc87c
3
.gitmodules
vendored
3
.gitmodules
vendored
@ -52,6 +52,3 @@
|
|||||||
[submodule "vim/.vim/nvim-bundle/indent-blankline"]
|
[submodule "vim/.vim/nvim-bundle/indent-blankline"]
|
||||||
path = vim/.vim/nvim-bundle/indent-blankline
|
path = vim/.vim/nvim-bundle/indent-blankline
|
||||||
url = https://github.com/lukas-reineke/indent-blankline.nvim.git
|
url = https://github.com/lukas-reineke/indent-blankline.nvim.git
|
||||||
[submodule "vim/.vim/nvim-bundle/LuaSnip"]
|
|
||||||
path = vim/.vim/nvim-bundle/LuaSnip
|
|
||||||
url = https://github.com/L3MON4D3/LuaSnip.git
|
|
||||||
|
|||||||
@ -5,10 +5,65 @@ source ~/.vimrc
|
|||||||
lua <<EOF
|
lua <<EOF
|
||||||
vim.g.mapleader = ','
|
vim.g.mapleader = ','
|
||||||
|
|
||||||
require('user.lspconfig')
|
-- print('Hello from lua')
|
||||||
require('user.indentblanklines')
|
require'lspconfig'.pylsp.setup{}
|
||||||
require('user.luasnip')
|
require'lspconfig'.solargraph.setup{}
|
||||||
|
|
||||||
|
-- Configure the 'indent-blankline' plugin
|
||||||
|
-- Look at configuring this for rainbow blocks at some point
|
||||||
|
require('ibl').setup{
|
||||||
|
enabled = false,
|
||||||
|
indent = {
|
||||||
|
char = '|'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
-- Setup LSP bindings
|
||||||
|
vim.api.nvim_create_autocmd('LspAttach', {
|
||||||
|
desc = 'LSP actions',
|
||||||
|
callback = function()
|
||||||
|
local bufmap = function(mode, lhs, rhs)
|
||||||
|
local opts = {buffer = true}
|
||||||
|
vim.keymap.set(mode, lhs, rhs, opts)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Displays hover information about the symbol under the cursor
|
||||||
|
bufmap('n', 'K', '<cmd>lua vim.lsp.buf.hover()<cr>')
|
||||||
|
|
||||||
|
-- Jump to the definition
|
||||||
|
bufmap('n', 'gd', '<cmd>lua vim.lsp.buf.definition()<cr>')
|
||||||
|
|
||||||
|
-- Jump to declaration
|
||||||
|
bufmap('n', 'gD', '<cmd>lua vim.lsp.buf.declaration()<cr>')
|
||||||
|
|
||||||
|
-- Lists all the implementations for the symbol under the cursor
|
||||||
|
bufmap('n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<cr>')
|
||||||
|
|
||||||
|
-- Jumps to the definition of the type symbol
|
||||||
|
bufmap('n', 'go', '<cmd>lua vim.lsp.buf.type_definition()<cr>')
|
||||||
|
|
||||||
|
-- Lists all the references
|
||||||
|
bufmap('n', 'gr', '<cmd>lua vim.lsp.buf.references()<cr>')
|
||||||
|
|
||||||
|
-- Displays a function's signature information
|
||||||
|
bufmap('n', 'gs', '<cmd>lua vim.lsp.buf.signature_help()<cr>')
|
||||||
|
|
||||||
|
-- Renames all references to the symbol under the cursor
|
||||||
|
bufmap('n', '<F2>', '<cmd>lua vim.lsp.buf.rename()<cr>')
|
||||||
|
|
||||||
|
-- Selects a code action available at the current cursor position
|
||||||
|
bufmap('n', '<F4>', '<cmd>lua vim.lsp.buf.code_action()<cr>')
|
||||||
|
|
||||||
|
-- Show diagnostics in a floating window
|
||||||
|
bufmap('n', 'gl', '<cmd>lua vim.diagnostic.open_float()<cr>')
|
||||||
|
|
||||||
|
-- Move to the previous diagnostic
|
||||||
|
bufmap('n', '[d', '<cmd>lua vim.diagnostic.goto_prev()<cr>')
|
||||||
|
|
||||||
|
-- Move to the next diagnostic
|
||||||
|
bufmap('n', ']d', '<cmd>lua vim.diagnostic.goto_next()<cr>')
|
||||||
|
end
|
||||||
|
})
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
nnoremap <leader>ib <cmd>IBLToggle<cr>
|
nnoremap <leader>ib <cmd>IBLToggle<cr>
|
||||||
|
|||||||
@ -1,8 +0,0 @@
|
|||||||
-- Configure the 'indent-blankline' plugin
|
|
||||||
-- Look at configuring this for rainbow blocks at some point
|
|
||||||
require('ibl').setup{
|
|
||||||
enabled = false,
|
|
||||||
indent = {
|
|
||||||
char = '|'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,85 +0,0 @@
|
|||||||
print('User LSP Configuration loaded')
|
|
||||||
local lsp = require('lspconfig')
|
|
||||||
|
|
||||||
-- Configure LuaLS for lua
|
|
||||||
lsp.lua_ls.setup{
|
|
||||||
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') then
|
|
||||||
client.config.settings = 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
|
|
||||||
-- "${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)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
client.notify("workspace/didChangeConfiguration", { settings = client.config.settings })
|
|
||||||
end
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
}
|
|
||||||
|
|
||||||
lsp.pylsp.setup{}
|
|
||||||
lsp.solargraph.setup{}
|
|
||||||
|
|
||||||
|
|
||||||
-- Setup LSP bindings
|
|
||||||
vim.api.nvim_create_autocmd('LspAttach', {
|
|
||||||
desc = 'LSP actions',
|
|
||||||
callback = function()
|
|
||||||
local bufmap = function(mode, lhs, rhs)
|
|
||||||
local opts = {buffer = true}
|
|
||||||
vim.keymap.set(mode, lhs, rhs, opts)
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Displays hover information about the symbol under the cursor
|
|
||||||
bufmap('n', 'K', '<cmd>lua vim.lsp.buf.hover()<cr>')
|
|
||||||
|
|
||||||
-- Jump to the definition
|
|
||||||
bufmap('n', 'gd', '<cmd>lua vim.lsp.buf.definition()<cr>')
|
|
||||||
|
|
||||||
-- Jump to declaration
|
|
||||||
bufmap('n', 'gD', '<cmd>lua vim.lsp.buf.declaration()<cr>')
|
|
||||||
|
|
||||||
-- Lists all the implementations for the symbol under the cursor
|
|
||||||
bufmap('n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<cr>')
|
|
||||||
|
|
||||||
-- Jumps to the definition of the type symbol
|
|
||||||
bufmap('n', 'go', '<cmd>lua vim.lsp.buf.type_definition()<cr>')
|
|
||||||
|
|
||||||
-- Lists all the references
|
|
||||||
bufmap('n', 'gr', '<cmd>lua vim.lsp.buf.references()<cr>')
|
|
||||||
|
|
||||||
-- Displays a function's signature information
|
|
||||||
bufmap('n', 'gs', '<cmd>lua vim.lsp.buf.signature_help()<cr>')
|
|
||||||
|
|
||||||
-- Renames all references to the symbol under the cursor
|
|
||||||
bufmap('n', '<F2>', '<cmd>lua vim.lsp.buf.rename()<cr>')
|
|
||||||
|
|
||||||
-- Selects a code action available at the current cursor position
|
|
||||||
bufmap('n', '<F4>', '<cmd>lua vim.lsp.buf.code_action()<cr>')
|
|
||||||
|
|
||||||
-- Show diagnostics in a floating window
|
|
||||||
bufmap('n', 'gl', '<cmd>lua vim.diagnostic.open_float()<cr>')
|
|
||||||
|
|
||||||
-- Move to the previous diagnostic
|
|
||||||
bufmap('n', '[d', '<cmd>lua vim.diagnostic.goto_prev()<cr>')
|
|
||||||
|
|
||||||
-- Move to the next diagnostic
|
|
||||||
bufmap('n', ']d', '<cmd>lua vim.diagnostic.goto_next()<cr>')
|
|
||||||
end
|
|
||||||
})
|
|
||||||
@ -1,82 +0,0 @@
|
|||||||
local ls = require("luasnip")
|
|
||||||
|
|
||||||
local fmt = require('luasnip.extras.fmt')
|
|
||||||
local rep = require('luasnip.extras').rep
|
|
||||||
|
|
||||||
-- some shorthands...
|
|
||||||
-- Taken from video/guide. Honestly I don't like these should probably work on learning their names
|
|
||||||
local s = ls.snippet
|
|
||||||
local sn = ls.snippet_node
|
|
||||||
local t = ls.text_node
|
|
||||||
local i = ls.insert_node
|
|
||||||
local f = ls.function_node
|
|
||||||
local c = ls.choice_node
|
|
||||||
local d = ls.dynamic_node
|
|
||||||
local r = ls.restore_node
|
|
||||||
local l = require("luasnip.extras").lambda
|
|
||||||
local rep = require("luasnip.extras").rep
|
|
||||||
local p = require("luasnip.extras").partial
|
|
||||||
local m = require("luasnip.extras").match
|
|
||||||
local n = require("luasnip.extras").nonempty
|
|
||||||
local dl = require("luasnip.extras").dynamic_lambda
|
|
||||||
local fmt = require("luasnip.extras.fmt").fmt
|
|
||||||
local fmta = require("luasnip.extras.fmt").fmta
|
|
||||||
local types = require("luasnip.util.types")
|
|
||||||
local conds = require("luasnip.extras.conditions")
|
|
||||||
local conds_expand = require("luasnip.extras.conditions.expand")
|
|
||||||
|
|
||||||
ls.config.set_config {
|
|
||||||
history = true,
|
|
||||||
|
|
||||||
-- This allows dynamic snippets to update as you type
|
|
||||||
updateevents = "TextChanged,TextChangedI"
|
|
||||||
}
|
|
||||||
|
|
||||||
-- Expand if expandable, or jump forward if jumpable
|
|
||||||
-- If neither, do nothing queitly
|
|
||||||
vim.keymap.set({ "i", "s" }, "<C-K>", function()
|
|
||||||
if ls.expand_or_jumpable() then
|
|
||||||
ls.expand_or_jump()
|
|
||||||
end
|
|
||||||
end, { silent = true })
|
|
||||||
-- end, { silent = true })
|
|
||||||
|
|
||||||
-- Jump backwards to the previous jumpable point
|
|
||||||
vim.keymap.set({ "i", "s" }, "<C-J>", function()
|
|
||||||
if ls.jumpable(-1) then
|
|
||||||
ls.jump(-1)
|
|
||||||
end
|
|
||||||
end, { silent = true })
|
|
||||||
|
|
||||||
-- Selecting from a list of options in a choice node
|
|
||||||
vim.keymap.set({ "i" }, "<C-L>", function()
|
|
||||||
if ls.choice_active() then
|
|
||||||
ls.change_choice(1)
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
|
|
||||||
-- Allow us to hot reload snippets
|
|
||||||
vim.keymap.set("n", "<leader><leader>s", "<cmd>source ~/.config/nvim/lua/user/luasnip.lua<CR>")
|
|
||||||
|
|
||||||
ls.add_snippets('lua', {
|
|
||||||
ls.parser.parse_snippet("expand", "-- this is what was expanded!"),
|
|
||||||
ls.parser.parse_snippet("lf", "local $1 = function($2)\n $0\nend"),
|
|
||||||
ls.parser.parse_snippet("mf", "$1.$2 = function($3)\n $0\nend"),
|
|
||||||
-- Example from snippet writing guide: https://github.com/L3MON4D3/LuaSnip/blob/master/Examples/snippets.lua#L190
|
|
||||||
s(
|
|
||||||
"fmt1",
|
|
||||||
fmt("To {title} {} {}.", {
|
|
||||||
i(2, "Name"),
|
|
||||||
i(3, "Surname"),
|
|
||||||
title = c(1, { t("Mr."), t("Ms.") }),
|
|
||||||
})
|
|
||||||
),
|
|
||||||
-- Example from video: https://www.youtube.com/watch?v=Dn800rlPIho
|
|
||||||
s(
|
|
||||||
"req",
|
|
||||||
fmt("local {} = require('{}')", {
|
|
||||||
i(1, "default"),
|
|
||||||
rep(1)
|
|
||||||
})
|
|
||||||
),
|
|
||||||
})
|
|
||||||
@ -1 +1 @@
|
|||||||
Subproject commit 011cf4fcb93a9649ffc6dcdff56ef948f5d0f7cc
|
Subproject commit e7bf502a6ae492f42a91d231864e25630286319b
|
||||||
@ -1 +1 @@
|
|||||||
Subproject commit 21f756b933cd11ac5990a6046fdc7c4e2a6c0aee
|
Subproject commit 3d1cfc8e183f1a58f71587442849510462f5857b
|
||||||
@ -1 +0,0 @@
|
|||||||
Subproject commit 8ae1dedd988eb56441b7858bd1e8554dfadaa46d
|
|
||||||
@ -1 +1 @@
|
|||||||
Subproject commit cf3dd4a290084a868fac0e2e876039321d57111c
|
Subproject commit f12f1b9e877b1e6e2ef7eae1a524d8253af4243d
|
||||||
@ -1 +1 @@
|
|||||||
Subproject commit 50012918b2fc8357b87cff2a7f7f0446e47da174
|
Subproject commit 4f71c0c4a196ceb656c824a70792f3df3ce6bb6d
|
||||||
@ -1 +1 @@
|
|||||||
Subproject commit d90956833d7c27e73c621a61f20b29fdb7122709
|
Subproject commit 236083884cfe6c874e03e6cb4e7cb08809c1333c
|
||||||
Loading…
x
Reference in New Issue
Block a user