diff options
author | Yigit Sever | 2021-10-10 21:03:02 +0300 |
---|---|---|
committer | Yigit Sever | 2021-10-10 21:03:02 +0300 |
commit | a55162742ca5a417037829ff08f35c71f7dd07a0 (patch) | |
tree | 9c79e124648edb8a2b6f8037935f2c2056b80d18 | |
parent | 1c0aa32806e097a2a0c30b760ae4cad481e758c6 (diff) | |
download | dotfiles-a55162742ca5a417037829ff08f35c71f7dd07a0.tar.gz dotfiles-a55162742ca5a417037829ff08f35c71f7dd07a0.tar.bz2 dotfiles-a55162742ca5a417037829ff08f35c71f7dd07a0.zip |
nvim: ported
-rw-r--r-- | .config/nvim/init.lua | 8 | ||||
-rw-r--r-- | .config/nvim/lua/autocmds.lua | 24 | ||||
-rw-r--r-- | .config/nvim/lua/mappings.lua | 31 | ||||
-rw-r--r-- | .config/nvim/lua/plugin_settings.lua | 87 | ||||
-rw-r--r-- | .config/nvim/lua/plugins.lua | 12 | ||||
-rw-r--r-- | .config/nvim/lua/settings.lua | 12 |
6 files changed, 131 insertions, 43 deletions
diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua index 9dcc9b5..071711d 100644 --- a/.config/nvim/init.lua +++ b/.config/nvim/init.lua | |||
@@ -11,8 +11,12 @@ | |||
11 | -- │ ▘▝▀▘▝▀▘│ | 11 | -- │ ▘▝▀▘▝▀▘│ |
12 | -- └────────┘ | 12 | -- └────────┘ |
13 | 13 | ||
14 | -- do not source the default filetype.vim | ||
15 | -- needed for filetype.nvim | ||
16 | vim.g.did_load_filetypes = 1 | ||
17 | |||
14 | require('plugins') | 18 | require('plugins') |
15 | require('settings') | 19 | require('settings') |
16 | require('autocmds') | ||
17 | require('mappings') | ||
18 | require('plugin_settings') | 20 | require('plugin_settings') |
21 | require('mappings') | ||
22 | require('autocmds') | ||
diff --git a/.config/nvim/lua/autocmds.lua b/.config/nvim/lua/autocmds.lua index 295dcc2..6b3279e 100644 --- a/.config/nvim/lua/autocmds.lua +++ b/.config/nvim/lua/autocmds.lua | |||
@@ -11,13 +11,6 @@ au.TextYankPost = function() | |||
11 | vim.highlight.on_yank({ higroup = 'Visual', timeout = 120 }) | 11 | vim.highlight.on_yank({ higroup = 'Visual', timeout = 120 }) |
12 | end | 12 | end |
13 | 13 | ||
14 | au.BufEnter = { | ||
15 | 'PKGBUILD', | ||
16 | function() | ||
17 | vim.bo.filetype = "PKGBUILD" | ||
18 | end, | ||
19 | } | ||
20 | |||
21 | -- autocmd FileType vimwiki,latex,tex setlocal formatprg=/home/yigit/.local/bin/sentences | 14 | -- autocmd FileType vimwiki,latex,tex setlocal formatprg=/home/yigit/.local/bin/sentences |
22 | au.FileType = { | 15 | au.FileType = { |
23 | 'vimwiki,latex,tex', | 16 | 'vimwiki,latex,tex', |
@@ -54,6 +47,21 @@ au.VimResized = { | |||
54 | au.FileType = { | 47 | au.FileType = { |
55 | 'markdown,text', | 48 | 'markdown,text', |
56 | function() | 49 | function() |
57 | vim.bo.spell = true | 50 | vim.wo.spell = true |
58 | end, | 51 | end, |
59 | } | 52 | } |
53 | |||
54 | au.BufEnter = { | ||
55 | 'init.lua', | ||
56 | function() | ||
57 | vim.opt.path:append("./lua") | ||
58 | end | ||
59 | } | ||
60 | |||
61 | au.BufLeave = { | ||
62 | 'init.lua', | ||
63 | function() | ||
64 | vim.opt.path:remove("./lua") | ||
65 | end | ||
66 | } | ||
67 | |||
diff --git a/.config/nvim/lua/mappings.lua b/.config/nvim/lua/mappings.lua index f27ac1b..6633134 100644 --- a/.config/nvim/lua/mappings.lua +++ b/.config/nvim/lua/mappings.lua | |||
@@ -1,9 +1,3 @@ | |||
1 | -- ┌──────────────────┐ | ||
2 | -- │ ▗ │ | ||
3 | -- │▛▀▖▞▀▖▞▀▖▌ ▌▄ ▛▚▀▖│ | ||
4 | -- │▌ ▌▛▀ ▌ ▌▐▐ ▐ ▌▐ ▌│ | ||
5 | -- │▘ ▘▝▀▘▝▀ ▘ ▀▘▘▝ ▘│ | ||
6 | -- └──────────────────┘ | ||
7 | -- ┌────────────────────────┐ | 1 | -- ┌────────────────────────┐ |
8 | -- │ ▗ │ | 2 | -- │ ▗ │ |
9 | -- │▛▚▀▖▝▀▖▛▀▖▛▀▖▄ ▛▀▖▞▀▌▞▀▘│ | 3 | -- │▛▚▀▖▝▀▖▛▀▖▛▀▖▄ ▛▀▖▞▀▌▞▀▘│ |
@@ -22,6 +16,9 @@ end | |||
22 | local cmd = vim.cmd | 16 | local cmd = vim.cmd |
23 | local M = {} | 17 | local M = {} |
24 | 18 | ||
19 | -- edit vimrc \ev | ||
20 | map('n', '<leader>ev', ':tabnew<CR>:e ~/.config/nvim/init.lua<CR>') | ||
21 | |||
25 | -- brute force deasciify everything | 22 | -- brute force deasciify everything |
26 | map('n', '<Leader>tc', 'TurkishDeasciifyForce()', {expr = true}) | 23 | map('n', '<Leader>tc', 'TurkishDeasciifyForce()', {expr = true}) |
27 | map('x', '<Leader>tc', 'TurkishDeasciifyForce()', {expr = true}) | 24 | map('x', '<Leader>tc', 'TurkishDeasciifyForce()', {expr = true}) |
@@ -42,7 +39,7 @@ map('n', '<Leader>rtrt', "TurkishAsciify() .. '_'", {expr = true}) | |||
42 | map('n', '*', ':keepjumps normal! mi*`i<CR>') | 39 | map('n', '*', ':keepjumps normal! mi*`i<CR>') |
43 | map('n', '#', ':keepjumps normal! mi#`i<CR> ') | 40 | map('n', '#', ':keepjumps normal! mi#`i<CR> ') |
44 | 41 | ||
45 | -- Save file as sudo on files that require root permission | 42 | -- save file as sudo on files that require root permission |
46 | map('c', 'w!!', 'execute "silent! write !sudo tee % >/dev/null" <bar> edit!') | 43 | map('c', 'w!!', 'execute "silent! write !sudo tee % >/dev/null" <bar> edit!') |
47 | 44 | ||
48 | -- replace ex mode with gq (format lines) | 45 | -- replace ex mode with gq (format lines) |
@@ -51,25 +48,25 @@ map('n', 'Q', 'gq') | |||
51 | -- set formatprg to sentences, for prose | 48 | -- set formatprg to sentences, for prose |
52 | map('n', '<Leader>fp', ":set formatprg=~/.local/bin/sentences<CR>") | 49 | map('n', '<Leader>fp', ":set formatprg=~/.local/bin/sentences<CR>") |
53 | 50 | ||
54 | -- Replace all is aliased to S. | 51 | -- replace all is aliased to S. |
55 | map('n', 'S', ':%s//g<Left><Left>') | 52 | map('n', 'S', ':%s//g<Left><Left>') |
56 | 53 | ||
57 | -- If you like "Y" to work from the cursor to the end of line (which is more | 54 | -- if you like "Y" to work from the cursor to the end of line (which is more |
58 | -- logical, but not Vi-compatible) | 55 | -- logical, but not Vi-compatible) |
59 | map('n', 'Y', 'y$') | 56 | map('n', 'Y', 'y$') |
60 | 57 | ||
61 | -- jump to buffer | 58 | -- jump to buffer |
62 | map('n', '<Leader>b', ':ls<cr>:b<space>') | 59 | map('n', '<Leader>b', ':ls<cr>:b<space>') |
63 | 60 | ||
64 | -- Up and down are more logical with g.. | 61 | -- up and down are more logical with g.. |
65 | map('n', 'k', 'gk') | 62 | map('n', 'k', 'gk') |
66 | map('n', 'j', 'gj') | 63 | map('n', 'j', 'gj') |
67 | map('i', '<Up>', '<Esc>gka') | 64 | map('i', '<Up>', '<Esc>gka') |
68 | map('i', '<Down>', '<Esc>gja') | 65 | map('i', '<Down>', '<Esc>gja') |
69 | 66 | ||
70 | -- Disable highlight when <leader><cr> is pressed | 67 | -- disable highlight when <leader><cr> is pressed |
71 | map('n', '<Leader><Cr>', ':noh<Cr>') | 68 | map('n', '<Leader><Cr>', ':noh<Cr>') |
72 | -- Space used to toggle folds, now it's x (because x is d) | 69 | -- space used to toggle folds, now it's x (because x is d) |
73 | map('n', '<Space>', '"_x') | 70 | map('n', '<Space>', '"_x') |
74 | 71 | ||
75 | -- separate cut and delete | 72 | -- separate cut and delete |
@@ -106,6 +103,9 @@ local function plugmap(mode, lhs, rhs, opts) | |||
106 | vim.api.nvim_set_keymap(mode, lhs, rhs, options) | 103 | vim.api.nvim_set_keymap(mode, lhs, rhs, options) |
107 | end | 104 | end |
108 | 105 | ||
106 | -- open the TagBar Plugin | ||
107 | plugmap('n', '<F3>', ':TagbarToggle<CR>') | ||
108 | |||
109 | -- sneak using grave, s is for sandwich | 109 | -- sneak using grave, s is for sandwich |
110 | plugmap('n', '`', '<Plug>Sneak_s') | 110 | plugmap('n', '`', '<Plug>Sneak_s') |
111 | plugmap('n', '`', '<Plug>Sneak_s') | 111 | plugmap('n', '`', '<Plug>Sneak_s') |
@@ -145,4 +145,11 @@ plugmap('n', '<leader>v', '<Plug>VimwikiToggleListItem') | |||
145 | -- add/increase header level | 145 | -- add/increase header level |
146 | plugmap('n', '<leader>a', '<Plug>VimwikiAddHeaderLevel') | 146 | plugmap('n', '<leader>a', '<Plug>VimwikiAddHeaderLevel') |
147 | 147 | ||
148 | -- vim-test bindings | ||
149 | map('n', 't<C-n>', ':TestNearest<CR>') | ||
150 | map('n', 't<C-f>', ':TestFile<CR>') | ||
151 | map('n', 't<C-s>', ':TestSuite<CR>') | ||
152 | map('n', 't<C-l>', ':TestLast<CR>') | ||
153 | map('n', 't<C-g>', ':TestVisit<CR>') | ||
154 | |||
148 | -- 1}}} -- | 155 | -- 1}}} -- |
diff --git a/.config/nvim/lua/plugin_settings.lua b/.config/nvim/lua/plugin_settings.lua index 4e28726..60bbbe1 100644 --- a/.config/nvim/lua/plugin_settings.lua +++ b/.config/nvim/lua/plugin_settings.lua | |||
@@ -1,9 +1,3 @@ | |||
1 | -- ┌──────────────────┐ | ||
2 | -- │ ▗ │ | ||
3 | -- │▛▀▖▞▀▖▞▀▖▌ ▌▄ ▛▚▀▖│ | ||
4 | -- │▌ ▌▛▀ ▌ ▌▐▐ ▐ ▌▐ ▌│ | ||
5 | -- │▘ ▘▝▀▘▝▀ ▘ ▀▘▘▝ ▘│ | ||
6 | -- └──────────────────┘ | ||
7 | -- ┌─────────────────────────────────────┐ | 1 | -- ┌─────────────────────────────────────┐ |
8 | -- │ ▜ ▐ ▐ ▗ │ | 2 | -- │ ▜ ▐ ▐ ▗ │ |
9 | -- │▛▀▖▐ ▌ ▌▞▀▌▗▖▖▞▀▘▞▀▖▜▀ ▜▀ ▄ ▛▀▖▞▀▌▞▀▘│ | 3 | -- │▛▀▖▐ ▌ ▌▞▀▌▗▖▖▞▀▘▞▀▖▜▀ ▜▀ ▄ ▛▀▖▞▀▌▞▀▘│ |
@@ -118,7 +112,86 @@ g.vimtex_view_method = 'zathura' | |||
118 | g.vimtex_quickfix_mode = 0 | 112 | g.vimtex_quickfix_mode = 0 |
119 | -- }}} vimtex -- | 113 | -- }}} vimtex -- |
120 | 114 | ||
121 | vim.g.polyglot_disabled={'latex', 'tex'} | 115 | -- filetype.nvim {{{ -- |
116 | require('filetype').setup({ | ||
117 | overrides = { | ||
118 | literal = { | ||
119 | PKGBUILD = 'PKGBUILD', | ||
120 | }, | ||
121 | } | ||
122 | }) | ||
123 | -- }}} filetype.nvim -- | ||
124 | |||
125 | -- tagbar {{{ -- | ||
126 | g.tagbar_autofocus = 1 | ||
127 | g.tagbar_compact = 1 | ||
128 | g.tagbar_sort = 0 | ||
129 | g.tagbar_width = 25 | ||
130 | -- }}} tagbar -- | ||
131 | |||
132 | -- ledger {{{ -- | ||
133 | g.ledger_maxwidth = 80 | ||
134 | g.ledger_fillstring = ' -' | ||
135 | -- }}} ledger -- | ||
136 | |||
137 | -- devicons {{{ -- | ||
138 | require'nvim-web-devicons'.setup { | ||
139 | override = { | ||
140 | wiki = { | ||
141 | icon = "", | ||
142 | color = "#D7827E", | ||
143 | name = "vimwiki" | ||
144 | }, | ||
145 | rem = { | ||
146 | icon = "", | ||
147 | color = "#B4637A", | ||
148 | name = "remind" | ||
149 | } | ||
150 | }; | ||
151 | |||
152 | default = true | ||
153 | } | ||
154 | -- }}} devicons -- | ||
155 | |||
156 | -- vim-slime {{{ -- | ||
157 | g.slime_target = "tmux" | ||
158 | g.slime_paste_file = "$HOME/.slime_paste" | ||
159 | g.slime_default_config = {socket_name = vim.call("get", vim.call("split", vim.env.TMUX, ','), "0"), target_pane = "{last}"} | ||
160 | -- }}} vim-slime -- | ||
161 | |||
162 | -- gutentags {{{ -- | ||
163 | g.gutentags_enabled = 1 | ||
164 | g.gutentags_add_default_project_roots = 0 | ||
165 | g.gutentags_project_root = {'Makefile', '.git'} | ||
166 | g.gutentags_exclude_filetypes = {'gitcommit', 'gitconfig', 'gitrebase', 'gitsendemail', 'git'} | ||
167 | g.gutentags_generate_on_new = 1 | ||
168 | g.gutentags_generate_on_missing = 1 | ||
169 | g.gutentags_generate_on_write = 1 | ||
170 | g.gutentags_generate_on_empty_buffer = 0 | ||
171 | g.gutentags_ctags_exclude = { | ||
172 | '*.git', '*.svn', '*.hg', | ||
173 | 'cache', 'build', 'dist', 'bin', 'node_modules', 'bower_components', | ||
174 | '*-lock.json', '*.lock', | ||
175 | '*.min.*', | ||
176 | '*.bak', | ||
177 | '*.zip', | ||
178 | '*.pyc', | ||
179 | '*.class', | ||
180 | '*.sln', | ||
181 | '*.csproj', '*.csproj.user', | ||
182 | '*.tmp', | ||
183 | '*.cache', | ||
184 | '*.vscode', | ||
185 | '*.pdb', | ||
186 | '*.exe', '*.dll', '*.bin', | ||
187 | '*.mp3', '*.ogg', '*.flac', | ||
188 | '*.swp', '*.swo', | ||
189 | '.DS_Store', '*.plist', | ||
190 | '*.bmp', '*.gif', '*.ico', '*.jpg', '*.png', '*.svg', | ||
191 | '*.rar', '*.zip', '*.tar', '*.tar.gz', '*.tar.xz', '*.tar.bz2', | ||
192 | '*.pdf', '*.doc', '*.docx', '*.ppt', '*.pptx', '*.xls', | ||
193 | } | ||
194 | -- }}} gutentags -- | ||
122 | 195 | ||
123 | -- float preview | 196 | -- float preview |
124 | g["float_preview#docked"] = 0 | 197 | g["float_preview#docked"] = 0 |
diff --git a/.config/nvim/lua/plugins.lua b/.config/nvim/lua/plugins.lua index 4f5420f..8233e44 100644 --- a/.config/nvim/lua/plugins.lua +++ b/.config/nvim/lua/plugins.lua | |||
@@ -12,7 +12,7 @@ return require('packer').startup(function() | |||
12 | -- latex suite | 12 | -- latex suite |
13 | use {'lervag/vimtex', ft = {'tex', 'latex', 'plaintext'}} | 13 | use {'lervag/vimtex', ft = {'tex', 'latex', 'plaintext'}} |
14 | 14 | ||
15 | -- still here | 15 | -- still here, going away soon say bye bye |
16 | use 'dense-analysis/ale' | 16 | use 'dense-analysis/ale' |
17 | -- manages tag files | 17 | -- manages tag files |
18 | use 'ludovicchabant/vim-gutentags' | 18 | use 'ludovicchabant/vim-gutentags' |
@@ -31,13 +31,15 @@ return require('packer').startup(function() | |||
31 | use 'ncm2/float-preview.nvim' | 31 | use 'ncm2/float-preview.nvim' |
32 | 32 | ||
33 | -- language packs | 33 | -- language packs |
34 | use 'sheerun/vim-polyglot' | 34 | use "nathom/filetype.nvim" |
35 | -- i3 config syntax | 35 | -- i3 config filetype |
36 | use 'mboughaba/i3config.vim' | 36 | use 'mboughaba/i3config.vim' |
37 | -- kitty config filetype | 37 | -- kitty config filetype |
38 | use 'fladson/vim-kitty' | 38 | use 'fladson/vim-kitty' |
39 | -- ledger filetype | ||
40 | use 'ledger/vim-ledger' | ||
39 | 41 | ||
40 | use{'junegunn/fzf', dir = '~/.fzf'} | 42 | use {'junegunn/fzf', dir = '~/.fzf'} |
41 | use 'junegunn/fzf.vim' | 43 | use 'junegunn/fzf.vim' |
42 | 44 | ||
43 | -- file explorer | 45 | -- file explorer |
@@ -116,7 +118,7 @@ return require('packer').startup(function() | |||
116 | use 'tpope/vim-unimpaired' | 118 | use 'tpope/vim-unimpaired' |
117 | -- git wrapper | 119 | -- git wrapper |
118 | use { | 120 | use { |
119 | 'tpope/vim-fugitive', cmd = { 'Git', 'Gstatus', 'Gblame', 'Gpush', 'Gpull' } | 121 | 'tpope/vim-fugitive', cmd = {'Git', 'Gstatus', 'Gblame', 'Gpush', 'Gpull'} |
120 | } | 122 | } |
121 | -- increment dates, times & more | 123 | -- increment dates, times & more |
122 | use 'tpope/vim-speeddating' | 124 | use 'tpope/vim-speeddating' |
diff --git a/.config/nvim/lua/settings.lua b/.config/nvim/lua/settings.lua index 5996c51..5931e5d 100644 --- a/.config/nvim/lua/settings.lua +++ b/.config/nvim/lua/settings.lua | |||
@@ -1,9 +1,3 @@ | |||
1 | -- ┌──────────────────┐ | ||
2 | -- │ ▗ │ | ||
3 | -- │▛▀▖▞▀▖▞▀▖▌ ▌▄ ▛▚▀▖│ | ||
4 | -- │▌ ▌▛▀ ▌ ▌▐▐ ▐ ▌▐ ▌│ | ||
5 | -- │▘ ▘▝▀▘▝▀ ▘ ▀▘▘▝ ▘│ | ||
6 | -- └──────────────────┘ | ||
7 | -- ┌───────────────────────┐ | 1 | -- ┌───────────────────────┐ |
8 | -- │ ▐ ▐ ▗ │ | 2 | -- │ ▐ ▐ ▗ │ |
9 | -- │▞▀▘▞▀▖▜▀ ▜▀ ▄ ▛▀▖▞▀▌▞▀▘│ | 3 | -- │▞▀▘▞▀▖▜▀ ▜▀ ▄ ▛▀▖▞▀▌▞▀▘│ |
@@ -34,9 +28,9 @@ o.softtabstop = 4 | |||
34 | o.tabstop = 8 | 28 | o.tabstop = 8 |
35 | 29 | ||
36 | -- use english for spellchecking, but don't spellcheck by default | 30 | -- use english for spellchecking, but don't spellcheck by default |
37 | o.spell = true | 31 | wo.spell = true |
38 | o.spelllang = "en_gb" | 32 | bo.spelllang = "en_gb" |
39 | o.spell = false | 33 | wo.spell = false |
40 | 34 | ||
41 | -- tab completion, zsh style | 35 | -- tab completion, zsh style |
42 | o.wildmode = "full" | 36 | o.wildmode = "full" |