diff options
Diffstat (limited to '.config/nvim/lua')
32 files changed, 1355 insertions, 1319 deletions
diff --git a/.config/nvim/lua/au.lua b/.config/nvim/lua/au.lua deleted file mode 100644 index 305169c..0000000 --- a/.config/nvim/lua/au.lua +++ /dev/null | |||
@@ -1,50 +0,0 @@ | |||
1 | -- | ||
2 | -- https://gist.github.com/numToStr/1ab83dd2e919de9235f9f774ef8076da | ||
3 | -- | ||
4 | local cmd = vim.api.nvim_command | ||
5 | |||
6 | local function autocmd(this, event, spec) | ||
7 | local is_table = type(spec) == 'table' | ||
8 | local pattern = is_table and spec[1] or '*' | ||
9 | local action = is_table and spec[2] or spec | ||
10 | if type(action) == 'function' then | ||
11 | action = this.set(action) | ||
12 | end | ||
13 | local e = type(event) == 'table' and table.concat(event, ',') or event | ||
14 | cmd('autocmd ' .. e .. ' ' .. pattern .. ' ' .. action) | ||
15 | end | ||
16 | |||
17 | local S = { | ||
18 | __au = {}, | ||
19 | } | ||
20 | |||
21 | local X = setmetatable({}, { | ||
22 | __index = S, | ||
23 | __newindex = autocmd, | ||
24 | __call = autocmd, | ||
25 | }) | ||
26 | |||
27 | function S.exec(id) | ||
28 | S.__au[id]() | ||
29 | end | ||
30 | |||
31 | function S.set(fn) | ||
32 | local id = string.format('%p', fn) | ||
33 | S.__au[id] = fn | ||
34 | return string.format('lua require("au").exec("%s")', id) | ||
35 | end | ||
36 | |||
37 | function S.group(grp, cmds) | ||
38 | cmd('augroup ' .. grp) | ||
39 | cmd('autocmd!') | ||
40 | if type(cmds) == 'function' then | ||
41 | cmds(X) | ||
42 | else | ||
43 | for _, au in ipairs(cmds) do | ||
44 | autocmd(S, au[1], { au[2], au[3] }) | ||
45 | end | ||
46 | end | ||
47 | cmd('augroup END') | ||
48 | end | ||
49 | |||
50 | return X | ||
diff --git a/.config/nvim/lua/autocmds.lua b/.config/nvim/lua/autocmds.lua deleted file mode 100644 index 1b8751c..0000000 --- a/.config/nvim/lua/autocmds.lua +++ /dev/null | |||
@@ -1,67 +0,0 @@ | |||
1 | -- ┌─────────────────────────┐ | ||
2 | -- │ ▐ ▌ │ | ||
3 | -- │▝▀▖▌ ▌▜▀ ▞▀▖▞▀▖▛▚▀▖▞▀▌▞▀▘│ | ||
4 | -- │▞▀▌▌ ▌▐ ▖▌ ▌▌ ▖▌▐ ▌▌ ▌▝▀▖│ | ||
5 | -- │▝▀▘▝▀▘ ▀ ▝▀ ▝▀ ▘▝ ▘▝▀▘▀▀ │ | ||
6 | -- └─────────────────────────┘ | ||
7 | |||
8 | local au = require('au') | ||
9 | |||
10 | au.TextYankPost = function() | ||
11 | vim.highlight.on_yank { higroup="IncSearch", timeout=400 } | ||
12 | end | ||
13 | |||
14 | -- autocmd FileType vimwiki,latex,tex setlocal formatprg=/home/yigit/.local/bin/sentences | ||
15 | au.FileType = { | ||
16 | 'vimwiki,latex,tex', | ||
17 | function() | ||
18 | vim.bo.formatprg = "/home/yigit/.local/bin/sentences" | ||
19 | end, | ||
20 | } | ||
21 | |||
22 | -- autocmd VimLeave *.tex !texclear % | ||
23 | au.VimLeave = { | ||
24 | '*.tex', | ||
25 | function() | ||
26 | vim.cmd("!texclear %") | ||
27 | end, | ||
28 | } | ||
29 | |||
30 | -- autocmd FileType rust let b:dispatch = 'cargo run' | ||
31 | au.FileType = { | ||
32 | 'rust', | ||
33 | function() | ||
34 | vim.b.dispatch = 'cargo run' | ||
35 | end, | ||
36 | } | ||
37 | |||
38 | -- autocmd VimResized * :wincmd = | ||
39 | au.VimResized = { | ||
40 | '*', | ||
41 | function() | ||
42 | vim.cmd(":wincmd =") | ||
43 | end, | ||
44 | } | ||
45 | |||
46 | -- autocmd FileType markdown,tex setlocal spell | ||
47 | au.FileType = { | ||
48 | 'markdown,text', | ||
49 | function() | ||
50 | vim.wo.spell = true | ||
51 | end, | ||
52 | } | ||
53 | |||
54 | -- gf plugins | ||
55 | au.BufEnter = { | ||
56 | 'init.lua', | ||
57 | function() | ||
58 | vim.opt.path:append("./lua") | ||
59 | end | ||
60 | } | ||
61 | |||
62 | au.BufLeave = { | ||
63 | 'init.lua', | ||
64 | function() | ||
65 | vim.opt.path:remove("./lua") | ||
66 | end | ||
67 | } | ||
diff --git a/.config/nvim/lua/core/keymaps.lua b/.config/nvim/lua/core/keymaps.lua new file mode 100644 index 0000000..b63156d --- /dev/null +++ b/.config/nvim/lua/core/keymaps.lua | |||
@@ -0,0 +1,77 @@ | |||
1 | local map = require("helpers.keys").map | ||
2 | |||
3 | -- https://stackoverflow.com/questions/4256697/vim-search-and-highlight-but-do-not-jump | ||
4 | -- search & highlight but do not jump | ||
5 | map("n", "*", "<cmd>keepjumps normal! mi*`i<CR>", "search forwards") | ||
6 | map("n", "#", "<cmd>keepjumps normal! mi#`i<CR>", "search backwards") | ||
7 | |||
8 | -- save file as sudo on files that require root permission | ||
9 | map("c", "w!!", 'execute "silent! write !sudo tee % >/dev/null" <bar> edit!<CR>', "save file as sudo", { silent = false }) | ||
10 | |||
11 | -- replace ex mode with gq (format lines) | ||
12 | map("n", "Q", "gq", "format lines") | ||
13 | |||
14 | -- set formatprg to sentences, for prose | ||
15 | -- TODO: can we do this with vim.o.formatprg? | ||
16 | map("n", "<Leader>fp", "<cmd>set formatprg=~/.local/bin/sentences<CR>", "switch to sentences view", { silent = false }) | ||
17 | |||
18 | -- replace all is aliased to S. | ||
19 | map("n", "S", ":s//g<Left><Left>", "replace all", { silent = false }) | ||
20 | map("v", "S", ":s//g<Left><Left>", "replace all selection", { silent = false }) | ||
21 | |||
22 | -- jump to buffer | ||
23 | map("n", "<Leader>b", "<cmd>ls<cr>:b<space>", "jump to buffer") | ||
24 | |||
25 | -- up and down are more logical with g.. | ||
26 | map("n", "k", '(v:count == 0 ? "gk" : "k")', "up", { expr = true }) | ||
27 | map("n", "j", '(v:count == 0 ? "gj" : "j")', "down", { expr = true }) | ||
28 | map("i", "<Up>", "<Esc>gka") | ||
29 | map("i", "<Down>", "<Esc>gja") | ||
30 | |||
31 | -- space used to toggle folds, now it's x (because x is d) | ||
32 | map("n", "<Space>", '"_x') | ||
33 | |||
34 | -- separate cut and delete | ||
35 | map("n", "x", "d") | ||
36 | map("x", "x", "d") | ||
37 | map("n", "xx", "dd") | ||
38 | map("n", "X", "D") | ||
39 | |||
40 | -- change into pwd of current buffer | ||
41 | map("n", "<Leader>cd", "<cmd>lcd %:p:h<CR>:pwd<CR>", "cd to current buffer's pwd") | ||
42 | |||
43 | -- call CreatePaper on word below cursor | ||
44 | map("n", "<leader>np", 'gewi[[/papers/<ESC>Ea]]<ESC>bb:call CreatePaper(expand("<cword>"))<CR>', | ||
45 | "vimwiki new paper on word under cursor") | ||
46 | |||
47 | -- link paper | ||
48 | map("n", "<leader>lp", "gewi[[/papers/<ESC>Ea]]<ESC>", "vimwiki link wrap word under cursor") | ||
49 | |||
50 | -- call CreateReference on word below cursor | ||
51 | map("n", "<leader>nr", '<cmd>call CreateReference(expand("<cword>"))<CR>', "vimwiki new reference word under cursor") | ||
52 | |||
53 | -- create a new note | ||
54 | map("n", "<leader>nn", "<cmd>call CreateNote()<CR>", "vimwiki new note for slipbox") | ||
55 | |||
56 | -- :%% to get current file path | ||
57 | map('c', '%%', "getcmdtype() == ':' ? expand('%:h').'/' : '%%'", "get current file path", { expr = true, silent = false }) | ||
58 | |||
59 | -- reselect visual selection after indent | ||
60 | map('v', '>', '>gv') | ||
61 | map('v', '<', '<gv') | ||
62 | |||
63 | -- keep cursor position after visual yank | ||
64 | map('v', 'y', 'myy`y') | ||
65 | map('v', 'Y', 'myY`y') | ||
66 | |||
67 | -- ` is more useful than ' | ||
68 | map('n', "'", '`') | ||
69 | |||
70 | -- switch between light and dark modes | ||
71 | map("n", "<leader>ut", function() | ||
72 | if vim.o.background == "dark" then | ||
73 | vim.o.background = "light" | ||
74 | else | ||
75 | vim.o.background = "dark" | ||
76 | end | ||
77 | end, "toggle between light and dark background") | ||
diff --git a/.config/nvim/lua/core/lazy.lua b/.config/nvim/lua/core/lazy.lua new file mode 100644 index 0000000..8a91029 --- /dev/null +++ b/.config/nvim/lua/core/lazy.lua | |||
@@ -0,0 +1,30 @@ | |||
1 | -- install lazy.nvim if not already installed | ||
2 | local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" | ||
3 | if not vim.loop.fs_stat(lazypath) then | ||
4 | vim.fn.system({ | ||
5 | "git", | ||
6 | "clone", | ||
7 | "--filter=blob:none", | ||
8 | "https://github.com/folke/lazy.nvim.git", | ||
9 | "--branch=stable", -- latest stable release | ||
10 | lazypath, | ||
11 | }) | ||
12 | end | ||
13 | vim.opt.rtp:prepend(lazypath) | ||
14 | |||
15 | -- use a protected call so we don't error out on first use | ||
16 | local ok, lazy = pcall(require, "lazy") | ||
17 | if not ok then | ||
18 | return | ||
19 | end | ||
20 | |||
21 | -- we have to set the leader key here for lazy.nvim to work | ||
22 | require("helpers.keys").set_leader("\\") | ||
23 | |||
24 | -- load plugins from specifications | ||
25 | -- see: https://github.com/folke/lazy.nvim#-structuring-your-plugins | ||
26 | -- we are loading them as a lua module | ||
27 | lazy.setup("plugins") | ||
28 | |||
29 | -- easy-access keybindings | ||
30 | require("helpers.keys").map("n", "<leader>L", lazy.show, "show lazy") | ||
diff --git a/.config/nvim/lua/core/options.lua b/.config/nvim/lua/core/options.lua new file mode 100644 index 0000000..3299e83 --- /dev/null +++ b/.config/nvim/lua/core/options.lua | |||
@@ -0,0 +1,98 @@ | |||
1 | local opts = { | ||
2 | -- this might not be needed anymore | ||
3 | termguicolors = true, | ||
4 | |||
5 | -- copy indent on a new line | ||
6 | autoindent = true, | ||
7 | |||
8 | -- :h tabstop, 2. point | ||
9 | -- use appropriate number of spaces to insert a <Tab> | ||
10 | expandtab = true, | ||
11 | shiftwidth = 4, | ||
12 | softtabstop = 4, | ||
13 | tabstop = 8, | ||
14 | |||
15 | -- use english for spellchecking | ||
16 | spelllang = "en_gb", | ||
17 | |||
18 | -- tab completion, zsh style | ||
19 | wildmode = "longest:full,full", | ||
20 | |||
21 | -- put one space for join (not two) | ||
22 | joinspaces = false, | ||
23 | |||
24 | -- keep n lines above/below cursor while scrolling | ||
25 | scrolloff = 4, | ||
26 | |||
27 | -- line numbers | ||
28 | number = true, | ||
29 | |||
30 | -- manual folding | ||
31 | foldmethod = "marker", | ||
32 | |||
33 | -- set the terminal title | ||
34 | title = true, | ||
35 | |||
36 | -- wrap using 'breakat' character | ||
37 | linebreak = true, | ||
38 | |||
39 | -- new split panes will split to below and right | ||
40 | splitbelow = true, | ||
41 | splitright = true, | ||
42 | |||
43 | -- use relative line numbers | ||
44 | relativenumber = true, | ||
45 | |||
46 | -- we are already using a cursorline, don't clobber linter messages | ||
47 | showmode = false, | ||
48 | |||
49 | -- jump to the matching bracket briefly | ||
50 | showmatch = true, | ||
51 | |||
52 | -- persistent undo | ||
53 | undofile = true, | ||
54 | |||
55 | -- lower case searches ignore case, upper case searches do not | ||
56 | ignorecase = true, | ||
57 | smartcase = true, | ||
58 | |||
59 | -- https://stackoverflow.com/a/3445040/ | ||
60 | -- switch case labels | ||
61 | cinoptions = "l1", | ||
62 | |||
63 | } | ||
64 | |||
65 | for opt, val in pairs(opts) do | ||
66 | vim.o[opt] = val | ||
67 | end | ||
68 | |||
69 | -- set other options | ||
70 | -- local colorscheme = require("helpers.colorscheme") | ||
71 | -- vim.cmd.colorscheme(colorscheme) | ||
72 | |||
73 | -- interact with system clipboard | ||
74 | vim.opt.clipboard:append('unnamedplus') | ||
75 | |||
76 | vim.opt.wildignore = { | ||
77 | '*.o', '*.obj', '*.class', '*.aux', '*.lof', '*.log', '*.lot', '*.fls', | ||
78 | '*.toc', '*.fmt', '*.fot', '*.cb', '*.cb2', '.*.lb', '.dvi', '*.xdv', | ||
79 | '*.bbl', '*.bcf', '*.blg', '*-blx.aux', '*-blx.bib', '*.run.xml', | ||
80 | '*.fdb_latexmk', '*.synctex', '*.synctex(busy)', '*.synctex.gz', | ||
81 | '*.synctex.gz(busy)', '*.pdfsync' | ||
82 | } | ||
83 | |||
84 | -- iwhite: ignore changes in amount of white space. | ||
85 | -- vertical: start diff mode with vertical splits | ||
86 | -- filler: show filler lines, | ||
87 | vim.opt.diffopt = { | ||
88 | "iwhite", "vertical", "filler", "algorithm:patience", "indent-heuristic" | ||
89 | } | ||
90 | |||
91 | -- menu: use a popup menu to show the possible completions | ||
92 | -- preview: show extra information | ||
93 | vim.opt.completeopt = {"menu", "menuone", "noselect"} | ||
94 | |||
95 | if vim.fn.executable("rg") then | ||
96 | vim.o.grepprg = "rg --vimgrep --no-heading --smart-case" | ||
97 | vim.o.grepformat = "%f:%l:%c:%m,%f:%l:%m" | ||
98 | end | ||
diff --git a/.config/nvim/lua/functions.lua b/.config/nvim/lua/functions.lua deleted file mode 100644 index daee597..0000000 --- a/.config/nvim/lua/functions.lua +++ /dev/null | |||
@@ -1,24 +0,0 @@ | |||
1 | -- ┌──────────────────────────┐ | ||
2 | -- │▗▀▖ ▐ ▗ │ | ||
3 | -- │▐ ▌ ▌▛▀▖▞▀▖▜▀ ▄ ▞▀▖▛▀▖▞▀▘│ | ||
4 | -- │▜▀ ▌ ▌▌ ▌▌ ▖▐ ▖▐ ▌ ▌▌ ▌▝▀▖│ | ||
5 | -- │▐ ▝▀▘▘ ▘▝▀ ▀ ▀▘▝▀ ▘ ▘▀▀ │ | ||
6 | -- └──────────────────────────┘ | ||
7 | -- 2021-10-10 21:50 WIP, I don't know how to integrate these functions to init.lua and honestly, everything is a nvim_command or something anyway | ||
8 | |||
9 | local random = math.random | ||
10 | |||
11 | local function random_filename() | ||
12 | uuid = '' | ||
13 | for i=0,6 do | ||
14 | uuid = uuid .. (string.format('%x', random(0, 0xf))) | ||
15 | end | ||
16 | return uuid | ||
17 | end | ||
18 | |||
19 | function create_note() | ||
20 | nvim_command("e! " .. nvim_call_function('fnameescape', '~/nextcloud/personal_wiki/text/box/' .. random_filename() .. ".wiki")) | ||
21 | local text = "= up =\n\n= down =\n\n= keywords =\n\n" | ||
22 | nvim_command("put! " .. text) | ||
23 | nvim_command("normal gg") | ||
24 | end | ||
diff --git a/.config/nvim/lua/helpers/keys.lua b/.config/nvim/lua/helpers/keys.lua new file mode 100644 index 0000000..ebbcf6e --- /dev/null +++ b/.config/nvim/lua/helpers/keys.lua | |||
@@ -0,0 +1,21 @@ | |||
1 | local M = {} | ||
2 | |||
3 | M.map = function(mode, lhs, rhs, desc, opts) | ||
4 | local options = { noremap = true, silent = true, desc = desc } | ||
5 | if opts then | ||
6 | options = vim.tbl_extend("force", options, opts) | ||
7 | end | ||
8 | vim.keymap.set(mode, lhs, rhs, options) | ||
9 | end | ||
10 | |||
11 | M.lsp_map = function(lhs, rhs, bufnr, desc) | ||
12 | vim.keymap.set("n", lhs, rhs, { silent = true, buffer = bufnr, desc = desc }) | ||
13 | end | ||
14 | |||
15 | M.set_leader = function(key) | ||
16 | vim.g.mapleader = key | ||
17 | vim.g.maplocalleader = key | ||
18 | M.map({ "n", "v" }, key, "<nop>") | ||
19 | end | ||
20 | |||
21 | return M | ||
diff --git a/.config/nvim/lua/stale.lua b/.config/nvim/lua/helpers/stale.lua index 0c79884..062e3cf 100644 --- a/.config/nvim/lua/stale.lua +++ b/.config/nvim/lua/helpers/stale.lua | |||
@@ -90,13 +90,13 @@ function M.setup(c) | |||
90 | '/' | 90 | '/' |
91 | 91 | ||
92 | vim.api.nvim_command('autocmd BufEnter ' .. ft .. | 92 | vim.api.nvim_command('autocmd BufEnter ' .. ft .. |
93 | ' lua require("stale").draw(0)') | 93 | ' lua require("helpers.stale").draw(0)') |
94 | vim.api.nvim_command('autocmd InsertLeave ' .. ft .. | 94 | vim.api.nvim_command('autocmd InsertLeave ' .. ft .. |
95 | ' lua require("stale").redraw(0)') | 95 | ' lua require("helpers.stale").redraw(0)') |
96 | vim.api.nvim_command('autocmd TextChanged ' .. ft .. | 96 | vim.api.nvim_command('autocmd TextChanged ' .. ft .. |
97 | ' lua require("stale").redraw(0)') | 97 | ' lua require("helpers.stale").redraw(0)') |
98 | vim.api.nvim_command('autocmd TextChangedI ' .. ft .. | 98 | vim.api.nvim_command('autocmd TextChangedI ' .. ft .. |
99 | ' lua require("stale").redraw(0)') | 99 | ' lua require("helpers.stale").redraw(0)') |
100 | 100 | ||
101 | vim.api.nvim_command('autocmd BufEnter ' .. ft .. ' syn match DueDate ' .. | 101 | vim.api.nvim_command('autocmd BufEnter ' .. ft .. ' syn match DueDate ' .. |
102 | regex_hi .. | 102 | regex_hi .. |
diff --git a/.config/nvim/lua/mappings.lua b/.config/nvim/lua/mappings.lua deleted file mode 100644 index adc68a9..0000000 --- a/.config/nvim/lua/mappings.lua +++ /dev/null | |||
@@ -1,183 +0,0 @@ | |||
1 | -- ┌────────────────────────┐ | ||
2 | -- │ ▗ │ | ||
3 | -- │▛▚▀▖▝▀▖▛▀▖▛▀▖▄ ▛▀▖▞▀▌▞▀▘│ | ||
4 | -- │▌▐ ▌▞▀▌▙▄▘▙▄▘▐ ▌ ▌▚▄▌▝▀▖│ | ||
5 | -- │▘▝ ▘▝▀▘▌ ▌ ▀▘▘ ▘▗▄▘▀▀ │ | ||
6 | -- └────────────────────────┘ | ||
7 | |||
8 | -- brute force deasciify everything | ||
9 | vim.keymap.set("n", "<leader>tc", "TurkishDeasciifyForce()", { expr = true }) | ||
10 | vim.keymap.set("n", "<leader>tctc", "TurkishDeasciifyForce() .. '_'", { expr = true }) | ||
11 | vim.keymap.set("x", "<leader>tc", "TurkishDeasciifyForce()", { expr = true }) | ||
12 | |||
13 | -- use turkish-mode to selectively deasciify | ||
14 | vim.keymap.set("n", "<Leader>tr", "TurkishDeasciify()", {expr = true}) | ||
15 | vim.keymap.set("n", "<Leader>trtr", "TurkishDeasciify() .. '_'", {expr = true}) | ||
16 | vim.keymap.set("x", "<Leader>tr", "TurkishDeasciify()", {expr = true}) | ||
17 | |||
18 | -- ascii everything | ||
19 | vim.keymap.set("n", "<Leader>rt", "TurkishAsciify()", {expr = true}) | ||
20 | vim.keymap.set("n", "<Leader>rtrt", "TurkishAsciify() .. '_'", {expr = true}) | ||
21 | vim.keymap.set("x", "<Leader>rt", "TurkishAsciify()", {expr = true}) | ||
22 | |||
23 | -- https://stackoverflow.com/questions/4256697/vim-search-and-highlight-but-do-not-jump | ||
24 | -- search & highlight but do not jump | ||
25 | vim.keymap.set("n", "*", ":keepjumps normal! mi*`i<CR>") | ||
26 | vim.keymap.set("n", "#", ":keepjumps normal! mi#`i<CR>") | ||
27 | |||
28 | -- save file as sudo on files that require root permission | ||
29 | vim.keymap.set("c", "w!!", 'execute "silent! write !sudo tee % >/dev/null" <bar> edit!<CR>', { silent = false }) | ||
30 | |||
31 | -- replace ex mode with gq (format lines) | ||
32 | vim.keymap.set('n', 'Q', 'gq') | ||
33 | |||
34 | -- set formatprg to sentences, for prose | ||
35 | vim.keymap.set('n', '<Leader>fp', ":set formatprg=~/.local/bin/sentences<CR>", { silent = false }) | ||
36 | |||
37 | -- replace all is aliased to S. | ||
38 | vim.keymap.set('n', 'S', ':%s//g<Left><Left>', { silent = false }) | ||
39 | vim.keymap.set('v', 'S', ':s//g<Left><Left>', { silent = false }) | ||
40 | |||
41 | -- jump to buffer | ||
42 | vim.keymap.set('n', '<Leader>b', ':ls<cr>:b<space>') | ||
43 | |||
44 | -- up and down are more logical with g.. | ||
45 | vim.keymap.set('n', 'k', '(v:count == 0 ? "gk" : "k")', { expr = true }) | ||
46 | vim.keymap.set('n', 'j', '(v:count == 0 ? "gj" : "j")', { expr = true }) | ||
47 | vim.keymap.set('i', '<Up>', '<Esc>gka') | ||
48 | vim.keymap.set('i', '<Down>', '<Esc>gja') | ||
49 | |||
50 | -- space used to toggle folds, now it's x (because x is d) | ||
51 | vim.keymap.set('n', '<Space>', '"_x') | ||
52 | |||
53 | -- separate cut and delete | ||
54 | vim.keymap.set('n', 'x', 'd') | ||
55 | vim.keymap.set('x', 'x', 'd') | ||
56 | vim.keymap.set('n', 'xx', 'dd') | ||
57 | vim.keymap.set('n', 'X', 'D') | ||
58 | |||
59 | -- change into pwd of current directory | ||
60 | vim.keymap.set('n', '<Leader>cd', ':lcd %:p:h<CR>:pwd<CR>') | ||
61 | |||
62 | -- call CreatePaper on word below cursor | ||
63 | vim.keymap.set('n', '<leader>np', 'gewi[[/papers/<ESC>Ea]]<ESC>bb:call CreatePaper(expand("<cword>"))<CR>') | ||
64 | |||
65 | -- link paper | ||
66 | vim.keymap.set('n', '<leader>lp', 'gewi[[/papers/<ESC>Ea]]<ESC>') | ||
67 | |||
68 | -- call CreateReference on word below cursor | ||
69 | vim.keymap.set('n', '<leader>nr', ':call CreateReference(expand("<cword>"))<CR>') | ||
70 | |||
71 | -- create a new note | ||
72 | vim.keymap.set('n', '<leader>nn', ':call CreateNote()<CR>') | ||
73 | |||
74 | -- :%% to get current file path | ||
75 | vim.keymap.set('c', '%%', "getcmdtype() == ':' ? expand('%:h').'/' : '%%'", { expr = true, silent = false }) | ||
76 | |||
77 | -- reselect visual selection after indent | ||
78 | vim.keymap.set('v', '>', '>gv') | ||
79 | vim.keymap.set('v', '<', '<gv') | ||
80 | |||
81 | -- keep cursor position after visual yank | ||
82 | vim.keymap.set('v', 'y', 'myy`y') | ||
83 | vim.keymap.set('v', 'Y', 'myY`y') | ||
84 | |||
85 | -- ` is more useful than ` | ||
86 | vim.keymap.set('n', "'", '`') | ||
87 | |||
88 | -- plug mappings {{{ -- | ||
89 | |||
90 | -- use the special yoink paste that rotates | ||
91 | vim.keymap.set('n', 'p', '<Plug>(YoinkPaste_p)') | ||
92 | vim.keymap.set('n', 'P', '<Plug>(YoinkPaste_P)') | ||
93 | |||
94 | -- substitute from yank | ||
95 | vim.keymap.set('n', '<Leader>ys', '<plug>(SubversiveSubstitute)') | ||
96 | vim.keymap.set('n', '<Leader>yss', '<plug>(SubversiveSubstituteLine)') | ||
97 | vim.keymap.set('n', '<Leader>yS', '<plug>(SubversiveSubstituteToEndOfLine)') | ||
98 | |||
99 | -- substitute over range | ||
100 | vim.keymap.set('n', '<Leader>s', '<plug>(SubversiveSubstituteRange)') | ||
101 | vim.keymap.set('x', '<Leader>s', '<plug>(SubversiveSubstituteRange)') | ||
102 | vim.keymap.set('n', '<Leader>ss', '<plug>(SubversiveSubstituteWordRange)') | ||
103 | |||
104 | -- subvert over range | ||
105 | vim.keymap.set('n', '<Leader><Leader>s', '<plug>(SubversiveSubvertRange)') | ||
106 | vim.keymap.set('x', '<Leader><Leader>s', '<plug>(SubversiveSubvertRange)') | ||
107 | vim.keymap.set('n', '<Leader><Leader>ss', '<plug>(SubversiveSubvertWordRange)') | ||
108 | |||
109 | -- iterate over yank list | ||
110 | vim.keymap.set('n', '<c-n>', '<Plug>(YoinkPostPasteSwapBack)') | ||
111 | vim.keymap.set('n', '<c-p>', '<Plug>(YoinkPostPasteSwapForward)') | ||
112 | |||
113 | -- checkmarks on vimwiki | ||
114 | vim.keymap.set('n', '<leader>v', '<Plug>VimwikiToggleListItem') | ||
115 | -- add/increase header level | ||
116 | vim.keymap.set('n', '<leader>a', '<Plug>VimwikiAddHeaderLevel') | ||
117 | |||
118 | -- vim-test bindings | ||
119 | vim.keymap.set('n', 't<C-n>', ':TestNearest<CR>') | ||
120 | vim.keymap.set('n', 't<C-f>', ':TestFile<CR>') | ||
121 | vim.keymap.set('n', 't<C-s>', ':TestSuite<CR>') | ||
122 | vim.keymap.set('n', 't<C-l>', ':TestLast<CR>') | ||
123 | vim.keymap.set('n', 't<C-g>', ':TestVisit<CR>') | ||
124 | |||
125 | -- telescope bindings | ||
126 | vim.keymap.set('n', '<leader>ff', "<cmd>lua require('telescope.builtin').find_files()<cr>") | ||
127 | vim.keymap.set('n', '<leader>fg', "<cmd>lua require('telescope.builtin').live_grep()<cr>") | ||
128 | vim.keymap.set('n', '<leader>fb', "<cmd>lua require('telescope.builtin').buffers()<cr>") | ||
129 | vim.keymap.set('n', '<leader>fh', "<cmd>lua require('telescope.builtin').help_tags()<cr>") | ||
130 | |||
131 | -- nvim tree mappings | ||
132 | vim.keymap.set('n', 'vt', ':NvimTreeToggle<CR>') | ||
133 | vim.keymap.set('n', 'vr', ':NvimTreeRefresh<CR>') | ||
134 | vim.keymap.set('n', 'vs', ':NvimTreeFindFile!<CR>') | ||
135 | |||
136 | -- dial.nvim mappings | ||
137 | local opts = { noremap=true, silent=true } | ||
138 | vim.keymap.set("n", "<C-a>", require("dial.map").inc_normal(), opts) | ||
139 | vim.keymap.set("n", "<C-x>", require("dial.map").dec_normal(), opts) | ||
140 | vim.keymap.set("v", "<C-a>", require("dial.map").inc_visual(), opts) | ||
141 | vim.keymap.set("v", "<C-x>", require("dial.map").dec_visual(), opts) | ||
142 | vim.keymap.set("v", "g<C-a>", require("dial.map").inc_gvisual(), opts) | ||
143 | vim.keymap.set("v", "g<C-x>", require("dial.map").dec_gvisual(), opts) | ||
144 | |||
145 | -- leap.nvim mappings | ||
146 | vim.keymap.set('n', '`', '<Plug>(leap-forward)', opts) | ||
147 | vim.keymap.set('n', '<Leader>`', '<Plug>(leap-backward)', opts) | ||
148 | vim.keymap.set('v', '`', '<Plug>(leap-forward)', opts) | ||
149 | vim.keymap.set('v', '<Leader>`', '<Plug>(leap-backward)', opts) | ||
150 | |||
151 | -- barbar.nvim mappings | ||
152 | local opts = { noremap = true, silent = true } | ||
153 | |||
154 | -- move to previous/next | ||
155 | vim.keymap.set('n', '<A-,>', '<Cmd>BufferPrevious<CR>', opts) | ||
156 | vim.keymap.set('n', '<A-.>', '<Cmd>BufferNext<CR>', opts) | ||
157 | -- re-order to previous/next | ||
158 | vim.keymap.set('n', '<A-e>', '<Cmd>BufferMovePrevious<CR>', opts) | ||
159 | vim.keymap.set('n', '<A-i>', '<Cmd>BufferMoveNext<CR>', opts) | ||
160 | -- goto buffer in position... | ||
161 | vim.keymap.set('n', '<A-1>', '<Cmd>BufferGoto 1<CR>', opts) | ||
162 | vim.keymap.set('n', '<A-2>', '<Cmd>BufferGoto 2<CR>', opts) | ||
163 | vim.keymap.set('n', '<A-3>', '<Cmd>BufferGoto 3<CR>', opts) | ||
164 | vim.keymap.set('n', '<A-4>', '<Cmd>BufferGoto 4<CR>', opts) | ||
165 | vim.keymap.set('n', '<A-5>', '<Cmd>BufferGoto 5<CR>', opts) | ||
166 | vim.keymap.set('n', '<A-6>', '<Cmd>BufferGoto 6<CR>', opts) | ||
167 | vim.keymap.set('n', '<A-7>', '<Cmd>BufferGoto 7<CR>', opts) | ||
168 | vim.keymap.set('n', '<A-8>', '<Cmd>BufferGoto 8<CR>', opts) | ||
169 | vim.keymap.set('n', '<A-9>', '<Cmd>BufferGoto 9<CR>', opts) | ||
170 | vim.keymap.set('n', '<A-0>', '<Cmd>BufferLast<CR>', opts) | ||
171 | -- pin/unpin buffer | ||
172 | vim.keymap.set('n', '<A-p>', '<Cmd>BufferPin<CR>', opts) | ||
173 | -- close buffer | ||
174 | vim.keymap.set('n', '<A-c>', '<Cmd>BufferClose<CR>', opts) | ||
175 | -- magic buffer-picking mode | ||
176 | vim.keymap.set('n', '<leader>dg', '<Cmd>BufferPick<CR>', opts) | ||
177 | -- sort automatically by... | ||
178 | vim.keymap.set('n', '<Leader>db', '<Cmd>BufferOrderByBufferNumber<CR>', opts) | ||
179 | vim.keymap.set('n', '<Leader>dd', '<Cmd>BufferOrderByDirectory<CR>', opts) | ||
180 | vim.keymap.set('n', '<Leader>dl', '<Cmd>BufferOrderByLanguage<CR>', opts) | ||
181 | vim.keymap.set('n', '<Leader>dw', '<Cmd>BufferOrderByWindowNumber<CR>', opts) | ||
182 | |||
183 | -- }}} plug mappings -- | ||
diff --git a/.config/nvim/lua/plugin_settings.lua b/.config/nvim/lua/plugin_settings.lua deleted file mode 100644 index 351592d..0000000 --- a/.config/nvim/lua/plugin_settings.lua +++ /dev/null | |||
@@ -1,722 +0,0 @@ | |||
1 | -- ┌─────────────────────────────────────┐ | ||
2 | -- │ ▜ ▐ ▐ ▗ │ | ||
3 | -- │▛▀▖▐ ▌ ▌▞▀▌▗▖▖▞▀▘▞▀▖▜▀ ▜▀ ▄ ▛▀▖▞▀▌▞▀▘│ | ||
4 | -- │▙▄▘▐ ▌ ▌▚▄▌▘▝ ▝▀▖▛▀ ▐ ▖▐ ▖▐ ▌ ▌▚▄▌▝▀▖│ | ||
5 | -- │▌ ▘▝▀▘▗▄▘ ▀▀ ▝▀▘ ▀ ▀ ▀▘▘ ▘▗▄▘▀▀ │ | ||
6 | -- └─────────────────────────────────────┘ | ||
7 | |||
8 | local g = vim.g -- global for let options | ||
9 | local opt = vim.opt -- convenient :set | ||
10 | local cmd = vim.cmd -- vim commands | ||
11 | |||
12 | -- vimwiki {{{ -- | ||
13 | g.vimwiki_list = { | ||
14 | { | ||
15 | path = '/home/yigit/nextcloud/personal_wiki/text', | ||
16 | path_html = '/home/yigit/nextcloud/personal_wiki/html', | ||
17 | auto_generate_tags = 1, | ||
18 | automatic_nested_syntaxes = 1, | ||
19 | template_path = '/home/yigit/nextcloud/personal_wiki/templates', | ||
20 | template_default = 'default_template', | ||
21 | template_ext = '.html', | ||
22 | auto_export = 1, | ||
23 | auto_tags = 1 | ||
24 | } | ||
25 | } | ||
26 | |||
27 | g.vimwiki_global_ext = 0 | ||
28 | g.vimwiki_hl_headers = 1 | ||
29 | -- }}} vimwiki -- | ||
30 | |||
31 | -- lualine {{{ -- | ||
32 | |||
33 | local function lualine_spell() | ||
34 | if vim.wo.spell then | ||
35 | return "spell" | ||
36 | else | ||
37 | return | ||
38 | end | ||
39 | end | ||
40 | |||
41 | local conditions = { | ||
42 | spell_on = function () | ||
43 | return vim.wo.spell | ||
44 | end, | ||
45 | filetype_is_tex = function() | ||
46 | return vim.bo.filetype == "tex" | ||
47 | end | ||
48 | } | ||
49 | |||
50 | -- https://www.reddit.com/r/neovim/comments/u2uc4p/your_lualine_custom_features/i4muvp6/ | ||
51 | -- override 'encoding': don't display if encoding is utf-8. | ||
52 | local encoding = function() | ||
53 | local ret, _ = (vim.bo.fenc).gsub("^utf%-8$", "") | ||
54 | return ret | ||
55 | end | ||
56 | |||
57 | -- fileformat: don't display if &ff is unix. | ||
58 | local fileformat = function() | ||
59 | local ret, _ = vim.bo.fileformat.gsub("^unix$", "") | ||
60 | return ret | ||
61 | end | ||
62 | |||
63 | require'lualine'.setup { | ||
64 | options = { | ||
65 | icons_enabled = true, | ||
66 | theme = "catppuccin", | ||
67 | section_separators = { left = '', right = '' }, | ||
68 | component_separators = { left = '', right = '' }, | ||
69 | }, | ||
70 | sections = { | ||
71 | lualine_a = {{'mode', fmt = string.lower}}, | ||
72 | lualine_b = {'branch', | ||
73 | { | ||
74 | 'diff', | ||
75 | diff_color= { | ||
76 | -- Same color values as the general color option can be used here. | ||
77 | added = { fg = 'LightGreen' }, | ||
78 | modified = { fg = 'LightBlue' }, -- Changes the diff's modified color | ||
79 | removed = { fg = 'LightRed' }, -- Changes the diff's removed color you | ||
80 | } | ||
81 | }, | ||
82 | { | ||
83 | lualine_spell, | ||
84 | cond = conditions.spell_on, | ||
85 | }}, | ||
86 | lualine_c = {'filename'}, | ||
87 | lualine_x = {encoding, fileformat, 'filetype'}, | ||
88 | lualine_y = {'progress'}, | ||
89 | lualine_z = { | ||
90 | 'location', { | ||
91 | 'diagnostics', | ||
92 | sources = {'nvim_diagnostic'}, | ||
93 | sections = {'error', 'warn', 'info', 'hint'}, | ||
94 | symbols = {error = 'e', warn = 'w', info = 'i', hint = 'h'} | ||
95 | } | ||
96 | } | ||
97 | }, | ||
98 | inactive_sections = { | ||
99 | lualine_a = {}, | ||
100 | lualine_b = {}, | ||
101 | lualine_c = {'filename'}, | ||
102 | lualine_x = {}, | ||
103 | lualine_y = {}, | ||
104 | lualine_z = {} | ||
105 | }, | ||
106 | tabline = {}, | ||
107 | extensions = {} | ||
108 | } | ||
109 | |||
110 | -- }}} lualine -- | ||
111 | |||
112 | -- cutlass suite {{{ -- | ||
113 | |||
114 | -- cutlass/yoink/subverse suite | ||
115 | g.yoinkIncludeDeleteOperations = 1 | ||
116 | |||
117 | -- fix the Target STRING not available | ||
118 | g.clipboard = { | ||
119 | name = 'xsel_override', | ||
120 | copy = { | ||
121 | ['+'] = 'xsel --input --clipboard', | ||
122 | ['*'] = 'xsel --input --primary', | ||
123 | }, | ||
124 | paste = { | ||
125 | ['+'] = 'xsel --output --clipboard', | ||
126 | ['*'] = 'xsel --output --primary', | ||
127 | }, | ||
128 | cache_enabled = 1, | ||
129 | } | ||
130 | |||
131 | -- }}} cutlass suite -- | ||
132 | |||
133 | -- UltiSnips {{{ -- | ||
134 | g.UltiSnipsEditSplit = "vertical" | ||
135 | -- ctrl + l expands the snippet, c + j/k navigates placeholders | ||
136 | g.UltiSnipsExpandTrigger = "<tab>" | ||
137 | g.UltiSnipsEnableSnipMate = "1" | ||
138 | g.UltiSnipsSnippetDirectories = {"my_snippets", "UltiSnips"} | ||
139 | -- }}} UltiSnips -- | ||
140 | |||
141 | -- vimtex {{{ -- | ||
142 | g.vimtex_view_method = 'zathura' | ||
143 | g.vimtex_quickfix_mode = 0 | ||
144 | g.vimtex_quickfix_ignore_filters = {"Underfull", "Overfull"} | ||
145 | |||
146 | g.vimtex_compiler_latexmk = { | ||
147 | options = { | ||
148 | "-pdf", '-shell-escape', '-verbose', '-file-line-error', '-synctex=1', '-interaction=nonstopmode' | ||
149 | } | ||
150 | } | ||
151 | |||
152 | -- }}} vimtex -- | ||
153 | |||
154 | -- devicons {{{ -- | ||
155 | require'nvim-web-devicons'.setup { | ||
156 | override = { | ||
157 | wiki = { | ||
158 | icon = "", | ||
159 | color = "#D7827E", | ||
160 | name = "vimwiki" | ||
161 | }, | ||
162 | rem = { | ||
163 | icon = "", | ||
164 | color = "#B4637A", | ||
165 | name = "remind" | ||
166 | }, | ||
167 | mail = { | ||
168 | icon = "", | ||
169 | color = "#907AA9", | ||
170 | name = "mail" | ||
171 | }, | ||
172 | }; | ||
173 | |||
174 | default = true | ||
175 | } | ||
176 | -- }}} devicons -- | ||
177 | |||
178 | -- vim-slime {{{ -- | ||
179 | g.slime_target = "tmux" | ||
180 | g.slime_paste_file = "$HOME/.slime_paste" | ||
181 | g.slime_default_config = {socket_name = vim.call("get", vim.call("split", vim.env.TMUX, ','), "0"), target_pane = "{last}"} | ||
182 | -- }}} vim-slime -- | ||
183 | |||
184 | -- gutentags {{{ -- | ||
185 | g.gutentags_enabled = 1 | ||
186 | g.gutentags_add_default_project_roots = 0 | ||
187 | g.gutentags_project_root = {'Makefile', '.git'} | ||
188 | g.gutentags_exclude_filetypes = {'gitcommit', 'gitconfig', 'gitrebase', 'gitsendemail', 'git'} | ||
189 | g.gutentags_generate_on_new = 1 | ||
190 | g.gutentags_generate_on_missing = 1 | ||
191 | g.gutentags_generate_on_write = 1 | ||
192 | g.gutentags_generate_on_empty_buffer = 0 | ||
193 | g.gutentags_ctags_exclude = { | ||
194 | '*.git', '*.svn', '*.hg', | ||
195 | 'cache', 'build', 'dist', 'bin', 'node_modules', 'bower_components', | ||
196 | '*-lock.json', '*.lock', | ||
197 | '*.min.*', | ||
198 | '*.bak', | ||
199 | '*.zip', | ||
200 | '*.pyc', | ||
201 | '*.class', | ||
202 | '*.sln', | ||
203 | '*.csproj', '*.csproj.user', | ||
204 | '*.tmp', | ||
205 | '*.cache', | ||
206 | '*.vscode', | ||
207 | '*.pdb', | ||
208 | '*.exe', '*.dll', '*.bin', | ||
209 | '*.mp3', '*.ogg', '*.flac', | ||
210 | '*.swp', '*.swo', | ||
211 | '.DS_Store', '*.plist', | ||
212 | '*.bmp', '*.gif', '*.ico', '*.jpg', '*.png', '*.svg', | ||
213 | '*.rar', '*.zip', '*.tar', '*.tar.gz', '*.tar.xz', '*.tar.bz2', | ||
214 | '*.pdf', '*.doc', '*.docx', '*.ppt', '*.pptx', '*.xls', | ||
215 | } | ||
216 | -- }}} gutentags -- | ||
217 | |||
218 | -- telescope {{{ -- | ||
219 | require('telescope').setup { | ||
220 | extensions = { | ||
221 | fzf = { | ||
222 | fuzzy = true, -- false will only do exact matching | ||
223 | override_generic_sorter = true, -- override the generic sorter | ||
224 | override_file_sorter = true, -- override the file sorter | ||
225 | case_mode = "smart_case", -- or "ignore_case" or "respect_case" | ||
226 | -- the default case_mode is "smart_case" | ||
227 | } | ||
228 | } | ||
229 | } | ||
230 | |||
231 | require('telescope').load_extension('fzf') | ||
232 | -- }}} telescope -- | ||
233 | |||
234 | -- dashboard {{{ -- | ||
235 | |||
236 | require('dashboard').setup { | ||
237 | theme = 'hyper', | ||
238 | config = { | ||
239 | week_header = { | ||
240 | enable = true, | ||
241 | }, | ||
242 | shortcut = { | ||
243 | { desc = ' Update', group = '@property', action = 'PackerSync', key = 'u' }, | ||
244 | { | ||
245 | icon = ' ', | ||
246 | icon_hl = '@variable', | ||
247 | desc = 'Files', | ||
248 | group = 'Label', | ||
249 | action = 'Telescope find_files', | ||
250 | key = 'f', | ||
251 | }, | ||
252 | }, | ||
253 | }, | ||
254 | } | ||
255 | |||
256 | -- }}} dashboard -- | ||
257 | |||
258 | -- treesitter {{{ -- | ||
259 | |||
260 | require 'nvim-treesitter.configs'.setup { | ||
261 | ensure_installed = "all", | ||
262 | auto_install = true, | ||
263 | highlight = { | ||
264 | enable = true, | ||
265 | disable = { "latex" }, | ||
266 | additional_vim_regex_highlighting = false, | ||
267 | }, | ||
268 | incremental_selection = { | ||
269 | enable = true, | ||
270 | keymaps = { | ||
271 | init_selection = "gnn", | ||
272 | node_incremental = "grn", | ||
273 | scope_incremental = "grc", | ||
274 | node_decremental = "grm", | ||
275 | }, | ||
276 | }, | ||
277 | indent = { | ||
278 | enable = true | ||
279 | } | ||
280 | } | ||
281 | -- }}} treesitter -- | ||
282 | |||
283 | -- nvim-cmp {{{ -- | ||
284 | local cmp = require'cmp' | ||
285 | |||
286 | cmp.setup({ | ||
287 | snippet = { | ||
288 | expand = function(args) | ||
289 | vim.fn["UltiSnips#Anon"](args.body) | ||
290 | end, | ||
291 | }, | ||
292 | window = { | ||
293 | completion = cmp.config.window.bordered(), | ||
294 | documentation = cmp.config.window.bordered(), | ||
295 | }, | ||
296 | mapping = cmp.mapping.preset.insert({ | ||
297 | ['<C-b>'] = cmp.mapping(cmp.mapping.scroll_docs(-4), { 'i', 'c' }), | ||
298 | ['<C-f>'] = cmp.mapping(cmp.mapping.scroll_docs(4), { 'i', 'c' }), | ||
299 | ['<C-c>'] = cmp.mapping(cmp.mapping.complete(), { 'i', 'c' }), | ||
300 | ['<C-e>'] = cmp.mapping({ | ||
301 | i = cmp.mapping.abort(), | ||
302 | c = cmp.mapping.close(), | ||
303 | }), | ||
304 | ['<C-l>'] = cmp.mapping.confirm({ select = true }), | ||
305 | }), | ||
306 | sources = cmp.config.sources({ | ||
307 | { name = 'nvim_lsp' }, | ||
308 | { name = 'ultisnips' }, | ||
309 | }, { | ||
310 | { name = 'buffer' }, | ||
311 | { name = 'path' }, | ||
312 | }) | ||
313 | }) | ||
314 | |||
315 | -- }}} nvim-cmp -- | ||
316 | |||
317 | -- nvim-lspconfig {{{ -- | ||
318 | local nvim_lsp = require('lspconfig') | ||
319 | |||
320 | -- Mappings. | ||
321 | local opts = { noremap=true, silent=true } | ||
322 | vim.keymap.set('n', '<leader>e', vim.diagnostic.open_float, opts) | ||
323 | vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, opts) | ||
324 | vim.keymap.set('n', ']d', vim.diagnostic.goto_next, opts) | ||
325 | vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, opts) | ||
326 | |||
327 | local on_attach = function(client, bufnr) | ||
328 | -- enable completion triggered by <c-x><c-o> | ||
329 | vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc') | ||
330 | |||
331 | -- see `:help vim.lsp.*` for documentation on any of the below functions | ||
332 | local bufopts = { noremap=true, silent=true, buffer=bufnr } | ||
333 | vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, bufopts) | ||
334 | vim.keymap.set('n', 'gd', vim.lsp.buf.definition, bufopts) | ||
335 | vim.keymap.set('n', 'vh', vim.lsp.buf.hover, bufopts) | ||
336 | vim.keymap.set('n', 'gh', vim.lsp.buf.implementation, bufopts) | ||
337 | vim.keymap.set('n', '<C-k>', vim.lsp.buf.signature_help, bufopts) | ||
338 | vim.keymap.set('n', '<leader>wa', vim.lsp.buf.add_workspace_folder, bufopts) | ||
339 | vim.keymap.set('n', '<leader>wr', vim.lsp.buf.remove_workspace_folder, bufopts) | ||
340 | vim.keymap.set('n', '<leader>wl', function() | ||
341 | print(vim.inspect(vim.lsp.buf.list_workspace_folders())) | ||
342 | end, bufopts) | ||
343 | vim.keymap.set('n', '<leader>D', vim.lsp.buf.type_definition, bufopts) | ||
344 | vim.keymap.set('n', '<leader>rn', vim.lsp.buf.rename, bufopts) | ||
345 | vim.keymap.set('n', '<leader>ca', vim.lsp.buf.code_action, bufopts) | ||
346 | vim.keymap.set('n', 'gr', vim.lsp.buf.references, bufopts) | ||
347 | vim.keymap.set('n', '<leader>fm', function() vim.lsp.buf.format { async = true } end, bufopts) | ||
348 | end | ||
349 | |||
350 | -- bring in cmp_nvim_lsp | ||
351 | local capabilities = require('cmp_nvim_lsp').default_capabilities() | ||
352 | |||
353 | local servers = { 'jedi_language_server', 'texlab', 'clangd', 'denols' } | ||
354 | for _, lsp in ipairs(servers) do | ||
355 | nvim_lsp[lsp].setup { | ||
356 | on_attach = on_attach, | ||
357 | capabilities = capabilities | ||
358 | } | ||
359 | end | ||
360 | |||
361 | nvim_lsp['efm'].setup { | ||
362 | on_attach = on_attach, | ||
363 | filetypes = { 'sh' }, | ||
364 | capabilities = capabilities | ||
365 | } | ||
366 | |||
367 | nvim_lsp.ltex.setup { | ||
368 | capabilities = capabilities, | ||
369 | on_attach = function(client, bufnr) | ||
370 | on_attach(client, bufnr) | ||
371 | require("ltex_extra").setup { | ||
372 | load_langs = { "en-GB" }, | ||
373 | init_check = true, | ||
374 | path = "/home/yigit/.local/share/nvim/ltex", | ||
375 | log_level = "none", | ||
376 | } | ||
377 | end, | ||
378 | settings = { | ||
379 | ltex = { | ||
380 | -- my settings here | ||
381 | } | ||
382 | } | ||
383 | } | ||
384 | |||
385 | -- rust-tools {{{ -- | ||
386 | |||
387 | -- Configure LSP through rust-tools.nvim plugin. | ||
388 | -- rust-tools will configure and enable certain LSP features for us. | ||
389 | -- See https://github.com/simrat39/rust-tools.nvim#configuration | ||
390 | local rust_opts = { | ||
391 | tools = { | ||
392 | runnables = { | ||
393 | use_telescope = true, | ||
394 | }, | ||
395 | inlay_hints = { | ||
396 | auto = true, | ||
397 | show_parameter_hints = true, | ||
398 | parameter_hints_prefix = "↸ ", | ||
399 | other_hints_prefix = "❱ ", | ||
400 | }, | ||
401 | }, | ||
402 | |||
403 | -- all the opts to send to nvim-lspconfig | ||
404 | -- these override the defaults set by rust-tools.nvim | ||
405 | -- see https://github.com/neovim/nvim-lspconfig/blob/master/CONFIG.md#rust_analyzer | ||
406 | server = { | ||
407 | -- on_attach is a callback called when the language server attachs to the buffer | ||
408 | on_attach = on_attach, | ||
409 | settings = { | ||
410 | -- to enable rust-analyzer settings visit: | ||
411 | -- https://github.com/rust-analyzer/rust-analyzer/blob/master/docs/user/generated_config.adoc | ||
412 | ["rust-analyzer"] = { | ||
413 | -- enable clippy on save | ||
414 | checkOnSave = { | ||
415 | command = "clippy", | ||
416 | }, | ||
417 | }, | ||
418 | }, | ||
419 | }, | ||
420 | } | ||
421 | |||
422 | require('rust-tools').setup(rust_opts) | ||
423 | |||
424 | -- }}} rust-tools -- | ||
425 | |||
426 | -- }}} nvim-lsp -- | ||
427 | |||
428 | -- indent-blankline {{{ -- | ||
429 | vim.opt.list = true | ||
430 | |||
431 | require("indent_blankline").setup { | ||
432 | show_current_context = true, | ||
433 | char = "┊", | ||
434 | buftype_exclude = {"terminal"}, | ||
435 | filetype_exclude = {"dashboard", "help", "man"} | ||
436 | } | ||
437 | -- }}} indent-blankline -- | ||
438 | |||
439 | -- nvim-autopairs {{{ -- | ||
440 | |||
441 | require('nvim-autopairs').setup({ | ||
442 | disable_filetype = { "TelescopePrompt" }, | ||
443 | }) | ||
444 | |||
445 | local cmp_autopairs = require('nvim-autopairs.completion.cmp') | ||
446 | local cmp = require('cmp') | ||
447 | cmp.event:on( 'confirm_done', cmp_autopairs.on_confirm_done()) | ||
448 | |||
449 | local Rule = require('nvim-autopairs.rule') | ||
450 | local npairs = require('nvim-autopairs') | ||
451 | |||
452 | npairs.add_rule(Rule('%"','%"',"remind")) | ||
453 | npairs.add_rule(Rule('/*','*/',"c")) | ||
454 | |||
455 | -- }}} nvim-autopairs -- | ||
456 | |||
457 | -- nvim-colorizer {{{ -- | ||
458 | require 'colorizer'.setup() | ||
459 | -- }}} nvim-colorizer -- | ||
460 | |||
461 | -- gitsigns.nvim {{{ -- | ||
462 | |||
463 | require('gitsigns').setup { | ||
464 | signs = { | ||
465 | add = { text = '│' }, | ||
466 | change = { text = '│' }, | ||
467 | delete = { text = '_' }, | ||
468 | topdelete = { text = '‾' }, | ||
469 | changedelete = { text = '~' }, | ||
470 | untracked = { text = '┆' }, | ||
471 | }, | ||
472 | signcolumn = true, -- Toggle with `:Gitsigns toggle_signs` | ||
473 | numhl = false, -- Toggle with `:Gitsigns toggle_numhl` | ||
474 | linehl = false, -- Toggle with `:Gitsigns toggle_linehl` | ||
475 | word_diff = false, -- Toggle with `:Gitsigns toggle_word_diff` | ||
476 | watch_gitdir = { | ||
477 | follow_files = true | ||
478 | }, | ||
479 | attach_to_untracked = true, | ||
480 | current_line_blame = false, -- Toggle with `:Gitsigns toggle_current_line_blame` | ||
481 | current_line_blame_opts = { | ||
482 | virt_text = true, | ||
483 | virt_text_pos = 'eol', -- 'eol' | 'overlay' | 'right_align' | ||
484 | delay = 1000, | ||
485 | ignore_whitespace = false, | ||
486 | }, | ||
487 | current_line_blame_formatter = '<author>, <author_time:%Y-%m-%d> - <summary>', | ||
488 | sign_priority = 6, | ||
489 | update_debounce = 100, | ||
490 | status_formatter = nil, -- Use default | ||
491 | max_file_length = 40000, -- Disable if file is longer than this (in lines) | ||
492 | preview_config = { | ||
493 | -- Options passed to nvim_open_win | ||
494 | border = 'single', | ||
495 | style = 'minimal', | ||
496 | relative = 'cursor', | ||
497 | row = 0, | ||
498 | col = 1 | ||
499 | }, | ||
500 | yadm = { | ||
501 | enable = true | ||
502 | }, | ||
503 | |||
504 | on_attach = function(bufnr) | ||
505 | local gs = package.loaded.gitsigns | ||
506 | |||
507 | local function map(mode, l, r, opts) | ||
508 | opts = opts or {} | ||
509 | opts.buffer = bufnr | ||
510 | vim.keymap.set(mode, l, r, opts) | ||
511 | end | ||
512 | |||
513 | -- Navigation | ||
514 | map('n', ']c', function() | ||
515 | if vim.wo.diff then return ']c' end | ||
516 | vim.schedule(function() gs.next_hunk() end) | ||
517 | return '<Ignore>' | ||
518 | end, {expr=true}) | ||
519 | |||
520 | map('n', '[c', function() | ||
521 | if vim.wo.diff then return '[c' end | ||
522 | vim.schedule(function() gs.prev_hunk() end) | ||
523 | return '<Ignore>' | ||
524 | end, {expr=true}) | ||
525 | |||
526 | -- Actions | ||
527 | map('n', '<leader>hs', gs.stage_hunk) | ||
528 | map('n', '<leader>hr', gs.reset_hunk) | ||
529 | map('v', '<leader>hs', function() gs.stage_hunk {vim.fn.line('.'), vim.fn.line('v')} end) | ||
530 | map('v', '<leader>hr', function() gs.reset_hunk {vim.fn.line('.'), vim.fn.line('v')} end) | ||
531 | map('n', '<leader>hS', gs.stage_buffer) | ||
532 | map('n', '<leader>hu', gs.undo_stage_hunk) | ||
533 | map('n', '<leader>hR', gs.reset_buffer) | ||
534 | map('n', '<leader>hp', gs.preview_hunk) | ||
535 | map('n', '<leader>hb', function() gs.blame_line{full=true} end) | ||
536 | map('n', '<leader>tb', gs.toggle_current_line_blame) | ||
537 | map('n', '<leader>hd', gs.diffthis) | ||
538 | map('n', '<leader>hD', function() gs.diffthis('~') end) | ||
539 | map('n', '<leader>td', gs.toggle_deleted) | ||
540 | |||
541 | -- Text object | ||
542 | map({'o', 'x'}, 'ih', ':<C-U>Gitsigns select_hunk<CR>') | ||
543 | end | ||
544 | } | ||
545 | |||
546 | -- }}} gitsigns.nvim -- | ||
547 | |||
548 | -- Comment.nvim {{{ -- | ||
549 | require('Comment').setup() | ||
550 | -- }}} Comment.nvim -- | ||
551 | |||
552 | -- catppuccin {{{ -- | ||
553 | require("catppuccin").setup({ | ||
554 | flavour = "mocha", -- latte, frappe, macchiato, mocha | ||
555 | background = { -- :h background | ||
556 | light = "latte", | ||
557 | dark = "mocha", | ||
558 | }, | ||
559 | transparent_background = false, | ||
560 | term_colors = false, | ||
561 | no_italic = true, -- force no italic | ||
562 | no_bold = false, -- force no bold | ||
563 | integrations = { | ||
564 | barbar = true, | ||
565 | cmp = true, | ||
566 | fidget = true, | ||
567 | gitsigns = true, | ||
568 | leap = true, | ||
569 | nvimtree = true, | ||
570 | telescope = true, | ||
571 | treesitter = true, | ||
572 | vimwiki = true, | ||
573 | }, | ||
574 | native_lsp = { | ||
575 | enabled = true, | ||
576 | underlines = { | ||
577 | errors = { "underline" }, | ||
578 | hints = { "underline" }, | ||
579 | warnings = { "underline" }, | ||
580 | information = { "underline" }, | ||
581 | }, | ||
582 | |||
583 | }, | ||
584 | indent_blankline = { | ||
585 | enabled = true, | ||
586 | }, | ||
587 | }) | ||
588 | |||
589 | -- setup must be called before loading | ||
590 | vim.cmd.colorscheme "catppuccin" | ||
591 | |||
592 | -- }}} catppuccin -- | ||
593 | |||
594 | -- dial.nvim {{{ -- | ||
595 | |||
596 | local augend = require("dial.augend") | ||
597 | require("dial.config").augends:register_group{ | ||
598 | -- default augends used when no group name is specified | ||
599 | default = { | ||
600 | augend.integer.alias.decimal, -- nonnegative decimal number (0, 1, 2, 3, ...) | ||
601 | augend.integer.alias.hex, -- nonnegative hex number (0x01, 0x1a1f, etc.) | ||
602 | augend.date.alias["%Y/%m/%d"], -- date (2022/02/19, etc.) | ||
603 | augend.date.alias["%Y-%m-%d"], | ||
604 | augend.semver.alias.semver, | ||
605 | augend.constant.new{ | ||
606 | elements = {"and", "or"}, | ||
607 | word = true, -- if false, "sand" is incremented into "sor", "doctor" into "doctand", etc. | ||
608 | cyclic = true, -- "or" is incremented into "and". | ||
609 | }, | ||
610 | augend.constant.new{ | ||
611 | elements = {"&&", "||"}, | ||
612 | word = false, | ||
613 | cyclic = true, | ||
614 | }, | ||
615 | }, | ||
616 | } | ||
617 | |||
618 | -- }}} dial.nvim -- | ||
619 | |||
620 | -- leap.nvim {{{ -- | ||
621 | require('leap').setup { | ||
622 | case_insensitive = true, | ||
623 | substitute_chars = { ['\r'] = '¬' } | ||
624 | } | ||
625 | |||
626 | -- }}} leap.nvim -- | ||
627 | |||
628 | -- fidget.nvim {{{ -- | ||
629 | require("fidget").setup{ | ||
630 | -- https://github.com/j-hui/fidget.nvim/blob/main/doc/fidget.md | ||
631 | text = { | ||
632 | spinner = "triangle", | ||
633 | commenced = "started", -- message shown when task starts | ||
634 | completed = "done", -- message shown when task completes | ||
635 | }, | ||
636 | } | ||
637 | -- }}} fidget.nvim -- | ||
638 | |||
639 | -- nvim-tree {{{ -- | ||
640 | |||
641 | require("nvim-tree").setup({ | ||
642 | sort_by = "case_sensitive", | ||
643 | diagnostics = { | ||
644 | enable = false, | ||
645 | icons = { | ||
646 | hint = "❔", | ||
647 | info = "❕", | ||
648 | warning = "❗", | ||
649 | error = "❌", | ||
650 | } | ||
651 | }, | ||
652 | view = { | ||
653 | adaptive_size = true, | ||
654 | }, | ||
655 | renderer = { | ||
656 | group_empty = true, | ||
657 | }, | ||
658 | filters = { | ||
659 | dotfiles = true, | ||
660 | }, | ||
661 | }) | ||
662 | |||
663 | -- }}} nvim-tree -- | ||
664 | |||
665 | -- barbar.nvim {{{ -- | ||
666 | |||
667 | vim.g.barbar_auto_setup = false -- disable auto-setup | ||
668 | |||
669 | require'barbar'.setup { | ||
670 | animation = false, | ||
671 | auto_hide = true, | ||
672 | tabpages = true, | ||
673 | closable = true, | ||
674 | clickable = false, | ||
675 | icons = { | ||
676 | diagnostics = { | ||
677 | -- `vim.diagnostic.severity` | ||
678 | [vim.diagnostic.severity.ERROR] = {enabled = true, icon = '❌'}, | ||
679 | [vim.diagnostic.severity.WARN] = {enabled = false}, | ||
680 | [vim.diagnostic.severity.INFO] = {enabled = false}, | ||
681 | [vim.diagnostic.severity.HINT] = {enabled = true}, | ||
682 | }, | ||
683 | filetype = { | ||
684 | custom_colors = false, | ||
685 | enabled = true, | ||
686 | }, | ||
687 | separator = { left = '▎', right = ''}, | ||
688 | modified = { button = '•'}, | ||
689 | pinned = { button = '車', filename = true, separator = { right = ''}}, | ||
690 | }, | ||
691 | |||
692 | insert_at_end = false, | ||
693 | insert_at_start = false, | ||
694 | |||
695 | maximum_padding = 1, | ||
696 | minimum_padding = 1, | ||
697 | maximum_length = 30, | ||
698 | semantic_letters = true, | ||
699 | letters = 'arstneoidhqwfpluy;zxcvkmARSTNEOIDHQWFPLUYZXCVKM', | ||
700 | no_name_title = nil, | ||
701 | } | ||
702 | |||
703 | local nvim_tree_events = require('nvim-tree.events') | ||
704 | local bufferline_api = require('bufferline.api') | ||
705 | |||
706 | local function get_tree_size() | ||
707 | return require'nvim-tree.view'.View.width | ||
708 | end | ||
709 | |||
710 | nvim_tree_events.subscribe('TreeOpen', function() | ||
711 | bufferline_api.set_offset(get_tree_size()) | ||
712 | end) | ||
713 | |||
714 | nvim_tree_events.subscribe('Resize', function() | ||
715 | bufferline_api.set_offset(get_tree_size()) | ||
716 | end) | ||
717 | |||
718 | nvim_tree_events.subscribe('TreeClose', function() | ||
719 | bufferline_api.set_offset(0) | ||
720 | end) | ||
721 | |||
722 | -- }}} barbar.nvim -- | ||
diff --git a/.config/nvim/lua/plugins.lua b/.config/nvim/lua/plugins.lua deleted file mode 100644 index a952ef3..0000000 --- a/.config/nvim/lua/plugins.lua +++ /dev/null | |||
@@ -1,168 +0,0 @@ | |||
1 | -- ┌───────────────────┐ | ||
2 | -- │ ▜ ▗ │ | ||
3 | -- │▛▀▖▐ ▌ ▌▞▀▌▄ ▛▀▖▞▀▘│ | ||
4 | -- │▙▄▘▐ ▌ ▌▚▄▌▐ ▌ ▌▝▀▖│ | ||
5 | -- │▌ ▘▝▀▘▗▄▘▀▘▘ ▘▀▀ │ | ||
6 | -- └───────────────────┘ | ||
7 | |||
8 | return require('packer').startup(function(use) | ||
9 | -- packer can manage itself | ||
10 | use 'wbthomason/packer.nvim' | ||
11 | |||
12 | -- improve startup time | ||
13 | -- remove when merged | ||
14 | -- https://github.com/neovim/neovim/pull/15436 | ||
15 | use 'lewis6991/impatient.nvim' | ||
16 | |||
17 | -- latex suite | ||
18 | use {'lervag/vimtex', ft = {'tex', 'latex', 'plaintext'}} | ||
19 | -- provides external ltex file handling and other functions | ||
20 | use 'barreiroleo/ltex-extra.nvim' | ||
21 | |||
22 | -- treesitter | ||
23 | use { | ||
24 | 'nvim-treesitter/nvim-treesitter', | ||
25 | run = ':TSUpdate' | ||
26 | } | ||
27 | -- quickstart lsp config | ||
28 | use 'neovim/nvim-lspconfig' | ||
29 | -- visualize lsp progress | ||
30 | use { | ||
31 | 'j-hui/fidget.nvim', | ||
32 | branch = 'legacy', | ||
33 | } | ||
34 | -- extra rust-analyzer functionality | ||
35 | use 'simrat39/rust-tools.nvim' | ||
36 | |||
37 | -- annotation generator | ||
38 | use { | ||
39 | "danymat/neogen", | ||
40 | config = function() | ||
41 | require('neogen').setup {} | ||
42 | end, | ||
43 | requires = "nvim-treesitter/nvim-treesitter", | ||
44 | } | ||
45 | |||
46 | -- dashboard | ||
47 | use { | ||
48 | 'glepnir/dashboard-nvim', | ||
49 | event = 'VimEnter', | ||
50 | requires = {'nvim-tree/nvim-web-devicons'} | ||
51 | } | ||
52 | |||
53 | -- completion suite | ||
54 | use 'hrsh7th/nvim-cmp' | ||
55 | use ({ | ||
56 | 'hrsh7th/cmp-nvim-lsp', | ||
57 | 'hrsh7th/cmp-buffer', | ||
58 | 'hrsh7th/cmp-path', | ||
59 | 'quangnguyen30192/cmp-nvim-ultisnips', | ||
60 | after = { 'hrsh7th/nvim-cmp' }, | ||
61 | requires = { 'hrsh7th/nvim-cmp' }, | ||
62 | }) | ||
63 | |||
64 | -- find, filter, preview, pick | ||
65 | use { | ||
66 | 'nvim-telescope/telescope.nvim', | ||
67 | requires = { 'nvim-lua/plenary.nvim' } | ||
68 | } | ||
69 | use {'nvim-telescope/telescope-fzf-native.nvim', run = 'make' } | ||
70 | |||
71 | -- git integration for buffers | ||
72 | use { | ||
73 | 'lewis6991/gitsigns.nvim', | ||
74 | requires = { | ||
75 | 'nvim-lua/plenary.nvim' | ||
76 | }, | ||
77 | } | ||
78 | |||
79 | -- manages tag files | ||
80 | use 'ludovicchabant/vim-gutentags' | ||
81 | -- type in file send to repl | ||
82 | use 'jpalardy/vim-slime' | ||
83 | -- snippets to expand | ||
84 | use {'SirVer/ultisnips', 'honza/vim-snippets'} | ||
85 | -- autopairs for neovim | ||
86 | use 'windwp/nvim-autopairs' | ||
87 | -- indent guides | ||
88 | use 'lukas-reineke/indent-blankline.nvim' | ||
89 | |||
90 | -- i3 config filetype | ||
91 | use 'mboughaba/i3config.vim' | ||
92 | |||
93 | -- file explorer | ||
94 | use 'kyazdani42/nvim-tree.lua' | ||
95 | |||
96 | -- undo tree | ||
97 | use { | ||
98 | 'mbbill/undotree', | ||
99 | cmd = 'UndotreeToggle', | ||
100 | config = [[vim.g.undotree_SetFocusWhenToggle = 1]], | ||
101 | } | ||
102 | |||
103 | -- highlight colors | ||
104 | use 'norcalli/nvim-colorizer.lua' | ||
105 | |||
106 | -- cutlass suite, x, d, \ys etc. | ||
107 | use { | ||
108 | 'svermeulen/vim-cutlass', | ||
109 | 'svermeulen/vim-subversive', | ||
110 | 'svermeulen/vim-yoink' | ||
111 | } | ||
112 | |||
113 | -- personal wiki | ||
114 | use 'vimwiki/vimwiki' | ||
115 | -- change ASCII text to Turkish text | ||
116 | use 'yigitsever/turkish-deasciifier.vim' | ||
117 | |||
118 | -- text alignment \w :Tab | ||
119 | use 'godlygeek/tabular' | ||
120 | -- move selections up and down with alt+[j,k] | ||
121 | use 'matze/vim-move' | ||
122 | -- surround text objects; sa, sr and sd | ||
123 | use 'machakann/vim-sandwich' | ||
124 | -- see the contents of registers on "/<CTRL-R> | ||
125 | use 'junegunn/vim-peekaboo' | ||
126 | -- use <leader>k to highlight multiple words) | ||
127 | use 'lfv89/vim-interestingwords' | ||
128 | -- swap delimited items using g>, g< | ||
129 | use 'machakann/vim-swap' | ||
130 | |||
131 | -- sneak, but in l u a | ||
132 | use 'ggandor/leap.nvim' | ||
133 | -- additional text objects, don't remove this ever again you fuck | ||
134 | use 'wellle/targets.vim' | ||
135 | -- enhanced increment/decrement plugin ala speeddating | ||
136 | use 'monaqa/dial.nvim' | ||
137 | -- comment helper | ||
138 | use 'numToStr/Comment.nvim' | ||
139 | |||
140 | -- icon pack | ||
141 | use 'nvim-tree/nvim-web-devicons' | ||
142 | -- statusline of the $CURRENT_YEAR | ||
143 | use { | ||
144 | 'nvim-lualine/lualine.nvim', | ||
145 | requires = {'nvim-tree/nvim-web-devicons', opt = true} | ||
146 | } | ||
147 | -- tabline | ||
148 | use {'romgrk/barbar.nvim', wants = 'nvim-web-devicons'} | ||
149 | -- colour theme of the $CURRENT_YEAR | ||
150 | use { "catppuccin/nvim", as = "catppuccin" } | ||
151 | |||
152 | -- search for, substitute, and abbreviate multiple variants of a word | ||
153 | use 'tpope/vim-abolish' | ||
154 | -- enable repeating supported plugin maps with '.' | ||
155 | use 'tpope/vim-repeat' | ||
156 | -- pairs of handy bracket mappings | ||
157 | use 'tpope/vim-unimpaired' | ||
158 | -- git wrapper | ||
159 | use { | ||
160 | 'tpope/vim-fugitive', cmd = {'Git', 'Gstatus', 'Gblame', 'Gpush', 'Gpull'} | ||
161 | } | ||
162 | -- provides ga, show unicode stuff of char under cursor | ||
163 | use 'tpope/vim-characterize' | ||
164 | -- asynchronous build and test dispatcher | ||
165 | use {'tpope/vim-dispatch', opt = true, cmd = {'Dispatch', 'Make', 'Focus', 'Start'}} | ||
166 | -- automatically adjust 'shiftwidth' and 'expandtab' | ||
167 | use 'tpope/vim-sleuth' | ||
168 | end) | ||
diff --git a/.config/nvim/lua/plugins/barbar.lua b/.config/nvim/lua/plugins/barbar.lua new file mode 100644 index 0000000..7b6c69d --- /dev/null +++ b/.config/nvim/lua/plugins/barbar.lua | |||
@@ -0,0 +1,77 @@ | |||
1 | return { | ||
2 | { | ||
3 | "romgrk/barbar.nvim", | ||
4 | dependencies = { | ||
5 | 'lewis6991/gitsigns.nvim', | ||
6 | "nvim-tree/nvim-web-devicons" | ||
7 | }, | ||
8 | init = function() | ||
9 | vim.g.barbar_auto_setup = false -- disable auto-setup | ||
10 | local map = require("helpers.keys").map | ||
11 | |||
12 | -- move to previous/next | ||
13 | map('n', '<A-,>', '<Cmd>BufferPrevious<CR>', "switch to previous buffer") | ||
14 | map('n', '<A-.>', '<Cmd>BufferNext<CR>', "switch to next buffer") | ||
15 | |||
16 | -- re-order to previous/next | ||
17 | map('n', '<A-e>', '<Cmd>BufferMovePrevious<CR>', "move buffer back") | ||
18 | map('n', '<A-i>', '<Cmd>BufferMoveNext<CR>', "move buffer forward") | ||
19 | |||
20 | -- goto buffer in position... | ||
21 | map('n', '<A-1>', '<Cmd>BufferGoto 1<CR>') | ||
22 | map('n', '<A-2>', '<Cmd>BufferGoto 2<CR>') | ||
23 | map('n', '<A-3>', '<Cmd>BufferGoto 3<CR>') | ||
24 | map('n', '<A-4>', '<Cmd>BufferGoto 4<CR>') | ||
25 | map('n', '<A-5>', '<Cmd>BufferGoto 5<CR>') | ||
26 | map('n', '<A-6>', '<Cmd>BufferGoto 6<CR>') | ||
27 | map('n', '<A-7>', '<Cmd>BufferGoto 7<CR>') | ||
28 | map('n', '<A-8>', '<Cmd>BufferGoto 8<CR>') | ||
29 | map('n', '<A-9>', '<Cmd>BufferGoto 9<CR>') | ||
30 | map('n', '<A-0>', '<Cmd>BufferLast<CR>') | ||
31 | |||
32 | -- pin/unpin buffer | ||
33 | map('n', '<A-p>', '<Cmd>BufferPin<CR>', "pin buffer") | ||
34 | -- close buffer | ||
35 | map('n', '<A-c>', '<Cmd>BufferClose<CR>', "close buffer") | ||
36 | -- magic buffer-picking mode | ||
37 | map('n', '<leader>dg', '<Cmd>BufferPick<CR>', "buffer picking mode") | ||
38 | -- sort automatically by... | ||
39 | map('n', '<Leader>db', '<Cmd>BufferOrderByBufferNumber<CR>', "sort buffers by number") | ||
40 | map('n', '<Leader>dd', '<Cmd>BufferOrderByDirectory<CR>', "sort buffers by directory") | ||
41 | map('n', '<Leader>dl', '<Cmd>BufferOrderByLanguage<CR>', "sort buffers by language") | ||
42 | map('n', '<Leader>dw', '<Cmd>BufferOrderByWindowNumber<CR>', "sort buffers by window number") | ||
43 | end, | ||
44 | opts = { | ||
45 | animation = false, | ||
46 | auto_hide = true, | ||
47 | tabpages = true, | ||
48 | closable = true, | ||
49 | clickable = false, | ||
50 | icons = { | ||
51 | diagnostics = { | ||
52 | [vim.diagnostic.severity.ERROR] = {enabled = true, icon = '❌'}, | ||
53 | [vim.diagnostic.severity.WARN] = {enabled = false}, | ||
54 | [vim.diagnostic.severity.INFO] = {enabled = false}, | ||
55 | [vim.diagnostic.severity.HINT] = {enabled = true}, | ||
56 | }, | ||
57 | filetype = { | ||
58 | custom_colors = false, | ||
59 | enabled = true, | ||
60 | }, | ||
61 | separator = { left = '▎', right = ''}, | ||
62 | modified = { button = ''}, | ||
63 | pinned = { button = '', filename = true, separator = { right = ''}}, | ||
64 | }, | ||
65 | |||
66 | insert_at_end = false, | ||
67 | insert_at_start = false, | ||
68 | |||
69 | maximum_padding = 1, | ||
70 | minimum_padding = 1, | ||
71 | maximum_length = 30, | ||
72 | semantic_letters = true, | ||
73 | letters = 'arstneoidhqwfpluy;zxcvkmARSTNEOIDHQWFPLUYZXCVKM', | ||
74 | no_name_title = nil, | ||
75 | }, | ||
76 | }, | ||
77 | } | ||
diff --git a/.config/nvim/lua/plugins/cmp.lua b/.config/nvim/lua/plugins/cmp.lua new file mode 100644 index 0000000..78ff9a9 --- /dev/null +++ b/.config/nvim/lua/plugins/cmp.lua | |||
@@ -0,0 +1,114 @@ | |||
1 | -- autocompletion | ||
2 | return { | ||
3 | { | ||
4 | "hrsh7th/nvim-cmp", | ||
5 | event = "InsertEnter", | ||
6 | dependencies = { | ||
7 | "hrsh7th/cmp-nvim-lsp", | ||
8 | "hrsh7th/cmp-nvim-lua", | ||
9 | "hrsh7th/cmp-buffer", | ||
10 | "hrsh7th/cmp-path", | ||
11 | "L3MON4D3/LuaSnip", | ||
12 | "saadparwaiz1/cmp_luasnip", | ||
13 | "rafamadriz/friendly-snippets", | ||
14 | }, | ||
15 | config = function() | ||
16 | local cmp = require("cmp") | ||
17 | local luasnip = require("luasnip") | ||
18 | |||
19 | require("luasnip/loaders/from_vscode").lazy_load() | ||
20 | |||
21 | local kind_icons = { | ||
22 | Text = "", | ||
23 | Method = "m", | ||
24 | Function = "", | ||
25 | Constructor = "", | ||
26 | Field = "", | ||
27 | Variable = "", | ||
28 | Class = "", | ||
29 | Interface = "", | ||
30 | Module = "", | ||
31 | Property = "", | ||
32 | Unit = "", | ||
33 | Value = "", | ||
34 | Enum = "", | ||
35 | Keyword = "", | ||
36 | Snippet = "", | ||
37 | Color = "", | ||
38 | File = "", | ||
39 | Reference = "", | ||
40 | Folder = "", | ||
41 | EnumMember = "", | ||
42 | Constant = "", | ||
43 | Struct = "", | ||
44 | Event = "", | ||
45 | Operator = "", | ||
46 | TypeParameter = "", | ||
47 | } | ||
48 | |||
49 | cmp.setup({ | ||
50 | enabled = true, | ||
51 | snippet = { | ||
52 | expand = function(args) | ||
53 | luasnip.lsp_expand(args.body) | ||
54 | end, | ||
55 | }, | ||
56 | mapping = cmp.mapping.preset.insert({ | ||
57 | ["<C-k>"] = cmp.mapping.select_prev_item(), | ||
58 | ["<C-j>"] = cmp.mapping.select_next_item(), | ||
59 | ["<C-d>"] = cmp.mapping.scroll_docs(-4), | ||
60 | ["<C-f>"] = cmp.mapping.scroll_docs(4), | ||
61 | ["<CR>"] = cmp.mapping.confirm({ | ||
62 | behavior = cmp.ConfirmBehavior.Replace, | ||
63 | select = false, | ||
64 | }), | ||
65 | ["<Tab>"] = cmp.mapping(function(fallback) | ||
66 | if cmp.visible() then | ||
67 | cmp.select_next_item() | ||
68 | elseif luasnip.expand_or_jumpable() then | ||
69 | luasnip.expand_or_jump() | ||
70 | else | ||
71 | fallback() | ||
72 | end | ||
73 | end, { "i", "s" }), | ||
74 | ["<S-Tab>"] = cmp.mapping(function(fallback) | ||
75 | if cmp.visible() then | ||
76 | cmp.select_prev_item() | ||
77 | elseif luasnip.jumpable(-1) then | ||
78 | luasnip.jump(-1) | ||
79 | else | ||
80 | fallback() | ||
81 | end | ||
82 | end, { "i", "s" }), | ||
83 | }), | ||
84 | formatting = { | ||
85 | fields = { "kind", "abbr", "menu" }, | ||
86 | format = function(entry, vim_item) | ||
87 | -- kind icons | ||
88 | vim_item.kind = string.format("%s", kind_icons[vim_item.kind]) | ||
89 | vim_item.menu = ({ | ||
90 | nvim_lsp = "[lsp]", | ||
91 | luasnip = "[snippet]", | ||
92 | buffer = "[buffer]", | ||
93 | path = "[path]", | ||
94 | })[entry.source.name] | ||
95 | return vim_item | ||
96 | end, | ||
97 | }, | ||
98 | sources = { | ||
99 | { name = "nvim_lsp" }, | ||
100 | { name = "luasnip" }, | ||
101 | { name = "buffer" }, | ||
102 | { name = "path" }, | ||
103 | }, | ||
104 | }) | ||
105 | |||
106 | -- If you want insert `(` after select function or method item | ||
107 | local cmp_autopairs = require('nvim-autopairs.completion.cmp') | ||
108 | cmp.event:on( | ||
109 | 'confirm_done', | ||
110 | cmp_autopairs.on_confirm_done() | ||
111 | ) | ||
112 | end, | ||
113 | }, | ||
114 | } | ||
diff --git a/.config/nvim/lua/plugins/colorscheme.lua b/.config/nvim/lua/plugins/colorscheme.lua new file mode 100644 index 0000000..969d304 --- /dev/null +++ b/.config/nvim/lua/plugins/colorscheme.lua | |||
@@ -0,0 +1,45 @@ | |||
1 | return { | ||
2 | { | ||
3 | "catppuccin/nvim", | ||
4 | name = "catppuccin", | ||
5 | lazy = false, | ||
6 | priority = 1000, | ||
7 | config = function() | ||
8 | require("catppuccin").setup({ | ||
9 | flavour = "mocha", -- latte, frappe, macchiato, mocha | ||
10 | background = { | ||
11 | light = "latte", | ||
12 | dark = "mocha", | ||
13 | }, | ||
14 | transparent_background = false, | ||
15 | term_colors = false, | ||
16 | no_italic = true, -- force no italic | ||
17 | no_bold = false, -- force no bold | ||
18 | integrations = { | ||
19 | barbar = true, | ||
20 | cmp = true, | ||
21 | fidget = true, | ||
22 | gitsigns = true, | ||
23 | leap = true, | ||
24 | nvimtree = true, | ||
25 | telescope = true, | ||
26 | treesitter = true, | ||
27 | vimwiki = true, | ||
28 | }, | ||
29 | native_lsp = { | ||
30 | enabled = true, | ||
31 | underlines = { | ||
32 | errors = { "underline" }, | ||
33 | hints = { "underline" }, | ||
34 | warnings = { "underline" }, | ||
35 | information = { "underline" }, | ||
36 | }, | ||
37 | }, | ||
38 | indent_blankline = { | ||
39 | enabled = true, | ||
40 | }, | ||
41 | }) | ||
42 | vim.cmd("colorscheme catppuccin") | ||
43 | end, | ||
44 | }, | ||
45 | } | ||
diff --git a/.config/nvim/lua/plugins/cutlass.lua b/.config/nvim/lua/plugins/cutlass.lua new file mode 100644 index 0000000..0b8ef52 --- /dev/null +++ b/.config/nvim/lua/plugins/cutlass.lua | |||
@@ -0,0 +1,51 @@ | |||
1 | return { | ||
2 | { | ||
3 | 'svermeulen/vim-cutlass', | ||
4 | }, | ||
5 | { | ||
6 | 'svermeulen/vim-subversive', | ||
7 | config = function() | ||
8 | local map = require("helpers.keys").map | ||
9 | |||
10 | -- substitute from yank | ||
11 | map('n', '<Leader>ys', '<plug>(SubversiveSubstitute)', "substitute from yank") | ||
12 | map('n', '<Leader>yss', '<plug>(SubversiveSubstituteLine)', "substitute from yank, line") | ||
13 | map('n', '<Leader>yS', '<plug>(SubversiveSubstituteToEndOfLine)', "substitute from yank, eol") | ||
14 | |||
15 | -- substitute over range | ||
16 | map( { 'n', 'x' }, '<Leader>s', '<plug>(SubversiveSubstituteRange)', "start substitude over range") | ||
17 | map('n', '<Leader>ss', '<plug>(SubversiveSubstituteWordRange)', "start substitude over range") | ||
18 | end | ||
19 | }, | ||
20 | { | ||
21 | 'svermeulen/vim-yoink', | ||
22 | config = function() | ||
23 | vim.g.yoinkIncludeDeleteOperations = 1 | ||
24 | |||
25 | -- fix the Target STRING not available | ||
26 | vim.g.clipboard = { | ||
27 | name = 'xsel_override', | ||
28 | copy = { | ||
29 | ['+'] = 'xsel --input --clipboard', | ||
30 | ['*'] = 'xsel --input --primary', | ||
31 | }, | ||
32 | paste = { | ||
33 | ['+'] = 'xsel --output --clipboard', | ||
34 | ['*'] = 'xsel --output --primary', | ||
35 | }, | ||
36 | cache_enabled = 1, | ||
37 | } | ||
38 | |||
39 | local map = require("helpers.keys").map | ||
40 | |||
41 | -- yoink paste | ||
42 | map('n', 'p', '<Plug>(YoinkPaste_p)') | ||
43 | map('n', 'P', '<Plug>(YoinkPaste_P)') | ||
44 | |||
45 | -- iterate over yank list | ||
46 | map('n', '<c-n>', '<Plug>(YoinkPostPasteSwapBack)') | ||
47 | map('n', '<c-p>', '<Plug>(YoinkPostPasteSwapForward)') | ||
48 | |||
49 | end, | ||
50 | } | ||
51 | } | ||
diff --git a/.config/nvim/lua/plugins/dashboard.lua b/.config/nvim/lua/plugins/dashboard.lua new file mode 100644 index 0000000..074d3f5 --- /dev/null +++ b/.config/nvim/lua/plugins/dashboard.lua | |||
@@ -0,0 +1,36 @@ | |||
1 | return { | ||
2 | { | ||
3 | 'glepnir/dashboard-nvim', | ||
4 | event = 'VimEnter', | ||
5 | config = function() | ||
6 | require('dashboard').setup { | ||
7 | theme = 'hyper', | ||
8 | change_to_vcs_root = true, | ||
9 | config = { | ||
10 | week_header = { | ||
11 | enable = true, | ||
12 | }, | ||
13 | shortcut = { | ||
14 | { | ||
15 | desc = ' Update', group = '@property', action = 'Lazy update', key = 'u', | ||
16 | }, | ||
17 | { | ||
18 | icon = ' ', | ||
19 | icon_hl = '@variable', | ||
20 | desc = 'Files', | ||
21 | group = 'Label', | ||
22 | action = 'Telescope find_files', | ||
23 | key = 'f', | ||
24 | }, | ||
25 | }, | ||
26 | }, | ||
27 | |||
28 | } | ||
29 | end, | ||
30 | dependencies = { | ||
31 | { | ||
32 | 'nvim-tree/nvim-web-devicons' | ||
33 | } | ||
34 | } | ||
35 | } | ||
36 | } | ||
diff --git a/.config/nvim/lua/plugins/devicons.lua b/.config/nvim/lua/plugins/devicons.lua new file mode 100644 index 0000000..712ecc6 --- /dev/null +++ b/.config/nvim/lua/plugins/devicons.lua | |||
@@ -0,0 +1,25 @@ | |||
1 | return { | ||
2 | { | ||
3 | "nvim-tree/nvim-web-devicons", | ||
4 | opts = { | ||
5 | override = { | ||
6 | wiki = { | ||
7 | icon = "", | ||
8 | color = "#D7827E", | ||
9 | name = "vimwiki" | ||
10 | }, | ||
11 | rem = { | ||
12 | icon = " ", | ||
13 | color = "#B4637A", | ||
14 | name = "remind" | ||
15 | }, | ||
16 | mail = { | ||
17 | icon = " ", | ||
18 | color = "#907AA9", | ||
19 | name = "mail" | ||
20 | }, | ||
21 | }, | ||
22 | default = true | ||
23 | }, | ||
24 | }, | ||
25 | } | ||
diff --git a/.config/nvim/lua/plugins/git.lua b/.config/nvim/lua/plugins/git.lua new file mode 100644 index 0000000..0e4d7f5 --- /dev/null +++ b/.config/nvim/lua/plugins/git.lua | |||
@@ -0,0 +1,95 @@ | |||
1 | return { | ||
2 | { | ||
3 | "lewis6991/gitsigns.nvim", | ||
4 | opts = { | ||
5 | signs = { | ||
6 | add = { text = '│' }, | ||
7 | change = { text = '│' }, | ||
8 | delete = { text = '_' }, | ||
9 | topdelete = { text = '‾' }, | ||
10 | changedelete = { text = '~' }, | ||
11 | untracked = { text = '┆' }, | ||
12 | }, | ||
13 | signcolumn = true, -- Toggle with `:Gitsigns toggle_signs` | ||
14 | numhl = false, -- Toggle with `:Gitsigns toggle_numhl` | ||
15 | linehl = false, -- Toggle with `:Gitsigns toggle_linehl` | ||
16 | word_diff = false, -- Toggle with `:Gitsigns toggle_word_diff` | ||
17 | watch_gitdir = { | ||
18 | follow_files = true | ||
19 | }, | ||
20 | attach_to_untracked = true, | ||
21 | current_line_blame = false, -- Toggle with `:Gitsigns toggle_current_line_blame` | ||
22 | current_line_blame_opts = { | ||
23 | virt_text = true, | ||
24 | virt_text_pos = 'eol', -- 'eol' | 'overlay' | 'right_align' | ||
25 | delay = 1000, | ||
26 | ignore_whitespace = false, | ||
27 | }, | ||
28 | current_line_blame_formatter = '<author>, <author_time:%Y-%m-%d> - <summary>', | ||
29 | sign_priority = 6, | ||
30 | update_debounce = 100, | ||
31 | status_formatter = nil, -- Use default | ||
32 | max_file_length = 40000, -- Disable if file is longer than this (in lines) | ||
33 | preview_config = { | ||
34 | -- Options passed to nvim_open_win | ||
35 | border = 'single', | ||
36 | style = 'minimal', | ||
37 | relative = 'cursor', | ||
38 | row = 0, | ||
39 | col = 1 | ||
40 | }, | ||
41 | yadm = { | ||
42 | enable = true | ||
43 | }, | ||
44 | |||
45 | on_attach = function(bufnr) | ||
46 | local gs = package.loaded.gitsigns | ||
47 | |||
48 | local function map(mode, l, r, desc, opts) | ||
49 | opts = opts or {} | ||
50 | opts.buffer = bufnr | ||
51 | opts.desc = desc | ||
52 | vim.keymap.set(mode, l, r, opts) | ||
53 | end | ||
54 | |||
55 | -- navigation | ||
56 | map('n', ']c', function() | ||
57 | if vim.wo.diff then return ']c' end | ||
58 | vim.schedule(function() gs.next_hunk() end) | ||
59 | return '<Ignore>' | ||
60 | end, "jump to next hunk", { expr = true }) | ||
61 | |||
62 | map('n', '[c', function() | ||
63 | if vim.wo.diff then return '[c' end | ||
64 | vim.schedule(function() gs.prev_hunk() end) | ||
65 | return '<Ignore>' | ||
66 | end, "jump to previous hunk", { expr = true }) | ||
67 | |||
68 | -- Actions | ||
69 | map('n', '<leader>hs', gs.stage_hunk, "stage hunk") | ||
70 | map('n', '<leader>hr', gs.reset_hunk, "reset hunk") | ||
71 | map('v', '<leader>hs', function() gs.stage_hunk { vim.fn.line('.'), vim.fn.line('v') } end, | ||
72 | "stage selection") | ||
73 | map('v', '<leader>hr', function() gs.reset_hunk { vim.fn.line('.'), vim.fn.line('v') } end, | ||
74 | "reset selection") | ||
75 | map('n', '<leader>hS', gs.stage_buffer, "stage buffer") | ||
76 | map('n', '<leader>hu', gs.undo_stage_hunk, "undo stage hunk") | ||
77 | map('n', '<leader>hR', gs.reset_buffer, "undo reset buffer") | ||
78 | map('n', '<leader>hp', gs.preview_hunk, "preview hunk") | ||
79 | map('n', '<leader>hb', function() gs.blame_line { full = true } end, "blame line") | ||
80 | map('n', '<leader>tb', gs.toggle_current_line_blame, "toggle current line blame") | ||
81 | map('n', '<leader>hd', gs.diffthis, "diff this") | ||
82 | map('n', '<leader>hD', function() gs.diffthis('~') end, "diff whole buffer") | ||
83 | map('n', '<leader>td', gs.toggle_deleted, "toggle deleted") | ||
84 | |||
85 | -- Text object | ||
86 | map({ 'o', 'x' }, 'ih', ':<C-U>Gitsigns select_hunk<CR>', "select hunk") | ||
87 | end | ||
88 | |||
89 | }, | ||
90 | }, | ||
91 | { | ||
92 | "tpope/vim-fugitive", | ||
93 | cmd = { 'Git', 'Gstatus', 'Gblame', 'Gpush', 'Gpull' }, | ||
94 | }, | ||
95 | } | ||
diff --git a/.config/nvim/lua/plugins/indent-blankline.lua b/.config/nvim/lua/plugins/indent-blankline.lua new file mode 100644 index 0000000..42e5c62 --- /dev/null +++ b/.config/nvim/lua/plugins/indent-blankline.lua | |||
@@ -0,0 +1,14 @@ | |||
1 | return { | ||
2 | { | ||
3 | "lukas-reineke/indent-blankline.nvim", | ||
4 | init = function() | ||
5 | vim.opt.list = true | ||
6 | end, | ||
7 | config = { | ||
8 | show_current_context = true, | ||
9 | char = "┊", | ||
10 | buftype_exclude = {"terminal"}, | ||
11 | filetype_exclude = {"dashboard", "help", "man"} | ||
12 | }, | ||
13 | }, | ||
14 | } | ||
diff --git a/.config/nvim/lua/plugins/latex.lua b/.config/nvim/lua/plugins/latex.lua new file mode 100644 index 0000000..8582c6f --- /dev/null +++ b/.config/nvim/lua/plugins/latex.lua | |||
@@ -0,0 +1,16 @@ | |||
1 | return { | ||
2 | { | ||
3 | "lervag/vimtex", | ||
4 | ft = { 'tex', 'latex', 'plaintext' }, | ||
5 | init = function() | ||
6 | vim.g.vimtex_view_method = 'zathura' | ||
7 | vim.g.vimtex_quickfix_mode = 0 | ||
8 | vim.g.vimtex_quickfix_ignore_filters = {"Underfull", "Overfull"} | ||
9 | vim.g.vimtex_compiler_latexmk = { | ||
10 | options = { | ||
11 | "-pdf", '-shell-escape', '-verbose', '-file-line-error', '-synctex=1', '-interaction=nonstopmode' | ||
12 | } | ||
13 | } | ||
14 | end, | ||
15 | }, | ||
16 | } | ||
diff --git a/.config/nvim/lua/plugins/lsp.lua b/.config/nvim/lua/plugins/lsp.lua new file mode 100644 index 0000000..d03d9af --- /dev/null +++ b/.config/nvim/lua/plugins/lsp.lua | |||
@@ -0,0 +1,236 @@ | |||
1 | return { | ||
2 | { | ||
3 | "neovim/nvim-lspconfig", | ||
4 | dependencies = { | ||
5 | "williamboman/mason.nvim", | ||
6 | "williamboman/mason-lspconfig.nvim", | ||
7 | "j-hui/fidget.nvim", | ||
8 | "folke/neodev.nvim", | ||
9 | "RRethy/vim-illuminate", | ||
10 | "hrsh7th/cmp-nvim-lsp", | ||
11 | }, | ||
12 | config = function() | ||
13 | local map = require("helpers.keys").map | ||
14 | |||
15 | map('n', '<leader>e', vim.diagnostic.open_float, "lsp: open diagnostics float") | ||
16 | map('n', '[d', vim.diagnostic.goto_prev, "lsp: goto previous diagnostic") | ||
17 | map('n', ']d', vim.diagnostic.goto_next, "lsp: goto next diagnostic") | ||
18 | |||
19 | -- set up mason before anything else | ||
20 | require("mason").setup() | ||
21 | require("mason-lspconfig").setup({ | ||
22 | ensure_installed = { | ||
23 | "lua_ls", | ||
24 | "pylsp", | ||
25 | }, | ||
26 | automatic_installation = true, | ||
27 | }) | ||
28 | |||
29 | -- quick access via keymap | ||
30 | require("helpers.keys").map("n", "<leader>M", "<cmd>Mason<cr>", "show mason") | ||
31 | |||
32 | -- neodev setup before lsp config | ||
33 | require("neodev").setup() | ||
34 | |||
35 | -- set up cool signs for diagnostics | ||
36 | local signs = { Error = " ", Warn = "", Hint = "", Info = "" } | ||
37 | for type, icon in pairs(signs) do | ||
38 | local hl = "DiagnosticSign" .. type | ||
39 | vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = "" }) | ||
40 | end | ||
41 | |||
42 | -- Diagnostic config | ||
43 | local config = { | ||
44 | virtual_text = false, | ||
45 | signs = { | ||
46 | active = signs, | ||
47 | }, | ||
48 | update_in_insert = true, | ||
49 | underline = true, | ||
50 | severity_sort = true, | ||
51 | float = { | ||
52 | focusable = true, | ||
53 | style = "minimal", | ||
54 | border = "rounded", | ||
55 | source = "always", | ||
56 | header = "", | ||
57 | prefix = "", | ||
58 | }, | ||
59 | } | ||
60 | vim.diagnostic.config(config) | ||
61 | |||
62 | -- this function gets run when an lsp connects to a particular buffer. | ||
63 | local on_attach = function(client, bufnr) | ||
64 | map = require("helpers.keys").lsp_map | ||
65 | |||
66 | map("<leader>lr", vim.lsp.buf.rename, bufnr, "lsp: rename symbol") | ||
67 | map("<leader>la", vim.lsp.buf.code_action, bufnr, "lsp: code action") | ||
68 | map("<leader>ld", vim.lsp.buf.type_definition, bufnr, "lsp: type definition") | ||
69 | map("<leader>ls", require("telescope.builtin").lsp_document_symbols, bufnr, "lsp: document symbols") | ||
70 | |||
71 | map("gd", vim.lsp.buf.definition, bufnr, "lsp: goto definition") | ||
72 | map("gD", vim.lsp.buf.declaration, bufnr, "lsp: goto declaration") | ||
73 | map("gr", require("telescope.builtin").lsp_references, bufnr, "lsp: goto references") | ||
74 | map("gI", vim.lsp.buf.implementation, bufnr, "lsp: goto implementation") | ||
75 | map("K", vim.lsp.buf.hover, bufnr, "lsp: hover documentation") | ||
76 | map("<c-k>", vim.lsp.buf.signature_help, bufnr, "lsp: signature help") | ||
77 | |||
78 | -- Create a command `:Format` local to the LSP buffer | ||
79 | vim.api.nvim_buf_create_user_command(bufnr, "Format", function(_) | ||
80 | vim.lsp.buf.format() | ||
81 | end, { desc = "lsp: format current buffer" }) | ||
82 | |||
83 | map("<leader>fm", "<cmd>Format<cr>", bufnr, "lsp: format current buffer") | ||
84 | |||
85 | -- Attach and configure vim-illuminate | ||
86 | -- apparently this is deprecated | ||
87 | -- https://github.com/RRethy/vim-illuminate/issues/111 | ||
88 | require("illuminate").on_attach(client) | ||
89 | end | ||
90 | |||
91 | -- nvim-cmp supports additional completion capabilities, so broadcast that to servers | ||
92 | local capabilities = vim.lsp.protocol.make_client_capabilities() | ||
93 | capabilities = require("cmp_nvim_lsp").default_capabilities(capabilities) | ||
94 | |||
95 | -- lua | ||
96 | require("lspconfig")["lua_ls"].setup({ | ||
97 | on_attach = on_attach, | ||
98 | capabilities = capabilities, | ||
99 | settings = { | ||
100 | Lua = { | ||
101 | completion = { | ||
102 | callSnippet = "Replace", | ||
103 | }, | ||
104 | diagnostics = { | ||
105 | globals = { "vim" }, | ||
106 | }, | ||
107 | workspace = { | ||
108 | library = { | ||
109 | [vim.fn.expand("$VIMRUNTIME/lua")] = true, | ||
110 | [vim.fn.stdpath("config") .. "/lua"] = true, | ||
111 | }, | ||
112 | }, | ||
113 | }, | ||
114 | }, | ||
115 | }) | ||
116 | |||
117 | -- python | ||
118 | require("lspconfig")["pylsp"].setup({ | ||
119 | on_attach = on_attach, | ||
120 | capabilities = capabilities, | ||
121 | settings = { | ||
122 | pylsp = { | ||
123 | plugins = { | ||
124 | flake8 = { | ||
125 | enabled = true, | ||
126 | maxLineLength = 88, -- black's line length | ||
127 | }, | ||
128 | -- disable plugins overlapping with flake8 | ||
129 | pycodestyle = { | ||
130 | enabled = false, | ||
131 | }, | ||
132 | mccabe = { | ||
133 | enabled = false, | ||
134 | }, | ||
135 | pyflakes = { | ||
136 | enabled = false, | ||
137 | }, | ||
138 | -- use black as the formatter | ||
139 | autopep8 = { | ||
140 | enabled = false, | ||
141 | }, | ||
142 | }, | ||
143 | }, | ||
144 | }, | ||
145 | }) | ||
146 | |||
147 | -- efm | ||
148 | require("lspconfig")["efm"].setup({ | ||
149 | on_attach = on_attach, | ||
150 | filetypes = { 'sh' }, | ||
151 | capabilities = capabilities | ||
152 | }) | ||
153 | |||
154 | -- ltex | ||
155 | require("lspconfig")["ltex"].setup({ | ||
156 | capabilities = capabilities, | ||
157 | on_attach = function(client, bufnr) | ||
158 | on_attach(client, bufnr) | ||
159 | require("ltex_extra").setup { | ||
160 | load_langs = { "en-GB" }, | ||
161 | init_check = true, | ||
162 | log_level = "none", | ||
163 | } | ||
164 | end, | ||
165 | settings = { | ||
166 | ltex = { | ||
167 | -- my settings here | ||
168 | } | ||
169 | } | ||
170 | }) | ||
171 | |||
172 | -- rust-tools | ||
173 | local rust_opts = { | ||
174 | tools = { | ||
175 | runnables = { | ||
176 | use_telescope = true, | ||
177 | }, | ||
178 | inlay_hints = { | ||
179 | auto = true, | ||
180 | show_parameter_hints = true, | ||
181 | parameter_hints_prefix = "↸ ", | ||
182 | other_hints_prefix = "❱ ", | ||
183 | }, | ||
184 | }, | ||
185 | |||
186 | -- all the opts to send to nvim-lspconfig | ||
187 | -- these override the defaults set by rust-tools.nvim | ||
188 | -- see https://github.com/neovim/nvim-lspconfig/blob/master/CONFIG.md#rust_analyzer | ||
189 | server = { | ||
190 | on_attach = on_attach, | ||
191 | settings = { | ||
192 | -- to enable rust-analyzer settings visit: | ||
193 | -- https://github.com/rust-analyzer/rust-analyzer/blob/master/docs/user/generated_config.adoc | ||
194 | ["rust-analyzer"] = { | ||
195 | -- enable clippy on save | ||
196 | checkOnSave = { | ||
197 | command = "clippy", | ||
198 | }, | ||
199 | }, | ||
200 | }, | ||
201 | }, | ||
202 | } | ||
203 | |||
204 | require('rust-tools').setup(rust_opts) | ||
205 | end, | ||
206 | }, | ||
207 | { | ||
208 | "barreiroleo/ltex-extra.nvim", | ||
209 | event = "LspAttach", | ||
210 | }, | ||
211 | { | ||
212 | "j-hui/fidget.nvim", | ||
213 | tag = "legacy", | ||
214 | event = "LspAttach", | ||
215 | opts = { | ||
216 | text = { | ||
217 | spinner = "triangle", | ||
218 | commenced = "started", -- message shown when task starts | ||
219 | completed = "done", -- message shown when task completes | ||
220 | }, | ||
221 | }, | ||
222 | }, | ||
223 | { | ||
224 | "simrat39/rust-tools.nvim", | ||
225 | event = "LspAttach", | ||
226 | }, | ||
227 | -- { | ||
228 | -- "RRethy/vim-illuminate", | ||
229 | -- opts = { | ||
230 | -- filetypes_denylist = { | ||
231 | -- 'NvimTree', | ||
232 | -- 'fugitive', | ||
233 | -- }, | ||
234 | -- }, | ||
235 | -- }, | ||
236 | } | ||
diff --git a/.config/nvim/lua/plugins/lualine.lua b/.config/nvim/lua/plugins/lualine.lua new file mode 100644 index 0000000..c528b69 --- /dev/null +++ b/.config/nvim/lua/plugins/lualine.lua | |||
@@ -0,0 +1,84 @@ | |||
1 | return { | ||
2 | "nvim-lualine/lualine.nvim", | ||
3 | dependencies = { | ||
4 | "nvim-tree/nvim-web-devicons" | ||
5 | }, | ||
6 | config = function() | ||
7 | local function lualine_spell() | ||
8 | if vim.wo.spell then | ||
9 | return "spell" | ||
10 | else | ||
11 | return | ||
12 | end | ||
13 | end | ||
14 | |||
15 | local conditions = { | ||
16 | spell_on = function () | ||
17 | return vim.wo.spell | ||
18 | end, | ||
19 | filetype_is_tex = function() | ||
20 | return vim.bo.filetype == "tex" | ||
21 | end | ||
22 | } | ||
23 | |||
24 | -- https://www.reddit.com/r/neovim/comments/u2uc4p/your_lualine_custom_features/i4muvp6/ | ||
25 | -- override 'encoding': don't display if encoding is utf-8. | ||
26 | local encoding = function() | ||
27 | local ret, _ = vim.bo.fenc:gsub("^utf%-8$", "") | ||
28 | return ret | ||
29 | end | ||
30 | |||
31 | -- fileformat: don't display if &ff is unix. | ||
32 | local fileformat = function() | ||
33 | local ret, _ = vim.bo.fileformat:gsub("^unix$", "") | ||
34 | return ret | ||
35 | end | ||
36 | |||
37 | require("lualine").setup({ | ||
38 | options = { | ||
39 | icons_enabled = true, | ||
40 | theme = "catppuccin", | ||
41 | section_separators = { left = '', right = '' }, | ||
42 | component_separators = { left = '', right = '' }, | ||
43 | }, | ||
44 | sections = { | ||
45 | lualine_a = {{'mode', fmt = string.lower}}, | ||
46 | lualine_b = {'branch', | ||
47 | { | ||
48 | 'diff', | ||
49 | diff_color= { | ||
50 | added = { fg = 'LightGreen' }, | ||
51 | modified = { fg = 'LightBlue' }, | ||
52 | removed = { fg = 'LightRed' }, | ||
53 | } | ||
54 | }, | ||
55 | { | ||
56 | lualine_spell, | ||
57 | cond = conditions.spell_on, | ||
58 | }}, | ||
59 | lualine_c = {'filename'}, | ||
60 | lualine_x = {encoding, fileformat, 'filetype'}, | ||
61 | lualine_y = {'progress'}, | ||
62 | lualine_z = { | ||
63 | 'location', { | ||
64 | 'diagnostics', | ||
65 | sources = {'nvim_diagnostic'}, | ||
66 | sections = {'error', 'warn', 'info', 'hint'}, | ||
67 | symbols = {error = 'e', warn = 'w', info = 'i', hint = 'h'} | ||
68 | } | ||
69 | } | ||
70 | }, | ||
71 | inactive_sections = { | ||
72 | lualine_a = {}, | ||
73 | lualine_b = {}, | ||
74 | lualine_c = {'filename'}, | ||
75 | lualine_x = {}, | ||
76 | lualine_y = {}, | ||
77 | lualine_z = {} | ||
78 | }, | ||
79 | tabline = {}, | ||
80 | extensions = {} | ||
81 | |||
82 | }) | ||
83 | end, | ||
84 | } | ||
diff --git a/.config/nvim/lua/plugins/misc.lua b/.config/nvim/lua/plugins/misc.lua new file mode 100644 index 0000000..f99051e --- /dev/null +++ b/.config/nvim/lua/plugins/misc.lua | |||
@@ -0,0 +1,83 @@ | |||
1 | return { | ||
2 | { | ||
3 | "numToStr/Comment.nvim", | ||
4 | lazy = false, | ||
5 | opts = {}, | ||
6 | }, | ||
7 | { | ||
8 | "godlygeek/tabular", | ||
9 | lazy = false, | ||
10 | }, | ||
11 | { | ||
12 | "matze/vim-move" | ||
13 | }, | ||
14 | { | ||
15 | "ggandor/leap.nvim", | ||
16 | lazy = false, | ||
17 | init = function() | ||
18 | local map = require("helpers.keys").map | ||
19 | |||
20 | map({ "n", "v" }, '`', '<Plug>(leap-forward)', "leap forward") | ||
21 | map({ "n", "v" }, '<Leader>`', '<Plug>(leap-backward)', "leap backward") | ||
22 | end, | ||
23 | opts = { | ||
24 | case_insensitive = true, | ||
25 | substitute_chars = { ['\r'] = '¬' } | ||
26 | } | ||
27 | }, | ||
28 | { | ||
29 | "wellle/targets.vim" | ||
30 | }, | ||
31 | { | ||
32 | "monaqa/dial.nvim", | ||
33 | init = function() | ||
34 | local augend = require("dial.augend") | ||
35 | require("dial.config").augends:register_group { | ||
36 | -- default augends used when no group name is specified | ||
37 | default = { | ||
38 | augend.integer.alias.decimal, -- nonnegative decimal number (0, 1, 2, 3, ...) | ||
39 | augend.integer.alias.hex, -- nonnegative hex number (0x01, 0x1a1f, etc.) | ||
40 | augend.date.alias["%Y/%m/%d"], -- date (2022/02/19, etc.) | ||
41 | augend.date.alias["%Y-%m-%d"], | ||
42 | augend.semver.alias.semver, | ||
43 | augend.constant.new { | ||
44 | elements = { "and", "or" }, | ||
45 | word = true, -- if false, "sand" is incremented into "sor", "doctor" into "doctand", etc. | ||
46 | cyclic = true, -- "or" is incremented into "and". | ||
47 | }, | ||
48 | augend.constant.new { | ||
49 | elements = { "&&", "||" }, | ||
50 | word = false, | ||
51 | cyclic = true, | ||
52 | }, | ||
53 | }, | ||
54 | } | ||
55 | local map = require("helpers.keys").map | ||
56 | map("n", "<C-a>", require("dial.map").inc_normal(), "dial: increment") | ||
57 | map("n", "<C-x>", require("dial.map").dec_normal(), "dial: decrement") | ||
58 | map("v", "<C-a>", require("dial.map").inc_visual(), "dial: visual increment") | ||
59 | map("v", "<C-x>", require("dial.map").dec_visual(), "dial: visual decrement") | ||
60 | end, | ||
61 | }, | ||
62 | { | ||
63 | "kylechui/nvim-surround", | ||
64 | version = "*", -- Use for stability; omit to use `main` branch for the latest features | ||
65 | event = "VeryLazy", | ||
66 | config = function() | ||
67 | require("nvim-surround").setup({}) | ||
68 | end | ||
69 | }, | ||
70 | { | ||
71 | "windwp/nvim-autopairs", | ||
72 | event = "InsertEnter", | ||
73 | opts = { | ||
74 | disable_filetype = { "TelescopePrompt" }, | ||
75 | }, | ||
76 | init = function() | ||
77 | local Rule = require('nvim-autopairs.rule') | ||
78 | local npairs = require('nvim-autopairs') | ||
79 | |||
80 | npairs.add_rule(Rule('%"', '%"', "remind")) | ||
81 | end | ||
82 | }, | ||
83 | } | ||
diff --git a/.config/nvim/lua/plugins/nvim-tree.lua b/.config/nvim/lua/plugins/nvim-tree.lua new file mode 100644 index 0000000..a2d4532 --- /dev/null +++ b/.config/nvim/lua/plugins/nvim-tree.lua | |||
@@ -0,0 +1,40 @@ | |||
1 | return { | ||
2 | { | ||
3 | "nvim-tree/nvim-tree.lua", | ||
4 | lazy = false, | ||
5 | dependencies = { | ||
6 | "nvim-tree/nvim-web-devicons", | ||
7 | }, | ||
8 | opts = { | ||
9 | sort_by = "case_sensitive", | ||
10 | diagnostics = { | ||
11 | enable = false, | ||
12 | icons = { | ||
13 | hint = "❔", | ||
14 | info = "❕", | ||
15 | warning = "❗", | ||
16 | error = "❌", | ||
17 | } | ||
18 | }, | ||
19 | view = { | ||
20 | adaptive_size = true, | ||
21 | }, | ||
22 | renderer = { | ||
23 | group_empty = true, | ||
24 | }, | ||
25 | filters = { | ||
26 | dotfiles = true, | ||
27 | }, | ||
28 | }, | ||
29 | init = function() | ||
30 | vim.g.loaded_netrw = 1 | ||
31 | vim.g.loaded_netrwPlugin = 1 | ||
32 | |||
33 | local map = require("helpers.keys").map | ||
34 | |||
35 | map("n", "vt", "<cmd>NvimTreeToggle<cr>") | ||
36 | map("n", "vr", "<cmd>NvimTreeRefresh<cr>") | ||
37 | map("n", "vs", "<cmd>NvimTreeFindFile<cr>") | ||
38 | end, | ||
39 | }, | ||
40 | } | ||
diff --git a/.config/nvim/lua/plugins/telescope.lua b/.config/nvim/lua/plugins/telescope.lua new file mode 100644 index 0000000..ecea32b --- /dev/null +++ b/.config/nvim/lua/plugins/telescope.lua | |||
@@ -0,0 +1,45 @@ | |||
1 | return { | ||
2 | { | ||
3 | "nvim-telescope/telescope.nvim", | ||
4 | dependencies = { | ||
5 | "nvim-lua/plenary.nvim", | ||
6 | { | ||
7 | "nvim-telescope/telescope-fzf-native.nvim", | ||
8 | build = "make", | ||
9 | cond = vim.fn.executable("make") == 1 | ||
10 | }, | ||
11 | }, | ||
12 | config = function() | ||
13 | require('telescope').setup({ | ||
14 | extensions = { | ||
15 | fzf = { | ||
16 | fuzzy = true, -- false will only do exact matching | ||
17 | override_generic_sorter = true, | ||
18 | override_file_sorter = true, | ||
19 | case_mode = "smart_case", | ||
20 | } | ||
21 | } | ||
22 | }) | ||
23 | -- Enable telescope fzf native, if installed | ||
24 | pcall(require("telescope").load_extension, "fzf") | ||
25 | |||
26 | local map = require("helpers.keys").map | ||
27 | |||
28 | map("n", "<leader>fr", require("telescope.builtin").oldfiles, "recently opened") | ||
29 | map("n", "<leader><space>", require("telescope.builtin").buffers, "open buffers") | ||
30 | map("n", "<leader>/", function() | ||
31 | -- You can pass additional configuration to telescope to change theme, layout, etc. | ||
32 | require("telescope.builtin").current_buffer_fuzzy_find(require("telescope.themes").get_dropdown({ | ||
33 | winblend = 10, | ||
34 | previewer = false, | ||
35 | })) | ||
36 | end, "search in current buffer") | ||
37 | |||
38 | map("n", "<leader>sf", require("telescope.builtin").find_files, "files") | ||
39 | map("n", "<leader>sh", require("telescope.builtin").help_tags, "help") | ||
40 | map("n", "<leader>sw", require("telescope.builtin").grep_string, "current word") | ||
41 | map("n", "<leader>sg", require("telescope.builtin").live_grep, "grep") | ||
42 | map("n", "<leader>sd", require("telescope.builtin").diagnostics, "diagnostics") | ||
43 | end, | ||
44 | }, | ||
45 | } | ||
diff --git a/.config/nvim/lua/plugins/tpope.lua b/.config/nvim/lua/plugins/tpope.lua new file mode 100644 index 0000000..5396303 --- /dev/null +++ b/.config/nvim/lua/plugins/tpope.lua | |||
@@ -0,0 +1,11 @@ | |||
1 | return { | ||
2 | { | ||
3 | "tpope/vim-repeat" | ||
4 | }, | ||
5 | { | ||
6 | "tpope/vim-unimpaired" | ||
7 | }, | ||
8 | { | ||
9 | "tpope/vim-characterize" | ||
10 | }, | ||
11 | } | ||
diff --git a/.config/nvim/lua/plugins/treesitter.lua b/.config/nvim/lua/plugins/treesitter.lua new file mode 100644 index 0000000..c454b48 --- /dev/null +++ b/.config/nvim/lua/plugins/treesitter.lua | |||
@@ -0,0 +1,73 @@ | |||
1 | return { | ||
2 | { | ||
3 | "nvim-treesitter/nvim-treesitter", | ||
4 | build = function() | ||
5 | pcall(require("nvim-treesitter.install").update({ with_sync = true })) | ||
6 | end, | ||
7 | dependencies = { | ||
8 | "nvim-treesitter/nvim-treesitter-textobjects", | ||
9 | }, | ||
10 | config = function() | ||
11 | require("nvim-treesitter.configs").setup({ | ||
12 | ensure_installed = { "bash", "bibtex", "c", "cpp", "css", "fish", "http", "latex", "lua", "python", "rust", "vim" }, | ||
13 | ignore_install = { }, | ||
14 | auto_install = true, | ||
15 | sync_install = false, | ||
16 | highlight = { | ||
17 | enable = true, | ||
18 | disable = { "latex" }, | ||
19 | additional_vim_regex_highlighting = false, | ||
20 | }, | ||
21 | indent = { | ||
22 | enable = true, | ||
23 | disable = { "python" } | ||
24 | }, | ||
25 | incremental_selection = { | ||
26 | enable = true, | ||
27 | keymaps = { | ||
28 | init_selection = "gnn", | ||
29 | node_incremental = "grn", | ||
30 | scope_incremental = "grc", | ||
31 | node_decremental = "grm", | ||
32 | }, | ||
33 | }, | ||
34 | textobjects = { | ||
35 | select = { | ||
36 | enable = true, | ||
37 | lookahead = true, -- automatically jump forward to textobj, similar to targets.vim | ||
38 | keymaps = { | ||
39 | -- you can use the capture groups defined in textobjects.scm | ||
40 | ["aa"] = "@parameter.outer", | ||
41 | ["ia"] = "@parameter.inner", | ||
42 | ["af"] = "@function.outer", | ||
43 | ["if"] = "@function.inner", | ||
44 | ["ac"] = "@class.outer", | ||
45 | ["ic"] = "@class.inner", | ||
46 | }, | ||
47 | }, | ||
48 | move = { | ||
49 | enable = true, | ||
50 | set_jumps = true, -- whether to set jumps in the jumplist | ||
51 | goto_next_start = { | ||
52 | ["]m"] = "@function.outer", | ||
53 | ["]]"] = "@class.outer", | ||
54 | }, | ||
55 | goto_next_end = { | ||
56 | ["]M"] = "@function.outer", | ||
57 | ["]["] = "@class.outer", | ||
58 | }, | ||
59 | goto_previous_start = { | ||
60 | ["[m"] = "@function.outer", | ||
61 | ["[["] = "@class.outer", | ||
62 | }, | ||
63 | goto_previous_end = { | ||
64 | ["[M"] = "@function.outer", | ||
65 | ["[]"] = "@class.outer", | ||
66 | }, | ||
67 | }, | ||
68 | }, | ||
69 | modules = { }, | ||
70 | }) | ||
71 | end, | ||
72 | }, | ||
73 | } | ||
diff --git a/.config/nvim/lua/plugins/trouble.lua b/.config/nvim/lua/plugins/trouble.lua new file mode 100644 index 0000000..6d72bd9 --- /dev/null +++ b/.config/nvim/lua/plugins/trouble.lua | |||
@@ -0,0 +1,14 @@ | |||
1 | return { | ||
2 | "folke/trouble.nvim", | ||
3 | dependencies = { "nvim-tree/nvim-web-devicons" }, | ||
4 | opts = {}, | ||
5 | config = function() | ||
6 | local map = require("helpers.keys").map | ||
7 | map("n", "<leader>xx", function() require("trouble").open() end, "trouble: open") | ||
8 | map("n", "<leader>xw", function() require("trouble").open("workspace_diagnostics") end, "trouble: open workspace diagnostics") | ||
9 | map("n", "<leader>xd", function() require("trouble").open("document_diagnostics") end, "trouble: open document diagnostics") | ||
10 | map("n", "<leader>xq", function() require("trouble").open("quickfix") end, "trouble: open quickfix") | ||
11 | map("n", "<leader>xl", function() require("trouble").open("loclist") end, "trouble: open loclist") | ||
12 | map("n", "gR", function() require("trouble").open("lsp_references") end, "trouble: open lsp references") | ||
13 | end, | ||
14 | } | ||
diff --git a/.config/nvim/lua/plugins/turkish-deasciifier.lua b/.config/nvim/lua/plugins/turkish-deasciifier.lua new file mode 100644 index 0000000..c39a35d --- /dev/null +++ b/.config/nvim/lua/plugins/turkish-deasciifier.lua | |||
@@ -0,0 +1,24 @@ | |||
1 | return { | ||
2 | { | ||
3 | "yigitsever/turkish-deasciifier.vim", | ||
4 | init = function() | ||
5 | local map = require("helpers.keys").map | ||
6 | |||
7 | -- brute force deasciify everything | ||
8 | map({ "n", "x" }, "<leader>tc", "TurkishDeasciifyForce()", "force turkish characters", | ||
9 | { expr = true }) | ||
10 | map("n", "<leader>tctc", "TurkishDeasciifyForce() .. '_'", "force turkish characters eol", | ||
11 | { expr = true }) | ||
12 | |||
13 | -- use turkish-mode to selectively deasciify | ||
14 | map({ "n", "x" }, "<Leader>tr", "TurkishDeasciify()", "infer turkish characters", { expr = true }) | ||
15 | map("n", "<Leader>trtr", "TurkishDeasciify() .. '_'", "infer turkish characters eol", | ||
16 | { expr = true }) | ||
17 | |||
18 | -- ascii everything | ||
19 | map({ "n", "x" }, "<Leader>rt", "TurkishAsciify()", "remove turkish characters", { expr = true }) | ||
20 | map("n", "<Leader>rtrt", "TurkishAsciify() .. '_'", "remove turkish characters eol", | ||
21 | { expr = true }) | ||
22 | end, | ||
23 | } | ||
24 | } | ||
diff --git a/.config/nvim/lua/plugins/vimwiki.lua b/.config/nvim/lua/plugins/vimwiki.lua new file mode 100644 index 0000000..11d4c2b --- /dev/null +++ b/.config/nvim/lua/plugins/vimwiki.lua | |||
@@ -0,0 +1,28 @@ | |||
1 | return { | ||
2 | { | ||
3 | "vimwiki/vimwiki", | ||
4 | init = function () | ||
5 | vim.g.vimwiki_list = { | ||
6 | { | ||
7 | path = '/home/yigit/nextcloud/personal_wiki/text', | ||
8 | path_html = '/home/yigit/nextcloud/personal_wiki/html', | ||
9 | auto_generate_tags = 1, | ||
10 | automatic_nested_syntaxes = 1, | ||
11 | template_path = '/home/yigit/nextcloud/personal_wiki/templates', | ||
12 | template_default = 'default_template', | ||
13 | template_ext = '.html', | ||
14 | auto_export = 1, | ||
15 | auto_tags = 1 | ||
16 | } | ||
17 | } | ||
18 | vim.g.vimwiki_hl_headers = 1 | ||
19 | |||
20 | local map = require("helpers.keys").map | ||
21 | |||
22 | --toggle checkmarks | ||
23 | map('n', '<leader>v', '<Plug>VimwikiToggleListItem', "vimwiki: toggle checkmark") | ||
24 | -- add/increase header level | ||
25 | map('n', '<leader>a', '<Plug>VimwikiAddHeaderLevel', "vimwiki: add header level") | ||
26 | end, | ||
27 | }, | ||
28 | } | ||
diff --git a/.config/nvim/lua/plugins/which-key.lua b/.config/nvim/lua/plugins/which-key.lua new file mode 100644 index 0000000..21048b9 --- /dev/null +++ b/.config/nvim/lua/plugins/which-key.lua | |||
@@ -0,0 +1,14 @@ | |||
1 | return { | ||
2 | { | ||
3 | "folke/which-key.nvim", | ||
4 | event = "VeryLazy", | ||
5 | init = function() | ||
6 | vim.o.timeout = true | ||
7 | vim.o.timeoutlen = 500 | ||
8 | end, | ||
9 | config = function() | ||
10 | local wk = require("which-key") | ||
11 | wk.setup() | ||
12 | end, | ||
13 | } | ||
14 | } | ||
diff --git a/.config/nvim/lua/settings.lua b/.config/nvim/lua/settings.lua deleted file mode 100644 index 27ad40d..0000000 --- a/.config/nvim/lua/settings.lua +++ /dev/null | |||
@@ -1,101 +0,0 @@ | |||
1 | -- ┌───────────────────────┐ | ||
2 | -- │ ▐ ▐ ▗ │ | ||
3 | -- │▞▀▘▞▀▖▜▀ ▜▀ ▄ ▛▀▖▞▀▌▞▀▘│ | ||
4 | -- │▝▀▖▛▀ ▐ ▖▐ ▖▐ ▌ ▌▚▄▌▝▀▖│ | ||
5 | -- │▀▀ ▝▀▘ ▀ ▀ ▀▘▘ ▘▗▄▘▀▀ │ | ||
6 | -- └───────────────────────┘ | ||
7 | |||
8 | local o = vim.o -- [o]ptions | ||
9 | local wo = vim.wo -- [w]indow-local [o]ptions | ||
10 | local bo = vim.bo -- [b]uffer-local [o]ptions | ||
11 | local go = vim.go -- [g]lobal [o]ptions | ||
12 | local opt = vim.opt -- convenient :set | ||
13 | |||
14 | -- neovim filetype lua | ||
15 | go.do_filetype_lua = true | ||
16 | go.did_load_filetypes = false | ||
17 | |||
18 | -- look & feel | ||
19 | o.termguicolors = true | ||
20 | |||
21 | -- interact with system clipboard | ||
22 | opt.clipboard:append('unnamedplus') | ||
23 | |||
24 | -- copy indent on a new line | ||
25 | o.autoindent = true | ||
26 | |||
27 | -- :h tabstop, 2. point | ||
28 | -- use appropriate number of spaces to insert a <Tab> | ||
29 | o.expandtab = true | ||
30 | o.shiftwidth = 4 | ||
31 | o.softtabstop = 4 | ||
32 | o.tabstop = 8 | ||
33 | |||
34 | -- use english for spellchecking, but don't spellcheck by default | ||
35 | wo.spell = true | ||
36 | bo.spelllang = "en_gb" | ||
37 | wo.spell = false | ||
38 | |||
39 | -- tab completion, zsh style | ||
40 | o.wildmode = "longest:full,full" | ||
41 | opt.wildignore = { | ||
42 | '*.o', '*.obj', '*.class', '*.aux', '*.lof', '*.log', '*.lot', '*.fls', | ||
43 | '*.toc', '*.fmt', '*.fot', '*.cb', '*.cb2', '.*.lb', '.dvi', '*.xdv', | ||
44 | '*.bbl', '*.bcf', '*.blg', '*-blx.aux', '*-blx.bib', '*.run.xml', | ||
45 | '*.fdb_latexmk', '*.synctex', '*.synctex(busy)', '*.synctex.gz', | ||
46 | '*.synctex.gz(busy)', '*.pdfsync' | ||
47 | } | ||
48 | |||
49 | -- put one space while joining (not two) | ||
50 | o.joinspaces = false | ||
51 | |||
52 | -- keep n lines above/below cursor while scrolling | ||
53 | o.scrolloff = 4 | ||
54 | -- line numbers | ||
55 | o.number = true | ||
56 | -- fold manually, when I place markers | ||
57 | o.foldmethod = "marker" | ||
58 | -- set the terminal title | ||
59 | o.title = true | ||
60 | -- wrap using 'breakat' character | ||
61 | o.linebreak = true | ||
62 | -- new split panes will split to below and right | ||
63 | o.splitbelow = true | ||
64 | o.splitright = true | ||
65 | -- highlight the current line, yoc undoes | ||
66 | o.cursorline = true | ||
67 | -- current line actual number, rest are relative | ||
68 | o.relativenumber = true | ||
69 | -- we are already using a cursorline, don't clobber linter messages | ||
70 | o.showmode = false | ||
71 | -- jump to the matching bracket briefly | ||
72 | o.showmatch = true | ||
73 | -- wait 500 ms for a mapped sequence to complete | ||
74 | o.timeoutlen = 500 | ||
75 | |||
76 | -- persistent undo | ||
77 | o.undofile = true | ||
78 | |||
79 | -- lower case searches ignore case, upper case searches do not | ||
80 | o.ignorecase = true | ||
81 | o.smartcase = true | ||
82 | |||
83 | -- https://stackoverflow.com/a/3445040/ | ||
84 | -- switch case labels | ||
85 | o.cinoptions = "l1" | ||
86 | |||
87 | if vim.fn.executable("rg") then | ||
88 | o.grepprg = "rg --vimgrep --no-heading --smart-case" | ||
89 | o.grepformat = "%f:%l:%c:%m,%f:%l:%m" | ||
90 | end | ||
91 | |||
92 | -- iwhite: ignore changes in amount of white space. | ||
93 | -- vertical: start diff mode with vertical splits | ||
94 | -- filler: show filler lines, | ||
95 | opt.diffopt = { | ||
96 | "iwhite", "vertical", "filler", "algorithm:patience", "indent-heuristic" | ||
97 | } | ||
98 | |||
99 | -- menu: use a popup menu to show the possible completions | ||
100 | -- preview: show extra information | ||
101 | opt.completeopt = {"menu", "menuone", "noselect"} | ||