Compare commits

..

No commits in common. "b47664f0ece5c6280b6881043c0c915c8570b08e" and "7f9256b56c8bd3d7ded9b71bb3edb8098521df47" have entirely different histories.

7 changed files with 16 additions and 68 deletions

View File

@ -0,0 +1,9 @@
-- 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,
}

View File

@ -1,13 +1,3 @@
-- 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 {
'stevearc/oil.nvim',
opts = {},

View File

@ -61,63 +61,14 @@ 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' })
if vim.g.neovide then
-- 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-v>', '"+p', { desc = 'Paste from System clipboard' })
-- Clipboard for command and insert mode
vim.keymap.set({ 'c', 'i' }, '<C-S-v>', '<C-R>+', { desc = 'Paste from System clipboard' })
-- Clipboard for insert mode
vim.keymap.set({ 'i' }, '<C-S-v>', '<Esc>"+pi', { desc = 'Paste from System clipboard' })
-- Clipboard for command mode
vim.keymap.set('c', '<C-S-v>', '<C-R>+', { desc = 'Paste from System clipboard' })
end
-- [[ Basic Autocommands ]]

View File

@ -166,7 +166,6 @@ return {
pyright = {},
svelte = {},
gopls = {},
intelephense = {},
-- ... 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:

View File

@ -23,7 +23,6 @@ return {
'markdown',
'gitcommit',
'gitignore',
'php',
},
-- Autoinstall languages that are not installed
auto_install = true,

View File

@ -25,7 +25,7 @@ return {
['<leader>r'] = { name = '[R]ename', _ = 'which_key_ignore' },
['<leader>s'] = { name = '[S]earch', _ = 'which_key_ignore' },
['<leader>w'] = { name = '[W]orkspace', _ = 'which_key_ignore' },
['<leader>g'] = { name = '[G]it/[G]lobal', _ = 'which_key_ignore' },
['<leader>g'] = { name = '[G]it', _ = '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>cd'] = { name = '[D]irectory', _ = 'which_key_ignore' },
@ -50,7 +50,6 @@ return {
['<leader>pn'] = { name = '[N]o', _ = 'which_key_ignore' },
['<leader>l'] = { name = '[L]ist', _ = 'which_key_ignore' },
['<leader>f'] = { name = '[F]ormat/[F]ile', _ = 'which_key_ignore' },
['<leader>g'] = { name = '[G]lobal', _ = 'which_key_ignore' },
}, { mode = 'v' })
end,
},

View File

@ -10,7 +10,8 @@ vim.api.nvim_exec2('language en_US', {})
-- Sets the shell to use for system() and ! commands in windows
if vim.fn.has 'win32' == 1 and vim.fn.has 'wsl' == 0 then
vim.opt.shell = vim.fn.executable 'pwsh' == 1 and 'pwsh' or 'powershell'
vim.opt.shellcmdflag = '-NoLogo -Command [Console]::InputEncoding=[Console]::OutputEncoding=[System.Text.Encoding]::UTF8;'
vim.opt.shellcmdflag =
'-NoLogo -NoProfile -ExecutionPolicy RemoteSigned -Command [Console]::InputEncoding=[Console]::OutputEncoding=[System.Text.Encoding]::UTF8;'
vim.opt.shellredir = '-RedirectStandardOutput %s -NoNewWindow -Wait'
vim.opt.shellpipe = '2>&1 | Out-File -Encoding UTF8 %s; exit $LastExitCode'
vim.opt.shellxquote = ''