kickstart - working

This commit is contained in:
jimrothstein 2023-11-15 11:58:04 -08:00
parent a7ec8e276a
commit 989b3b4eba
4 changed files with 67 additions and 18 deletions

View File

@ -8,7 +8,7 @@ require 'jim.config' -- lua/jim/config.lua
require 'jim.keymaps' -- lua/jim/keymaps.lua require 'jim.keymaps' -- lua/jim/keymaps.lua
require 'jim.settings' -- lua/jim/settings.lua require 'jim.settings' -- lua/jim/settings.lua
require 'jim.luasnip' -- lua/jim/luasnip.lua require 'jim.luasnip' -- lua/jim/luasnip.lua
--
--------------------- ---------------------
-- other config files -- other config files
--------------------- ---------------------

View File

@ -180,8 +180,12 @@ require('lazy').setup({
event = "BufReadPre", event = "BufReadPre",
}, },
-- "gc" to comment visual regions/lines -------------------
{ 'numToStr/Comment.nvim', opts = {} }, -- Comments.nvim
-------------------
-- 2023-11-12 Comment.nvim keymaps conflict with my Telescope keymaps
-- { 'numToStr/Comment.nvim', opts = {} },
-- Fuzzy Finder (files, lsp, etc) -- Fuzzy Finder (files, lsp, etc)
{ {
@ -277,6 +281,12 @@ Add to bottom of *.qmd, *.R file:
--]] --]]
-- --
-- :h 'fo'
-- where does line belong?
-- +r comments will be autoadded
vim.cmd([[ set formatoptions+=r]])
-- always display top/bottom 8 lines -- always display top/bottom 8 lines
vim.opt.scrolloff = 8 vim.opt.scrolloff = 8
vim.opt.colorcolumn = "80" vim.opt.colorcolumn = "80"
@ -603,11 +613,12 @@ mason_lspconfig.setup_handlers {
end, end,
} }
-- nvim-cmp configuration -- nvim-cmp configuration
-- [[ Configure hrsh7th nvim-cmp ]] -- [[ Configure hrsh7th nvim-cmp ]]
-- See `:help cmp` -- See `:help cmp`
local cmp = require 'cmp' local cmp = require 'cmp'
local luasnip = require 'luasnip'
local ls = require 'luasnip'
cmp.setup { cmp.setup {
snippet = { snippet = {
@ -625,16 +636,21 @@ cmp.setup {
behavior = cmp.ConfirmBehavior.Replace, behavior = cmp.ConfirmBehavior.Replace,
select = true, select = true,
}, },
---------------------------------------
-- TJ says don't use <TAB> this way
---------------------------------------
--
-- TAB selects NEXT item (CR to complete) -- TAB selects NEXT item (CR to complete)
['<Tab>'] = cmp.mapping(function(fallback) -- ['<Tab>'] = cmp.mapping(function(fallback)
if cmp.visible() then -- if cmp.visible() then
cmp.select_next_item() -- cmp.select_next_item()
elseif luasnip.expand_or_locally_jumpable() then -- elseif luasnip.expand_or_locally_jumpable() then
luasnip.expand_or_jump() -- luasnip.expand_or_jump()
else -- else
fallback() -- fallback()
end -- end
end, { 'i', 's' }), -- end, { 'i', 's' }),
['<S-Tab>'] = cmp.mapping(function(fallback) ['<S-Tab>'] = cmp.mapping(function(fallback)
if cmp.visible() then if cmp.visible() then
cmp.select_prev_item() cmp.select_prev_item()

View File

@ -1,3 +1,10 @@
----------------------
-- EXPERIMENTS:
----------------------
-- date
vim.keymap.set({ 'i', 'v' }, ':w<CR>', '<esc>:w<CR>',
{ desc = "Write File, in insert modde", silent = false })
---------------------- ----------------------
-- [[ Basic Keymaps ]] -- [[ Basic Keymaps ]]
---------------------- ----------------------
@ -7,6 +14,7 @@ vim.keymap.set({ 'n', 'v' }, '<Space>', '<Nop>', { silent = true })
vim.keymap.set({ 'n', 'v' }, 'q', '<Nop>', { desc = "<nop>", silent = true }) vim.keymap.set({ 'n', 'v' }, 'q', '<Nop>', { desc = "<nop>", silent = true })
-------------------------- --------------------------
-- EXPERIMENTAL -- EXPERIMENTAL
-------------------------- --------------------------
@ -98,18 +106,26 @@ local mappings = {
-- checkhealth, gb, gc are conflicts -- checkhealth, gb, gc are conflicts
f = { "<cmd>Telescope find_files<cr>", "Find File" }, -- create a binding with label f = { "<cmd>Telescope find_files<cr>", "Find File" }, -- create a binding with label
g = { "<cmd>Telescope live_grep<cr>", "Full Text Search" }, g = { "<cmd>Telescope live_grep<cr>", "Full Text Search" },
b = { "<cmd>Telescope buffers<cr>", "Buffers" }, -- gb taken by comments plugin
bu = { "<cmd>Telescope buffers<cr>", "Telescope [Bu]ffers" },
q = { "<cmd>q<cr>", 'Quit - no warn' }, q = { "<cmd>q<cr>", 'Quit - no warn' },
}, },
n = { n = {
name = "my notes", name = "my notes",
t = { "<cmd>e ~/code/docs/tech_notes/300_tech_notes.qmd<cr>", "[T]ech [Notes]" },
m = { "<cmd>e ~/code/docs/tech_notes/500_ML_Notes.qmd<cr>", "[M]L [Notes]" },
a = { "<cmd>cd ~/code/docs/ALZ/<cr>", "cd [A]LZ [Notes]" }, a = { "<cmd>cd ~/code/docs/ALZ/<cr>", "cd [A]LZ [Notes]" },
m = { "<cmd>e ~/code/docs/tech_notes/500_ML_Notes.qmd<cr>", "[M]L [Notes]" },
h = { "<cmd>e ~/code/docs/health_notes/medical_notes.qmd<cr>",
"[H]ealth [Notes]" },
o = { "<cmd>cd ~/code/docs/misc_files/<cr>", "cd Misc Notes" },
t = { "<cmd>e ~/code/docs/tech_notes/300_tech_notes.qmd<cr>", "[T]ech [Notes]" },
--vim.keymap.set('n', '<leader>tn', ':e ~/code/docs/tech_notes/300_tech_notes.qmd<CR>', { desc = 'Tech Notes' }) --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>mln', ':e ~/code/docs/tech_notes/500_ML_Notes.qmd<CR>', { desc = 'ML Notes' })
}, },
r = {
name = "extra R cmds",
sx = { "<cmd>RStop<CR>", "interrupt R, RStop" },
x = { "<cmd>RStop<CR>", "interrupt R, RStop" },
},
t = { t = {
name = "telescope", name = "telescope",
f = { "<cmd>Telescope find_files<cr>", "Find File" }, -- create a binding with label f = { "<cmd>Telescope find_files<cr>", "Find File" }, -- create a binding with label

View File

@ -8,10 +8,20 @@ local isn = ls.indent_snippet_node
local t = ls.text_node local t = ls.text_node
local f = ls.function_node local f = ls.function_node
-- HELPER -- HELPER
local filename = function() -- :p expand to full path
-- :h head (last path component removed)
-- :t tail (last path component only)
-- :r root (one extension removed)
-- :e extension only
-- :lua print(vim.fn.expand '%:t') -- actual file only
local full_filename = function()
return { vim.fn.expand '%:p' } return { vim.fn.expand '%:p' }
end end
local filename = function()
return { vim.fn.expand '%:t' }
end
-- SNIPS -- SNIPS
ls.add_snippets('all', { -- `all` all filetypes, `lua` only lua ft ls.add_snippets('all', { -- `all` all filetypes, `lua` only lua ft
s('luaxx', { t 'this is lua file!' }), s('luaxx', { t 'this is lua file!' }),
@ -25,6 +35,13 @@ ls.add_snippets('all', { -- `all` all filetypes, `lua` only lua ft
}, { }, {
f(filename, {}), f(filename, {}),
}), }),
s({
trig = "long filename",
namr = "long Filename",
dscr = "insert canonical file name",
}, {
f(full_filename, {}),
}),
}) })
--------------- ---------------
-- next line: allows use of snippet collection in vscode (??) -- next line: allows use of snippet collection in vscode (??)