summaryrefslogtreecommitdiffstats
path: root/.config/nvim/lua
diff options
context:
space:
mode:
authorYigit Sever2021-10-10 21:03:02 +0300
committerYigit Sever2021-10-10 21:03:02 +0300
commita55162742ca5a417037829ff08f35c71f7dd07a0 (patch)
tree9c79e124648edb8a2b6f8037935f2c2056b80d18 /.config/nvim/lua
parent1c0aa32806e097a2a0c30b760ae4cad481e758c6 (diff)
downloaddotfiles-a55162742ca5a417037829ff08f35c71f7dd07a0.tar.gz
dotfiles-a55162742ca5a417037829ff08f35c71f7dd07a0.tar.bz2
dotfiles-a55162742ca5a417037829ff08f35c71f7dd07a0.zip
nvim: ported
Diffstat (limited to '.config/nvim/lua')
-rw-r--r--.config/nvim/lua/autocmds.lua24
-rw-r--r--.config/nvim/lua/mappings.lua31
-rw-r--r--.config/nvim/lua/plugin_settings.lua87
-rw-r--r--.config/nvim/lua/plugins.lua12
-rw-r--r--.config/nvim/lua/settings.lua12
5 files changed, 125 insertions, 41 deletions
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 })
12end 12end
13 13
14au.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
22au.FileType = { 15au.FileType = {
23 'vimwiki,latex,tex', 16 'vimwiki,latex,tex',
@@ -54,6 +47,21 @@ au.VimResized = {
54au.FileType = { 47au.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
54au.BufEnter = {
55 'init.lua',
56 function()
57 vim.opt.path:append("./lua")
58 end
59}
60
61au.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
22local cmd = vim.cmd 16local cmd = vim.cmd
23local M = {} 17local M = {}
24 18
19-- edit vimrc \ev
20map('n', '<leader>ev', ':tabnew<CR>:e ~/.config/nvim/init.lua<CR>')
21
25-- brute force deasciify everything 22-- brute force deasciify everything
26map('n', '<Leader>tc', 'TurkishDeasciifyForce()', {expr = true}) 23map('n', '<Leader>tc', 'TurkishDeasciifyForce()', {expr = true})
27map('x', '<Leader>tc', 'TurkishDeasciifyForce()', {expr = true}) 24map('x', '<Leader>tc', 'TurkishDeasciifyForce()', {expr = true})
@@ -42,7 +39,7 @@ map('n', '<Leader>rtrt', "TurkishAsciify() .. '_'", {expr = true})
42map('n', '*', ':keepjumps normal! mi*`i<CR>') 39map('n', '*', ':keepjumps normal! mi*`i<CR>')
43map('n', '#', ':keepjumps normal! mi#`i<CR> ') 40map('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
46map('c', 'w!!', 'execute "silent! write !sudo tee % >/dev/null" <bar> edit!') 43map('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
52map('n', '<Leader>fp', ":set formatprg=~/.local/bin/sentences<CR>") 49map('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.
55map('n', 'S', ':%s//g<Left><Left>') 52map('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)
59map('n', 'Y', 'y$') 56map('n', 'Y', 'y$')
60 57
61-- jump to buffer 58-- jump to buffer
62map('n', '<Leader>b', ':ls<cr>:b<space>') 59map('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..
65map('n', 'k', 'gk') 62map('n', 'k', 'gk')
66map('n', 'j', 'gj') 63map('n', 'j', 'gj')
67map('i', '<Up>', '<Esc>gka') 64map('i', '<Up>', '<Esc>gka')
68map('i', '<Down>', '<Esc>gja') 65map('i', '<Down>', '<Esc>gja')
69 66
70-- Disable highlight when <leader><cr> is pressed 67-- disable highlight when <leader><cr> is pressed
71map('n', '<Leader><Cr>', ':noh<Cr>') 68map('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)
73map('n', '<Space>', '"_x') 70map('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)
107end 104end
108 105
106-- open the TagBar Plugin
107plugmap('n', '<F3>', ':TagbarToggle<CR>')
108
109-- sneak using grave, s is for sandwich 109-- sneak using grave, s is for sandwich
110plugmap('n', '`', '<Plug>Sneak_s') 110plugmap('n', '`', '<Plug>Sneak_s')
111plugmap('n', '`', '<Plug>Sneak_s') 111plugmap('n', '`', '<Plug>Sneak_s')
@@ -145,4 +145,11 @@ plugmap('n', '<leader>v', '<Plug>VimwikiToggleListItem')
145-- add/increase header level 145-- add/increase header level
146plugmap('n', '<leader>a', '<Plug>VimwikiAddHeaderLevel') 146plugmap('n', '<leader>a', '<Plug>VimwikiAddHeaderLevel')
147 147
148-- vim-test bindings
149map('n', 't<C-n>', ':TestNearest<CR>')
150map('n', 't<C-f>', ':TestFile<CR>')
151map('n', 't<C-s>', ':TestSuite<CR>')
152map('n', 't<C-l>', ':TestLast<CR>')
153map('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'
118g.vimtex_quickfix_mode = 0 112g.vimtex_quickfix_mode = 0
119-- }}} vimtex -- 113-- }}} vimtex --
120 114
121vim.g.polyglot_disabled={'latex', 'tex'} 115-- filetype.nvim {{{ --
116require('filetype').setup({
117 overrides = {
118 literal = {
119 PKGBUILD = 'PKGBUILD',
120 },
121 }
122})
123-- }}} filetype.nvim --
124
125-- tagbar {{{ --
126g.tagbar_autofocus = 1
127g.tagbar_compact = 1
128g.tagbar_sort = 0
129g.tagbar_width = 25
130-- }}} tagbar --
131
132-- ledger {{{ --
133g.ledger_maxwidth = 80
134g.ledger_fillstring = ' -'
135-- }}} ledger --
136
137-- devicons {{{ --
138require'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 {{{ --
157g.slime_target = "tmux"
158g.slime_paste_file = "$HOME/.slime_paste"
159g.slime_default_config = {socket_name = vim.call("get", vim.call("split", vim.env.TMUX, ','), "0"), target_pane = "{last}"}
160-- }}} vim-slime --
161
162-- gutentags {{{ --
163g.gutentags_enabled = 1
164g.gutentags_add_default_project_roots = 0
165g.gutentags_project_root = {'Makefile', '.git'}
166g.gutentags_exclude_filetypes = {'gitcommit', 'gitconfig', 'gitrebase', 'gitsendemail', 'git'}
167g.gutentags_generate_on_new = 1
168g.gutentags_generate_on_missing = 1
169g.gutentags_generate_on_write = 1
170g.gutentags_generate_on_empty_buffer = 0
171g.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
124g["float_preview#docked"] = 0 197g["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
34o.tabstop = 8 28o.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
37o.spell = true 31wo.spell = true
38o.spelllang = "en_gb" 32bo.spelllang = "en_gb"
39o.spell = false 33wo.spell = false
40 34
41-- tab completion, zsh style 35-- tab completion, zsh style
42o.wildmode = "full" 36o.wildmode = "full"