summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosh Rahm <rahm@google.com>2024-07-09 17:30:14 +0000
committerJosh Rahm <rahm@google.com>2024-07-09 17:31:05 +0000
commita815f31519cbdd47b559485ba2a72072166759ab (patch)
tree50adc2efc394c2776fd3e28efa57c9f2fd7c8097
parent5a67c0b472324f1086c5024b23f7c58009a43636 (diff)
downloadconfig.vim-a815f31519cbdd47b559485ba2a72072166759ab.tar.gz
config.vim-a815f31519cbdd47b559485ba2a72072166759ab.tar.bz2
config.vim-a815f31519cbdd47b559485ba2a72072166759ab.zip
Minor changes
-rw-r--r--init.vim24
-rw-r--r--lua/lsp.lua4
2 files changed, 25 insertions, 3 deletions
diff --git a/init.vim b/init.vim
index 94031ad..8126339 100644
--- a/init.vim
+++ b/init.vim
@@ -44,7 +44,6 @@ Plug 'nvim-telescope/telescope.nvim'
Plug 'nvim-tree/nvim-tree.lua'
Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'}
Plug 'nvim-treesitter/nvim-treesitter-textobjects'
-Plug 'nvim-treesitter/playground'
Plug 'onsails/lspkind.nvim'
" Plug 'tpope/vim-surround'
Plug 'kylechui/nvim-surround'
@@ -72,6 +71,7 @@ set number
set relativenumber
set pumheight=20
set updatetime=1000
+set matchpairs+=<:>
let mapleader=" "
@@ -117,7 +117,7 @@ noremap <leader>t <cmd>TroubleToggle<cr>
augroup InitVim
au!
- autocmd BufRead *.java,*.c,*.cpp,*.cxx,*.hs TSBufEnable highlight
+ autocmd BufRead *.java,*.c,*.cpp,*.cxx,*.hs,*.ts TSBufEnable highlight
" Automatically stop highligting things when leaving insert mode. If I want
" the highlight back, I can just hit 'n' and it will come back.
@@ -248,6 +248,26 @@ augroup END
let g:jq_highlight_objects = 1
let g:jq_highlight_function_calls = 1
+" Increment the character under the cursor to the next character in order.
+function! OrdNext()
+ let char = matchstr(getline('.'), '\%' . col('.') . 'c.')
+ let nr = char2nr(char)
+ let new_char = nr2char(nr + 1)
+ exec "norm r" . new_char
+endfunction
+
+" Decrement the character under the cursor to the last character in order.
+function! OrdPrev()
+ let char = matchstr(getline('.'), '\%' . col('.') . 'c.')
+ let nr = char2nr(char)
+ let new_char = nr2char(nr - 1)
+ exec "norm r" . new_char
+endfunction
+
+noremap α <cmd>call OrdNext()<cr>
+" Capital alpha (α)
+noremap Α <cmd>call OrdPrev()<cr>
+
lua << EOF
function open_terminal_on_directory()
diff --git a/lua/lsp.lua b/lua/lsp.lua
index 6684c80..47eb97e 100644
--- a/lua/lsp.lua
+++ b/lua/lsp.lua
@@ -3,7 +3,9 @@ local vim = assert(vim)
local nvim_lsp = require("lspconfig")
nvim_lsp.bashls.setup {}
-nvim_lsp.clangd.setup {}
+nvim_lsp.clangd.setup {
+ filetypes = { 'c', 'cpp', 'objc', 'objcpp', 'cuda' },
+}
nvim_lsp.jqls.setup {}
nvim_lsp.lua_ls.setup {}
nvim_lsp.ocamllsp.setup {}