summaryrefslogtreecommitdiff
path: root/init.vim
diff options
context:
space:
mode:
Diffstat (limited to 'init.vim')
-rw-r--r--init.vim51
1 files changed, 33 insertions, 18 deletions
diff --git a/init.vim b/init.vim
index bca3c9d..f6c3acf 100644
--- a/init.vim
+++ b/init.vim
@@ -49,7 +49,7 @@ Plug 'onsails/lspkind.nvim'
Plug 'kylechui/nvim-surround'
Plug 'vito-c/jq.vim'
Plug 'EdenEast/nightfox.nvim'
-Plug 'sphamba/smear-cursor.nvim'
+" Plug 'sphamba/smear-cursor.nvim'
Plug 'smoka7/hop.nvim'
Plug 'lewis6991/gitsigns.nvim'
@@ -166,10 +166,8 @@ 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.
- "
- " I don't know why it can't just be 'noh' and why I have to do this feedkeys
- " nonsense, but there appears to be a bug of some kind.
- autocmd InsertLeave * call feedkeys("\<cmd>noh\<cr>")
+ autocmd InsertLeave * set nohlsearch
+ autocmd CmdlineEnter /,\? set hlsearch
autocmd TextYankPost *
\ lua require'vim.hl'.on_yank(
@@ -177,7 +175,10 @@ 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
" Local configuration that can be set by hostname or just a local configuration.
" Local files are ignored by .gitignore so they won't be added to the repo,
@@ -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,11 +553,20 @@ lua << EOF
})
require("nvim-surround").setup({})
- require('smear_cursor').enabled = true
- require('smear_cursor').cursor_color = '#ff0000'
- require('smear_cursor').legacy_computing_symbols_support = true
- require('smear_cursor').stiffness = 0.4
- require('smear_cursor').distance_stop_animating = 5
+ -- 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