mirror of
https://github.com/Baipyrus/nvim-config.git
synced 2024-12-26 13:21:45 +00:00
Compare commits
10 Commits
b47664f0ec
...
b6acf5ccb1
Author | SHA1 | Date | |
---|---|---|---|
b6acf5ccb1 | |||
7a9d85ceb9 | |||
de146ec6de | |||
197b1f4ca0 | |||
6806aa7977 | |||
704f92592b | |||
c240529edd | |||
cacb564101 | |||
b138a01336 | |||
d117ed8ecf |
@ -1,9 +0,0 @@
|
|||||||
-- Plugin to automatically create and restore simple sessions
|
|
||||||
return {
|
|
||||||
'rmagatti/auto-session',
|
|
||||||
config = function()
|
|
||||||
require('auto-session').setup {
|
|
||||||
auto_session_enable_last_session = true,
|
|
||||||
}
|
|
||||||
end,
|
|
||||||
}
|
|
@ -1,3 +1,13 @@
|
|||||||
|
-- Fix oil absolute path to relative path conversion
|
||||||
|
vim.api.nvim_create_augroup('OilRelPathFix', {})
|
||||||
|
vim.api.nvim_create_autocmd('BufLeave', {
|
||||||
|
group = 'OilRelPathFix',
|
||||||
|
pattern = 'oil:///*',
|
||||||
|
callback = function()
|
||||||
|
vim.cmd 'cd .'
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'stevearc/oil.nvim',
|
'stevearc/oil.nvim',
|
||||||
opts = {},
|
opts = {},
|
||||||
|
@ -61,6 +61,66 @@ vim.keymap.set({ 'n', 'v' }, '<M-.>', '<C-W>>')
|
|||||||
vim.keymap.set({ 'n', 'v' }, '<M-=>', '<C-W>+')
|
vim.keymap.set({ 'n', 'v' }, '<M-=>', '<C-W>+')
|
||||||
vim.keymap.set({ 'n', 'v' }, '<M-->', '<C-W>-')
|
vim.keymap.set({ 'n', 'v' }, '<M-->', '<C-W>-')
|
||||||
|
|
||||||
|
local function get_visual_selection()
|
||||||
|
-- Get selection position
|
||||||
|
local s_start = vim.fn.getpos "'<"
|
||||||
|
local s_end = vim.fn.getpos "'>"
|
||||||
|
-- Get line count
|
||||||
|
local n_lines = math.abs(s_end[2] - s_start[2]) + 1
|
||||||
|
-- Read lines from buffer
|
||||||
|
local lines = vim.api.nvim_buf_get_lines(0, s_start[2] - 1, s_end[2], false)
|
||||||
|
-- Subtract unselected sections from lines
|
||||||
|
lines[1] = string.sub(lines[1], s_start[3], -1)
|
||||||
|
if n_lines == 1 then
|
||||||
|
lines[n_lines] = string.sub(lines[n_lines], 1, s_end[3] - s_start[3] + 1)
|
||||||
|
else
|
||||||
|
lines[n_lines] = string.sub(lines[n_lines], 1, s_end[3])
|
||||||
|
end
|
||||||
|
-- Return selected
|
||||||
|
return lines
|
||||||
|
end
|
||||||
|
|
||||||
|
local function global_cmd_yank()
|
||||||
|
-- Prompt user input for expression
|
||||||
|
local inexpr = vim.fn.input 'Enter expression: '
|
||||||
|
local outsep = vim.fn.input 'Enter separator: '
|
||||||
|
|
||||||
|
-- Get the (selected) lines
|
||||||
|
local lines = nil
|
||||||
|
local mode = vim.api.nvim_get_mode()['mode']
|
||||||
|
if string.find(mode:lower(), '^v') then
|
||||||
|
lines = get_visual_selection()
|
||||||
|
else
|
||||||
|
lines = vim.api.nvim_buf_get_lines(0, 0, -1, false)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Apply expression on all lines
|
||||||
|
local matches = vim.fn.matchstrlist(lines, inexpr)
|
||||||
|
local extracted = vim.tbl_map(function(value)
|
||||||
|
return value['text']
|
||||||
|
end, matches)
|
||||||
|
|
||||||
|
-- Concat matches according to separator
|
||||||
|
local value = table.concat(extracted, outsep)
|
||||||
|
-- Trigger global search to highlight results
|
||||||
|
vim.cmd('g/' .. inexpr .. '/')
|
||||||
|
-- Write to system register
|
||||||
|
vim.fn.setreg('+', value)
|
||||||
|
|
||||||
|
print('Found ' .. #extracted .. ' results!')
|
||||||
|
end
|
||||||
|
|
||||||
|
vim.keymap.set({ 'n', 'v' }, '<leader>gy', global_cmd_yank, { desc = '[G]lobal command [Y]ank' })
|
||||||
|
|
||||||
|
-- Fix filename keymap
|
||||||
|
vim.keymap.set({ 'n', 'v' }, '<leader>fp', function()
|
||||||
|
-- lua print(string.gsub(vim.api.nvim_buf_get_name(0), vim.fn.getcwd(), ''))
|
||||||
|
local cwd = vim.fn.getcwd()
|
||||||
|
local path = vim.api.nvim_buf_get_name(0)
|
||||||
|
local file, _ = string.gsub(path, cwd .. '\\', '')
|
||||||
|
vim.cmd('0f | file ' .. file)
|
||||||
|
end, { desc = '[F]ile Fix Relative [P]ath' })
|
||||||
|
|
||||||
if vim.g.neovide then
|
if vim.g.neovide then
|
||||||
-- System clipboard keybinds in normal and visual mode
|
-- System clipboard keybinds in normal and visual mode
|
||||||
vim.keymap.set({ 'n', 'v' }, '<C-S-c>', '"+y', { desc = 'Yank to System clipboard' })
|
vim.keymap.set({ 'n', 'v' }, '<C-S-c>', '"+y', { desc = 'Yank to System clipboard' })
|
||||||
|
@ -18,7 +18,7 @@ return {
|
|||||||
-- Disable "format_on_save lsp_fallback" for languages that don't
|
-- Disable "format_on_save lsp_fallback" for languages that don't
|
||||||
-- have a well standardized coding style. You can add additional
|
-- have a well standardized coding style. You can add additional
|
||||||
-- languages here or re-enable it for the disabled ones.
|
-- languages here or re-enable it for the disabled ones.
|
||||||
local disable_filetypes = { c = true, cpp = true }
|
local disable_filetypes = { c = true, cpp = true, php = true }
|
||||||
return {
|
return {
|
||||||
timeout_ms = 500,
|
timeout_ms = 500,
|
||||||
lsp_fallback = not disable_filetypes[vim.bo[bufnr].filetype],
|
lsp_fallback = not disable_filetypes[vim.bo[bufnr].filetype],
|
||||||
|
@ -166,6 +166,7 @@ return {
|
|||||||
pyright = {},
|
pyright = {},
|
||||||
svelte = {},
|
svelte = {},
|
||||||
gopls = {},
|
gopls = {},
|
||||||
|
intelephense = {},
|
||||||
-- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs
|
-- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs
|
||||||
--
|
--
|
||||||
-- Some languages (like typescript) have entire language plugins that can be useful:
|
-- Some languages (like typescript) have entire language plugins that can be useful:
|
||||||
|
@ -23,6 +23,7 @@ return {
|
|||||||
'markdown',
|
'markdown',
|
||||||
'gitcommit',
|
'gitcommit',
|
||||||
'gitignore',
|
'gitignore',
|
||||||
|
'php',
|
||||||
},
|
},
|
||||||
-- Autoinstall languages that are not installed
|
-- Autoinstall languages that are not installed
|
||||||
auto_install = true,
|
auto_install = true,
|
||||||
|
@ -25,7 +25,7 @@ return {
|
|||||||
['<leader>r'] = { name = '[R]ename', _ = 'which_key_ignore' },
|
['<leader>r'] = { name = '[R]ename', _ = 'which_key_ignore' },
|
||||||
['<leader>s'] = { name = '[S]earch', _ = 'which_key_ignore' },
|
['<leader>s'] = { name = '[S]earch', _ = 'which_key_ignore' },
|
||||||
['<leader>w'] = { name = '[W]orkspace', _ = 'which_key_ignore' },
|
['<leader>w'] = { name = '[W]orkspace', _ = 'which_key_ignore' },
|
||||||
['<leader>g'] = { name = '[G]it', _ = 'which_key_ignore' },
|
['<leader>g'] = { name = '[G]it/[G]lobal', _ = 'which_key_ignore' },
|
||||||
['<leader>b'] = { name = '[B]uffer/[B]reakpoint', _ = 'which_key_ignore' },
|
['<leader>b'] = { name = '[B]uffer/[B]reakpoint', _ = 'which_key_ignore' },
|
||||||
['<leader>c'] = { name = '[C]ode/[C]odeium/[C]hange', _ = 'which_key_ignore' },
|
['<leader>c'] = { name = '[C]ode/[C]odeium/[C]hange', _ = 'which_key_ignore' },
|
||||||
['<leader>cd'] = { name = '[D]irectory', _ = 'which_key_ignore' },
|
['<leader>cd'] = { name = '[D]irectory', _ = 'which_key_ignore' },
|
||||||
@ -50,6 +50,7 @@ return {
|
|||||||
['<leader>pn'] = { name = '[N]o', _ = 'which_key_ignore' },
|
['<leader>pn'] = { name = '[N]o', _ = 'which_key_ignore' },
|
||||||
['<leader>l'] = { name = '[L]ist', _ = 'which_key_ignore' },
|
['<leader>l'] = { name = '[L]ist', _ = 'which_key_ignore' },
|
||||||
['<leader>f'] = { name = '[F]ormat/[F]ile', _ = 'which_key_ignore' },
|
['<leader>f'] = { name = '[F]ormat/[F]ile', _ = 'which_key_ignore' },
|
||||||
|
['<leader>g'] = { name = '[G]lobal', _ = 'which_key_ignore' },
|
||||||
}, { mode = 'v' })
|
}, { mode = 'v' })
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
@ -16,11 +16,8 @@ require('lazy').setup({
|
|||||||
-- Discord RPC
|
-- Discord RPC
|
||||||
'andweeb/presence.nvim',
|
'andweeb/presence.nvim',
|
||||||
|
|
||||||
-- Processing-Java
|
|
||||||
'sophacles/vim-processing',
|
|
||||||
|
|
||||||
-- NOTE: Plugins can be added with a link (or for a github repo: 'owner/repo' link).
|
-- NOTE: Plugins can be added with a link (or for a github repo: 'owner/repo' link).
|
||||||
'tpope/vim-sleuth', -- Detect tabstop and shiftwidth automatically
|
'sophacles/vim-processing', -- Processing-Java
|
||||||
|
|
||||||
-- NOTE: Plugins can also be added by using a table,
|
-- NOTE: Plugins can also be added by using a table,
|
||||||
-- with the first argument being the link and the following
|
-- with the first argument being the link and the following
|
||||||
|
Loading…
Reference in New Issue
Block a user