summaryrefslogtreecommitdiffstats
path: root/.config/nvim
diff options
context:
space:
mode:
Diffstat (limited to '.config/nvim')
-rw-r--r--.config/nvim/lua/mappings.lua46
-rw-r--r--.config/nvim/lua/plugin_settings.lua96
-rw-r--r--.config/nvim/lua/plugins.lua11
3 files changed, 94 insertions, 59 deletions
diff --git a/.config/nvim/lua/mappings.lua b/.config/nvim/lua/mappings.lua
index a324d90..db2a552 100644
--- a/.config/nvim/lua/mappings.lua
+++ b/.config/nvim/lua/mappings.lua
@@ -5,16 +5,6 @@
5-- │▘▝ ▘▝▀▘▌ ▌ ▀▘▘ ▘▗▄▘▀▀ │ 5-- │▘▝ ▘▝▀▘▌ ▌ ▀▘▘ ▘▗▄▘▀▀ │
6-- └────────────────────────┘ 6-- └────────────────────────┘
7 7
8-- -- map helper
9-- local function map(mode, lhs, rhs, opts)
10-- local options = {noremap = true, silent = true}
11-- if opts then options = vim.tbl_extend('force', options, opts) end
12-- vim.api.nvim_set_keymap(mode, lhs, rhs, options)
13-- end
14
15-- local cmd = vim.cmd
16-- local M = {}
17
18-- brute force deasciify everything 8-- brute force deasciify everything
19vim.keymap.set("n", "<leader>tc", "TurkishDeasciifyForce()", { expr = true }) 9vim.keymap.set("n", "<leader>tc", "TurkishDeasciifyForce()", { expr = true })
20vim.keymap.set("n", "<leader>tctc", "TurkishDeasciifyForce() .. '_'", { expr = true }) 10vim.keymap.set("n", "<leader>tctc", "TurkishDeasciifyForce() .. '_'", { expr = true })
@@ -95,22 +85,11 @@ vim.keymap.set('v', '<', '<gv')
95vim.keymap.set('v', 'y', 'myy`y') 85vim.keymap.set('v', 'y', 'myy`y')
96vim.keymap.set('v', 'Y', 'myY`y') 86vim.keymap.set('v', 'Y', 'myY`y')
97 87
98-- plug mappings {{{ -- 88-- ` is more useful than `
99-- New vim.keymap.set handles Plug mappings, I think, remove this paragraph if nothing breaks in the upcoming days
100-- -- <Plug> mappings should not be noremap
101-- -- https://www.reddit.com/r/vim/comments/78izt4/please_help_understand_how_to_use_plug_mapping/
102-- local function plugmap(mode, lhs, rhs, opts)
103-- local options = {noremap = false, silent = true}
104-- if opts then options = vim.tbl_extend('force', options, opts) end
105-- vim.api.nvim_set_keymap(mode, lhs, rhs, options)
106-- end
107
108-- sneak using grave, s is for sandwich
109vim.keymap.set('n', '`', '<Plug>Sneak_s')
110vim.keymap.set('n', '`', '<Plug>Sneak_s')
111vim.keymap.set('n', '<Leader>`', '<Plug>Sneak_S')
112vim.keymap.set('n', "'", '`') 89vim.keymap.set('n', "'", '`')
113 90
91-- plug mappings {{{ --
92
114-- use the special yoink paste that rotates 93-- use the special yoink paste that rotates
115vim.keymap.set('n', 'p', '<Plug>(YoinkPaste_p)') 94vim.keymap.set('n', 'p', '<Plug>(YoinkPaste_p)')
116vim.keymap.set('n', 'P', '<Plug>(YoinkPaste_P)') 95vim.keymap.set('n', 'P', '<Plug>(YoinkPaste_P)')
@@ -162,11 +141,18 @@ vim.keymap.set('n', 'vr', ':NvimTreeRefresh<CR>')
162vim.keymap.set('n', 'vs', ':NvimTreeFindFile<CR>') 141vim.keymap.set('n', 'vs', ':NvimTreeFindFile<CR>')
163 142
164-- dial.nvim mappings 143-- dial.nvim mappings
165vim.keymap.set("n", "<C-a>", require("dial.map").inc_normal(), {noremap = true}) 144local opts = { noremap=true, silent=true }
166vim.keymap.set("n", "<C-x>", require("dial.map").dec_normal(), {noremap = true}) 145vim.keymap.set("n", "<C-a>", require("dial.map").inc_normal(), opts)
167vim.keymap.set("v", "<C-a>", require("dial.map").inc_visual(), {noremap = true}) 146vim.keymap.set("n", "<C-x>", require("dial.map").dec_normal(), opts)
168vim.keymap.set("v", "<C-x>", require("dial.map").dec_visual(), {noremap = true}) 147vim.keymap.set("v", "<C-a>", require("dial.map").inc_visual(), opts)
169vim.keymap.set("v", "g<C-a>", require("dial.map").inc_gvisual(), {noremap = true}) 148vim.keymap.set("v", "<C-x>", require("dial.map").dec_visual(), opts)
170vim.keymap.set("v", "g<C-x>", require("dial.map").dec_gvisual(), {noremap = true}) 149vim.keymap.set("v", "g<C-a>", require("dial.map").inc_gvisual(), opts)
150vim.keymap.set("v", "g<C-x>", require("dial.map").dec_gvisual(), opts)
151
152-- leap.nvim mappings
153vim.keymap.set('n', '`', '<Plug>(leap-forward)', opts)
154vim.keymap.set('n', '<Leader>`', '<Plug>(leap-backward)', opts)
155vim.keymap.set('v', '`', '<Plug>(leap-forward)', opts)
156vim.keymap.set('v', '<Leader>`', '<Plug>(leap-backward)', opts)
171 157
172-- }}} plug mappings -- 158-- }}} plug mappings --
diff --git a/.config/nvim/lua/plugin_settings.lua b/.config/nvim/lua/plugin_settings.lua
index 41a663a..734efd3 100644
--- a/.config/nvim/lua/plugin_settings.lua
+++ b/.config/nvim/lua/plugin_settings.lua
@@ -38,11 +38,6 @@ local function lualine_spell()
38 end 38 end
39end 39end
40 40
41-- Grinds vim to a halt
42local function lualine_tex_wordcount()
43 return vim.fn['vimtex#misc#wordcount']() .. " ‽"
44end
45
46local conditions = { 41local conditions = {
47 spell_on = function () 42 spell_on = function ()
48 return vim.wo.spell 43 return vim.wo.spell
@@ -337,38 +332,38 @@ local nvim_lsp = require('lspconfig')
337 332
338-- Mappings. 333-- Mappings.
339local opts = { noremap=true, silent=true } 334local opts = { noremap=true, silent=true }
340vim.api.nvim_set_keymap('n', '<leader>e', '<cmd>lua vim.diagnostic.open_float()<CR>', opts) 335vim.keymap.set('n', '<leader>e', vim.diagnostic.open_float, opts)
341vim.api.nvim_set_keymap('n', '[d', '<cmd>lua vim.diagnostic.goto_prev()<CR>', opts) 336vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, opts)
342vim.api.nvim_set_keymap('n', ']d', '<cmd>lua vim.diagnostic.goto_next()<CR>', opts) 337vim.keymap.set('n', ']d', vim.diagnostic.goto_next, opts)
343vim.api.nvim_set_keymap('n', '<leader>q', '<cmd>lua vim.diagnostic.setloclist()<CR>', opts) 338vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, opts)
344 339
345local on_attach = function(client, bufnr) 340local on_attach = function(client, bufnr)
346 -- Enable completion triggered by <c-x><c-o> 341 -- Enable completion triggered by <c-x><c-o>
347 vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc') 342 vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
348 343
349 -- See `:help vim.lsp.*` for documentation on any of the below functions 344 -- See `:help vim.lsp.*` for documentation on any of the below functions
350 vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gD', '<cmd>lua vim.lsp.buf.declaration()<CR>', opts) 345 local bufopts = { noremap=true, silent=true, buffer=bufnr }
351 vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gd', '<cmd>lua vim.lsp.buf.definition()<CR>', opts) 346 vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, bufopts)
352 vim.api.nvim_buf_set_keymap(bufnr, 'n', 'vh', '<cmd>lua vim.lsp.buf.hover()<CR>', opts) 347 vim.keymap.set('n', 'gd', vim.lsp.buf.definition, bufopts)
353 vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gh', '<cmd>lua vim.lsp.buf.implementation()<CR>', opts) 348 vim.keymap.set('n', 'vh', vim.lsp.buf.hover, bufopts)
354 vim.api.nvim_buf_set_keymap(bufnr, 'n', '<C-k>', '<cmd>lua vim.lsp.buf.signature_help()<CR>', opts) 349 vim.keymap.set('n', 'gh', vim.lsp.buf.implementation, bufopts)
355 vim.api.nvim_buf_set_keymap(bufnr, 'n', '<leader>wa', '<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>', opts) 350 vim.keymap.set('n', '<C-k>', vim.lsp.buf.signature_help, bufopts)
356 vim.api.nvim_buf_set_keymap(bufnr, 'n', '<leader>wr', '<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>', opts) 351 vim.keymap.set('n', '<leader>wa', vim.lsp.buf.add_workspace_folder, bufopts)
357 vim.api.nvim_buf_set_keymap(bufnr, 'n', '<leader>wl', '<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>', opts) 352 vim.keymap.set('n', '<leader>wr', vim.lsp.buf.remove_workspace_folder, bufopts)
358 vim.api.nvim_buf_set_keymap(bufnr, 'n', '<leader>D', '<cmd>lua vim.lsp.buf.type_definition()<CR>', opts) 353 vim.keymap.set('n', '<leader>wl', function()
359 vim.api.nvim_buf_set_keymap(bufnr, 'n', '<leader>rn', '<cmd>lua vim.lsp.buf.rename()<CR>', opts) 354 print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
360 vim.api.nvim_buf_set_keymap(bufnr, 'n', '<leader>ca', '<cmd>lua vim.lsp.buf.code_action()<CR>', opts) 355 end, bufopts)
361 vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gr', '<cmd>lua vim.lsp.buf.references()<CR>', opts) 356 vim.keymap.set('n', '<leader>D', vim.lsp.buf.type_definition, bufopts)
362 vim.api.nvim_buf_set_keymap(bufnr, 'n', '<leader>fm', '<cmd>lua vim.lsp.buf.formatting()<CR>', opts) 357 vim.keymap.set('n', '<leader>rn', vim.lsp.buf.rename, bufopts)
358 vim.keymap.set('n', '<leader>ca', vim.lsp.buf.code_action, bufopts)
359 vim.keymap.set('n', 'gr', vim.lsp.buf.references, bufopts)
360 vim.keymap.set('n', '<leader>fm', vim.lsp.buf.formatting, bufopts)
363end 361end
364 362
365local servers = { 'rust_analyzer', 'jedi_language_server', 'texlab', 'clangd', 'ltex' } 363local servers = { 'rust_analyzer', 'jedi_language_server', 'texlab', 'clangd', 'ltex' }
366for _, lsp in ipairs(servers) do 364for _, lsp in ipairs(servers) do
367 nvim_lsp[lsp].setup { 365 nvim_lsp[lsp].setup {
368 on_attach = on_attach, 366 on_attach = on_attach,
369 flags = {
370 debounce_text_changes = 150,
371 },
372 capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities()) 367 capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities())
373 } 368 }
374end 369end
@@ -555,3 +550,54 @@ require('rose-pine').setup({
555-- set colorscheme after options 550-- set colorscheme after options
556vim.cmd('colorscheme rose-pine') 551vim.cmd('colorscheme rose-pine')
557-- }}} Rose Pine -- 552-- }}} Rose Pine --
553
554-- dial.nvim {{{ --
555
556local augend = require("dial.augend")
557require("dial.config").augends:register_group{
558 -- default augends used when no group name is specified
559 default = {
560 augend.integer.alias.decimal, -- nonnegative decimal number (0, 1, 2, 3, ...)
561 augend.integer.alias.hex, -- nonnegative hex number (0x01, 0x1a1f, etc.)
562 augend.date.alias["%Y/%m/%d"], -- date (2022/02/19, etc.)
563 augend.date.alias["%Y-%m-%d"],
564 augend.semver.alias.semver,
565 augend.constant.new{
566 elements = {"and", "or"},
567 word = true, -- if false, "sand" is incremented into "sor", "doctor" into "doctand", etc.
568 cyclic = true, -- "or" is incremented into "and".
569 },
570 augend.constant.new{
571 elements = {"&&", "||"},
572 word = false,
573 cyclic = true,
574 },
575 },
576}
577
578-- }}} dial.nvim --
579
580-- leap.nvim {{{ --
581require('leap').setup {
582 max_aot_targets = nil,
583 highlight_unlabeled = false,
584 case_sensitive = false,
585 -- Groups of characters that should match each other.
586 -- Obvious candidates are braces & quotes ('([{', ')]}', '`"\'').
587 character_classes = { ' \t\r\n', },
588 -- Leaving the appropriate list empty effectively disables "smart" mode,
589 -- and forces auto-jump to be on or off.
590 -- safe_labels = { . . . },
591 -- labels = { . . . },
592 -- These keys are captured directly by the plugin at runtime.
593 -- (For `prev_match`, I suggest <s-enter> if possible in the terminal/GUI.)
594 special_keys = {
595 repeat_search = '<enter>',
596 next_match = '<enter>',
597 prev_match = '<tab>',
598 next_group = '<space>',
599 prev_group = '<tab>',
600 },
601}
602
603-- }}} leap.nvim --
diff --git a/.config/nvim/lua/plugins.lua b/.config/nvim/lua/plugins.lua
index ba5ae0b..2628272 100644
--- a/.config/nvim/lua/plugins.lua
+++ b/.config/nvim/lua/plugins.lua
@@ -125,12 +125,17 @@ return require('packer').startup(function()
125 use 'lfv89/vim-interestingwords' 125 use 'lfv89/vim-interestingwords'
126 -- swap delimited items using g>, g< 126 -- swap delimited items using g>, g<
127 use 'machakann/vim-swap' 127 use 'machakann/vim-swap'
128 -- jump to location by 2 characters, ` 128
129 use 'justinmk/vim-sneak' 129 -- sneak, but in l u a
130 use 'ggandor/leap.nvim'
131 -- -- jump to location by 2 characters, `
132 -- use 'justinmk/vim-sneak'
130 -- additional text objects, don't remove this ever again you fuck 133 -- additional text objects, don't remove this ever again you fuck
131 use 'wellle/targets.vim' 134 use 'wellle/targets.vim'
132 -- enhanced increment/decrement plugin ala speeddating 135 -- enhanced increment/decrement plugin ala speeddating
133 use 'monaqa/dial.nvim' 136 use 'monaqa/dial.nvim'
137 -- comment helper
138 use 'numToStr/Comment.nvim'
134 139
135 -- statusline of the $CURRENT_YEAR 140 -- statusline of the $CURRENT_YEAR
136 use { 141 use {
@@ -152,8 +157,6 @@ return require('packer').startup(function()
152 } 157 }
153 -- provides ga, show unicode stuff of char under cursor 158 -- provides ga, show unicode stuff of char under cursor
154 use 'tpope/vim-characterize' 159 use 'tpope/vim-characterize'
155 -- comment helper
156 use 'numToStr/Comment.nvim'
157 -- asynchronous build and test dispatcher 160 -- asynchronous build and test dispatcher
158 use {'tpope/vim-dispatch', opt = true, cmd = {'Dispatch', 'Make', 'Focus', 'Start'}} 161 use {'tpope/vim-dispatch', opt = true, cmd = {'Dispatch', 'Make', 'Focus', 'Start'}}
159 -- automatically adjust 'shiftwidth' and 'expandtab' 162 -- automatically adjust 'shiftwidth' and 'expandtab'