Compare commits
7 Commits
d0e94ed5a7
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 65992c0328 | |||
| 3d80d362da | |||
| e51d1a3c4b | |||
| 2e7694351b | |||
|
|
8ccc729ce7 | ||
| be94adda8a | |||
| 4f8489bfdb |
9
lsp/lua_ls.lua
Normal file
9
lsp/lua_ls.lua
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
return {
|
||||||
|
settings = {
|
||||||
|
Lua = {
|
||||||
|
diagnostics = { globals = { "vim" } },
|
||||||
|
workspace = { checkThirdParty = false },
|
||||||
|
telemetry = { enable = false },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
@@ -12,8 +12,8 @@ if not (vim.uv or vim.loop).fs_stat(lazypath) then
|
|||||||
os.exit(1)
|
os.exit(1)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
vim.opt.rtp:prepend(lazypath)
|
|
||||||
|
|
||||||
|
vim.opt.rtp:prepend(lazypath)
|
||||||
vim.g.mapleader = " "
|
vim.g.mapleader = " "
|
||||||
vim.g.maplocalleader = " "
|
vim.g.maplocalleader = " "
|
||||||
|
|
||||||
@@ -25,7 +25,7 @@ require("lazy").setup {
|
|||||||
{ import = "plugins" },
|
{ import = "plugins" },
|
||||||
},
|
},
|
||||||
install = { colorscheme = { "tokyonight" } },
|
install = { colorscheme = { "tokyonight" } },
|
||||||
checker = { enabled = true },
|
checker = { enabled = true, notify = false },
|
||||||
}
|
}
|
||||||
|
|
||||||
vim.cmd [[colorscheme tokyonight]]
|
vim.cmd [[colorscheme tokyonight]]
|
||||||
|
|||||||
@@ -1,5 +1,21 @@
|
|||||||
|
local is_ssh = vim.env.SSH_CONNECTION ~= nil or vim.env.SSH_TTY ~= nil
|
||||||
|
|
||||||
vim.opt.clipboard = "unnamedplus"
|
vim.opt.clipboard = "unnamedplus"
|
||||||
|
|
||||||
|
if vim.env.SSH_CONNECTION then
|
||||||
|
vim.g.clipboard = {
|
||||||
|
name = "OSC 52",
|
||||||
|
copy = {
|
||||||
|
["+"] = require("vim.ui.clipboard.osc52").copy("+"),
|
||||||
|
["*"] = require("vim.ui.clipboard.osc52").copy("*"),
|
||||||
|
},
|
||||||
|
paste = {
|
||||||
|
["+"] = function() return nil end,
|
||||||
|
["*"] = function() return nil end,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
vim.opt.termguicolors = true
|
vim.opt.termguicolors = true
|
||||||
|
|
||||||
vim.opt.expandtab = true
|
vim.opt.expandtab = true
|
||||||
|
|||||||
70
lua/plugins/cmp.lua
Normal file
70
lua/plugins/cmp.lua
Normal file
@@ -0,0 +1,70 @@
|
|||||||
|
return {
|
||||||
|
{
|
||||||
|
"hrsh7th/nvim-cmp",
|
||||||
|
event = "InsertEnter",
|
||||||
|
dependencies = {
|
||||||
|
"hrsh7th/cmp-nvim-lsp",
|
||||||
|
|
||||||
|
"L3MON4D3/LuaSnip",
|
||||||
|
"saadparwaiz1/cmp_luasnip",
|
||||||
|
|
||||||
|
"hrsh7th/cmp-buffer",
|
||||||
|
"hrsh7th/cmp-path",
|
||||||
|
"hrsh7th/cmp-cmdline",
|
||||||
|
},
|
||||||
|
config = function()
|
||||||
|
local cmp = require "cmp"
|
||||||
|
local luasnip = require "luasnip"
|
||||||
|
|
||||||
|
cmp.setup {
|
||||||
|
snippet = {
|
||||||
|
expand = function(args)
|
||||||
|
luasnip.lsp_expand(args.body)
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
mapping = cmp.mapping.preset.insert {
|
||||||
|
["<C-Space>"] = cmp.mapping.complete(),
|
||||||
|
["<CR>"] = cmp.mapping.confirm { select = true },
|
||||||
|
|
||||||
|
["<Tab>"] = cmp.mapping(function(fallback)
|
||||||
|
if cmp.visible() then
|
||||||
|
cmp.select_next_item()
|
||||||
|
elseif luasnip.expand_or_jumpable() then
|
||||||
|
luasnip.expand_or_jump()
|
||||||
|
else
|
||||||
|
fallback()
|
||||||
|
end
|
||||||
|
end, { "i", "s" }),
|
||||||
|
|
||||||
|
["<S-Tab>"] = cmp.mapping(function(fallback)
|
||||||
|
if cmp.visible() then
|
||||||
|
cmp.select_prev_item()
|
||||||
|
elseif luasnip.jumpable(-1) then
|
||||||
|
luasnip.jump(-1)
|
||||||
|
else
|
||||||
|
fallback()
|
||||||
|
end
|
||||||
|
end, { "i", "s" }),
|
||||||
|
},
|
||||||
|
|
||||||
|
sources = cmp.config.sources {
|
||||||
|
{ name = "nvim_lsp" },
|
||||||
|
{ name = "luasnip" },
|
||||||
|
{ name = "path" },
|
||||||
|
{ name = "buffer" },
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
cmp.setup.cmdline({ "/", "?" }, {
|
||||||
|
mapping = cmp.mapping.preset.cmdline(),
|
||||||
|
sources = { { name = "buffer" } },
|
||||||
|
})
|
||||||
|
|
||||||
|
cmp.setup.cmdline(":", {
|
||||||
|
mapping = cmp.mapping.preset.cmdline(),
|
||||||
|
sources = cmp.config.sources({ { name = "path" } }, { { name = "cmdline" } }),
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
||||||
@@ -17,6 +17,10 @@ return {
|
|||||||
opts = {
|
opts = {
|
||||||
formatters_by_ft = {
|
formatters_by_ft = {
|
||||||
lua = { "stylua" },
|
lua = { "stylua" },
|
||||||
|
yml = { "yamlfmt" },
|
||||||
|
yaml = { "yamlfmt" },
|
||||||
|
nix = { "nixfmt" },
|
||||||
|
bash = { "shfmt" },
|
||||||
},
|
},
|
||||||
default_format_opts = {
|
default_format_opts = {
|
||||||
lsp_format = "fallback",
|
lsp_format = "fallback",
|
||||||
|
|||||||
@@ -1,29 +1,4 @@
|
|||||||
return {
|
return {
|
||||||
{
|
|
||||||
"hrsh7th/nvim-cmp",
|
|
||||||
dependencies = {
|
|
||||||
"hrsh7th/cmp-nvim-lsp",
|
|
||||||
"L3MON4D3/LuaSnip",
|
|
||||||
},
|
|
||||||
config = function()
|
|
||||||
local cmp = require "cmp"
|
|
||||||
cmp.setup {
|
|
||||||
snippet = {
|
|
||||||
expand = function(args)
|
|
||||||
require("luasnip").lsp_expand(args.body)
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
mapping = cmp.mapping.preset.insert {
|
|
||||||
["<CR>"] = cmp.mapping.confirm { select = true },
|
|
||||||
["<C-Space>"] = cmp.mapping.complete(),
|
|
||||||
},
|
|
||||||
sources = {
|
|
||||||
{ name = "nvim_lsp" },
|
|
||||||
{ name = "luasnip" },
|
|
||||||
},
|
|
||||||
}
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"neovim/nvim-lspconfig",
|
"neovim/nvim-lspconfig",
|
||||||
dependencies = {
|
dependencies = {
|
||||||
@@ -35,23 +10,9 @@ return {
|
|||||||
caps = require("cmp_nvim_lsp").default_capabilities(caps)
|
caps = require("cmp_nvim_lsp").default_capabilities(caps)
|
||||||
|
|
||||||
vim.lsp.config("*", { capabilities = caps })
|
vim.lsp.config("*", { capabilities = caps })
|
||||||
|
|
||||||
vim.lsp.config("lua_ls", {
|
|
||||||
settings = {
|
|
||||||
Lua = {
|
|
||||||
diagnostics = {
|
|
||||||
globals = { "vim" },
|
|
||||||
},
|
|
||||||
workspace = {
|
|
||||||
checkThirdParty = false,
|
|
||||||
},
|
|
||||||
telemetry = { enable = false },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
vim.lsp.enable {
|
vim.lsp.enable {
|
||||||
"lua_ls",
|
"lua_ls",
|
||||||
|
"bashls",
|
||||||
}
|
}
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user