summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--init.vim52
1 files changed, 29 insertions, 23 deletions
diff --git a/init.vim b/init.vim
index 441ed34..e2a597f 100644
--- a/init.vim
+++ b/init.vim
@@ -166,7 +166,7 @@ augroup InitVim
au!
" Automatically stop highligting things when leaving insert mode. If I want
" the highlight back, I can just hit 'n' and it will come back.
- autocmd InsertLeave * set nohlsearch | redraw
+ autocmd InsertLeave * set nohlsearch
autocmd CmdlineEnter /,\? set hlsearch
autocmd TextYankPost *
@@ -175,6 +175,7 @@ augroup InitVim
" autocmd CursorHold * lua vim.lsp.buf.document_highlight()
" autocmd CursorHoldI * lua vim.lsp.buf.document_highlight()
" autocmd CursorMoved * lua vim.lsp.buf.clear_references()
+ autocmd FocusGained,BufEnter * checktime
augroup END
nnoremap <silent> n <cmd>set hlsearch<CR>n
nnoremap <silent> N <cmd>set hlsearch<CR>N
@@ -266,6 +267,8 @@ noremap g[co <cmd>Telescope lsp_outgoing_calls path_display={"shorten"}<cr>
noremap g[sd <cmd>Telescope lsp_document_symbols path_display={"shorten"}<cr>
noremap g[sw <cmd>Telescope lsp_workspace_symbols path_display={"shorten"}<cr>
noremap g[sdw <cmd>Telescope lsp_dynamic_workspace_symbols path_display={"shorten"}<cr>
+noremap [e <cmd>lua vim.diagnostic.jump({count=-1, severity=vim.diagnostic.severity.ERROR})<cr>
+noremap ]e <cmd>lua vim.diagnostic.jump({count=1, severity=vim.diagnostic.severity.ERROR})<cr>
set textwidth=80
set colorcolumn=+1
@@ -279,7 +282,7 @@ if has('rneovim')
endif
" Opens a terminal in the directory of the current file.
-command! TERM exec "term sh -c " . shellescape(printf("cd %s && exec ", shellescape(expand('%:p:h')))) . '$SHELL'
+command! TERM lua open_terminal_on_directory(vim.fn.expand('%:p:h'))
" W = w. I often click when typing :w
command! W w
@@ -340,20 +343,23 @@ menu PopUp.Close :q<cr>
noremap gh <cmd>HopCamelCase<cr>
lua << EOF
- function open_terminal_on_directory()
- local buf = vim.api.nvim_get_current_buf()
- local bufname = vim.api.nvim_buf_get_name(buf)
+ function open_terminal_on_directory(dirname)
+ if not dirname then
+ local buf = vim.api.nvim_get_current_buf()
+ dirname = vim.api.nvim_buf_get_name(buf)
+ end
- if vim.fn.isdirectory(bufname) ~= 1 then
+ if vim.fn.isdirectory(dirname) ~= 1 then
return
end
- local tcmd = string.format("cd %s && exec $SHELL", vim.fn.shellescape(bufname))
+ local tcmd = string.format("cd %s && exec $SHELL", vim.fn.shellescape(dirname))
local cmd = string.format("term sh -c %s", vim.fn.shellescape(tcmd))
vim.cmd(cmd)
vim.cmd("startinsert")
+ vim.cmd("silent! keepalt file TERM " .. dirname)
end
require'nvim-treesitter.configs'.setup {
@@ -375,8 +381,8 @@ lua << EOF
["ia"] = "@parameter.inner",
["iq"] = "@block.inner",
["aq"] = "@block.outer",
- ["aS"] = "@statement.outer",
- ["iS"] = "@statement.inner",
+ ["a;"] = "@statement.outer",
+ ["i;"] = "@statement.inner",
-- You can optionally set descriptions to the mappings (used in the desc parameter of
-- nvim_buf_set_keymap) which plugins like which-key display
["iC"] = { query = "@class.inner", desc = "Select inner part of a class region" },
@@ -547,20 +553,20 @@ lua << EOF
})
require("nvim-surround").setup({})
- local smear_cursor = require('smear_cursor')
- smear_cursor.enabled = true
- smear_cursor.delay_event_to_smear = 33
- smear_cursor.cursor_color = '#ff0000'
- smear_cursor.legacy_computing_symbols_support = true
- smear_cursor.stiffness = 0.8
- smear_cursor.min_vertical_distance_smear = 5
- smear_cursor.min_horizontal_distance_smear = 20
- smear_cursor.distance_stop_animating = 0
- smear_cursor.trailing_stiffness = 0.5
- smear_cursor.time_inerval = 5
- smear_cursor.gamma = 2
- smear_cursor.color_levels = 16
- smear_cursor.smear_to_cmd = false
+ -- local smear_cursor = require('smear_cursor')
+ -- smear_cursor.enabled = true
+ -- smear_cursor.delay_event_to_smear = 33
+ -- smear_cursor.cursor_color = '#ff0000'
+ -- smear_cursor.legacy_computing_symbols_support = true
+ -- smear_cursor.stiffness = 0.8
+ -- smear_cursor.min_vertical_distance_smear = 5
+ -- smear_cursor.min_horizontal_distance_smear = 20
+ -- smear_cursor.distance_stop_animating = 0
+ -- smear_cursor.trailing_stiffness = 0.5
+ -- smear_cursor.time_inerval = 5
+ -- smear_cursor.gamma = 2
+ -- smear_cursor.color_levels = 16
+ -- smear_cursor.smear_to_cmd = false
require('hop').setup()
EOF