summaryrefslogtreecommitdiffstats
path: root/.config/nvim/lua
diff options
context:
space:
mode:
Diffstat (limited to '.config/nvim/lua')
-rw-r--r--.config/nvim/lua/mappings.lua188
-rw-r--r--.config/nvim/lua/plugins.lua20
2 files changed, 111 insertions, 97 deletions
diff --git a/.config/nvim/lua/mappings.lua b/.config/nvim/lua/mappings.lua
index 3a37584..a324d90 100644
--- a/.config/nvim/lua/mappings.lua
+++ b/.config/nvim/lua/mappings.lua
@@ -5,168 +5,168 @@
5-- │▘▝ ▘▝▀▘▌ ▌ ▀▘▘ ▘▗▄▘▀▀ │ 5-- │▘▝ ▘▝▀▘▌ ▌ ▀▘▘ ▘▗▄▘▀▀ │
6-- └────────────────────────┘ 6-- └────────────────────────┘
7 7
8-- map helper 8-- -- map helper
9local function map(mode, lhs, rhs, opts) 9-- local function map(mode, lhs, rhs, opts)
10 local options = {noremap = true, silent = true} 10-- local options = {noremap = true, silent = true}
11 if opts then options = vim.tbl_extend('force', options, opts) end 11-- if opts then options = vim.tbl_extend('force', options, opts) end
12 vim.api.nvim_set_keymap(mode, lhs, rhs, options) 12-- vim.api.nvim_set_keymap(mode, lhs, rhs, options)
13end 13-- end
14 14
15local cmd = vim.cmd 15-- local cmd = vim.cmd
16local M = {} 16-- local M = {}
17 17
18-- brute force deasciify everything 18-- brute force deasciify everything
19map('n', '<Leader>tc', 'TurkishDeasciifyForce()', {expr = true}) 19vim.keymap.set("n", "<leader>tc", "TurkishDeasciifyForce()", { expr = true })
20map('x', '<Leader>tc', 'TurkishDeasciifyForce()', {expr = true}) 20vim.keymap.set("n", "<leader>tctc", "TurkishDeasciifyForce() .. '_'", { expr = true })
21map('n', '<Leader>tctc', "TurkishDeasciifyForce() .. '_'", {expr = true}) 21vim.keymap.set("x", "<leader>tc", "TurkishDeasciifyForce()", { expr = true })
22 22
23-- use turkish-mode to selectively deasciify 23-- use turkish-mode to selectively deasciify
24map('n', '<Leader>tr', 'TurkishDeasciify()', {expr = true}) 24vim.keymap.set("n", "<Leader>tr", "TurkishDeasciify()", {expr = true})
25map('x', '<Leader>tr', 'TurkishDeasciify()', {expr = true}) 25vim.keymap.set("n", "<Leader>trtr", "TurkishDeasciify() .. '_'", {expr = true})
26map('n', '<Leader>trtr', "TurkishDeasciify() .. '_'", {expr = true}) 26vim.keymap.set("x", "<Leader>tr", "TurkishDeasciify()", {expr = true})
27 27
28-- ascii everything 28-- ascii everything
29map('n', '<Leader>rt', 'TurkishAsciify()', {expr = true}) 29vim.keymap.set("n", "<Leader>rt", "TurkishAsciify()", {expr = true})
30map('x', '<Leader>rt', 'TurkishAsciify()', {expr = true}) 30vim.keymap.set("n", "<Leader>rtrt", "TurkishAsciify() .. '_'", {expr = true})
31map('n', '<Leader>rtrt', "TurkishAsciify() .. '_'", {expr = true}) 31vim.keymap.set("x", "<Leader>rt", "TurkishAsciify()", {expr = true})
32 32
33-- https://stackoverflow.com/questions/4256697/vim-search-and-highlight-but-do-not-jump 33-- https://stackoverflow.com/questions/4256697/vim-search-and-highlight-but-do-not-jump
34-- search & highlight but do not jump 34-- search & highlight but do not jump
35map('n', '*', ':keepjumps normal! mi*`i<CR>') 35vim.keymap.set("n", "*", ":keepjumps normal! mi*`i<CR>")
36map('n', '#', ':keepjumps normal! mi#`i<CR> ') 36vim.keymap.set("n", "#", ":keepjumps normal! mi#`i<CR>")
37 37
38-- save file as sudo on files that require root permission 38-- save file as sudo on files that require root permission
39map('c', 'w!!', 'execute "silent! write !sudo tee % >/dev/null" <bar> edit!<CR>', { silent = false }) 39vim.keymap.set("c", "w!!", 'execute "silent! write !sudo tee % >/dev/null" <bar> edit!<CR>', { silent = false })
40 40
41-- replace ex mode with gq (format lines) 41-- replace ex mode with gq (format lines)
42map('n', 'Q', 'gq') 42vim.keymap.set('n', 'Q', 'gq')
43 43
44-- set formatprg to sentences, for prose 44-- set formatprg to sentences, for prose
45map('n', '<Leader>fp', ":set formatprg=~/.local/bin/sentences<CR>", { silent = false }) 45vim.keymap.set('n', '<Leader>fp', ":set formatprg=~/.local/bin/sentences<CR>", { silent = false })
46 46
47-- replace all is aliased to S. 47-- replace all is aliased to S.
48map('n', 'S', ':%s//g<Left><Left>', { silent = false }) 48vim.keymap.set('n', 'S', ':%s//g<Left><Left>', { silent = false })
49map('v', 'S', ':s//g<Left><Left>', { silent = false }) 49vim.keymap.set('v', 'S', ':s//g<Left><Left>', { silent = false })
50 50
51-- jump to buffer 51-- jump to buffer
52map('n', '<Leader>b', ':ls<cr>:b<space>') 52vim.keymap.set('n', '<Leader>b', ':ls<cr>:b<space>')
53 53
54-- up and down are more logical with g.. 54-- up and down are more logical with g..
55map('n', 'k', '(v:count == 0 ? "gk" : "k")', { expr = true }) 55vim.keymap.set('n', 'k', '(v:count == 0 ? "gk" : "k")', { expr = true })
56map('n', 'j', '(v:count == 0 ? "gj" : "j")', { expr = true }) 56vim.keymap.set('n', 'j', '(v:count == 0 ? "gj" : "j")', { expr = true })
57map('i', '<Up>', '<Esc>gka') 57vim.keymap.set('i', '<Up>', '<Esc>gka')
58map('i', '<Down>', '<Esc>gja') 58vim.keymap.set('i', '<Down>', '<Esc>gja')
59 59
60-- disable highlight when <leader><cr> is pressed
61map('n', '<Leader><Cr>', ':noh<Cr>')
62-- space used to toggle folds, now it's x (because x is d) 60-- space used to toggle folds, now it's x (because x is d)
63map('n', '<Space>', '"_x') 61vim.keymap.set('n', '<Space>', '"_x')
64 62
65-- separate cut and delete 63-- separate cut and delete
66map('n', 'x', 'd') 64vim.keymap.set('n', 'x', 'd')
67map('x', 'x', 'd') 65vim.keymap.set('x', 'x', 'd')
68map('n', 'xx', 'dd') 66vim.keymap.set('n', 'xx', 'dd')
69map('n', 'X', 'D') 67vim.keymap.set('n', 'X', 'D')
70 68
71-- change into pwd of current directory 69-- change into pwd of current directory
72map('n', '<Leader>cd', ':lcd %:p:h<CR>:pwd<CR>') 70vim.keymap.set('n', '<Leader>cd', ':lcd %:p:h<CR>:pwd<CR>')
73 71
74-- press \g and start writing prose 72-- press \g and start writing prose
75map('n', '<Leader>g', ':Goyo<CR>') 73vim.keymap.set('n', '<Leader>g', ':Goyo<CR>')
76 74
77-- call CreatePaper on word below cursor 75-- call CreatePaper on word below cursor
78map('n', '<leader>np', 'gewi[[/papers/<ESC>Ea]]<ESC>bb:call CreatePaper(expand("<cword>"))<CR>') 76vim.keymap.set('n', '<leader>np', 'gewi[[/papers/<ESC>Ea]]<ESC>bb:call CreatePaper(expand("<cword>"))<CR>')
79 77
80-- link paper 78-- link paper
81map('n', '<leader>lp', 'gewi[[/papers/<ESC>Ea]]<ESC>') 79vim.keymap.set('n', '<leader>lp', 'gewi[[/papers/<ESC>Ea]]<ESC>')
82 80
83-- call CreateReference on word below cursor 81-- call CreateReference on word below cursor
84map('n', '<leader>nr', ':call CreateReference(expand("<cword>"))<CR>') 82vim.keymap.set('n', '<leader>nr', ':call CreateReference(expand("<cword>"))<CR>')
85 83
86-- create a new note 84-- create a new note
87map('n', '<leader>nn', ':call CreateNote()<CR>') 85vim.keymap.set('n', '<leader>nn', ':call CreateNote()<CR>')
88 86
89-- :%% to get current file path 87-- :%% to get current file path
90map('c', '%%', "getcmdtype() == ':' ? expand('%:h').'/' : '%%'", { expr = true, silent = false }) 88vim.keymap.set('c', '%%', "getcmdtype() == ':' ? expand('%:h').'/' : '%%'", { expr = true, silent = false })
91 89
92-- reselect visual selection after indent 90-- reselect visual selection after indent
93map('v', '>', '>gv') 91vim.keymap.set('v', '>', '>gv')
94map('v', '<', '<gv') 92vim.keymap.set('v', '<', '<gv')
95 93
96-- keep cursor position after visual yank 94-- keep cursor position after visual yank
97map('v', 'y', 'myy`y') 95vim.keymap.set('v', 'y', 'myy`y')
98map('v', 'Y', 'myY`y') 96vim.keymap.set('v', 'Y', 'myY`y')
99 97
100-- plug mappings {{{ -- 98-- plug mappings {{{ --
101 99-- New vim.keymap.set handles Plug mappings, I think, remove this paragraph if nothing breaks in the upcoming days
102-- <Plug> mappings should not be noremap 100-- -- <Plug> mappings should not be noremap
103-- https://www.reddit.com/r/vim/comments/78izt4/please_help_understand_how_to_use_plug_mapping/ 101-- -- https://www.reddit.com/r/vim/comments/78izt4/please_help_understand_how_to_use_plug_mapping/
104local function plugmap(mode, lhs, rhs, opts) 102-- local function plugmap(mode, lhs, rhs, opts)
105 local options = {noremap = false, silent = true} 103-- local options = {noremap = false, silent = true}
106 if opts then options = vim.tbl_extend('force', options, opts) end 104-- if opts then options = vim.tbl_extend('force', options, opts) end
107 vim.api.nvim_set_keymap(mode, lhs, rhs, options) 105-- vim.api.nvim_set_keymap(mode, lhs, rhs, options)
108end 106-- end
109
110-- open the TagBar Plugin
111plugmap('n', '<F3>', ':TagbarToggle<CR>')
112 107
113-- sneak using grave, s is for sandwich 108-- sneak using grave, s is for sandwich
114plugmap('n', '`', '<Plug>Sneak_s') 109vim.keymap.set('n', '`', '<Plug>Sneak_s')
115plugmap('n', '`', '<Plug>Sneak_s') 110vim.keymap.set('n', '`', '<Plug>Sneak_s')
116plugmap('n', '<Leader>`', '<Plug>Sneak_S') 111vim.keymap.set('n', '<Leader>`', '<Plug>Sneak_S')
117map('n', "'", '`') 112vim.keymap.set('n', "'", '`')
118 113
119-- use the special yoink paste that rotates 114-- use the special yoink paste that rotates
120plugmap('n', 'p', '<Plug>(YoinkPaste_p)') 115vim.keymap.set('n', 'p', '<Plug>(YoinkPaste_p)')
121plugmap('n', 'P', '<Plug>(YoinkPaste_P)') 116vim.keymap.set('n', 'P', '<Plug>(YoinkPaste_P)')
122 117
123-- substitute from yank 118-- substitute from yank
124plugmap('n', '<Leader>ys', '<plug>(SubversiveSubstitute)') 119vim.keymap.set('n', '<Leader>ys', '<plug>(SubversiveSubstitute)')
125plugmap('n', '<Leader>yss', '<plug>(SubversiveSubstituteLine)') 120vim.keymap.set('n', '<Leader>yss', '<plug>(SubversiveSubstituteLine)')
126plugmap('n', '<Leader>yS', '<plug>(SubversiveSubstituteToEndOfLine)') 121vim.keymap.set('n', '<Leader>yS', '<plug>(SubversiveSubstituteToEndOfLine)')
127 122
128-- substitute over range 123-- substitute over range
129plugmap('n', '<Leader>s', '<plug>(SubversiveSubstituteRange)') 124vim.keymap.set('n', '<Leader>s', '<plug>(SubversiveSubstituteRange)')
130plugmap('x', '<Leader>s', '<plug>(SubversiveSubstituteRange)') 125vim.keymap.set('x', '<Leader>s', '<plug>(SubversiveSubstituteRange)')
131plugmap('n', '<Leader>ss', '<plug>(SubversiveSubstituteWordRange)') 126vim.keymap.set('n', '<Leader>ss', '<plug>(SubversiveSubstituteWordRange)')
132 127
133-- subvert over range 128-- subvert over range
134plugmap('n', '<Leader><Leader>s', '<plug>(SubversiveSubvertRange)') 129vim.keymap.set('n', '<Leader><Leader>s', '<plug>(SubversiveSubvertRange)')
135plugmap('x', '<Leader><Leader>s', '<plug>(SubversiveSubvertRange)') 130vim.keymap.set('x', '<Leader><Leader>s', '<plug>(SubversiveSubvertRange)')
136plugmap('n', '<Leader><Leader>ss', '<plug>(SubversiveSubvertWordRange)') 131vim.keymap.set('n', '<Leader><Leader>ss', '<plug>(SubversiveSubvertWordRange)')
137 132
138-- iterate over yank list 133-- iterate over yank list
139plugmap('n', '<c-n>', '<Plug>(YoinkPostPasteSwapBack)') 134vim.keymap.set('n', '<c-n>', '<Plug>(YoinkPostPasteSwapBack)')
140plugmap('n', '<c-p>', '<Plug>(YoinkPostPasteSwapForward)') 135vim.keymap.set('n', '<c-p>', '<Plug>(YoinkPostPasteSwapForward)')
141 136
142-- checkmarks on vimwiki 137-- checkmarks on vimwiki
143plugmap('n', '<leader>v', '<Plug>VimwikiToggleListItem') 138vim.keymap.set('n', '<leader>v', '<Plug>VimwikiToggleListItem')
144-- add/increase header level 139-- add/increase header level
145plugmap('n', '<leader>a', '<Plug>VimwikiAddHeaderLevel') 140vim.keymap.set('n', '<leader>a', '<Plug>VimwikiAddHeaderLevel')
146 141
147-- vim-test bindings 142-- vim-test bindings
148map('n', 't<C-n>', ':TestNearest<CR>') 143vim.keymap.set('n', 't<C-n>', ':TestNearest<CR>')
149map('n', 't<C-f>', ':TestFile<CR>') 144vim.keymap.set('n', 't<C-f>', ':TestFile<CR>')
150map('n', 't<C-s>', ':TestSuite<CR>') 145vim.keymap.set('n', 't<C-s>', ':TestSuite<CR>')
151map('n', 't<C-l>', ':TestLast<CR>') 146vim.keymap.set('n', 't<C-l>', ':TestLast<CR>')
152map('n', 't<C-g>', ':TestVisit<CR>') 147vim.keymap.set('n', 't<C-g>', ':TestVisit<CR>')
153 148
154-- telescope bindings 149-- telescope bindings
155map('n', '<leader>ff', "<cmd>lua require('telescope.builtin').find_files()<cr>") 150vim.keymap.set('n', '<leader>ff', "<cmd>lua require('telescope.builtin').find_files()<cr>")
156map('n', '<leader>fg', "<cmd>lua require('telescope.builtin').live_grep()<cr>") 151vim.keymap.set('n', '<leader>fg', "<cmd>lua require('telescope.builtin').live_grep()<cr>")
157map('n', '<leader>fb', "<cmd>lua require('telescope.builtin').buffers()<cr>") 152vim.keymap.set('n', '<leader>fb', "<cmd>lua require('telescope.builtin').buffers()<cr>")
158map('n', '<leader>fh', "<cmd>lua require('telescope.builtin').help_tags()<cr>") 153vim.keymap.set('n', '<leader>fh', "<cmd>lua require('telescope.builtin').help_tags()<cr>")
159 154
160-- vista 155-- vista
161map('n', '<F3>', ":Vista focus<cr>") 156vim.keymap.set('n', '<F3>', ":Vista focus<cr>")
162map('n', '<F4>', ":Vista finder<cr>") 157vim.keymap.set('n', '<F4>', ":Vista finder<cr>")
163
164-- toggle rose pine theme
165map('n', '<F5>', [[<cmd>lua require('rose-pine.functions').toggle_variant({'dawn', 'base'})<cr>]], { noremap = true, silent = true })
166 158
167-- nvim tree mappings 159-- nvim tree mappings
168map('n', 'vt', ':NvimTreeToggle<CR>') 160vim.keymap.set('n', 'vt', ':NvimTreeToggle<CR>')
169map('n', 'vr', ':NvimTreeRefresh<CR>') 161vim.keymap.set('n', 'vr', ':NvimTreeRefresh<CR>')
170map('n', 'vs', ':NvimTreeFindFile<CR>') 162vim.keymap.set('n', 'vs', ':NvimTreeFindFile<CR>')
163
164-- dial.nvim mappings
165vim.keymap.set("n", "<C-a>", require("dial.map").inc_normal(), {noremap = true})
166vim.keymap.set("n", "<C-x>", require("dial.map").dec_normal(), {noremap = true})
167vim.keymap.set("v", "<C-a>", require("dial.map").inc_visual(), {noremap = true})
168vim.keymap.set("v", "<C-x>", require("dial.map").dec_visual(), {noremap = true})
169vim.keymap.set("v", "g<C-a>", require("dial.map").inc_gvisual(), {noremap = true})
170vim.keymap.set("v", "g<C-x>", require("dial.map").dec_gvisual(), {noremap = true})
171 171
172-- }}} plug mappings -- 172-- }}} plug mappings --
diff --git a/.config/nvim/lua/plugins.lua b/.config/nvim/lua/plugins.lua
index 3266aeb..a217616 100644
--- a/.config/nvim/lua/plugins.lua
+++ b/.config/nvim/lua/plugins.lua
@@ -19,6 +19,18 @@ return require('packer').startup(function()
19 } 19 }
20 -- quickstart lsp config 20 -- quickstart lsp config
21 use 'neovim/nvim-lspconfig' 21 use 'neovim/nvim-lspconfig'
22
23 -- annotation generator
24 -- learn to use it 2022-05-17 00:44
25 -- https://github.com/danymat/neogen
26 use {
27 "danymat/neogen",
28 config = function()
29 require('neogen').setup {}
30 end,
31 requires = "nvim-treesitter/nvim-treesitter",
32 }
33
22 -- dashboard 34 -- dashboard
23 use { 35 use {
24 'goolord/alpha-nvim', 36 'goolord/alpha-nvim',
@@ -67,7 +79,6 @@ return require('packer').startup(function()
67 79
68 -- file explorer 80 -- file explorer
69 use 'kyazdani42/nvim-tree.lua' 81 use 'kyazdani42/nvim-tree.lua'
70
71 -- viewer & finder for lsp symbols and tags 82 -- viewer & finder for lsp symbols and tags
72 use 'liuchengxu/vista.vim' 83 use 'liuchengxu/vista.vim'
73 84
@@ -77,6 +88,7 @@ return require('packer').startup(function()
77 cmd = 'UndotreeToggle', 88 cmd = 'UndotreeToggle',
78 config = [[vim.g.undotree_SetFocusWhenToggle = 1]], 89 config = [[vim.g.undotree_SetFocusWhenToggle = 1]],
79 } 90 }
91
80 -- highlight colors 92 -- highlight colors
81 use 'norcalli/nvim-colorizer.lua' 93 use 'norcalli/nvim-colorizer.lua'
82 94
@@ -112,6 +124,8 @@ return require('packer').startup(function()
112 use 'justinmk/vim-sneak' 124 use 'justinmk/vim-sneak'
113 -- additional text objects, don't remove this ever again you fuck 125 -- additional text objects, don't remove this ever again you fuck
114 use 'wellle/targets.vim' 126 use 'wellle/targets.vim'
127 -- enhanced increment/decrement plugin ala speeddating
128 use 'monaqa/dial.nvim'
115 129
116 -- statusline of the $CURRENT_YEAR 130 -- statusline of the $CURRENT_YEAR
117 use { 131 use {
@@ -121,6 +135,8 @@ return require('packer').startup(function()
121 -- colour theme of the $CURRENT_YEAR 135 -- colour theme of the $CURRENT_YEAR
122 use 'rose-pine/neovim' 136 use 'rose-pine/neovim'
123 137
138 -- search for, substitute, and abbreviate multiple variants of a word
139 use 'tpope/vim-abolish'
124 -- enable repeating supported plugin maps with '.' 140 -- enable repeating supported plugin maps with '.'
125 use 'tpope/vim-repeat' 141 use 'tpope/vim-repeat'
126 -- pairs of handy bracket mappings 142 -- pairs of handy bracket mappings
@@ -129,8 +145,6 @@ return require('packer').startup(function()
129 use { 145 use {
130 'tpope/vim-fugitive', cmd = {'Git', 'Gstatus', 'Gblame', 'Gpush', 'Gpull'} 146 'tpope/vim-fugitive', cmd = {'Git', 'Gstatus', 'Gblame', 'Gpush', 'Gpull'}
131 } 147 }
132 -- increment dates, times & more
133 use 'tpope/vim-speeddating'
134 -- provides ga, show unicode stuff of char under cursor 148 -- provides ga, show unicode stuff of char under cursor
135 use 'tpope/vim-characterize' 149 use 'tpope/vim-characterize'
136 -- comment helper 150 -- comment helper