updates
This commit is contained in:
parent
c839993a25
commit
f1d8f5f834
@ -63,3 +63,28 @@ vim.cmd([[
|
|||||||
-- end
|
-- end
|
||||||
-- end
|
-- end
|
||||||
-- })
|
-- })
|
||||||
|
|
||||||
|
local function set_timeoutlen_for_insert_mode()
|
||||||
|
if vim.bo.buftype == "terminal" or vim.bo.filetype == "codecompanion" then
|
||||||
|
vim.o.timeoutlen = 0
|
||||||
|
else
|
||||||
|
vim.o.timeoutlen = 300 -- Default timeoutlen for other buffers
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Create an augroup for managing the autocmds
|
||||||
|
local augroup = vim.api.nvim_create_augroup("InsertModeTimeout", { clear = true })
|
||||||
|
|
||||||
|
-- Autocommand to adjust timeoutlen when entering insert mode
|
||||||
|
vim.api.nvim_create_autocmd("InsertEnter", {
|
||||||
|
group = augroup,
|
||||||
|
callback = set_timeoutlen_for_insert_mode,
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Autocommand to reset timeoutlen when leaving insert mode
|
||||||
|
vim.api.nvim_create_autocmd("InsertLeave", {
|
||||||
|
group = augroup,
|
||||||
|
callback = function()
|
||||||
|
vim.o.timeoutlen = 300
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
@ -83,23 +83,35 @@ end
|
|||||||
|
|
||||||
map("v", "op", "<C-\\><C-N>:ToggleTerm name=ipython")
|
map("v", "op", "<C-\\><C-N>:ToggleTerm name=ipython")
|
||||||
map("v", "oP", "<C-\\><C-N>:ToggleTerm name=ipython-full")
|
map("v", "oP", "<C-\\><C-N>:ToggleTerm name=ipython-full")
|
||||||
map("t", "<leader>tp", "<C-\\><C-N>:FloatermToggle ipython<CR>", opts)
|
|
||||||
map("t", "<leader>tP", "<C-\\><C-N>:FloatermToggle ipython-full<CR>", opts)
|
|
||||||
|
|
||||||
map("n", "<C-T>", ":ToggleTerm name=toggleterm<CR>", opts)
|
map("n", "<C-T>", ":ToggleTerm name=toggleterm<CR>", opts)
|
||||||
map("n", "<leader>tt", ":ToggleTerm name=toggleterm<CR>", opts)
|
map("n", "<leader>tt", ":ToggleTerm name=toggleterm<CR>", opts)
|
||||||
|
map("n", "<leader>tT", ":ToggleTerm name=toggleterm-full direction=tab<CR>", opts)
|
||||||
map("n", "<leader>ts", ":TermSelect<CR>", opts)
|
map("n", "<leader>ts", ":TermSelect<CR>", opts)
|
||||||
map("n", "<leader>tv", ":ToggleTerm direction=vertical name=toggleterm-vert<CR>", opts)
|
map("n", "<leader>tv", ":ToggleTerm direction=vertical name=toggleterm-vert<CR>", opts)
|
||||||
map("n", "<leader>th", ":ToggleTerm direction=horizontal name=toggleterm-hori<CR>", opts)
|
map("n", "<leader>th", ":ToggleTerm direction=horizontal name=toggleterm-hori<CR>", opts)
|
||||||
map("n", "<leader>tf", ":ToggleTerm name=toggleterm<CR>", opts)
|
map("n", "<leader>tf", ":ToggleTerm name=toggleterm<CR>", opts)
|
||||||
|
map("n", "<leader>-", "<C-\\><C-N>:ToggleTerm direction='horizontal'<CR>", opts)
|
||||||
|
map("n", "<leader>|", "<C-\\><C-N>:ToggleTerm direction='vertical'<CR>", opts)
|
||||||
|
|
||||||
map("t", "<leader>tt", "<C-\\><C-N>:ToggleTerm<CR>", opts)
|
-- map("t", "<leader>tt", "<C-\\><C-N>:ToggleTerm<CR>", opts)
|
||||||
map("t", "<leader>tf", "<C-\\><C-N>:ToggleTerm<CR>", opts)
|
-- map("t", "<leader>tf", "<C-\\><C-N>:ToggleTerm<CR>", opts)
|
||||||
map("t", "<leader>tv", "<C-\\><C-N>:ToggleTerm --name=toggleterm-vert<CR>", opts)
|
-- map("t", "<leader>-", "<C-\\><C-N>:ToggleTerm direction='horizontal'<CR>", opts)
|
||||||
map("t", "<leader>th", "<C-\\><C-N>:ToggleTerm --name=toggleterm-hori<CR>", opts)
|
-- map("t", "<leader>|", "<C-\\><C-N>:ToggleTerm direction='vertical'<CR>", opts)
|
||||||
map("t", "<C-T>", "<C-\\><C-n>:Toggleterm<CR>", opts)
|
-- map("t", "<leader>tv", "<C-\\><C-N>:ToggleTerm --name=toggleterm-vert<CR>", opts)
|
||||||
map("t", "<Esc>", "<C-\\><C-n>", opts)
|
-- map("t", "<leader>th", "<C-\\><C-N>:ToggleTerm --name=toggleterm-hori<CR>", opts)
|
||||||
map("t", "<space>", "<space>", opts) -- fix space in terminal
|
-- map("t", "<C-T>", "<C-\\><C-n>:Toggleterm<CR>", opts)
|
||||||
|
-- map("t", "<Esc>", "<C-\\><C-n>", opts)
|
||||||
|
-- map("n", "<space>", "<nop>", opts) -- fix space in terminal
|
||||||
|
function _G.set_terminal_keymaps()
|
||||||
|
local opts = { buffer = 0 }
|
||||||
|
map("t", "<esc>", [[<C-\><C-n>]], opts)
|
||||||
|
map("t", "<C-w>", [[<C-\><C-n><C-w>]], opts)
|
||||||
|
-- map("t", "<space>", "<space>", { buffer = 0, silent = true }) -- fix space in terminal
|
||||||
|
end
|
||||||
|
|
||||||
|
-- if you only want these mappings for toggle term use term://*toggleterm#* instead
|
||||||
|
vim.cmd("autocmd! TermOpen term://* lua set_terminal_keymaps()")
|
||||||
--}}}
|
--}}}
|
||||||
|
|
||||||
--{{{ LSP mappings
|
--{{{ LSP mappings
|
||||||
@ -140,7 +152,7 @@ map("v", "<leader>CT", ":CodeCompanion /tests<CR>", opts)
|
|||||||
map("n", "<leader>cd", ":Telescope diagnostics<CR>")
|
map("n", "<leader>cd", ":Telescope diagnostics<CR>")
|
||||||
map("n", "<leader>cDn", ":lua vim.diagnostic.goto_next()<CR>")
|
map("n", "<leader>cDn", ":lua vim.diagnostic.goto_next()<CR>")
|
||||||
map("n", "<leader>cDp", ":lua vim.diagnostic.goto_prev()<CR<CR>")
|
map("n", "<leader>cDp", ":lua vim.diagnostic.goto_prev()<CR<CR>")
|
||||||
map("n", "<leader>cd", ":lua vim.diagnostic.setloclist()<CR>")
|
map("n", "<leader>cl", ":lua vim.diagnostic.setloclist()<CR>")
|
||||||
--}}}
|
--}}}
|
||||||
|
|
||||||
--{{{ Telescope mappings
|
--{{{ Telescope mappings
|
||||||
@ -217,7 +229,7 @@ end, opts)
|
|||||||
--{{{ LSP
|
--{{{ LSP
|
||||||
map("n", "<leader>ld", ":Telescope lsp_definitions<CR>")
|
map("n", "<leader>ld", ":Telescope lsp_definitions<CR>")
|
||||||
map("n", "<leader>lD", ":Telescope diagnostic<CR>")
|
map("n", "<leader>lD", ":Telescope diagnostic<CR>")
|
||||||
map("n", "<leader>la", ":lua vim.lsp.buf.code_action()<CR>")
|
map("n", "<leader>la", vim.lsp.buf.code_action)
|
||||||
map("n", "<leader>lci", ":Telescope lsp_incoming_calls<CR>")
|
map("n", "<leader>lci", ":Telescope lsp_incoming_calls<CR>")
|
||||||
map("n", "<leader>lco", ":Telescope lsp_outgoing_calls<CR>")
|
map("n", "<leader>lco", ":Telescope lsp_outgoing_calls<CR>")
|
||||||
map("n", "<leader>lh", ":lua vim.lsp.buf.signature_help()<CR>")
|
map("n", "<leader>lh", ":lua vim.lsp.buf.signature_help()<CR>")
|
||||||
|
@ -235,6 +235,35 @@ require("packer").startup(function(use)
|
|||||||
use({ "rcarriga/nvim-notify" })
|
use({ "rcarriga/nvim-notify" })
|
||||||
use({ "stevearc/dressing.nvim" })
|
use({ "stevearc/dressing.nvim" })
|
||||||
use({ "echasnovski/mini.nvim" })
|
use({ "echasnovski/mini.nvim" })
|
||||||
|
use({
|
||||||
|
"windwp/nvim-autopairs",
|
||||||
|
event = "InsertEnter",
|
||||||
|
config = function()
|
||||||
|
local npairs = require("nvim-autopairs")
|
||||||
|
local Rule = require("nvim-autopairs.rule")
|
||||||
|
local cmp_autopairs = require("nvim-autopairs.completion.cmp")
|
||||||
|
local cmp = require("cmp")
|
||||||
|
cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done())
|
||||||
|
|
||||||
|
npairs.setup({
|
||||||
|
disable_filetype = { "TelescopePrompt", "spectre_panel", "Terminal", "terminal" },
|
||||||
|
check_ts = true,
|
||||||
|
ts_config = {
|
||||||
|
lua = { "string" }, -- it will not add a pair on that treesitter node
|
||||||
|
javascript = { "template_string" },
|
||||||
|
java = false, -- don't check treesitter on java
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
local ts_conds = require("nvim-autopairs.ts-conds")
|
||||||
|
|
||||||
|
-- press % => %% only while inside a comment or string
|
||||||
|
npairs.add_rules({
|
||||||
|
Rule("%", "%", "lua"):with_pair(ts_conds.is_ts_node({ "string", "comment" })),
|
||||||
|
Rule("$", "$", "lua"):with_pair(ts_conds.is_not_ts_node({ "function" })),
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
-- }}}
|
-- }}}
|
||||||
|
|
||||||
@ -258,7 +287,6 @@ require("packer").startup(function(use)
|
|||||||
})
|
})
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
use("jiangmiao/auto-pairs")
|
|
||||||
use("pechorin/any-jump.vim")
|
use("pechorin/any-jump.vim")
|
||||||
use("tpope/vim-commentary")
|
use("tpope/vim-commentary")
|
||||||
use("tpope/vim-dotenv")
|
use("tpope/vim-dotenv")
|
||||||
|
@ -3,45 +3,45 @@ local helpers = require("null-ls.helpers")
|
|||||||
-- syncronous formatting
|
-- syncronous formatting
|
||||||
local augroup = vim.api.nvim_create_augroup("LspFormatting", {})
|
local augroup = vim.api.nvim_create_augroup("LspFormatting", {})
|
||||||
require("null-ls").setup({
|
require("null-ls").setup({
|
||||||
-- you can reuse a shared lspconfig on_attach callback here
|
-- you can reuse a shared lspconfig on_attach callback here
|
||||||
on_attach = function(client, bufnr)
|
on_attach = function(client, bufnr)
|
||||||
if client.supports_method("textDocument/formatting") then
|
if client.supports_method("textDocument/formatting") then
|
||||||
vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr })
|
vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr })
|
||||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||||
group = augroup,
|
group = augroup,
|
||||||
buffer = bufnr,
|
buffer = bufnr,
|
||||||
callback = function()
|
callback = function()
|
||||||
-- on 0.8, you should use vim.lsp.buf.format({ bufnr = bufnr }) instead
|
-- on 0.8, you should use vim.lsp.buf.format({ bufnr = bufnr }) instead
|
||||||
-- on later neovim version, you should use vim.lsp.buf.format({ async = false }) instead
|
-- on later neovim version, you should use vim.lsp.buf.format({ async = false }) instead
|
||||||
-- vim.lsp.buf.formatting_sync()
|
-- vim.lsp.buf.formatting_sync()
|
||||||
vim.lsp.buf.format({
|
vim.lsp.buf.format({
|
||||||
async = false,
|
async = false,
|
||||||
bufnr = bufnr,
|
bufnr = bufnr,
|
||||||
filter = function(client)
|
filter = function(client)
|
||||||
return client.name == "null-ls"
|
return client.name == "null-ls"
|
||||||
end
|
end,
|
||||||
})
|
})
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
sources = {
|
sources = {
|
||||||
null_ls.builtins.completion.luasnip,
|
null_ls.builtins.completion.luasnip,
|
||||||
null_ls.builtins.formatting.black,
|
null_ls.builtins.formatting.black,
|
||||||
null_ls.builtins.formatting.isort,
|
null_ls.builtins.formatting.isort,
|
||||||
null_ls.builtins.diagnostics.mypy,
|
null_ls.builtins.diagnostics.mypy,
|
||||||
null_ls.builtins.diagnostics.markdownlint,
|
null_ls.builtins.diagnostics.markdownlint,
|
||||||
null_ls.builtins.diagnostics.pylint,
|
null_ls.builtins.diagnostics.pylint,
|
||||||
null_ls.builtins.diagnostics.pydoclint,
|
-- null_ls.builtins.diagnostics.pydoclint,
|
||||||
null_ls.builtins.formatting.stylua,
|
null_ls.builtins.formatting.stylua,
|
||||||
null_ls.builtins.formatting.markdownlint,
|
null_ls.builtins.formatting.markdownlint,
|
||||||
null_ls.builtins.formatting.prettier, -- handled by lsp server
|
null_ls.builtins.formatting.prettier, -- handled by lsp server
|
||||||
null_ls.builtins.formatting.shfmt.with({
|
null_ls.builtins.formatting.shfmt.with({
|
||||||
filetypes = { "sh", "bash" },
|
filetypes = { "sh", "bash" },
|
||||||
extra_args = { "-i", "0", "-ci", "-sr" }
|
extra_args = { "-i", "0", "-ci", "-sr" },
|
||||||
}),
|
}),
|
||||||
-- null_ls.builtins.diagnostics.actionlint,
|
-- null_ls.builtins.diagnostics.actionlint,
|
||||||
}
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
-- null_ls.setup({
|
-- null_ls.setup({
|
||||||
|
@ -1,79 +1,81 @@
|
|||||||
require("toggleterm").setup {
|
require("toggleterm").setup({
|
||||||
-- size can be a number or function which is passed the current terminal
|
-- size can be a number or function which is passed the current terminal
|
||||||
size = function(term)
|
size = function(term)
|
||||||
if term.direction == "horizontal" then
|
if term.direction == "horizontal" then
|
||||||
return 20
|
return 20
|
||||||
elseif term.direction == "vertical" then
|
elseif term.direction == "vertical" then
|
||||||
return vim.o.columns * 0.45
|
return vim.o.columns * 0.45
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
open_mapping = { [[<c-t>]], [[<leader>tt]] }, -- or { [[<c-\>]], [[<c-¥>]] } if you also use a Japanese keyboard.
|
open_mapping = { [[<c-t>]] }, -- or { [[<c-\>]], [[<c-¥>]] } if you also use a Japanese keyboard.
|
||||||
-- on_create = fun(t: Terminal), -- function to run when the terminal is first created
|
-- on_create = fun(t: Terminal), -- function to run when the terminal is first created
|
||||||
-- on_open = fun(t: Terminal), -- function to run when the terminal opens
|
-- on_open = fun(t: Terminal), -- function to run when the terminal opens
|
||||||
-- on_close = fun(t: Terminal), -- function to run when the terminal closes
|
-- on_close = fun(t: Terminal), -- function to run when the terminal closes
|
||||||
-- on_stdout = fun(t: Terminal, job: number, data: string[], name: string) -- callback for processing output on stdout
|
-- on_stdout = fun(t: Terminal, job: number, data: string[], name: string) -- callback for processing output on stdout
|
||||||
-- on_stderr = fun(t: Terminal, job: number, data: string[], name: string) -- callback for processing output on stderr
|
-- on_stderr = fun(t: Terminal, job: number, data: string[], name: string) -- callback for processing output on stderr
|
||||||
-- on_exit = fun(t: Terminal, job: number, exit_code: number, name: string) -- function to run when terminal process exits
|
-- on_exit = fun(t: Terminal, job: number, exit_code: number, name: string) -- function to run when terminal process exits
|
||||||
hide_numbers = true, -- hide the number column in toggleterm buffers
|
hide_numbers = true, -- hide the number column in toggleterm buffers
|
||||||
-- shade_filetypes = {},
|
-- shade_filetypes = {},
|
||||||
autochdir = false, -- when neovim changes it current directory the terminal will change it's own when next it's opened
|
autochdir = false, -- when neovim changes it current directory the terminal will change it's own when next it's opened
|
||||||
highlights = {
|
highlights = {
|
||||||
-- highlights which map to a highlight group name and a table of it's values
|
-- highlights which map to a highlight group name and a table of it's values
|
||||||
-- NOTE: this is only a subset of values, any group placed here will be set for the terminal window split
|
-- NOTE: this is only a subset of values, any group placed here will be set for the terminal window split
|
||||||
Normal = {
|
Normal = {
|
||||||
guibg = "#24273A",
|
guibg = "#24273A",
|
||||||
},
|
},
|
||||||
NormalFloat = {
|
NormalFloat = {
|
||||||
link = 'Normal'
|
link = "Normal",
|
||||||
},
|
},
|
||||||
-- FloatBorder = {
|
-- FloatBorder = {
|
||||||
-- guifg = "<VALUE-HERE>",
|
-- guifg = "<VALUE-HERE>",
|
||||||
-- guibg = "<VALUE-HERE>",
|
-- guibg = "<VALUE-HERE>",
|
||||||
-- },
|
-- },
|
||||||
},
|
},
|
||||||
shade_terminals = false, -- NOTE: this option takes priority over highlights specified so if you specify Normal highlights you should set this to false
|
shade_terminals = false, -- NOTE: this option takes priority over highlights specified so if you specify Normal highlights you should set this to false
|
||||||
-- shading_factor = '-10', -- the percentage by which to lighten dark terminal background, default: -30
|
-- shading_factor = '-10', -- the percentage by which to lighten dark terminal background, default: -30
|
||||||
-- shading_ratio = '-3', -- the ratio of shading factor for light/dark terminal background, default: -3
|
-- shading_ratio = '-3', -- the ratio of shading factor for light/dark terminal background, default: -3
|
||||||
start_in_insert = true,
|
start_in_insert = true,
|
||||||
insert_mappings = true, -- whether or not the open mapping applies in insert mode
|
insert_mappings = true, -- whether or not the open mapping applies in insert mode
|
||||||
terminal_mappings = true, -- whether or not the open mapping applies in the opened terminals
|
terminal_mappings = true, -- whether or not the open mapping applies in the opened terminals
|
||||||
persist_size = false,
|
persist_size = false,
|
||||||
persist_mode = true, -- if set to true (default) the previous terminal mode will be remembered
|
persist_mode = true, -- if set to true (default) the previous terminal mode will be remembered
|
||||||
-- direction = 'vertical' | 'horizontal' | 'tab' | 'float',
|
-- direction = 'vertical' | 'horizontal' | 'tab' | 'float',
|
||||||
direction = 'float',
|
direction = "float",
|
||||||
-- close_on_exit = true, -- close the terminal window when the process exits
|
-- close_on_exit = true, -- close the terminal window when the process exits
|
||||||
-- clear_env = false, -- use only environmental variables from `env`, passed to jobstart()
|
-- clear_env = false, -- use only environmental variables from `env`, passed to jobstart()
|
||||||
-- Change the default shell. Can be a string or a function returning a string
|
-- Change the default shell. Can be a string or a function returning a string
|
||||||
shell = vim.o.shell,
|
shell = vim.o.shell,
|
||||||
auto_scroll = true, -- automatically scroll to the bottom on terminal output
|
auto_scroll = true, -- automatically scroll to the bottom on terminal output
|
||||||
-- This field is only relevant if direction is set to 'float'
|
-- This field is only relevant if direction is set to 'float'
|
||||||
float_opts = {
|
float_opts = {
|
||||||
-- The border key is *almost* the same as 'nvim_open_win'
|
-- The border key is *almost* the same as 'nvim_open_win'
|
||||||
-- see :h nvim_open_win for details on borders however
|
-- see :h nvim_open_win for details on borders however
|
||||||
-- the 'curved' border is a custom border type
|
-- the 'curved' border is a custom border type
|
||||||
-- not natively supported but implemented in this plugin.
|
-- not natively supported but implemented in this plugin.
|
||||||
-- border = 'single' | 'double' | 'shadow' | 'curved' | ... other options supported by win open
|
-- border = 'single' | 'double' | 'shadow' | 'curved' | ... other options supported by win open
|
||||||
border = 'curved',
|
border = "curved",
|
||||||
-- like `size`, width, height, row, and col can be a number or function which is passed the current terminal
|
-- like `size`, width, height, row, and col can be a number or function which is passed the current terminal
|
||||||
width = vim.o.columns * 0.8,
|
width = function()
|
||||||
-- height = 75,
|
return vim.o.columns - 35
|
||||||
-- row = <value>,
|
end,
|
||||||
-- col = vim.o.columns * 0.8,
|
-- height = 75,
|
||||||
winblend = 3,
|
-- row = <value>,
|
||||||
zindex = 10,
|
-- col = vim.o.columns * 0.8,
|
||||||
-- title_pos = 'left' | 'center' | 'right', position of the title of the floating window
|
winblend = 3,
|
||||||
title_pos = 'center',
|
zindex = 10,
|
||||||
},
|
-- title_pos = 'left' | 'center' | 'right', position of the title of the floating window
|
||||||
winbar = {
|
title_pos = "center",
|
||||||
enabled = true,
|
},
|
||||||
name_formatter = function(term) -- term: Terminal
|
winbar = {
|
||||||
return term.name
|
enabled = false,
|
||||||
end
|
name_formatter = function(term) -- term: Terminal
|
||||||
},
|
return term.name
|
||||||
responsiveness = {
|
end,
|
||||||
-- breakpoint in terms of `vim.o.columns` at which terminals will start to stack on top of each other
|
},
|
||||||
-- instead of next to each other
|
responsiveness = {
|
||||||
-- default = 0 which means the feature is turned off
|
-- breakpoint in terms of `vim.o.columns` at which terminals will start to stack on top of each other
|
||||||
horizontal_breakpoint = 135,
|
-- instead of next to each other
|
||||||
}
|
-- default = 0 which means the feature is turned off
|
||||||
}
|
horizontal_breakpoint = 135,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user