From 1ec250ecda72916117380c38421ffa2a7a862b78 Mon Sep 17 00:00:00 2001 From: jimrothstein Date: Mon, 4 Dec 2023 11:29:00 -0800 Subject: [PATCH] wip --- lua/jim/Nvim-R.lua | 18 +++++++++++++++--- lua/jim/config.lua | 6 +++--- lua/jim/keymaps.lua | 9 +++++++++ 3 files changed, 27 insertions(+), 6 deletions(-) diff --git a/lua/jim/Nvim-R.lua b/lua/jim/Nvim-R.lua index ac2a5856..9aa384b5 100644 --- a/lua/jim/Nvim-R.lua +++ b/lua/jim/Nvim-R.lua @@ -4,7 +4,7 @@ vim.cmd([[ let R_assign=2 ]]) -- underline becomes left ar vim.cmd([[ let R_enable_comment=1 ]]) -- toggle comments with xx -- seems to work -vim.cmd([[ let R_filetypes = ['r', 'rmd', 'rrst', 'rnoweb', 'quarto', 'rhelp'] ]]) +-- vim.cmd([[ let R_filetypes = ['r', 'rmd', 'rrst', 'rnoweb', 'quarto', 'rhelp'] ]]) vim.cmd([[let g:LanguageClient_serverCommands = { \ 'r': ['R', '--slave', '-e', 'languageserver::run()'], \ } @@ -14,7 +14,19 @@ vim.cmd([[ " autocmd FileType r x :RStop ]]) -vim.cmd([[ autocmd FileType r nnoremap wwww ]]) vim.cmd([[ - " autocmd BufRead, BufNewFile *.r *.qmd *.rmd setlocal filetype = r +" autocmd BufRead, BufNewFile *.r *.qmd *.rmd setlocal filetype = r ]]) +vim.cmd([[ +function! s:customNvimRMappings() + nmap sr RStart +" imap sr RStart +" vmap sr RStart +" nnoremap xxx ":call SendRmdChunkToR('echo', 'down')" + nmap wwww ":echo 'hi'" + endfunction + augroup myNvimR + au! + autocmd filetype r call s:customNvimRMappings() + augroup end +]]) diff --git a/lua/jim/config.lua b/lua/jim/config.lua index 50c3274c..055bb699 100644 --- a/lua/jim/config.lua +++ b/lua/jim/config.lua @@ -35,15 +35,15 @@ vim.opt.rtp:prepend(lazypath) -- -- You can also configure plugins after the setup call, -- as they will be available in your neovim runtime. --- + require('lazy').setup({ -- NOTE: First, some plugins that don't require any configuration -- Nvim-R 'jalvesaq/Nvim-R', -- Git related plugins - 'tpope/vim-fugitive', - 'tpope/vim-rhubarb', + -- 'tpope/vim-fugitive', + -- 'tpope/vim-rhubarb', -- Detect tabstop and shiftwidth automatically 'tpope/vim-sleuth', diff --git a/lua/jim/keymaps.lua b/lua/jim/keymaps.lua index a16d597d..37b8124b 100644 --- a/lua/jim/keymaps.lua +++ b/lua/jim/keymaps.lua @@ -2,6 +2,9 @@ -- keymaps vs which-key -- which-key should pick up any separaely defined keymaps -- to maintain groups, however, do this in which-key +-- +-- TODO: +-- R and Which-key: can not add MY keymaps; don't work in R AND appear in non-R ---------------------- -- [[ Basic Keymaps ]] ---------------------- @@ -16,6 +19,8 @@ vim.keymap.set({ 'i', 'v' }, ':w', ':w', -------------------------- -- EXPERIMENTAL -------------------------- +-- change to directory of current file automatically +--vim.cmd([[autocmd BufEnter * lcd %:p:h]]) @@ -131,6 +136,10 @@ local mappings = { z1 = { 'p', 'other window' }, z2 = { 'pAjunk', 'other window junk' }, rk = { ':RKill', 'RKill , but not guaranteed to close terminal' }, + + -- can not find function + -- rcd = { ':call SendRmdChunktoR("echo", "down")', 'Chunk Down' }, + ck = { ':e ~/.config/kickstart/init.lua', '[ck] Edit KICKSTART config' }, cr = { ':e ~/.config/kickstart/lua/jim/Nvim-R.lua', '[cr] Edit Nvim-R config' }, }