summaryrefslogtreecommitdiffstats
path: root/.config/nvim/lua
diff options
context:
space:
mode:
Diffstat (limited to '.config/nvim/lua')
-rw-r--r--.config/nvim/lua/mappings.lua131
-rw-r--r--.config/nvim/lua/plugin_settings.lua126
-rw-r--r--.config/nvim/lua/plugins.lua136
-rw-r--r--.config/nvim/lua/settings.lua103
4 files changed, 496 insertions, 0 deletions
diff --git a/.config/nvim/lua/mappings.lua b/.config/nvim/lua/mappings.lua
new file mode 100644
index 0000000..fe59a99
--- /dev/null
+++ b/.config/nvim/lua/mappings.lua
@@ -0,0 +1,131 @@
1-- ┌──────────────────┐
2-- │ ▗ │
3-- │▛▀▖▞▀▖▞▀▖▌ ▌▄ ▛▚▀▖│
4-- │▌ ▌▛▀ ▌ ▌▐▐ ▐ ▌▐ ▌│
5-- │▘ ▘▝▀▘▝▀ ▘ ▀▘▘▝ ▘│
6-- └──────────────────┘
7-- ┌────────────────────────┐
8-- │ ▗ │
9-- │▛▚▀▖▝▀▖▛▀▖▛▀▖▄ ▛▀▖▞▀▌▞▀▘│
10-- │▌▐ ▌▞▀▌▙▄▘▙▄▘▐ ▌ ▌▚▄▌▝▀▖│
11-- │▘▝ ▘▝▀▘▌ ▌ ▀▘▘ ▘▗▄▘▀▀ │
12-- └────────────────────────┘
13
14-- map helper
15local function map(mode, lhs, rhs, opts)
16 local options = {noremap = true, silent = true}
17 if opts then options = vim.tbl_extend('force', options, opts) end
18 vim.api.nvim_set_keymap(mode, lhs, rhs, options)
19end
20
21-- local map = vim.api.nvim_set_keymap
22local cmd = vim.cmd
23local M = {}
24
25-- brute force deasciify everything
26map('n', '<Leader>tc', 'TurkishDeasciifyForce()', {expr = true})
27map('x', '<Leader>tc', 'TurkishDeasciifyForce()', {expr = true})
28map('n', '<Leader>tctc', "TurkishDeasciifyForce() .. '_'", {expr = true})
29
30-- use turkish-mode to selectively deasciify
31map('n', '<Leader>tr', 'TurkishDeasciify()', {expr = true})
32map('x', '<Leader>tr', 'TurkishDeasciify()', {expr = true})
33map('n', '<Leader>trtr', "TurkishDeasciify() .. '_'", {expr = true})
34
35-- ascii everything
36map('n', '<Leader>rt', 'TurkishAsciify()', {expr = true})
37map('x', '<Leader>rt', 'TurkishAsciify()', {expr = true})
38map('n', '<Leader>rtrt', "TurkishAsciify() .. '_'", {expr = true})
39
40-- https://stackoverflow.com/questions/4256697/vim-search-and-highlight-but-do-not-jump
41-- search & highlight but do not jump
42map('n', '*', ':keepjumps normal! mi*`i<CR>')
43map('n', '#', ':keepjumps normal! mi#`i<CR> ')
44
45-- Save file as sudo on files that require root permission
46map('c', 'w!!', 'execute "silent! write !sudo tee % >/dev/null" <bar> edit!')
47
48-- replace ex mode with gq (format lines)
49map('n', 'Q', 'gq')
50
51-- set formatprg to sentences, for prose
52map('n', '<Leader>fp', ":set formatprg=~/.local/bin/sentences<CR>")
53
54-- Replace all is aliased to S.
55map('n', 'S', ':%s//g<Left><Left>')
56
57-- If you like "Y" to work from the cursor to the end of line (which is more
58-- logical, but not Vi-compatible)
59map('n', 'Y', 'y$')
60
61-- jump to buffer
62map('n', '<Leader>b', ':ls<cr>:b<space>')
63
64-- Up and down are more logical with g..
65map('n', 'k', 'gk')
66map('n', 'j', 'gj')
67map('i', '<Up>', '<Esc>gka')
68map('i', '<Down>', '<Esc>gja')
69
70-- Disable highlight when <leader><cr> is pressed
71map('n', '<Leader><Cr>', ':noh<Cr>')
72-- Space used to toggle folds, now it's x (because x is d)
73map('n', '<Space>', '"_x')
74
75-- separate cut and delete
76map('n', 'x', 'd')
77map('x', 'x', 'd')
78map('n', 'xx', 'dd')
79map('n', 'X', 'D')
80
81-- change into pwd of current directory
82map('n', '<Leader>cd', ':cd %:p:h<CR>:pwd<CR>')
83
84-- press \g and start writing prose
85map('n', '<Leader>g', ':Goyo<CR>')
86
87-- plug mappings {{{1 --
88
89-- <Plug> mappings should not be noremap
90-- https://www.reddit.com/r/vim/comments/78izt4/please_help_understand_how_to_use_plug_mapping/
91local function plugmap(mode, lhs, rhs, opts)
92 local options = {noremap = false, silent = true}
93 if opts then options = vim.tbl_extend('force', options, opts) end
94 vim.api.nvim_set_keymap(mode, lhs, rhs, options)
95end
96
97-- sneak using grave, s is for sandwich
98plugmap('n', '`', '<Plug>Sneak_s')
99plugmap('n', '`', '<Plug>Sneak_s')
100plugmap('n', '<Leader>`', '<Plug>Sneak_S')
101plugmap('n', "'", '`')
102
103-- use the special yoink paste that rotates
104plugmap('n', 'p', '<Plug>(YoinkPaste_p)')
105plugmap('n', 'P', '<Plug>(YoinkPaste_P)')
106
107-- substitute from yank
108plugmap('n', '<Leader>ys', '<plug>(SubversiveSubstitute)')
109plugmap('n', '<Leader>yss', '<plug>(SubversiveSubstituteLine)')
110plugmap('n', '<Leader>yS', '<plug>(SubversiveSubstituteToEndOfLine)')
111
112-- substitute over range
113plugmap('n', '<Leader>s', '<plug>(SubversiveSubstituteRange)')
114plugmap('x', '<Leader>s', '<plug>(SubversiveSubstituteRange)')
115plugmap('n', '<Leader>ss', '<plug>(SubversiveSubstituteWordRange)')
116
117-- subvert over range
118plugmap('n', '<Leader><Leader>s', '<plug>(SubversiveSubvertRange)')
119plugmap('x', '<Leader><Leader>s', '<plug>(SubversiveSubvertRange)')
120plugmap('n', '<Leader><Leader>ss', '<plug>(SubversiveSubvertWordRange)')
121
122-- iterate over yank list
123plugmap('n', '<c-n>', '<Plug>(YoinkPostPasteSwapBack)')
124plugmap('n', '<c-p>', '<Plug>(YoinkPostPasteSwapForward)')
125
126-- insert mode completion
127plugmap('i', '<c-x><c-k>', '<plug>(fzf-complete-word)')
128plugmap('i', '<c-x><c-f>', '<plug>(fzf-complete-path)')
129plugmap('i', '<c-x><c-l>', '<plug>(fzf-complete-line)')
130
131-- 1}}} --
diff --git a/.config/nvim/lua/plugin_settings.lua b/.config/nvim/lua/plugin_settings.lua
new file mode 100644
index 0000000..6de7ebd
--- /dev/null
+++ b/.config/nvim/lua/plugin_settings.lua
@@ -0,0 +1,126 @@
1-- ┌──────────────────┐
2-- │ ▗ │
3-- │▛▀▖▞▀▖▞▀▖▌ ▌▄ ▛▚▀▖│
4-- │▌ ▌▛▀ ▌ ▌▐▐ ▐ ▌▐ ▌│
5-- │▘ ▘▝▀▘▝▀ ▘ ▀▘▘▝ ▘│
6-- └──────────────────┘
7-- ┌─────────────────────────────────────┐
8-- │ ▜ ▐ ▐ ▗ │
9-- │▛▀▖▐ ▌ ▌▞▀▌▗▖▖▞▀▘▞▀▖▜▀ ▜▀ ▄ ▛▀▖▞▀▌▞▀▘│
10-- │▙▄▘▐ ▌ ▌▚▄▌▘▝ ▝▀▖▛▀ ▐ ▖▐ ▖▐ ▌ ▌▚▄▌▝▀▖│
11-- │▌ ▘▝▀▘▗▄▘ ▀▀ ▝▀▘ ▀ ▀ ▀▘▘ ▘▗▄▘▀▀ │
12-- └─────────────────────────────────────┘
13
14local g = vim.g -- global for let options
15local opt = vim.opt -- convenient :set
16local cmd = vim.cmd -- vim commands
17
18-- vimwiki {{{ --
19g.vimwiki_list = {
20 {
21 path = '/home/yigit/nextcloud/personal_wiki/text',
22 path_html = '/home/yigit/nextcloud/personal_wiki/html',
23 auto_generate_tags = 1,
24 automatic_nested_syntaxes = 1,
25 template_path = '/home/yigit/nextcloud/personal_wiki/templates',
26 template_default = 'default_template',
27 template_ext = '.html',
28 auto_export = 1,
29 auto_tags = 1
30 }
31}
32
33g.vimwiki_global_ext = 0
34g.vimwiki_hl_headers = 1
35-- }}} vimwiki --
36
37-- lualine {{{ --
38require'lualine'.setup {
39 options = {
40 lower = true,
41 icons_enabled = true,
42 theme = 'rose-pine',
43 section_separators = {'', ''},
44 component_separators = {'', ''},
45 disabled_filetypes = {}
46 },
47 sections = {
48 lualine_a = {{'mode', lower = true}},
49 lualine_b = {'branch', 'diff'},
50 lualine_c = {'filename'},
51 lualine_x = {'encoding', 'fileformat', 'filetype'},
52 lualine_y = {'progress'},
53 lualine_z = {
54 'location', {
55 'diagnostics',
56 sources = {'ale'},
57 sections = {'error', 'warn', 'info', 'hint'},
58 symbols = {error = 'e', warn = 'w', info = 'i', hint = 'h'}
59 }
60 }
61 },
62 inactive_sections = {
63 lualine_a = {},
64 lualine_b = {},
65 lualine_c = {'filename'},
66 lualine_x = {},
67 lualine_y = {},
68 lualine_z = {}
69 },
70 tabline = {},
71 extensions = {}
72}
73-- }}} requi --
74
75-- Cutlass suite {{{1 --
76
77-- cutlass/yoink/subverse suite
78g.yoinkIncludeDeleteOperations = 1
79
80-- fix the Target STRING not available
81g.clipboard = {
82 name = 'xsel_override',
83 copy = {
84 ['+'] = 'xsel --input --clipboard',
85 ['*'] = 'xsel --input --primary',
86 },
87 paste = {
88 ['+'] = 'xsel --output --clipboard',
89 ['*'] = 'xsel --output --primary',
90 },
91 cache_enabled = 1,
92}
93
94-- 1}}} --
95
96-- UltiSnips {{{ --
97opt.runtimepath:append('/home/yigit/.vim/my-snippets/')
98g.UltiSnipsEditSplit = "vertical"
99-- ctrl + l expands the snippet, c + j/k navigates placeholders
100g.UltiSnipsExpandTrigger = "<C-l>"
101g.UltiSnipsEnableSnipMate = "1"
102-- }}} UltiSnips --
103
104-- float preview
105g["float_preview#docked"] = 0
106
107-- highlight on yank
108cmd('highlight HighlightedyankRegion cterm=reverse gui=reverse')
109g.highlightedyank_highlight_duration = 200
110
111-- beacon {{{ --
112g.beacon_size = 100
113g.beacon_shrink = 1
114cmd('highlight Beacon guibg=red ctermbg=15')
115-- }}} beacon --
116
117-- vim-slime {{{ --
118g.slime_target = "tmux"
119g.slime_paste_file = "/home/yigit/.slime_paste"
120-- g.slime_default_config = {socket_name = get(split($TMUX, ","), 0), target_pane = "{last}"}
121-- }}} vim-slime --
122
123-- vimtex {{{ --
124g.vimtex_view_method = 'zathura'
125g.vimtex_quickfix_mode = 0
126-- }}} vimtex --
diff --git a/.config/nvim/lua/plugins.lua b/.config/nvim/lua/plugins.lua
new file mode 100644
index 0000000..58cccbc
--- /dev/null
+++ b/.config/nvim/lua/plugins.lua
@@ -0,0 +1,136 @@
1-- ┌───────────────────┐
2-- │ ▜ ▗ │
3-- │▛▀▖▐ ▌ ▌▞▀▌▄ ▛▀▖▞▀▘│
4-- │▙▄▘▐ ▌ ▌▚▄▌▐ ▌ ▌▝▀▖│
5-- │▌ ▘▝▀▘▗▄▘▀▘▘ ▘▀▀ │
6-- └───────────────────┘
7
8return require('packer').startup(function()
9 -- Packer can manage itself
10 use 'wbthomason/packer.nvim'
11
12 -- latex suite
13 use {'lervag/vimtex', ft = {'tex', 'latex', 'plaintext'}}
14
15 -- still here
16 use 'dense-analysis/ale'
17 -- manages tag files
18 use 'ludovicchabant/vim-gutentags'
19 -- run tests (todo: write tests)
20 use 'janko/vim-test'
21 -- type in file send to repl
22 use 'jpalardy/vim-slime'
23 -- snippets to expand
24 use {'SirVer/ultisnips', 'honza/vim-snippets'}
25 -- Highlight the yanked region
26 use 'machakann/vim-highlightedyank'
27
28 -- auto pair plugin, people hate these
29 use 'tmsvg/pear-tree'
30 -- git diff in the sign column
31 use 'airblade/vim-gitgutter'
32 -- completion preview of floating window
33 use 'ncm2/float-preview.nvim'
34
35 -- language packs
36 use 'sheerun/vim-polyglot'
37 -- i3 config syntax
38 use 'mboughaba/i3config.vim'
39 -- kitty config filetype
40 use 'fladson/vim-kitty'
41
42 use{'junegunn/fzf', dir = '~/.fzf'}
43 use 'junegunn/fzf.vim'
44
45 -- file explorer
46 use 'lambdalisue/fern.vim'
47 -- bug in neovim, so required for now
48 -- https://github.com/lambdalisue/fern.vim/issues/120
49 use 'antoinemadec/FixCursorHold.nvim'
50
51 -- displays tags ordered by scope
52 use 'majutsushi/tagbar'
53 -- Undo tree
54 use {
55 'mbbill/undotree',
56 cmd = 'UndotreeToggle',
57 config = [[vim.g.undotree_SetFocusWhenToggle = 1]],
58 }
59 -- Highlight colors
60 use {
61 'norcalli/nvim-colorizer.lua',
62 ft = { 'css', 'javascript', 'vim', 'html' },
63 config = [[require('colorizer').setup {'css', 'javascript', 'vim', 'html'}]],
64 }
65
66 -- cutlass suite, x, d, \ys etc.
67 use {
68 'svermeulen/vim-cutlass',
69 'svermeulen/vim-subversive',
70 'svermeulen/vim-yoink'
71 }
72
73 -- Personal wiki
74 use 'vimwiki/vimwiki'
75 -- centers the writing
76 use 'junegunn/goyo.vim'
77 -- highlights the current paragraph
78 use 'junegunn/limelight.vim'
79 -- change ASCII text to Turkish text
80 use 'yigitsever/turkish-deasciifier.vim'
81
82 -- text alignment \w :Tab
83 use 'godlygeek/tabular'
84 -- move selections up and down with alt+[j,k]
85 use 'matze/vim-move'
86 -- surround text objects; sa, sr and sd
87 use 'machakann/vim-sandwich'
88 -- provide additional text objects
89 use 'wellle/targets.vim'
90 -- indentation level text object, ia, ii
91 use 'michaeljsmith/vim-indent-object'
92 -- visual feedback for substitute holy shit this is amazing
93 use 'markonm/traces.vim'
94 -- see the contents of registers on "/<CTRL-R>
95 use 'junegunn/vim-peekaboo'
96 -- use <leader>k to highlight multiple words)
97 use 'lfv89/vim-interestingwords'
98 -- swap delimited items using g>, g<
99 use 'machakann/vim-swap'
100 -- jump to location by 2 characters, `
101 use 'justinmk/vim-sneak'
102 -- reopen files at your last edit position
103 use 'farmergreg/vim-lastplace'
104 -- flash cursor on jump
105 use 'DanilaMihailov/beacon.nvim'
106
107 -- cursorline of the $CURRENT_YEAR
108 use {
109 'hoob3rt/lualine.nvim',
110 requires = {'kyazdani42/nvim-web-devicons', opt = true}
111 }
112 -- colour theme of the $CURRENT_YEAR
113 use 'rose-pine/neovim'
114
115 -- enable repeating supported plugin maps with '.'
116 use 'tpope/vim-repeat'
117 -- pairs of handy bracket mappings
118 use 'tpope/vim-unimpaired'
119 -- git wrapper
120 use {
121 'tpope/vim-fugitive', cmd = { 'Git', 'Gstatus', 'Gblame', 'Gpush', 'Gpull' }
122 }
123 -- increment dates, times & more
124 use 'tpope/vim-speeddating'
125 -- search, substitute and abbreviate
126 use 'tpope/vim-abolish'
127 -- provides ga, show unicode stuff of char under cursor
128 use 'tpope/vim-characterize'
129 -- comment helper
130 use 'tpope/vim-commentary'
131 -- asynchronous build and test dispatcher
132 use {'tpope/vim-dispatch', opt = true, cmd = {'Dispatch', 'Make', 'Focus', 'Start'}}
133
134 -- fancy start screen
135 use 'mhinz/vim-startify'
136end)
diff --git a/.config/nvim/lua/settings.lua b/.config/nvim/lua/settings.lua
new file mode 100644
index 0000000..5996c51
--- /dev/null
+++ b/.config/nvim/lua/settings.lua
@@ -0,0 +1,103 @@
1-- ┌──────────────────┐
2-- │ ▗ │
3-- │▛▀▖▞▀▖▞▀▖▌ ▌▄ ▛▚▀▖│
4-- │▌ ▌▛▀ ▌ ▌▐▐ ▐ ▌▐ ▌│
5-- │▘ ▘▝▀▘▝▀ ▘ ▀▘▘▝ ▘│
6-- └──────────────────┘
7-- ┌───────────────────────┐
8-- │ ▐ ▐ ▗ │
9-- │▞▀▘▞▀▖▜▀ ▜▀ ▄ ▛▀▖▞▀▌▞▀▘│
10-- │▝▀▖▛▀ ▐ ▖▐ ▖▐ ▌ ▌▚▄▌▝▀▖│
11-- │▀▀ ▝▀▘ ▀ ▀ ▀▘▘ ▘▗▄▘▀▀ │
12-- └───────────────────────┘
13
14local o = vim.o -- gl[o]bal options
15local wo = vim.wo -- [w]indow-local [o]ptions
16local bo = vim.bo -- [b]uffer-local [o]ptions
17local opt = vim.opt -- convenient :set
18
19-- look & feel
20o.termguicolors = true
21vim.cmd('colorscheme rose-pine')
22
23-- interact with system clipboard
24opt.clipboard:append('unnamedplus')
25
26-- copy indent on a new line
27o.autoindent = true
28
29-- :h tabstop, 2. point
30-- use appropriate number of spaces to insert a <Tab>
31o.expandtab = true
32o.shiftwidth = 4
33o.softtabstop = 4
34o.tabstop = 8
35
36-- use english for spellchecking, but don't spellcheck by default
37o.spell = true
38o.spelllang = "en_gb"
39o.spell = false
40
41-- tab completion, zsh style
42o.wildmode = "full"
43opt.wildignore = {
44 '*.o', '*.obj', '*.class', '*.aux', '*.lof', '*.log', '*.lot', '*.fls',
45 '*.toc', '*.fmt', '*.fot', '*.cb', '*.cb2', '.*.lb', '.dvi', '*.xdv',
46 '*.bbl', '*.bcf', '*.blg', '*-blx.aux', '*-blx.bib', '*.run.xml',
47 '*.fdb_latexmk', '*.synctex', '*.synctex(busy)', '*.synctex.gz',
48 '*.synctex.gz(busy)', '*.pdfsync'
49}
50
51-- put one space while joining (not two)
52o.joinspaces = false
53
54-- keep n lines above/below cursor while scrolling
55o.scrolloff = 4
56-- line numbers
57o.number = true
58-- fold manually, when I place markers
59o.foldmethod = "marker"
60-- set the terminal title
61o.title = true
62-- wrap using 'breakat' character
63o.linebreak = true
64-- new split panes will split to below and right
65o.splitbelow = true
66o.splitright = true
67-- highlight the current line, yoc undoes
68o.cursorline = true
69-- current line actual number, rest are relative
70o.relativenumber = true
71-- we are already using a cursorline, don't clobber linter messages
72o.showmode = false
73-- jump to the matching bracket briefly
74o.showmatch = true
75-- move freely between buffers
76o.hidden = true
77
78-- persistent undo
79o.undodir = "/home/yigit/.vim/undodir"
80o.undofile = true
81
82-- lower case searches ignore case, upper case searches do not
83o.ignorecase = true
84o.smartcase = true
85
86-- https://stackoverflow.com/a/3445040/
87-- switch case labels
88o.cinoptions = "l1"
89
90if vim.fn.executable("rg") then
91 o.grepprg = "rg --vimgrep --no-heading --smart-case"
92end
93
94-- iwhite: ignore changes in amount of white space.
95-- vertical: start diff mode with vertical splits
96-- filler: show filler lines,
97opt.diffopt = {
98 "iwhite", "vertical", "filler", "algorithm:patience", "indent-heuristic"
99}
100
101-- menu: use a popup menu to show the possible completions
102-- preview: show extra information
103opt.completeopt = {"menu", "preview"}