diff options
author | Yigit Sever | 2021-10-08 00:09:37 +0300 |
---|---|---|
committer | Yigit Sever | 2021-10-08 00:09:37 +0300 |
commit | a8903ac96dd7cd0e1af968d729e557d579f26124 (patch) | |
tree | afe2c89a0fbc1b0bfe79dd1b9ea9d7050f83fc08 /.config/nvim/lua | |
parent | 82bc7c109cd3890b3494d88f7ead43c3aa3e7860 (diff) | |
download | dotfiles-a8903ac96dd7cd0e1af968d729e557d579f26124.tar.gz dotfiles-a8903ac96dd7cd0e1af968d729e557d579f26124.tar.bz2 dotfiles-a8903ac96dd7cd0e1af968d729e557d579f26124.zip |
neovim: migrate to init.lua
Diffstat (limited to '.config/nvim/lua')
-rw-r--r-- | .config/nvim/lua/mappings.lua | 131 | ||||
-rw-r--r-- | .config/nvim/lua/plugin_settings.lua | 126 | ||||
-rw-r--r-- | .config/nvim/lua/plugins.lua | 136 | ||||
-rw-r--r-- | .config/nvim/lua/settings.lua | 103 |
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 | ||
15 | local 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) | ||
19 | end | ||
20 | |||
21 | -- local map = vim.api.nvim_set_keymap | ||
22 | local cmd = vim.cmd | ||
23 | local M = {} | ||
24 | |||
25 | -- brute force deasciify everything | ||
26 | map('n', '<Leader>tc', 'TurkishDeasciifyForce()', {expr = true}) | ||
27 | map('x', '<Leader>tc', 'TurkishDeasciifyForce()', {expr = true}) | ||
28 | map('n', '<Leader>tctc', "TurkishDeasciifyForce() .. '_'", {expr = true}) | ||
29 | |||
30 | -- use turkish-mode to selectively deasciify | ||
31 | map('n', '<Leader>tr', 'TurkishDeasciify()', {expr = true}) | ||
32 | map('x', '<Leader>tr', 'TurkishDeasciify()', {expr = true}) | ||
33 | map('n', '<Leader>trtr', "TurkishDeasciify() .. '_'", {expr = true}) | ||
34 | |||
35 | -- ascii everything | ||
36 | map('n', '<Leader>rt', 'TurkishAsciify()', {expr = true}) | ||
37 | map('x', '<Leader>rt', 'TurkishAsciify()', {expr = true}) | ||
38 | map('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 | ||
42 | map('n', '*', ':keepjumps normal! mi*`i<CR>') | ||
43 | map('n', '#', ':keepjumps normal! mi#`i<CR> ') | ||
44 | |||
45 | -- Save file as sudo on files that require root permission | ||
46 | map('c', 'w!!', 'execute "silent! write !sudo tee % >/dev/null" <bar> edit!') | ||
47 | |||
48 | -- replace ex mode with gq (format lines) | ||
49 | map('n', 'Q', 'gq') | ||
50 | |||
51 | -- set formatprg to sentences, for prose | ||
52 | map('n', '<Leader>fp', ":set formatprg=~/.local/bin/sentences<CR>") | ||
53 | |||
54 | -- Replace all is aliased to S. | ||
55 | map('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) | ||
59 | map('n', 'Y', 'y$') | ||
60 | |||
61 | -- jump to buffer | ||
62 | map('n', '<Leader>b', ':ls<cr>:b<space>') | ||
63 | |||
64 | -- Up and down are more logical with g.. | ||
65 | map('n', 'k', 'gk') | ||
66 | map('n', 'j', 'gj') | ||
67 | map('i', '<Up>', '<Esc>gka') | ||
68 | map('i', '<Down>', '<Esc>gja') | ||
69 | |||
70 | -- Disable highlight when <leader><cr> is pressed | ||
71 | map('n', '<Leader><Cr>', ':noh<Cr>') | ||
72 | -- Space used to toggle folds, now it's x (because x is d) | ||
73 | map('n', '<Space>', '"_x') | ||
74 | |||
75 | -- separate cut and delete | ||
76 | map('n', 'x', 'd') | ||
77 | map('x', 'x', 'd') | ||
78 | map('n', 'xx', 'dd') | ||
79 | map('n', 'X', 'D') | ||
80 | |||
81 | -- change into pwd of current directory | ||
82 | map('n', '<Leader>cd', ':cd %:p:h<CR>:pwd<CR>') | ||
83 | |||
84 | -- press \g and start writing prose | ||
85 | map('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/ | ||
91 | local 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) | ||
95 | end | ||
96 | |||
97 | -- sneak using grave, s is for sandwich | ||
98 | plugmap('n', '`', '<Plug>Sneak_s') | ||
99 | plugmap('n', '`', '<Plug>Sneak_s') | ||
100 | plugmap('n', '<Leader>`', '<Plug>Sneak_S') | ||
101 | plugmap('n', "'", '`') | ||
102 | |||
103 | -- use the special yoink paste that rotates | ||
104 | plugmap('n', 'p', '<Plug>(YoinkPaste_p)') | ||
105 | plugmap('n', 'P', '<Plug>(YoinkPaste_P)') | ||
106 | |||
107 | -- substitute from yank | ||
108 | plugmap('n', '<Leader>ys', '<plug>(SubversiveSubstitute)') | ||
109 | plugmap('n', '<Leader>yss', '<plug>(SubversiveSubstituteLine)') | ||
110 | plugmap('n', '<Leader>yS', '<plug>(SubversiveSubstituteToEndOfLine)') | ||
111 | |||
112 | -- substitute over range | ||
113 | plugmap('n', '<Leader>s', '<plug>(SubversiveSubstituteRange)') | ||
114 | plugmap('x', '<Leader>s', '<plug>(SubversiveSubstituteRange)') | ||
115 | plugmap('n', '<Leader>ss', '<plug>(SubversiveSubstituteWordRange)') | ||
116 | |||
117 | -- subvert over range | ||
118 | plugmap('n', '<Leader><Leader>s', '<plug>(SubversiveSubvertRange)') | ||
119 | plugmap('x', '<Leader><Leader>s', '<plug>(SubversiveSubvertRange)') | ||
120 | plugmap('n', '<Leader><Leader>ss', '<plug>(SubversiveSubvertWordRange)') | ||
121 | |||
122 | -- iterate over yank list | ||
123 | plugmap('n', '<c-n>', '<Plug>(YoinkPostPasteSwapBack)') | ||
124 | plugmap('n', '<c-p>', '<Plug>(YoinkPostPasteSwapForward)') | ||
125 | |||
126 | -- insert mode completion | ||
127 | plugmap('i', '<c-x><c-k>', '<plug>(fzf-complete-word)') | ||
128 | plugmap('i', '<c-x><c-f>', '<plug>(fzf-complete-path)') | ||
129 | plugmap('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 | |||
14 | local g = vim.g -- global for let options | ||
15 | local opt = vim.opt -- convenient :set | ||
16 | local cmd = vim.cmd -- vim commands | ||
17 | |||
18 | -- vimwiki {{{ -- | ||
19 | g.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 | |||
33 | g.vimwiki_global_ext = 0 | ||
34 | g.vimwiki_hl_headers = 1 | ||
35 | -- }}} vimwiki -- | ||
36 | |||
37 | -- lualine {{{ -- | ||
38 | require'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 | ||
78 | g.yoinkIncludeDeleteOperations = 1 | ||
79 | |||
80 | -- fix the Target STRING not available | ||
81 | g.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 {{{ -- | ||
97 | opt.runtimepath:append('/home/yigit/.vim/my-snippets/') | ||
98 | g.UltiSnipsEditSplit = "vertical" | ||
99 | -- ctrl + l expands the snippet, c + j/k navigates placeholders | ||
100 | g.UltiSnipsExpandTrigger = "<C-l>" | ||
101 | g.UltiSnipsEnableSnipMate = "1" | ||
102 | -- }}} UltiSnips -- | ||
103 | |||
104 | -- float preview | ||
105 | g["float_preview#docked"] = 0 | ||
106 | |||
107 | -- highlight on yank | ||
108 | cmd('highlight HighlightedyankRegion cterm=reverse gui=reverse') | ||
109 | g.highlightedyank_highlight_duration = 200 | ||
110 | |||
111 | -- beacon {{{ -- | ||
112 | g.beacon_size = 100 | ||
113 | g.beacon_shrink = 1 | ||
114 | cmd('highlight Beacon guibg=red ctermbg=15') | ||
115 | -- }}} beacon -- | ||
116 | |||
117 | -- vim-slime {{{ -- | ||
118 | g.slime_target = "tmux" | ||
119 | g.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 {{{ -- | ||
124 | g.vimtex_view_method = 'zathura' | ||
125 | g.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 | |||
8 | return 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' | ||
136 | end) | ||
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 | |||
14 | local o = vim.o -- gl[o]bal options | ||
15 | local wo = vim.wo -- [w]indow-local [o]ptions | ||
16 | local bo = vim.bo -- [b]uffer-local [o]ptions | ||
17 | local opt = vim.opt -- convenient :set | ||
18 | |||
19 | -- look & feel | ||
20 | o.termguicolors = true | ||
21 | vim.cmd('colorscheme rose-pine') | ||
22 | |||
23 | -- interact with system clipboard | ||
24 | opt.clipboard:append('unnamedplus') | ||
25 | |||
26 | -- copy indent on a new line | ||
27 | o.autoindent = true | ||
28 | |||
29 | -- :h tabstop, 2. point | ||
30 | -- use appropriate number of spaces to insert a <Tab> | ||
31 | o.expandtab = true | ||
32 | o.shiftwidth = 4 | ||
33 | o.softtabstop = 4 | ||
34 | o.tabstop = 8 | ||
35 | |||
36 | -- use english for spellchecking, but don't spellcheck by default | ||
37 | o.spell = true | ||
38 | o.spelllang = "en_gb" | ||
39 | o.spell = false | ||
40 | |||
41 | -- tab completion, zsh style | ||
42 | o.wildmode = "full" | ||
43 | opt.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) | ||
52 | o.joinspaces = false | ||
53 | |||
54 | -- keep n lines above/below cursor while scrolling | ||
55 | o.scrolloff = 4 | ||
56 | -- line numbers | ||
57 | o.number = true | ||
58 | -- fold manually, when I place markers | ||
59 | o.foldmethod = "marker" | ||
60 | -- set the terminal title | ||
61 | o.title = true | ||
62 | -- wrap using 'breakat' character | ||
63 | o.linebreak = true | ||
64 | -- new split panes will split to below and right | ||
65 | o.splitbelow = true | ||
66 | o.splitright = true | ||
67 | -- highlight the current line, yoc undoes | ||
68 | o.cursorline = true | ||
69 | -- current line actual number, rest are relative | ||
70 | o.relativenumber = true | ||
71 | -- we are already using a cursorline, don't clobber linter messages | ||
72 | o.showmode = false | ||
73 | -- jump to the matching bracket briefly | ||
74 | o.showmatch = true | ||
75 | -- move freely between buffers | ||
76 | o.hidden = true | ||
77 | |||
78 | -- persistent undo | ||
79 | o.undodir = "/home/yigit/.vim/undodir" | ||
80 | o.undofile = true | ||
81 | |||
82 | -- lower case searches ignore case, upper case searches do not | ||
83 | o.ignorecase = true | ||
84 | o.smartcase = true | ||
85 | |||
86 | -- https://stackoverflow.com/a/3445040/ | ||
87 | -- switch case labels | ||
88 | o.cinoptions = "l1" | ||
89 | |||
90 | if vim.fn.executable("rg") then | ||
91 | o.grepprg = "rg --vimgrep --no-heading --smart-case" | ||
92 | end | ||
93 | |||
94 | -- iwhite: ignore changes in amount of white space. | ||
95 | -- vertical: start diff mode with vertical splits | ||
96 | -- filler: show filler lines, | ||
97 | opt.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 | ||
103 | opt.completeopt = {"menu", "preview"} | ||