This commit is contained in:
jimrothstein 2023-11-07 00:28:21 -08:00
parent c00ae4838d
commit 7e2f485274
4 changed files with 104 additions and 87 deletions

View File

@ -1,8 +1,13 @@
-- Need original init.lua ? use *.BAK
--
-- tmux -- ~/.tmux.conf
-- main config file
require 'jim.config' -- lua/jim/config.lua
require 'jim.keymaps' -- lua/jim/keymaps.lua
require 'jim.settings' -- lua/jim/settings.lua
-- ~/.config/kickstart/skeleton/skeleton.qmd
--
-- vim: ts=2 sts=2 sw=2 et

View File

@ -257,6 +257,11 @@ vim.cmd([[let g:LanguageClient_serverCommands = {
\ }
]])
-- 2023-11-03 (experimental filetype)
vim.cmd([[
autocmd BufRead, BufNewFile *.r *.qmd *.rmd setlocal filetype = r
]])
--[[
2023-10-07 another try with R & LSP
1) Mason to install r language server (takes a while)
@ -267,6 +272,8 @@ BUT, can not get r language server to fire up with *.qmd
Add to bottom of *.qmd, *.R file:
# /* vim: set filetype=r : */
# vim:linebreak:nospell:nowrap:cul tw=78 fo=tqlnrc foldcolumn=1 cc=+1 filetype=r
--nope \ 'qmd': ['R', '--slave', '-e', 'languageserver::run()'],
-- compare to lua version: https://github.com/neovim/nvim-lspconfig/blob/1028360e0f2f724d93e876df3d22f63c1acd6ff9/lua/lspconfig/server_configurations/r_language_server.lua#L8
--]]
@ -328,36 +335,6 @@ vim.o.completeopt = 'menuone,noselect'
-- NOTE: You should make sure your terminal supports this (yes: 2023-09-03)
vim.o.termguicolors = true
----------------------
-- [[ Basic Keymaps ]]
----------------------
-- Keymaps for better default experience
-- See `:help vim.keymap.set()`
vim.keymap.set({ 'n', 'v' }, '<Space>', '<Nop>', { silent = true })
vim.keymap.set({ 'n', 'v' }, 'q', '<Nop>', { silent = true })
-- REF: https://nanotipsforvim.prose.sh/keeping-your-register-clean-from-dd
-- if dd action holds content: keep it
-- if dd action holds BLANK LINE: sent to black hole _dd
vim.keymap.set("n", "dd", function()
if vim.fn.getline(".") == "" then return '"_dd' end
return "dd"
end, { expr = true })
-- vim.keymap.set( {'n', '<leader>]nc',
-- Remap for dealing with word wrap
-- jr 2023-10-07 Not cause of sticky line
vim.keymap.set('n', 'k', "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true })
vim.keymap.set('n', 'j', "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true })
vim.keymap.set('n', '<C-u>', '<C-u>zz', { desc = 'Move Up, center' })
vim.keymap.set('n', '<C-d>', '<C-d>zz', { desc = 'Move Down, center' })
-- vim.keymap.set('n', '<leader>ck', ':e ~/.config/kickstart/init.lua<CR>', { desc = 'Config Kickstart' })
vim.keymap.set('n', '<leader>tn', ':e ~/code/docs/tech_notes/300_tech_notes.qmd<CR>', { desc = 'Tech Notes' })
vim.keymap.set('n', '<leader>mln', ':e ~/code/docs/tech_notes/500_ML_Notes.qmd<CR>', { desc = 'ML Notes' })
vim.keymap.set('n', '<leader>bw', 'i**<esc>Ea**<esc>w', { desc = "[B]old [W]ord" })
-- insert # --------...
vim.keymap.set("n", "<leader>ic", "yypVr-I# <ESC>", { desc = "[ic]insert comment line" })
-- [[ Highlight on yank ]]
-- See `:help vim.highlight.on_yank()`
@ -375,61 +352,6 @@ vim.api.nvim_create_autocmd('TextYankPost', {
vim.cmd([[
autocmd BufNewFile *.qmd r ~/.config/kickstart/skeleton/skeleton.qmd
]])
------------------------------------------------------
-- which-key
------------------------------------------------------
-- experiment; add my keymaps to which-key
-- stolen: REF: https://github.com/hackorum/nfs/blob/master/lua/whichkey-config/init.lua
------------------------------------------------------
--{{{
local wk = require 'which-key'
wk.setup {
plugins = {
marks = false,
registers = true,
spelling = { enabled = false, suggestions = 20 },
presets = {
operators = false,
motions = false,
text_objects = false,
windows = false,
nav = false,
-- z = false,
g = false,
},
},
}
local mappings = {
-- g is an experiment and duplicates done elsewhere
g = {
name = "temp file",
f = { "<cmd>Telescope find_files<cr>", "Find File" }, -- create a binding with label
g = { "<cmd>Telescope live_grep<cr>", "Full Text Search" },
b = { "<cmd>Telescope buffers<cr>", "Buffers" },
q = { "<cmd>q<cr>", 'Quit - no warn' },
},
t = {
name = "telescope",
f = { "<cmd>Telescope find_files<cr>", "Find File" }, -- create a binding with label
z = { "<cmd>Telescope find_files<cr>", "Find File", desc = "Search Home", pwd = '/home/jim' }, -- create a binding with label
},
q = { ':q<cr>', 'Quit - no warn' },
Q = { ':wq<cr>', 'Save & Quit' },
w = { ':w<cr>', 'Save' },
x = { ':bdelete<cr>', 'Close' },
-- use :RKill to stop R, close terminal (not guaranteed)
z1 = { '<C-W>p', 'other window' },
z2 = { '<C-W>pAjunk<esc>', 'other window junk' },
rk = { ':RKill<CR>', 'RKill , but not guaranteed to close terminal' },
-- use <leader>ck E = { ':e ~/.config/kickstart/init.lua<cr>', 'Edit KICKSTART config' },
ck = { ':e ~/.config/kickstart/init.lua<cr>', '[ck] Edit KICKSTART config' },
-- f = { ":Telescope find_files<cr>", "Telescope Find Files" },
-- r = { ":Telescope live_grep<cr>", "Telescope Live Grep" },
}
local opts = { prefix = '<leader>' }
wk.register(mappings, opts)
-- }}}
--
------------------------------------------------------
-- require("lspconfig").sumneko_lua.setup({

86
lua/jim/keymaps.lua Normal file
View File

@ -0,0 +1,86 @@
----------------------
-- [[ Basic Keymaps ]]
----------------------
-- Keymaps for better default experience
-- See `:help vim.keymap.set()`
vim.keymap.set({ 'n', 'v' }, '<Space>', '<Nop>', { silent = true })
vim.keymap.set({ 'n', 'v' }, 'q', '<Nop>', { silent = true })
-- REF: https://nanotipsforvim.prose.sh/keeping-your-register-clean-from-dd
-- if dd action holds content: keep it
-- if dd action holds BLANK LINE: sent to black hole _dd
vim.keymap.set("n", "dd", function()
if vim.fn.getline(".") == "" then return '"_dd' end
return "dd"
end, { expr = true })
-- vim.keymap.set( {'n', '<leader>]nc',
-- Remap for dealing with word wrap
-- jr 2023-10-07 Not cause of sticky line
vim.keymap.set('n', 'k', "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true })
vim.keymap.set('n', 'j', "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true })
vim.keymap.set('n', '<C-u>', '<C-u>zz', { desc = 'Move Up, center' })
vim.keymap.set('n', '<C-d>', '<C-d>zz', { desc = 'Move Down, center' })
-- vim.keymap.set('n', '<leader>ck', ':e ~/.config/kickstart/init.lua<CR>', { desc = 'Config Kickstart' })
vim.keymap.set('n', '<leader>tn', ':e ~/code/docs/tech_notes/300_tech_notes.qmd<CR>', { desc = 'Tech Notes' })
vim.keymap.set('n', '<leader>mln', ':e ~/code/docs/tech_notes/500_ML_Notes.qmd<CR>', { desc = 'ML Notes' })
vim.keymap.set('n', '<leader>bw', 'i**<esc>Ea**<esc>w', { desc = "[B]old [W]ord" })
-- insert # --------...
vim.keymap.set("n", "<leader>ic", "yypVr-I# <ESC>", { desc = "[ic]insert comment line" })
------------------------------------------------------
-- which-key
------------------------------------------------------
-- experiment; add my keymaps to which-key
-- stolen: REF: https://github.com/hackorum/nfs/blob/master/lua/whichkey-config/init.lua
------------------------------------------------------
--{{{
local wk = require 'which-key'
wk.setup {
plugins = {
marks = false,
registers = true,
spelling = { enabled = false, suggestions = 20 },
presets = {
operators = false,
motions = false,
text_objects = false,
windows = false,
nav = false,
-- z = false,
g = false,
},
},
}
local mappings = {
-- g is an experiment and duplicates done elsewhere
g = {
name = "temp file",
f = { "<cmd>Telescope find_files<cr>", "Find File" }, -- create a binding with label
g = { "<cmd>Telescope live_grep<cr>", "Full Text Search" },
b = { "<cmd>Telescope buffers<cr>", "Buffers" },
q = { "<cmd>q<cr>", 'Quit - no warn' },
},
t = {
name = "telescope",
f = { "<cmd>Telescope find_files<cr>", "Find File" }, -- create a binding with label
z = { "<cmd>Telescope find_files<cr>", "Find File", desc = "Search Home", pwd = '/home/jim' }, -- create a binding with label
},
q = { ':q<cr>', 'Quit - no warn' },
Q = { ':wq<cr>', 'Save & Quit' },
w = { ':w<cr>', 'Save' },
x = { ':bdelete<cr>', 'Close' },
-- use :RKill to stop R, close terminal (not guaranteed)
z1 = { '<C-W>p', 'other window' },
z2 = { '<C-W>pAjunk<esc>', 'other window junk' },
rk = { ':RKill<CR>', 'RKill , but not guaranteed to close terminal' },
-- use <leader>ck E = { ':e ~/.config/kickstart/init.lua<cr>', 'Edit KICKSTART config' },
ck = { ':e ~/.config/kickstart/init.lua<cr>', '[ck] Edit KICKSTART config' },
-- f = { ":Telescope find_files<cr>", "Telescope Find Files" },
-- r = { ":Telescope live_grep<cr>", "Telescope Live Grep" },
}
local opts = { prefix = '<leader>' }
wk.register(mappings, opts)
-- }}}

View File

@ -1,8 +1,12 @@
---
title: Loose Leaf
date: last-modified
# Quarto requires title, if want date to appear
---
```{r}
```
vim:linebreak:nospell:nowrap:cul tw=78 fo=tqlnr foldcolumn=1 cc=+1 filetype=r
vim:linebreak:nospell:nowrap:cul tw=78 fo=tqlnrc foldcolumn=1 cc=+1 filetype=r