wip
This commit is contained in:
parent
7e2f485274
commit
a7ec8e276a
11
init.lua
11
init.lua
|
@ -1,13 +1,18 @@
|
||||||
-- Need original init.lua ? use *.BAK
|
-- Need original init.lua ? use *.BAK
|
||||||
--
|
--
|
||||||
-- tmux -- ~/.tmux.conf
|
-- 2023-11-08
|
||||||
|
-- separate luansip.lua file
|
||||||
|
--
|
||||||
-- main config file
|
-- main config file
|
||||||
require 'jim.config' -- lua/jim/config.lua
|
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
|
||||||
|
|
||||||
|
---------------------
|
||||||
|
-- other config files
|
||||||
|
---------------------
|
||||||
|
-- tmux -- ~/.tmux.conf
|
||||||
-- ~/.config/kickstart/skeleton/skeleton.qmd
|
-- ~/.config/kickstart/skeleton/skeleton.qmd
|
||||||
|
|
||||||
--
|
|
||||||
|
|
||||||
-- vim: ts=2 sts=2 sw=2 et
|
-- vim: ts=2 sts=2 sw=2 et
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
print(' this is ./lua/init.lua') --
|
-- config.lua
|
||||||
|
|
||||||
-- Set <space> as the leader key
|
-- Set <space> as the leader key
|
||||||
-- See `:help mapleader`
|
-- See `:help mapleader`
|
||||||
-- NOTE: Must happen before plugins are required (otherwise wrong leader will be used)
|
-- NOTE: Must happen before plugins are required (otherwise wrong leader will be used)
|
||||||
|
@ -124,7 +123,6 @@ require('lazy').setup({
|
||||||
},
|
},
|
||||||
|
|
||||||
-- hardtime.nvim (nvim advice?) 2023-09-03
|
-- hardtime.nvim (nvim advice?) 2023-09-03
|
||||||
--
|
|
||||||
{
|
{
|
||||||
'm4xshen/hardtime.nvim',
|
'm4xshen/hardtime.nvim',
|
||||||
dependencies = { 'MunifTanjim/nui.nvim', 'nvim-lua/plenary.nvim' },
|
dependencies = { 'MunifTanjim/nui.nvim', 'nvim-lua/plenary.nvim' },
|
||||||
|
@ -369,8 +367,11 @@ require('lspconfig').lua_ls.setup { -- {{{
|
||||||
},
|
},
|
||||||
} -- }}}
|
} -- }}}
|
||||||
|
|
||||||
|
-----------------
|
||||||
|
-- TELESCOPE
|
||||||
-- [[ Configure Telescope ]]
|
-- [[ Configure Telescope ]]
|
||||||
-- See `:help telescope` and `:help telescope.setup()`
|
-- See `:help telescope` and `:help telescope.setup()`
|
||||||
|
-----------------
|
||||||
require('telescope').setup {
|
require('telescope').setup {
|
||||||
defaults = {
|
defaults = {
|
||||||
mappings = {
|
mappings = {
|
||||||
|
@ -406,9 +407,10 @@ vim.keymap.set('n', '<leader>sw', require('telescope.builtin').grep_string, { de
|
||||||
vim.keymap.set('n', '<leader>sg', require('telescope.builtin').live_grep, { desc = '[S]earch by [G]rep' })
|
vim.keymap.set('n', '<leader>sg', require('telescope.builtin').live_grep, { desc = '[S]earch by [G]rep' })
|
||||||
vim.keymap.set('n', '<leader>sd', require('telescope.builtin').diagnostics, { desc = '[S]earch [D]iagnostics' })
|
vim.keymap.set('n', '<leader>sd', require('telescope.builtin').diagnostics, { desc = '[S]earch [D]iagnostics' })
|
||||||
|
|
||||||
|
---------------------------------
|
||||||
-- [[ Configure Treesitter ]]
|
-- [[ Configure Treesitter ]]
|
||||||
--
|
|
||||||
-- See `:help nvim-treesitter`{{{
|
-- See `:help nvim-treesitter`{{{
|
||||||
|
---------------------------------
|
||||||
--
|
--
|
||||||
-- Defer Treesitter setup after first render to improve startup time of 'nvim {filename}'
|
-- Defer Treesitter setup after first render to improve startup time of 'nvim {filename}'
|
||||||
vim.defer_fn(function()
|
vim.defer_fn(function()
|
||||||
|
@ -493,14 +495,10 @@ vim.cmd [[
|
||||||
highlight StatusLineNC cterm=bold ctermfg=white ctermbg=darkgray
|
highlight StatusLineNC cterm=bold ctermfg=white ctermbg=darkgray
|
||||||
]]
|
]]
|
||||||
|
|
||||||
-- Diagnostic keymaps
|
|
||||||
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = 'Go to previous diagnostic message' })
|
|
||||||
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = 'Go to next diagnostic message' })
|
|
||||||
vim.keymap.set('n', '<leader>e', vim.diagnostic.open_float, { desc = 'Open floating diagnostic message' })
|
|
||||||
vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagnostics list' })
|
|
||||||
|
|
||||||
|
----------------------
|
||||||
-- [[ Configure LSP ]]
|
-- [[ Configure LSP ]]
|
||||||
--
|
----------------------
|
||||||
-- This function gets run when an LSP connects to a particular buffer.
|
-- This function gets run when an LSP connects to a particular buffer.
|
||||||
local on_attach = function(_, bufnr)
|
local on_attach = function(_, bufnr)
|
||||||
-- NOTE: Remember that lua is a real programming language, and as such it is possible
|
-- NOTE: Remember that lua is a real programming language, and as such it is possible
|
||||||
|
@ -605,38 +603,6 @@ mason_lspconfig.setup_handlers {
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
|
|
||||||
--
|
|
||||||
-- LUASNIP
|
|
||||||
local luasnip = require 'luasnip'
|
|
||||||
local ls = require 'luasnip'
|
|
||||||
local s = ls.snippet
|
|
||||||
local sn = ls.snippet_node
|
|
||||||
local isn = ls.indent_snippet_node
|
|
||||||
local t = ls.text_node
|
|
||||||
local f = ls.function_node
|
|
||||||
-- HELPER
|
|
||||||
local filename = function()
|
|
||||||
return { vim.fn.expand '%:p' }
|
|
||||||
end
|
|
||||||
|
|
||||||
-- SNIPS
|
|
||||||
ls.add_snippets('all', { -- `all` all filetypes, `lua` only lua ft
|
|
||||||
s('luaxx', { t 'this is lua file!' }),
|
|
||||||
s('sep', t { '---------------' }),
|
|
||||||
|
|
||||||
-- snip: add file's filename
|
|
||||||
s({
|
|
||||||
trig = "filename",
|
|
||||||
namr = "Filename",
|
|
||||||
dscr = "insert file name",
|
|
||||||
}, {
|
|
||||||
f(filename, {}),
|
|
||||||
}),
|
|
||||||
})
|
|
||||||
---------------
|
|
||||||
-- next line: allows use of snippet collection in vscode (??)
|
|
||||||
require('luasnip.loaders.from_vscode').lazy_load()
|
|
||||||
luasnip.config.setup {}
|
|
||||||
|
|
||||||
-- nvim-cmp configuration
|
-- nvim-cmp configuration
|
||||||
-- [[ Configure hrsh7th nvim-cmp ]]
|
-- [[ Configure hrsh7th nvim-cmp ]]
|
||||||
|
|
|
@ -4,31 +4,60 @@
|
||||||
-- Keymaps for better default experience
|
-- Keymaps for better default experience
|
||||||
-- See `:help vim.keymap.set()`
|
-- See `:help vim.keymap.set()`
|
||||||
vim.keymap.set({ 'n', 'v' }, '<Space>', '<Nop>', { silent = true })
|
vim.keymap.set({ 'n', 'v' }, '<Space>', '<Nop>', { silent = true })
|
||||||
vim.keymap.set({ 'n', 'v' }, 'q', '<Nop>', { silent = true })
|
vim.keymap.set({ 'n', 'v' }, 'q', '<Nop>', { desc = "<nop>", silent = true })
|
||||||
|
|
||||||
|
|
||||||
|
--------------------------
|
||||||
|
-- EXPERIMENTAL
|
||||||
|
--------------------------
|
||||||
|
local map = vim.keymap.set
|
||||||
|
-- not working
|
||||||
|
map(
|
||||||
|
"n",
|
||||||
|
"<Leader>cd",
|
||||||
|
"<Cmd>cd! %:h<CR>",
|
||||||
|
{ desc = "cd to current buffer path" }
|
||||||
|
)
|
||||||
|
|
||||||
|
-- works
|
||||||
|
map("n", "<Leader>..", "<Cmd>cd! ..<CR>", { desc = "cd up a level" })
|
||||||
|
--------------------------
|
||||||
|
--------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-- REF: https://nanotipsforvim.prose.sh/keeping-your-register-clean-from-dd
|
-- REF: https://nanotipsforvim.prose.sh/keeping-your-register-clean-from-dd
|
||||||
-- if dd action holds content: keep it
|
-- By default, action dd stores in reg ??
|
||||||
-- if dd action holds BLANK LINE: sent to black hole _dd
|
-- If you then dd on blank line "" replaces content in reg ??
|
||||||
|
-- So, if dd action holds content: keep it (don't replace)
|
||||||
|
-- if dd action holds BLANK LINE: sent to black hole _dd (discard it)
|
||||||
vim.keymap.set("n", "dd", function()
|
vim.keymap.set("n", "dd", function()
|
||||||
if vim.fn.getline(".") == "" then return '"_dd' end
|
if vim.fn.getline(".") == "" then return '"_dd' end
|
||||||
return "dd"
|
return "dd"
|
||||||
end, { expr = true })
|
end, { expr = true })
|
||||||
|
|
||||||
|
|
||||||
-- vim.keymap.set( {'n', '<leader>]nc',
|
-- vim.keymap.set( {'n', '<leader>]nc',
|
||||||
-- Remap for dealing with word wrap
|
-- Remap for dealing with word wrap
|
||||||
-- jr 2023-10-07 Not cause of sticky line
|
-- 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', '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', '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-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', '<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>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" })
|
vim.keymap.set('n', '<leader>bw', 'i**<esc>Ea**<esc>w', { desc = "[B]old [W]ord" })
|
||||||
-- insert # --------...
|
-- insert # --------...
|
||||||
vim.keymap.set("n", "<leader>ic", "yypVr-I# <ESC>", { desc = "[ic]insert comment line" })
|
vim.keymap.set("n", "<leader>ic", "yypVr-I# <ESC>", { desc = "[ic]insert comment line" })
|
||||||
|
|
||||||
|
---------------------
|
||||||
|
-- Diagnostic keymaps
|
||||||
|
---------------------
|
||||||
|
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = 'Go to previous diagnostic message' })
|
||||||
|
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = 'Go to next diagnostic message' })
|
||||||
|
vim.keymap.set('n', '<leader>e', vim.diagnostic.open_float, { desc = 'Open floating diagnostic message' })
|
||||||
|
vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagnostics list' })
|
||||||
|
|
||||||
------------------------------------------------------
|
------------------------------------------------------
|
||||||
-- which-key
|
-- which-key
|
||||||
------------------------------------------------------
|
------------------------------------------------------
|
||||||
|
@ -52,26 +81,46 @@ wk.setup {
|
||||||
g = false,
|
g = false,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
show_help = true, -- (default) show a help message in the command line for using WhichKey
|
||||||
|
key_labels = {
|
||||||
|
-- override the label used to display some keys. It doesn't effect WK in any other way.
|
||||||
|
-- For example:
|
||||||
|
["<space>"] = "SPACE",
|
||||||
|
["n"] = "notes",
|
||||||
|
-- ["<cr>"] = "RET",
|
||||||
|
-- ["<tab>"] = "TAB",
|
||||||
|
},
|
||||||
}
|
}
|
||||||
local mappings = {
|
local mappings = {
|
||||||
-- g is an experiment and duplicates done elsewhere
|
-- g is an experiment and duplicates done elsewhere
|
||||||
g = {
|
g = {
|
||||||
name = "temp file",
|
name = "temp file",
|
||||||
|
-- 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" },
|
b = { "<cmd>Telescope buffers<cr>", "Buffers" },
|
||||||
q = { "<cmd>q<cr>", 'Quit - no warn' },
|
q = { "<cmd>q<cr>", 'Quit - no warn' },
|
||||||
},
|
},
|
||||||
|
n = {
|
||||||
|
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]" },
|
||||||
|
|
||||||
|
--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' })
|
||||||
|
},
|
||||||
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
|
||||||
z = { "<cmd>Telescope find_files<cr>", "Find File", desc = "Search Home", pwd = '/home/jim' }, -- create a binding with label
|
-- tz is conflict
|
||||||
|
-- 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 = { ":q<cr>", "Quit - no warn" },
|
||||||
Q = { ':wq<cr>', 'Save & Quit' },
|
Q = { ":wq<cr>", "Save & Quit" },
|
||||||
w = { ':w<cr>', 'Save' },
|
w = { ":w<cr>", "Save" },
|
||||||
x = { ':bdelete<cr>', 'Close' },
|
x = { ":bdelete<cr>", "Close" },
|
||||||
-- use :RKill to stop R, close terminal (not guaranteed)
|
-- use :RKill to stop R, close terminal (not guaranteed)
|
||||||
z1 = { '<C-W>p', 'other window' },
|
z1 = { '<C-W>p', 'other window' },
|
||||||
z2 = { '<C-W>pAjunk<esc>', 'other window junk' },
|
z2 = { '<C-W>pAjunk<esc>', 'other window junk' },
|
||||||
|
@ -81,6 +130,7 @@ local mappings = {
|
||||||
-- f = { ":Telescope find_files<cr>", "Telescope Find Files" },
|
-- f = { ":Telescope find_files<cr>", "Telescope Find Files" },
|
||||||
-- r = { ":Telescope live_grep<cr>", "Telescope Live Grep" },
|
-- r = { ":Telescope live_grep<cr>", "Telescope Live Grep" },
|
||||||
}
|
}
|
||||||
|
|
||||||
local opts = { prefix = '<leader>' }
|
local opts = { prefix = '<leader>' }
|
||||||
wk.register(mappings, opts)
|
wk.register(mappings, opts)
|
||||||
-- }}}
|
-- }}}
|
||||||
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
--
|
||||||
|
-- LUASNIP
|
||||||
|
local luasnip = require 'luasnip'
|
||||||
|
local ls = require 'luasnip'
|
||||||
|
local s = ls.snippet
|
||||||
|
local sn = ls.snippet_node
|
||||||
|
local isn = ls.indent_snippet_node
|
||||||
|
local t = ls.text_node
|
||||||
|
local f = ls.function_node
|
||||||
|
-- HELPER
|
||||||
|
local filename = function()
|
||||||
|
return { vim.fn.expand '%:p' }
|
||||||
|
end
|
||||||
|
|
||||||
|
-- SNIPS
|
||||||
|
ls.add_snippets('all', { -- `all` all filetypes, `lua` only lua ft
|
||||||
|
s('luaxx', { t 'this is lua file!' }),
|
||||||
|
s('sep', t { '---------------' }),
|
||||||
|
|
||||||
|
-- snip: add file's filename
|
||||||
|
s({
|
||||||
|
trig = "filename",
|
||||||
|
namr = "Filename",
|
||||||
|
dscr = "insert file name",
|
||||||
|
}, {
|
||||||
|
f(filename, {}),
|
||||||
|
}),
|
||||||
|
})
|
||||||
|
---------------
|
||||||
|
-- next line: allows use of snippet collection in vscode (??)
|
||||||
|
require('luasnip.loaders.from_vscode').lazy_load()
|
||||||
|
luasnip.config.setup {}
|
|
@ -1,3 +1,3 @@
|
||||||
-- settings.lua
|
-- settings.lua
|
||||||
--
|
--
|
||||||
print('this is settings.lua')
|
-- print('this is settings.lua')
|
||||||
|
|
Loading…
Reference in New Issue