add terminal config for linux and windows

This commit is contained in:
Luke 2023-03-10 19:48:57 -07:00
parent 11d0840dba
commit 528706506e
1 changed files with 25 additions and 21 deletions

View File

@ -42,20 +42,24 @@ vim.g.mapleader = ' '
vim.g.maplocalleader = ' ' vim.g.maplocalleader = ' '
-- Set powershell as the terminal -- Set powershell as the terminal
local powershell_options = { local powershell_options = {}
shell = vim.fn.executable "pwsh" == 1 and "pwsh" or "powershell", if not vim.loop.os_uname() == "linux" then
shellcmdflag = powershell_options = {
"-NoLogo -NoProfile -ExecutionPolicy RemoteSigned -Command [Console]::InputEncoding=[Console]::OutputEncoding=[System.Text.Encoding]::UTF8;", shell = vim.fn.executable "pwsh" == 1 and "pwsh" or "powershell",
shellredir = "-RedirectStandardOutput %s -NoNewWindow -Wait", shellcmdflag =
shellpipe = "2>&1 | Out-File -Encoding UTF8 %s; exit $LastExitCode", "-NoLogo -NoProfile -ExecutionPolicy RemoteSigned -Command [Console]::InputEncoding=[Console]::OutputEncoding=[System.Text.Encoding]::UTF8;",
shellquote = "", shellredir = "-RedirectStandardOutput %s -NoNewWindow -Wait",
shellxquote = "", shellpipe = "2>&1 | Out-File -Encoding UTF8 %s; exit $LastExitCode",
} shellquote = "",
shellxquote = "",
}
for option, value in pairs(powershell_options) do for option, value in pairs(powershell_options) do
vim.opt[option] = value vim.opt[option] = value
end
end end
-- Install package manager -- Install package manager
-- https://github.com/folke/lazy.nvim -- https://github.com/folke/lazy.nvim
-- `:help lazy.nvim.txt` for more info -- `:help lazy.nvim.txt` for more info
@ -264,8 +268,8 @@ require('telescope').setup {
defaults = { defaults = {
mappings = { mappings = {
i = { i = {
['<C-u>'] = false, ['<C-u>'] = false,
['<C-d>'] = false, ['<C-d>'] = false,
}, },
}, },
}, },
@ -387,14 +391,14 @@ cmp.setup {
end, end,
}, },
mapping = cmp.mapping.preset.insert { mapping = cmp.mapping.preset.insert {
['<C-d>'] = cmp.mapping.scroll_docs(-4), ['<C-d>'] = cmp.mapping.scroll_docs( -4),
['<C-f>'] = cmp.mapping.scroll_docs(4), ['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-Space>'] = cmp.mapping.complete {}, ['<C-Space>'] = cmp.mapping.complete {},
['<CR>'] = cmp.mapping.confirm { ['<CR>'] = cmp.mapping.confirm {
behavior = cmp.ConfirmBehavior.Replace, behavior = cmp.ConfirmBehavior.Replace,
select = true, select = true,
}, },
["<Tab>"] = cmp.mapping(function(fallback) ["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then if cmp.visible() then
cmp.select_next_item() cmp.select_next_item()
-- You could replace the expand_or_jumpable() calls with expand_or_locally_jumpable() -- You could replace the expand_or_jumpable() calls with expand_or_locally_jumpable()
@ -408,11 +412,11 @@ cmp.setup {
end end
end, { "i", "s" }), end, { "i", "s" }),
["<S-Tab>"] = cmp.mapping(function(fallback) ["<S-Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then if cmp.visible() then
cmp.select_prev_item() cmp.select_prev_item()
elseif luasnip.jumpable(-1) then elseif luasnip.jumpable( -1) then
luasnip.jump(-1) luasnip.jump( -1)
else else
fallback() fallback()
end end