Skip to content

Commit

Permalink
update dotfiles
Browse files Browse the repository at this point in the history
nvim
- c++ debugging helpers
- sending files to harpoon
- leap other keybindings to not interfere with nvim-surround
- remove nvim-tags completions, because they interfere with inbuild
  C-n,C-p buffer completions of currently shown buffers
- add nvim-lsp-installer, because its too convenient and nix let me down
  with their inability to provide an undo installation command
- remove tags, because no vim-gutentag setup and overlapping with
  C-n,C-p
  * issue quangnguyen30192/cmp-nvim-tags#5
- telescope-send-to-harpoon has caching problems, most likely from upstream
  harpoon
  * asbjornhaland/telescope-send-to-harpoon.nvim#1
- remove hop.nvim and add leap with -,_ and gs keybindings
  * no overlap with nvim-surround
- gdb has super useful `fin` instruction to finish current scope
- git reset --hard without losing content instructions
  • Loading branch information
matu3ba committed Jul 15, 2022
1 parent b45d499 commit 50a052a
Show file tree
Hide file tree
Showing 9 changed files with 56 additions and 8 deletions.
16 changes: 16 additions & 0 deletions .config/nvim/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,22 @@ vim.api.nvim_create_autocmd('BufWritePre', {group = 'MYAUCMDS', pattern = { '*.h
-- Debugging C++ values
-- std::cout << ": " << << "\n"; // DEBUG
-- std::cout << ": " << << "\n"; // DEBUG
-- touch /tmp/debug.log
-- std::ofstream ofstr("/tmp/debug.log", std::ios_base::app); // assume the file already exists
-- ofstr << "msCompositeSchedule._sChargingRateUnit_tempString: " << msCompositeSchedule._sChargingRateUnit_tempString << "\n";
-- ofstr.close();
--#include <iostream>
--#include <fstream>
--#include <string>
--// Usage example: filePutContents("./yourfile.txt", "content", true);
--void filePutContents(const std::string& name, const std::string& content, bool append = false) {
-- std::ofstream outfile;
-- if (append)
-- outfile.open(name, std::ios_base::app);
-- else
-- outfile.open(name);
-- outfile << content;
--}
--
-- convert windows line ending to linux:
-- :%s/^M$//
Expand Down
4 changes: 4 additions & 0 deletions .config/nvim/lua/my_cmds.lua
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,10 @@ add_cmd('SelLazyEscStr', [[/\\".\{-}\\"]], {}) -- non-greedy search of \"..\" fi
add_cmd('CoutDebug', [[execute 'normal! i' . 'std::cout << DEBUG << "\n"; // DEBUG' . '<Esc>']], {})
add_cmd('RmBufDebug', [[execute 'g/.*DEBUG$/del']], {}) -- non-greedy search of \"..\" fields

---- Harpoon ----
-- send all quickfixlist files to harpoon
add_cmd('HSend', [[:cfdo lua require("harpoon.mark").add_file()]], {})

---- Quickfixlist ----
--<C-q>f to telescope results to quickfixlist
-- there is no quickfixlists overview (how many quickfixlists exist)
Expand Down
7 changes: 7 additions & 0 deletions .config/nvim/lua/my_keymaps.lua
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,8 @@ map('n', '<C-w><C-q>', '<cmd>tabclose<CR>', opts)
--map('n', ',t', '<cmd>tabnew<CR>', opts) -- Newtab (like in browser)
--map('n', ',w', '<cmd>tabclose<CR>', opts) -- Closetab (like in browser)
---- window navigation ----
--map('n', '<C-A>hjkl', ':q<CR>', opts) -- TODO: nvagiation
--map('n', ';q', ':q<CR>', opts) -- quit
--map('n', ';q', ':q<CR>', opts) -- quit
--map('n', ';c', ':close<CR>', opts) -- close window unless its the last one
--map('n', ';o', ':only<CR>', opts) -- close all windows but this one
Expand Down Expand Up @@ -437,6 +439,11 @@ map('n', '<leader>th', [[<cmd>lua require('telescope.builtin').help_tags()<CR>]]
--map('n', '<leader>ed', [[<cmd>lua require'telescope'.extensions.project-scripts.edit{}<CR>]], opts) -- edit_script
--map('n', '<leader>ex', [[<cmd>lua require'telescope'.extensions.project-scripts.run{}<CR>]], opts) -- run_script

---- leap ----
map('n', '-', '<Plug>(leap-forward)', {}) -- -> forward
map('n', '_', '<Plug>(leap-backward)', {}) -- _> inverse forward
map('n', 'gs', '<Plug>(leap-cross-window)', {}) -- search and go across the windows

---- gitsigns ---- in file git operations (:Gitsigns debug_messages)
-- mappings are workaround of https://github.com/lewis6991/gitsigns.nvim/issues/498
--map('n', ']c', '<cmd>Gitsigns next_hunk<CR>', opts)
Expand Down
4 changes: 3 additions & 1 deletion .config/nvim/lua/my_nvimcmp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ cmp.setup {
-- },
--},
{ name = 'nvim_lsp' },
{ name = 'tags' },
-- TODO setup inbuild completions to work properly by adjusting C-n,Cp
-- or setup vim-gutentags
--{ name = 'tags' },
--{ name = 'cmp_ctags' },
-- { name = 'vsnip' }, -- For vsnip users.
-- { name = 'luasnip' }, -- For luasnip users.
Expand Down
16 changes: 11 additions & 5 deletions .config/nvim/lua/my_packer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ return require('packer').startup(function()
--use { 'ThePrimeagen/git-worktree.nvim' } -- idea project setup
--use { 'nvim-lualine/lualine.nvim', requires = { 'kyazdani42/nvim-web-devicons' } }
---- lsp+competion ----
use { 'williamboman/nvim-lsp-installer' }
use { 'neovim/nvim-lspconfig' } --:sh, gd,gi,gs,gr,K,<l>ca,<l>cd,<l>rf,[e,]e, UNUSED: <l>wa/wr/wl/q/f (workspace folders, loclist, formatting)
--use { 'ms-jpq/coq_nvim', branch = 'coq' } -- autocompletion plugin for various sources, very frequent updates (ca. 4 days)
--use { 'ms-jpq/coq.artifacts', branch = 'artifacts' } --9000+ Snippets. BUT: own way of updating may fail => annoying
Expand All @@ -27,19 +28,19 @@ return require('packer').startup(function()
--gitsigns: [c, ]c, <l>hs/hu,hS/hR,hp(review),hb(lame),hd(iff),hD(fndiff),htb(toggle line blame),htd(toggle deleted) :Gitsigns toggle_
--use { 'lewis6991/gitsigns.nvim', branch = 'main', config = function() require('gitsigns').setup() end }
use { 'lewis6991/gitsigns.nvim', branch = 'main' }
use { 'tpope/vim-fugitive' } -- TODO setup
use { 'tpope/vim-fugitive' } -- idea setup
--:DiffviewOpen, :DiffviewClose/tabclose, :DiffviewFileHistory
use { 'sindrets/diffview.nvim', requires = 'nvim-lua/plenary.nvim' }
use { 'phaazon/hop.nvim', config = function() require'hop'.setup() end, }
-- idea use { 'axieax/urlview.nvim' } -- :Telescope urlview
--requires = { 'tpope/vim-repeat' }
-- leap: s|S char1 char2 (<space>|<tab>)* label?
-- leap: gs in all other windows on the tab page
-- leap: enter repeates, tab reverses the motion
-- s|S char1 char2 <space>? (<space>|<tab>)* label?
--use { 'ggandor/leap.nvim', branch = 'main', config = function() require('leap').set_default_keymaps() end, } -- get used to enter for repeat
-- -|_ char1 char2 <space>? (<space>|<tab>)* label?
use { 'ggandor/leap.nvim', branch = 'main', } -- repeat action not yet supported
use { 'luukvbaal/nnn.nvim', config = function() require('nnn').setup() end, } --<l>n and :Np
--use { 'anuvyklack/hydra.nvim' } -- TODO finish this
--use { 'anuvyklack/hydra.nvim' } -- idea finish this

-- TODO visual mode gc,gb clash
-- visual gc/gb, normal [count]gcc/gbc, gco/gcO/gcA
Expand All @@ -51,6 +52,8 @@ return require('packer').startup(function()
-- selection S' to put ' around selected text
-- ysiw' for inner word with '
-- ? support for ysiwf ?
-- word -> ysiw' -> 'word'
-- (da da) ->( ysa") -> ("da da")
use { 'kylechui/nvim-surround', config = function() require("nvim-surround").setup() end, } -- stylish
use { 'folke/which-key.nvim', config = function() require('which-key').setup() end, } -- :Telescope builtin.keymaps
use { 'ThePrimeagen/harpoon' } -- <l> [m|c|s]key=[j|k|l|u|i] mv|mc|mm
Expand All @@ -62,7 +65,9 @@ return require('packer').startup(function()
--use { '~/dev/git/lua/telescope-project.nvim' } --TODO fixit
use { 'nvim-telescope/telescope-github.nvim' } --Telescope gh issues|pull_request|gist|run
-- Telescope gh issues author=windwp label=bug search=miscompilation
use { 'asbjornhaland/telescope-send-to-harpoon.nvim' } -- TODO use this
--problem: https://github.com/asbjornhaland/telescope-send-to-harpoon.nvim/issues/1
--workaround: command
--use { 'asbjornhaland/telescope-send-to-harpoon.nvim' } -- required: telescope,harpoon,
-- TODO rename folder as you type
--use { 'LinArcX/telescope-command-palette.nvim' } -- necessary?
--use { 'nvim-telescope/telescope-symbols.nvim' } --:lua require'telescope.builtin'.symbols{ sources = {'emoji', 'kaomoji', 'gitmoji'} }
Expand Down Expand Up @@ -105,6 +110,7 @@ return require('packer').startup(function()
-- replacement of , vim-unimpaired, vim-speeddating, vim-repeat by optional lua functions
-- look into https://github.com/jonatan-branting/nvim-better-n

--use { 'phaazon/hop.nvim', config = function() require'hop'.setup() end, }
--use { 'vim-table' }
--use { 'mrjones2014/legendary.nvim' } -- legend+search for keymaps, cmds, autocmds, I want to keep annotations dense+minimal
--use { 'karb94/neoscroll.nvim', config = function() require('neoscroll').setup() end, }
Expand Down
7 changes: 7 additions & 0 deletions .config/nvim/lua/my_telesc.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ telescope.setup {
'--column',
'--smart-case',
},
-- upstream issue: https://github.com/asbjornhaland/telescope-send-to-harpoon.nvim/issues/1
-- mappings = {
-- i = {
-- ["<C-h>"] = telescope.extensions.send_to_harpoon.actions.send_selected_to_harpoon
-- },
-- },
},
--extensions = {
-- hop = {
Expand All @@ -35,6 +41,7 @@ telescope.setup {
telescope.load_extension 'fzf'
telescope.load_extension 'hop'
telescope.load_extension 'gh'
--telescope.load_extension 'send_to_harpoon'
--telescope.load_extension 'urlview'

--telescope.load_extension 'project'
Expand Down
5 changes: 3 additions & 2 deletions .config/shells/aliases
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,11 @@ alias helpcommonuser='echo "bashrc firejail_build nvim tmuxst tmuxat foxla sfoxl
#valgrind leakcheck:
#gdb --tui, --ex run, set tui enable
#gdb --args ./runTests --gtest_filter=Br* --gtest_break_on_failure
#gdb: 'i b' list breakpoints, l list LOC around, p print val
#gdb: 'i b' list/print breakpoints, l list LOC around, p print val
#gdb: r (re)run, b [file]:LOC|function|*addr|+-offset,
#gdb: d del breakpoint(s), dis disable breakpoint(s)
#gdb: c continue, s single-step into, n single-step over,
#gdb: c continue, s single-step into, n single-step over, fin(ish) current scope,
#gdb: up oen context level on stack (to caller), do(wn)
#gdb: q quit,
#gdb: checkpoint (save snapshot), info checkpoints, restart checkid
#gdb: delete checkpoint checkid,
Expand Down
4 changes: 4 additions & 0 deletions .config/shells/aliases_git
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
#root directory of current git repo
#git rev-parse --show-toplevel

#overwrite current branch with other branch without losing content
#git tag old-email-branch
#git reset --hard staging

#patch based work
#git format-patch --stdout first_commit^..last_commit > changes.patch
#git am -3 < changes.patch
Expand Down
1 change: 1 addition & 0 deletions templates/gdb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ p variable
ps -p pid (posix)
pgrep pname
pidof pname
ps aux | grep -i process
gdb> set follow-fork-mode child

Debugging on Windows:
Expand Down

0 comments on commit 50a052a

Please sign in to comment.