dotfile: sync
This commit is contained in:
@@ -13,8 +13,11 @@ end
|
||||
vim.g.mapleader = ' '
|
||||
|
||||
nmap(';', ':')
|
||||
map('v', ';', ':')
|
||||
nmap(',,', '<C-^>')
|
||||
nmap('<leader>w', ':w<CR>') -- TODO: stop this madness, :h autowrite
|
||||
-- TODO: stop this madness, :h autowrite
|
||||
-- doesnt seem to work well in terminal
|
||||
nmap('<leader>w', ':w<CR>')
|
||||
nmap('Q', ':q!<CR>')
|
||||
nmap('<leader><space>', ':nohlsearch<CR>', { silent = true })
|
||||
|
||||
@@ -28,7 +31,7 @@ nmap('k', 'gk')
|
||||
nmap('H', '^')
|
||||
nmap('L', '$')
|
||||
nmap('J', 'mzJ`z')
|
||||
nmap('K', '<Nop>')
|
||||
-- nmap('K', '<Nop>')
|
||||
nmap('gQ', '<Nop>')
|
||||
nmap('vv', ':vs<CR>')
|
||||
|
||||
@@ -50,20 +53,21 @@ map('v', '<', '<gv')
|
||||
map('v', '>', '>gv')
|
||||
|
||||
-- vim-easy-align
|
||||
vim.keymap.set("n", "ga", "<Plug>(EasyAlign)")
|
||||
vim.keymap.set("x", "ga", "<Plug>(EasyAlign)")
|
||||
map("n", "ga", "<Plug>(EasyAlign)")
|
||||
map("x", "ga", "<Plug>(EasyAlign)")
|
||||
|
||||
-- nvim-tree.lua
|
||||
nmap('<leader>n', ':NvimTreeToggle<CR>')
|
||||
nmap('<leader>N', ':NvimTreeFindFile<CR>')
|
||||
-- nmap('<leader>n', ':NvimTreeToggle<CR>')
|
||||
-- nmap('<leader>N', ':NvimTreeFindFile<CR>')
|
||||
vim.keymap.set("n", "-", "<CMD>Oil<CR>", { desc = "Open parent directory" })
|
||||
|
||||
-- glow.vim
|
||||
nmap('<leader>p', ':Glow<CR>')
|
||||
|
||||
-- fugitive.vim
|
||||
nmap('<leader>ga',':Gwrite<CR>')
|
||||
nmap('<leader>gs',':Git<CR>')
|
||||
nmap('<leader>gb',':Git blame<CR>')
|
||||
nmap('<leader>ga', ':Gwrite<CR>')
|
||||
nmap('<leader>gs', ':Git<CR>')
|
||||
nmap('<leader>gb', ':Git blame<CR>')
|
||||
|
||||
-- rails-vim
|
||||
nmap('<leader>a', ':A<CR>')
|
||||
@@ -78,8 +82,28 @@ nmap('<C-f>', '<Plug>CtrlSFPrompt')
|
||||
-- trim whitespace
|
||||
nmap('<leader>W', ':TrimWhitespace<CR>')
|
||||
|
||||
|
||||
-- EXPERIMENTAL:
|
||||
-- nmap('<leader>x', ':!rm %<CR>')
|
||||
nmap('<leader>x', ":call delete(expand('%')) | bdelete!<CR>")
|
||||
|
||||
nmap('<leader>q', ':copen<CR>')
|
||||
nmap(']q', ':cnext<CR>')
|
||||
nmap('[q', ':cprevious<CR>')
|
||||
|
||||
-- command mode
|
||||
vim.keymap.set('c', '<C-a>', '<Home>')
|
||||
vim.keymap.set('c', '<C-e>', '<End>')
|
||||
|
||||
-- paste in visual mode and keep available
|
||||
local expr = { expr = true, noremap = false, silent = false }
|
||||
vim.keymap.set('x', 'p', [['pgv"'.v:register.'y`>']], expr)
|
||||
vim.keymap.set('x', 'P', [['Pgv"'.v:register.'y`>']], expr)
|
||||
|
||||
-- vim.keymap.set('n', 'gQ', 'mzgggqG`z<cmd>delmarks z<cr>zz', { desc = 'Format buffer' })
|
||||
|
||||
vim.keymap.set('n', '<C-d>', '<C-d>zz', { desc = 'Scroll downwards' })
|
||||
vim.keymap.set('n', '<C-u>', '<C-u>zz', { desc = 'Scroll upwards' })
|
||||
|
||||
-- vim.keymap.set('n', '<leader>to', '<cmd>tabonly<cr>', { desc = 'Close other tab pages' })
|
||||
|
||||
-- Make U opposite to u.
|
||||
-- vim.keymap.set('n', 'U', '<C-r>', { desc = 'Redo' })
|
||||
|
||||
@@ -125,7 +125,26 @@ packer.startup(function()
|
||||
-- EXPERIMENTAL: trying out different plugins
|
||||
use { 'skywind3000/asyncrun.vim' }
|
||||
|
||||
use {'kevinhwang91/nvim-bqf', ft = 'qf'} -- better qf
|
||||
use { 'kevinhwang91/nvim-bqf', ft = 'qf' }
|
||||
use { 'kevinhwang91/nvim-pqf', ft = 'qf' }
|
||||
use { 'weilbith/vim-qfloc-edit', ft = 'qf' }
|
||||
|
||||
use({
|
||||
"stevearc/oil.nvim",
|
||||
config = function()
|
||||
require("oil").setup({
|
||||
-- skip_confirm_for_simple_edits = true,
|
||||
-- prompt_save_on_select_new_entry = true,
|
||||
default_file_explorer = true,
|
||||
|
||||
view_options = {
|
||||
-- Show files and directories that start with "."
|
||||
show_hidden = false,
|
||||
}
|
||||
})
|
||||
end,
|
||||
})
|
||||
|
||||
end)
|
||||
|
||||
require('plugins.lsp')
|
||||
|
||||
@@ -2,8 +2,11 @@ local M = {}
|
||||
|
||||
function M.setup()
|
||||
vim.keymap.set('n', '<leader>ff', function() require('telescope.builtin').find_files({ hidden = true }) end)
|
||||
vim.keymap.set('n', '<leader>fb', function() require('telescope.builtin').buffers({ hidden = true }) end)
|
||||
vim.keymap.set('n', '<leader>fo', function() require('telescope.builtin').find_files({ cwd = '~/Syncthing/Obsidian/Personal/', search_file = '*.md' }) end)
|
||||
vim.keymap.set('n', '<leader>fO', function() require('telescope.builtin').live_grep({ cwd = '~/Syncthing/Obsidian/Personal/', search_file = '*.md' }) end)
|
||||
vim.keymap.set('n', '<leader>fh', function() require('telescope.builtin').help_tags() end)
|
||||
vim.keymap.set('n', '<leader>fq', function() require('telescope.builtin').quickfix() end)
|
||||
-- require('telescope.builtin').find_files({ hidden = true })
|
||||
end
|
||||
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
local cmd, opt, g = vim.cmd, vim.opt, vim.g
|
||||
|
||||
cmd('au TextYankPost * lua vim.highlight.on_yank { timeout = 250 }')
|
||||
local opt, g = vim.opt, vim.g
|
||||
|
||||
opt.smartindent = true -- Autoindenting when starting a new line
|
||||
opt.completeopt = {'menu', 'menuone', 'noselect'}
|
||||
@@ -33,16 +31,16 @@ opt.listchars = {
|
||||
nbsp = '⦸', -- CIRCLED REVERSE SOLIDUS (U+29B8, UTF-8: E2 A6 B8)
|
||||
extends = '»', -- RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK (U+00BB, UTF-8: C2 BB)
|
||||
precedes = '«', -- LEFT-POINTING DOUBLE ANGLE QUOTATION MARK (U+00AB, UTF-8: C2 AB)
|
||||
-- tab = ' ', -- '▷─' WHITE RIGHT-POINTING TRIANGLE (U+25B7, UTF-8: E2 96 B7) + BOX DRAWINGS HEAVY TRIPLE DASH HORIZONTAL (U+2505, UTF-8: E2 94 85)
|
||||
trail = '•', -- BULLET (U+2022, UTF-8: E2 80 A2)
|
||||
space = ' ',
|
||||
tab = '<->'
|
||||
tab = '→ '
|
||||
}
|
||||
|
||||
opt.fillchars = {
|
||||
diff = '⣿',
|
||||
eob = ' ', -- NO-BREAK SPACE (U+00A0, UTF-8: C2 A0) to suppress ~ at EndOfBuffer
|
||||
vert = '│', -- window border when window splits vertically ─ ┴ ┬ ┤ ├ ┼
|
||||
-- vert = '│', -- window border when window splits vertically ─ ┴ ┬ ┤ ├ ┼
|
||||
vert = '│',
|
||||
msgsep = '‾',
|
||||
fold = '·', -- MIDDLE DOT (U+00B7, UTF-8: C2 B7)
|
||||
foldopen = '▾',
|
||||
@@ -79,6 +77,7 @@ opt.shortmess = {
|
||||
|
||||
if vim.fn.executable('rg') > 0 then
|
||||
vim.o.grepprg = [[rg --glob "!.git" --no-heading --vimgrep --follow $*]]
|
||||
-- opt.grepformat = opt.grepformat ^ { '%f:%l:%c:%m' }
|
||||
end
|
||||
|
||||
-- ignore when autocompleting
|
||||
@@ -104,3 +103,41 @@ g.ctrlsf_mapping = {
|
||||
}
|
||||
|
||||
g.ruby_host_prog = 'asdf exec neovim-ruby-host'
|
||||
|
||||
-- highlight yanked text briefly
|
||||
vim.api.nvim_create_autocmd('TextYankPost', {
|
||||
callback = function()
|
||||
vim.highlight.on_yank {
|
||||
higroup = 'Search',
|
||||
timeout = 250,
|
||||
on_visual = true,
|
||||
}
|
||||
end,
|
||||
})
|
||||
|
||||
-- resize splits when Vim is resized
|
||||
vim.api.nvim_create_autocmd('VimResized', { command = 'horizontal wincmd =' })
|
||||
|
||||
vim.api.nvim_create_augroup('cursorline_focus', {})
|
||||
vim.api.nvim_create_autocmd({ 'InsertLeave', 'WinEnter' }, {
|
||||
group = 'cursorline_focus',
|
||||
callback = function()
|
||||
vim.wo.cursorline = true
|
||||
end,
|
||||
})
|
||||
vim.api.nvim_create_autocmd({ 'InsertEnter', 'WinLeave' }, {
|
||||
group = 'cursorline_focus',
|
||||
callback = function()
|
||||
vim.wo.cursorline = false
|
||||
end,
|
||||
})
|
||||
|
||||
-- Experimental
|
||||
opt.iskeyword:prepend { '-' } -- treat dash separated words as a word textobject
|
||||
|
||||
opt.updatetime = 100
|
||||
opt.timeout = true
|
||||
opt.timeoutlen = 1000
|
||||
opt.ttimeoutlen = 10
|
||||
|
||||
vim.cmd('packadd cfilter')
|
||||
|
||||
Reference in New Issue
Block a user