aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xREADME.md391
-rwxr-xr-xafter/syntax/log.vim2
-rwxr-xr-xafter/syntax/markdown.vim12
-rw-r--r--init.lua277
-rw-r--r--lua/plugins/cmp.lua157
-rw-r--r--lua/plugins/colorizer.lua6
-rw-r--r--lua/plugins/colorscheme.lua6
-rw-r--r--lua/plugins/devicons.lua11
-rw-r--r--lua/plugins/fzf.lua4
-rw-r--r--lua/plugins/gitsigns.lua6
-rw-r--r--lua/plugins/lspsaga.lua10
-rw-r--r--lua/plugins/orgmode.lua11
-rw-r--r--lua/plugins/popup.lua5
-rw-r--r--lua/plugins/telescope.lua15
-rw-r--r--lua/plugins/treesitter.lua20
-rw-r--r--vimrc10
16 files changed, 508 insertions, 435 deletions
diff --git a/README.md b/README.md
index c6da247..0d4f81b 100755
--- a/README.md
+++ b/README.md
@@ -50,191 +50,212 @@ For different working scenarios.
50 textwidth (configured with `set textwidth=80` for example) 50 textwidth (configured with `set textwidth=80` for example)
51 51
52 52
53 :viusage = summary of all keyboard shortcuts 53## general
54 :options = shows currently :set options (with descriptions) 54
55 leader key = usually set to backslash expects a quick command 55 :viusage = summary of all keyboard shortcuts
56 56 :options = shows currently :set options (with descriptions)
57 [normal mode] 57 leader key = usually set to backslash expects a quick command
58 f{char} = move cursor to the character {char} 58
59 gf = open file under cursor 59### normal mode
60 <C-w>gf = open file under cursor in a tab 60
61 <C-w>] = jump to the tag under the cursor in a new window 61 f{char} = move cursor to the character {char}
62 <C-t> = jump back from where that ^ brought you 62 gf = open file under cursor
63 K = keyword lookup for the word under the cursor (see :help kp) 63 <C-w>gf = open file under cursor in a tab
64 w = next word 64 <C-w>] = jump to the tag under the cursor in a new window
65 e = end of word (=inner word) 65 <C-t> = jump back from where that ^ brought you
66 66 K = keyword lookup for the word under the cursor (see :help kp)
67 @see: :h text-objects 67 w = next word
68 ci' = change between single quote 68 e = end of word (=inner word)
69 ci" = change between double quote 69
70 ci( = change between brace 70 @see: :h text-objects
71 cit = change XML Tag 71 ci' = change between single quote
72 ciw = select inner word 72 ci" = change between double quote
73 caw = select 'a word' 73 ci( = change between brace
74 " where c can be replaced by v for visual mode 74 cit = change XML Tag
75 75 ciw = select inner word
76 :%s/foo/bar/g = replace all foo with bar 76 caw = select 'a word'
77 :g/foo/s/bar//g = on lines with foo replace bar with nothing 77 " where c can be replaced by v for visual mode
78 :g!/foo/s/bar//g = on lines not containing foo replace bar with nothing 78
79 :g!/^foo/execute("normal dd") delete lines starting with foo 79 :%s/foo/bar/g = replace all foo with bar
80 80 :g/foo/s/bar//g = on lines with foo replace bar with nothing
81 flags, end: after the last / 81 :g!/foo/s/bar//g = on lines not containing foo replace bar with nothing
82 g = replace globally (all occurances on the current line) 82 :g!/^foo/execute("normal dd") delete lines starting with foo
83 c = confirm each replace, also allows to switch to g (use the flag to see the help message) 83
84 e = places the cursor in the end of the selection 84 flags, end: after the last /
85 85 g = replace globally (all occurances on the current line)
86 flags, within the search string: 86 c = confirm each replace, also allows to switch to g (use the flag to see the help message)
87 \v = use very magic search (more like perl) 87 e = places the cursor in the end of the selection
88 \V = use no very magic, more like searching verbatim 88
89 \zs .. \ze = mark begin and end of a sub pattern (like perl lookaround assertions) 89 flags, within the search string:
90 90 \v = use very magic search (more like perl)
91 [visual mode] # with selected lines 91 \V = use no very magic, more like searching verbatim
92 gq = formats text so that it fits in whatever :set textwidth was set 92 \zs .. \ze = mark begin and end of a sub pattern (like perl lookaround assertions)
93 iB = select block between curly braces (:help object-select) 93
94 94### visual mode (with selected lines)
95 [commands] 95
96 command line mode begins with : and has its own key mappings starting with c like in cnormap 96 gq = formats text so that it fits in whatever :set textwidth was set
97 97 iB = select block between curly braces (:help object-select)
98 :spell [word] = adds a word to the current dictionary (no mistake any more) 98
99 :set list = display non printable characters 99### command line mode
100 :retab = replaces tabs with spaces 100command line mode begins with : and has its own key mappings starting with c
101 :set expandtab = in insert mode: replace tab with spaces 101like in cnormap
102 :Explore = cli version open file dialog (file explorer) 102
103 :Lex = use netrw as project drawer (stays open in its own window) 103 :spell [word] = adds a word to the current dictionary (no mistake any more)
104 :only = 'maximize' current buffer 104 :set list = display non printable characters
105 105 :retab = replaces tabs with spaces
106 <c-r><c-w> = auto completion with the word under the cursor (interesting with incsearch) 106 :set expandtab = in insert mode: replace tab with spaces
107 <c-a> = expand pattern from command line (e.g. *.txt) 107 :Explore = cli version open file dialog (file explorer)
108 108 :Lex = use netrw as project drawer (stays open in its own window)
109 [navigation] 109 :only = 'maximize' current buffer
110 <CTRL-]> = look up the tag under the cursor (help links as well) 110
111 <CTRL-T> = return back from tag under the cursor 111
112 gd = jump to the declaration of the variable under the cursor 112### insert mode
113 113
114 [macros] # record and play back a series of vim commands 114 <c-r><c-w> = auto completion with the word under the cursor (interesting with incsearch)
115 qa = start (q) macro recording in register a (can be anything) 115 <c-a> = expand pattern from command line (e.g. *.txt)
116 q = stop macro recording 116
117 @a = replay macro a 117### navigation
118 :'<,'>normal @a = apply a to every line in the current selection 118
119 :reg = lists all registers (including those with macros in them) 119 <CTRL-]> = look up the tag under the cursor (help links as well)
120 120 <CTRL-T> = return back from tag under the cursor
121 [registers] 121 gd = jump to the declaration of the variable under the cursor
122 notice, that registers get used for both: macro recordings and copying text 122
123 123### macros
124 :reg = shows contents of all registers 124record and play back a series of vim commands
125 "0p = pasts from register 0, which is the same as "", but not overwritten by dd 125
126 "ap = same for register a 126 qa = start (q) macro recording in register a (can be anything)
127 "0yy = yanks to register 0 (same as y by itself) 127 q = stop macro recording
128 "ay = yanks current selection to register a (in visual mode) 128 @a = replay macro a
129 129 :'<,'>normal @a = apply a to every line in the current selection
130 [marker] 130 :reg = lists all registers (including those with macros in them)
131 ma = set marker a-z (a in this case) 131
132 mA = create a session persistent file marker which can be used to reopen a file (not bound to the buffer) 132### registers
133 `a = go to marker a (line & column) 133notice, that registers get used for both: macro recordings and copying text
134 'a = go to marker a (line, first non blank), same as `a^ 134
135 135 :reg = shows contents of all registers
136 [hotkeys] 136 "0p = pasts from register 0, which is the same as "", but not overwritten by dd
137 <C-A>, <C-X> = increment, decrement number under the cursor 137 "ap = same for register a
138 138 "0yy = yanks to register 0 (same as y by itself)
139 [windows] 139 "ay = yanks current selection to register a (in visual mode)
140 <C-W>v = splits buffer vertically (screen uses |) 140
141 <C-W>s = splits buffer horizontally (same as screen) 141### marker
142 <C-W>w = moves the cursor to the next window and back 142
143 <C-W>[dir] = moves the cursor in that direction (use hjkl or arrow keys) 143 ma = set marker a-z (a in this case)
144 <C-W>[HK] = make a vertical split horizontal and vice versa 144 mA = create a session persistent file marker which can be used to reopen a file (not bound to the buffer)
145 <C-W>o = only: close all other windows 145 `a = go to marker a (line & column)
146 <C-W>c = close: current window in which the cursor sits 146 'a = go to marker a (line, first non blank), same as `a^
147 147
148 [vimdiff] 148### other hotkeys
149 do = get changes from other window into the current 149
150 dp = put changes from current window into the other 150 <C-A>, <C-X> = increment, decrement number under the cursor
151 ]c = jump to the next change 151
152 [c = jump to the prevous change 152## windows
153 153
154 [folds] 154 <C-w>v = splits buffer vertically (screen uses |)
155 za = toggle a fold 155 <C-w>s = splits buffer horizontally (same as screen)
156 zM = close all folds 156 <C-w>w = moves the cursor to the next window and back
157 zR = opens all folds (unfold all) 157 <C-w>[dir] = moves the cursor in that direction (use hjkl or arrow keys)
158 zE = eliminates all folds 158 <C-w>[HK] = make a vertical split horizontal and vice versa
159 159 <C-w>o = only: close all other windows
160 [buffers] 160 <C-w>c = close: current window in which the cursor sits
161 :bn = buffer next 161
162 :bp = buffer previous 162### vimdiff
163 :bd = buffer dispatch (close) 163
164 :b <tab> = switch buffer by name (use <tab> and <return>) 164 do = get changes from other window into the current
165 :set nobuflisted = hide buffer in buffer list (great for neovim's terminal) 165 dp = put changes from current window into the other
166 166 ]c = jump to the next change
167 [args] 167 [c = jump to the prevous change
168 :n **/*.c = opens all files with that name or type in buffers and also fills the argument list 168
169 169### folds
170 [special] 170
171 g CTRL-g = display file properties including word and char count 171 za = toggle a fold
172 q: = show command history and use it like a normal buffer 172 zM = close all folds
173 z= = show spellcheck suggestions 173 zR = opens all folds (unfold all)
174 174 zE = eliminates all folds
175 [completions] 175
176 CTRL-O = display completions: omnicomplete (context dependant completions) 176### buffers
177 177
178 CTRL-X CTRL-F = display completions: file name (using vim-internals omnicomplete) 178 :bn = buffer next
179 CTRL-N CTRL-P = display completions: file keywords 179 :bp = buffer previous
180 CTRL-K = display completions: dictionary 180 :bd = buffer dispatch (close)
181 CTRL-T = display completions: thesaurus 181 :b <tab> = switch buffer by name (use <tab> and <return>)
182 CTRL-I = display completions: include files 182 :set nobuflisted = hide buffer in buffer list (great for neovim's terminal)
183 CTRL-] = display completions: tags 183
184 CTRL-D = display completions: (marcro-) definitions 184### args
185 CTRL-V = display completions: vim command line 185
186 CTRL-U = display completions: user-defined 186 :n **/*.c = opens all files with that name or type in buffers and also fills the argument list
187 187
188 [annoyances] 188### special
189 gv = visual mode: reselect last selection 189
190 CTRL-o = lets the caret jump back to the previous location 190 g CTRL-g = display file properties including word and char count
191 CTRL-L = redraws the complete screen 191 q: = show command history and use it like a normal buffer
192 CTRL-R<register> = in insert mode and command line: paste contents of <register> (e.g. : for last command, * for clipboard) 192 z= = show spellcheck suggestions
193 CTRL-R = in normal mode: redoes what has been undone with u 193
194 "<register>p = in normal mode: paste paste contents of <register> 194### completions
195 195
196 [registers] 196 CTRL-O = display completions: omnicomplete (context dependant completions)
197 "/ = last search expression 197 CTRL-X CTRL-F = display completions: file name (using vim-internals omnicomplete)
198 ": = last command entered 198 CTRL-N CTRL-P = display completions: file keywords
199 "= = expression register (to do calculations or call vim functions) 199 CTRL-K = display completions: dictionary
200 200 CTRL-T = display completions: thesaurus
201 [netrw] 201 CTRL-I = display completions: include files
202 :Lex = open the netrw-view as project drawer 202 CTRL-] = display completions: tags
203 gn = makes the directory under the cursor the root directory 203 CTRL-D = display completions: (marcro-) definitions
204 a = toggles display of hidden files 204 CTRL-V = display completions: vim command line
205 205 CTRL-U = display completions: user-defined
206 [filetype:css] 206
207 viB:sort = sort inner block by name 207### annoyances
208 208 gv = visual mode: reselect last selection
209 [vim commands] 209 CTRL-o = lets the caret jump back to the previous location
210 :for i in range(1,12) | put ='2016-'.i | endfor 210 CTRL-l = redraws the complete screen
211 211 CTRL-R<register> = in insert mode and command line: paste contents of <register> (e.g. : for last command, * for clipboard)
212 [fancy utf-8 symbols] 212 CTRL-R = in normal mode: redoes what has been undone with u
213 ௵ 213 "<register>p = in normal mode: paste paste contents of <register>
214 214
215 [debugging] 215### registers
216 :profile! start /tmp/profile.log 216 "/ = last search expression
217 :profile func * 217 ": = last command entered
218 :profile file * 218 "= = expression register (to do calculations or call vim functions)
219 " At this point do slow actions 219
220 :profdel * 220### netrw
221 :e /tmp/profile.log 221 :Lex = open the netrw-view as project drawer
222 " add a break point to a vim script (like vimrc) to invoke the internal debugger 222 gn = makes the directory under the cursor the root directory
223 :breakadd here 223 a = toggles display of hidden files
224 224
225 :finish = from within a viml-script: stop sourcing it 225### filetype:css
226 226
227 [substitutions] 227 viB:sort = sort inner block by name
228 delete all comments: %s/\/\*\*< [^(\*\/)]*\*\///g 228
229 remove empty lines: global/^$/d 229### vim commands
230 remove non-empty lines: v/^$/d 230
231 231 :for i in range(1,12) | put ='2016-'.i | endfor
232 [programs] 232
233 gpm - cut and paste helper for the linux console (to get text from CTRL-ALT-F2 to CTRL-ALT-F3) 233### debugging
234 234
235 [vim modeline] 235 :profile! start /tmp/profile.log
236 filetype can have multiple values, like python.django 236 :profile func *
237 The last line can be a mode line, which holds settings like tab width: 237 :profile file *
238 " At this point do slow actions
239 :profdel *
240 :e /tmp/profile.log
241 " add a break point to a vim script (like vimrc) to invoke the internal debugger
242 :breakadd here
243 :finish = from within a viml-script: stop sourcing it
244
245### substitutions
246
247 delete all comments: %s/\/\*\*< [^(\*\/)]*\*\///g
248 remove empty lines: global/^$/d
249 remove non-empty lines: v/^$/d
250
251### programs
252
253 gpm - cut and paste helper for the linux console (to get text from CTRL-ALT-F2 to CTRL-ALT-F3)
254
255### vim modeline
256
257 filetype can have multiple values, like python.django
258 The last line can be a mode line, which holds settings like tab width:
238 259
239 260
240 261
diff --git a/after/syntax/log.vim b/after/syntax/log.vim
index 44223e6..99b677f 100755
--- a/after/syntax/log.vim
+++ b/after/syntax/log.vim
@@ -14,7 +14,7 @@ syn match Info / INFO / fold
14syn match Pass / PASS / fold 14syn match Pass / PASS / fold
15 15
16 16
17silent! lvimgrep /[^ ]* \(ERROR\|WARNING\|FAIL\) / % 17silent! lvimgrep /\(ERROR\|WARNING\|FAIL\)/ %
18lopen 12 18lopen 12
19 19
20 20
diff --git a/after/syntax/markdown.vim b/after/syntax/markdown.vim
index 7bdbf46..e012ee4 100755
--- a/after/syntax/markdown.vim
+++ b/after/syntax/markdown.vim
@@ -1,12 +1,12 @@
1" Custom conceal 1" Custom conceal
2" syntax region todolist start="^\s*[\+-\*x ]" end="\s" contained keepend 2" syntax region todolist start="^\s*[\+-\*x ]" end="\s" contained keepend
3 3
4 4syntax match markdownConceal "\[\ \]" conceal cchar=ó°„±
5syntax match markdownConceal "\[\ \]" contained conceal cchar= 5syntax match markdownConceal "\[x\]" conceal cchar=󰰰
6syntax match markdownConceal "\[x\]" contained conceal cchar= 6syntax match markdownConceal "\[v\]" conceal cchar=󰄵
7syntax match markdownConceal "*" contained conceal cchar=ï‘„ 7syntax match markdownConceal "*" conceal cchar=ï‘„
8syntax match markdownConceal "-" contained conceal cchar=ï…† 8syntax match markdownConceal "-" conceal cchar=ï…†
9syntax match markdownConceal "+" contained conceal cchar= 9syntax match markdownConceal "+" conceal cchar=
10 10
11syntax region 11syntax region
12 \ markdownItemization 12 \ markdownItemization
diff --git a/init.lua b/init.lua
index ce9d584..a68778d 100644
--- a/init.lua
+++ b/init.lua
@@ -1,67 +1,46 @@
1-------------------------------------------------------------------------------- 1--------------------------------------------------------------------------------
2-- lazy plugin manager 2-- vim options, first sourced from vimrc, then appended by Neovim specific stuff
3--------------------------------------------------------------------------------
4local configdir = vim.fn.fnamemodify(vim.fn.expand("$MYVIMRC"), ":p:h")
5vim.cmd('source ' .. configdir .. '/vimrc')
6
7vim.opt.encoding='utf-8'
8vim.opt.inccommand = "nosplit" -- Neovim only: preview substitute and such things in real time
9vim.opt.shadafile = configdir .. "/shada.file"
10
11--------------------------------------------------------------------------------
12-- Bootstrap lazy.nvim
3-------------------------------------------------------------------------------- 13--------------------------------------------------------------------------------
4local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" 14local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
5if not (vim.uv or vim.loop).fs_stat(lazypath) then 15if not (vim.uv or vim.loop).fs_stat(lazypath) then
6 vim.fn.system({ 16 local lazyrepo = "https://github.com/folke/lazy.nvim.git"
7 "git", 17 local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
8 "clone", 18 if vim.v.shell_error ~= 0 then
9 "--filter = blob:none", 19 vim.api.nvim_echo({
10 "https://github.com/folke/lazy.nvim.git", 20 { "Failed to clone lazy.nvim:\n", "ErrorMsg" },
11 "--branch = stable", -- latest stable release 21 { out, "WarningMsg" },
12 lazypath, 22 { "\nPress any key to exit..." },
13 }) 23 }, true, {})
24 vim.fn.getchar()
25 os.exit(1)
26 end
14end 27end
15vim.opt.rtp:prepend(lazypath) 28vim.opt.rtp:prepend(lazypath)
29
16require("lazy").setup({ 30require("lazy").setup({
17 'nvim-tree/nvim-web-devicons', 31 spec = {
18 'lewis6991/gitsigns.nvim', 32 { import = "plugins", },
19 'folke/neodev.nvim',
20 'neovim/nvim-lspconfig',
21 'hrsh7th/cmp-nvim-lsp',
22 'hrsh7th/cmp-buffer',
23 'hrsh7th/cmp-path',
24 'hrsh7th/cmp-cmdline',
25 'hrsh7th/nvim-cmp',
26 'hrsh7th/vim-vsnip',
27 'octaltree/cmp-look',
28 'L3MON4D3/LuaSnip',
29 'saadparwaiz1/cmp_luasnip',
30 'RRethy/base16-nvim',
31 'nvim-treesitter/nvim-treesitter',
32 'nvim-lua/popup.nvim',
33 'nvim-lua/plenary.nvim',
34 'nvim-telescope/telescope.nvim',
35 'nvim-telescope/telescope-media-files.nvim',
36 'coderonline/vim-fancy-line', 33 'coderonline/vim-fancy-line',
37 'coderonline/vim-recently-used', 34 'coderonline/vim-recently-used',
38 'norcalli/nvim-colorizer.lua', 35 }
39 'folke/trouble.nvim',
40}) 36})
41 37
42--------------------------------------------------------------------------------
43-- vim options, first sourced from vimrc, then appended by Neovim specific stuff
44--------------------------------------------------------------------------------
45local configdir = vim.fn.fnamemodify(vim.fn.expand("$MYVIMRC"), ":p:h")
46vim.cmd('source ' .. configdir .. '/vimrc')
47vim.cmd.colorscheme "base16-rebecca"
48-- vim.cmd.colorscheme "base16-katy"
49
50vim.opt.encoding = 'utf-8'
51vim.opt.number = true
52vim.opt.number = true
53vim.opt.shiftwidth = 2
54vim.opt.tabstop = 2
55vim.opt.softtabstop = 2
56vim.opt.inccommand = "nosplit" -- Neovim only: preview substitute and such things in real time
57vim.opt.termguicolors = true
58vim.opt.shadafile = configdir .. "/shada.file"
59
60-- Restore cursor position 38-- Restore cursor position
61vim.api.nvim_create_autocmd({ "BufReadPost" }, { 39vim.api.nvim_create_autocmd({ "BufReadPost" }, {
62 callback = function() vim.cmd('silent! normal! g`"zv') end 40 callback = function() vim.cmd('silent! normal! g`"zv') end
63}) 41})
64 42
43-- LSP says 'fix available', but there is no such command? Let us fix that:
65vim.api.nvim_create_user_command( 44vim.api.nvim_create_user_command(
66 'LspFix', 45 'LspFix',
67 function() 46 function()
@@ -69,13 +48,21 @@ vim.api.nvim_create_user_command(
69 end, {} 48 end, {}
70) 49)
71 50
51-- speaking of lsp, lets enable logging (TODO: remove if you remove
52-- `lua/cmp.lua`, but why would you?)
53vim.g.lsp_log_verbose = 1
54vim.g.lsp_log_file = configdir .. ('/vim-lsp.log')
55vim.lsp.set_log_level 'error'
56if vim.fn.has 'nvim-0.5.1' == 1 then
57 require('vim.lsp.log').set_format_func(vim.inspect)
58end
59
60-- If you need scoop for some dependencies on Windows machines this may come
61-- handy:
72if vim.fn.has("win32") then 62if vim.fn.has("win32") then
73 vim.opt.rtp:append(vim.fn.expand("$HOME\\scoop\\shims")) 63 vim.opt.rtp:append(vim.fn.expand("$HOME\\scoop\\shims"))
74end 64end
75 65
76vim.g.lsp_log_verbose = 1
77vim.g.lsp_log_file = configdir .. ('/vim-lsp.log')
78
79if vim.g.neovide then 66if vim.g.neovide then
80 vim.guifont = "monospace:h11:b" 67 vim.guifont = "monospace:h11:b"
81 vim.g.neovide_cursor_animation_length = 0.03 68 vim.g.neovide_cursor_animation_length = 0.03
@@ -90,192 +77,4 @@ if vim.g.neovide then
90 vim.g.neovide_scale_factor = 1.0 77 vim.g.neovide_scale_factor = 1.0
91end 78end
92 79
93--------------------------------------------------------------------------------
94-- plugin setup and options
95--------------------------------------------------------------------------------
96require'nvim-treesitter.configs'.setup {
97 -- A list of parser names, or "all" (the five listed parsers should always be installed)
98 ensure_installed = { "c", "lua", "vim", "vimdoc", "query" },
99 modules = {},
100 -- Install parsers synchronously (only applied to `ensure_installed`)
101 sync_install = false,
102 -- Automatically install missing parsers when entering buffer
103 -- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally
104 auto_install = true,
105 ignore_install = { "javascript" },
106 highlight = {
107 enable = true,
108 -- NOTE: these are the names of the parsers and not the filetype. (for example if you want to
109 -- disable highlighting for the `tex` filetype, you need to include `latex` in this list as this is
110 -- the name of the parser)
111 -- list of language that will be disabled
112 disable = function(_, buf)
113 local max_filesize = 100 * 1024 -- 100 KB
114 local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf))
115 if ok and stats and stats.size > max_filesize then
116 return true
117 end
118 end,
119 -- Setting this to true will run `:h syntax` and tree-sitter at the same time.
120 -- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
121 -- Using this option may slow down your editor, and you may see some duplicate highlights.
122 -- Instead of true it can also be a list of languages
123 additional_vim_regex_highlighting = false,
124 },
125}
126
127-- vim.wo.foldtext = 'v:lua.vim.treesitter.foldtext()' -- not available yet in my installation
128vim.wo.foldexpr = 'v:lua.vim.treesitter.foldexpr()'
129vim.wo.foldlevel = 1
130
131require('telescope').load_extension('media_files')
132
133vim.lsp.set_log_level 'error'
134if vim.fn.has 'nvim-0.5.1' == 1 then
135 require('vim.lsp.log').set_format_func(vim.inspect)
136end
137require'nvim-web-devicons'.setup {
138 color_icons = true;
139 default = true;
140 strict = true;
141}
142require('colorizer').setup()
143require('gitsigns').setup()
144require('trouble').setup()
145require('neodev').setup()
146
147local builtin = require('telescope.builtin')
148vim.keymap.set('n', '<leader>ff', builtin.find_files, {})
149vim.keymap.set('n', '<leader>fg', builtin.live_grep, {})
150vim.keymap.set('n', '<leader>fb', builtin.buffers, {})
151vim.keymap.set('n', '<leader>fh', builtin.help_tags, {})
152
153vim.keymap.set({"i", "s"}, "<leader><Tab>", function() require('luasnip').jump(1) end, {silent = true})
154vim.keymap.set({"i", "s"}, "<leader><S-Tab>", function() require('luasnip').jump(-1) end, {silent = true})
155
156local cmp = require'cmp'
157cmp.setup({
158 snippet = {
159 -- REQUIRED - you must specify a snippet engine
160 expand = function(args)
161 require('luasnip').lsp_expand(args.body) -- For `luasnip` users.
162 -- vim.snippet.expand(args.body) -- For native neovim snippets (Neovim v0.10+)
163 end,
164 },
165 window = {
166 completion = cmp.config.window.bordered(),
167 documentation = cmp.config.window.bordered(),
168 },
169 mapping = cmp.mapping.preset.insert({
170 ['<C-b>'] = cmp.mapping.scroll_docs(-4),
171 ['<C-f>'] = cmp.mapping.scroll_docs(4),
172 ['<C-Space>'] = cmp.mapping.complete(),
173 ['<C-e>'] = cmp.mapping.abort(),
174 ['<CR>'] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
175 }),
176 sources = cmp.config.sources({
177 { name = 'nvim_lsp' },
178 { name = 'luasnip' }, -- For luasnip users.
179 }, {
180 { name = 'buffer' },
181 })
182})
183
184-- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won't work anymore).
185cmp.setup.cmdline({ '/', '?' }, {
186 mapping = cmp.mapping.preset.cmdline({
187 ['<Down>'] = { c = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert }) },
188 ['<Up>'] = { c = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Insert }) },
189 }),
190 sources = {{ name = 'buffer' }}
191})
192
193-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
194cmp.setup.cmdline(':', {
195 mapping = cmp.mapping.preset.cmdline({
196 ['<Down>'] = { c = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert }) },
197 ['<Up>'] = { c = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Insert }) },
198 }),
199 sources = cmp.config.sources(
200 {{ name = 'path' }},
201 {{ name = 'cmdline' }}
202 ),
203 matching = {
204 disallow_symbol_nonprefix_matching = false,
205 disallow_partial_matching = false,
206 disallow_fullfuzzy_matching = false,
207 disallow_fuzzy_matching = false,
208 disallow_partial_fuzzy_matching = false,
209 disallow_prefix_unmatching = false,
210 }
211})
212
213-- Set up lspconfig.
214local capabilities = require('cmp_nvim_lsp').default_capabilities()
215
216-- # Language Servers
217-- https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md
218
219-- C/C++ | clang
220require('lspconfig')['clangd'].setup{capabilities = capabilities}
221-- lua (but not init.lua entirely, hence why neodev)
222require('lspconfig')['lua_ls'].setup { capabilities = capabilities }
223-- require('lspconfig')['java_language_server'].setup{ cmd = { "/usr/share/java/java-language-server/lang_server_linux.sh" }, root_dir = function () return vim.fn.getcwd() end }
224require'lspconfig'.jdtls.setup{}
225-- bash | bash-language-server
226require('lspconfig')['bashls'].setup{capabilities = capabilities}
227-- ccs | vscode-css-languageserver
228require('lspconfig')['cssls'].setup{capabilities = capabilities}
229-- rust | rust-analyzer
230require('lspconfig')['rust_analyzer'].setup{capabilities = capabilities}
231-- javascript | eslint
232require('lspconfig')['eslint'].setup{capabilities = capabilities}
233-- javascript | typescript-language-server
234require('lspconfig')['tsserver'].setup{capabilities = capabilities}
235-- vimscript | vim-language-server
236require('lspconfig')['vimls'].setup{capabilities = capabilities}
237-- html
238require('lspconfig')['html'].setup{capabilities = capabilities}
239-- jsonls
240require('lspconfig')['jsonls'].setup{capabilities = capabilities}
241-- C/C++ | clang
242require('lspconfig')['clangd'].setup{capabilities = capabilities}
243-- bash | bash-language-server
244require('lspconfig')['bashls'].setup{capabilities = capabilities}
245-- ccs | vscode-css-languageserver
246require('lspconfig')['cssls'].setup{capabilities = capabilities}
247-- rust | rust-analyzer
248require('lspconfig')['rust_analyzer'].setup{capabilities = capabilities}
249-- javascript | eslint
250require('lspconfig')['eslint'].setup{capabilities = capabilities}
251-- javascript | typescript-language-server
252require('lspconfig')['tsserver'].setup{capabilities = capabilities}
253-- vimscript | vim-language-server
254require('lspconfig')['vimls'].setup{capabilities = capabilities}
255-- configure html server
256require('lspconfig')["html"].setup({
257 capabilities = capabilities,
258 -- on_attach = on_attach,
259 init_options = {
260 configurationSection = { "html", "css", "javascript" },
261 embeddedLanguages = {
262 css = true,
263 javascript = true,
264 },
265 provideFormatter = true,
266 },
267})
268require('lspconfig')['pylsp'].setup{
269 settings = {
270 pylsp = {
271 plugins = {
272 pycodestyle = {
273 ignore = {'W391'},
274 maxLineLength = 100
275 }
276 }
277 }
278 }
279}
280
281-- vim: tabstop=2 shiftwidth=2 softtabstop=2 80-- vim: tabstop=2 shiftwidth=2 softtabstop=2
diff --git a/lua/plugins/cmp.lua b/lua/plugins/cmp.lua
new file mode 100644
index 0000000..1eb9646
--- /dev/null
+++ b/lua/plugins/cmp.lua
@@ -0,0 +1,157 @@
1return {
2 {
3 'hrsh7th/nvim-cmp',
4 dependencies = {
5 'nvim-lua/popup.nvim',
6 'nvim-lua/plenary.nvim',
7 'saadparwaiz1/cmp_luasnip',
8 "hrsh7th/cmp-emoji",
9 'hrsh7th/cmp-nvim-lsp',
10 'hrsh7th/cmp-buffer',
11 'hrsh7th/cmp-path',
12 'hrsh7th/vim-vsnip',
13 'octaltree/cmp-look',
14 'folke/trouble.nvim',
15 {
16 'L3MON4D3/LuaSnip',
17 config = function()
18 vim.keymap.set(
19 {"i", "s"},
20 "<leader><Tab>",
21 function() require('luasnip').jump(1) end,
22 {silent = true}
23 )
24 vim.keymap.set(
25 {"i", "s"},
26 "<leader><S-Tab>",
27 function() require('luasnip').jump(-1) end,
28 {silent = true}
29 )
30 end,
31 },
32 },
33
34 config = function()
35 require('trouble').setup()
36
37 local cmp = require'cmp'
38 cmp.setup({
39 snippet = {
40 -- REQUIRED - you must specify a snippet engine
41 expand = function(args)
42 require('luasnip').lsp_expand(args.body) -- For `luasnip` users.
43 -- vim.snippet.expand(args.body) -- For native neovim snippets (Neovim v0.10+)
44 end,
45 },
46 window = {
47 completion = cmp.config.window.bordered(),
48 documentation = cmp.config.window.bordered(),
49 },
50 mapping = cmp.mapping.preset.insert({
51 ['<C-b>'] = cmp.mapping.scroll_docs(-4),
52 ['<C-f>'] = cmp.mapping.scroll_docs(4),
53 ['<C-Space>'] = cmp.mapping.complete(),
54 ['<C-e>'] = cmp.mapping.abort(),
55 ['<CR>'] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
56 }),
57 sources = cmp.config.sources({
58 { name = 'nvim_lsp' },
59 { name = 'luasnip' }, -- For luasnip users.
60 }, {
61 { name = 'buffer' },
62 })
63 })
64 end
65 },
66 {
67 'neovim/nvim-lspconfig',
68 dependencies = {
69 { "folke/neodev.nvim" }
70 },
71 config = function()
72 -- Set up lspconfig.
73 local keymap = vim.keymap
74 local on_attach = function(client, bufnr)
75 local opts = { noremap = true, silent = true, buffer = bufnr }
76 keymap.set("n", "gf", "<cmd>Lspsaga lsp_finder<CR>", opts) -- show definition, references
77 keymap.set("n", "gD", "<Cmd>Lspsaga goto_definition<CR>", opts) -- got to declaration
78 keymap.set("n", "gd", "<cmd>Lspsaga peek_definition<CR>", opts) -- see definition and make edits in window
79 keymap.set("n", "gi", "<cmd>lua vim.lsp.buf.implementation()<CR>", opts) -- go to implementation
80 keymap.set("n", "<leader>ca", "<cmd>Lspsaga code_action<CR>", opts) -- see available code actions
81 keymap.set("n", "<leader>rn", "<cmd>Lspsaga rename<CR>", opts) -- smart rename
82 keymap.set("n", "<leader>D", "<cmd>Lspsaga show_line_diagnostics<CR>", opts) -- show diagnostics for line
83 keymap.set("n", "<leader>d", "<cmd>Lspsaga show_cursor_diagnostics<CR>", opts) -- show diagnostics for cursor
84 keymap.set("n", "[d", "<cmd>Lspsaga diagnostic_jump_prev<CR>", opts) -- jump to previous diagnostic in buffer
85 keymap.set("n", "]d", "<cmd>Lspsaga diagnostic_jump_next<CR>", opts) -- jump to next diagnostic in buffer
86 keymap.set("n", "K", "<cmd>Lspsaga hover_doc<CR>", opts) -- show documentation for what is under cursor
87 keymap.set("n", "<leader>o", "<cmd>LSoutlineToggle<CR>", opts) -- see outline on right hand side
88 keymap.set("n", "gr", "<cmd>lua vim.lsp.buf.references()<CR>", opts)
89 vim.keymap.set("n", "<C-n>", ":cnext<CR>")
90 vim.keymap.set("n", "<C-p>", ":cprev<CR>")
91 end
92
93 local capabilities = require("cmp_nvim_lsp").default_capabilities()
94
95 -- # Language Servers
96 -- https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md
97 for _,server in ipairs({
98 'bitbake_language_server',
99 "clangd", -- C/C++ | clang
100 "ts_ls", -- javascript | typescript-language-server
101 "lua_ls", -- lua (but not init.lua entirely, hence why neodev)
102 "jdtls",
103 "html",
104 "cssls", -- ccs | vscode-css-languageserver
105 "rust_analyzer", -- rust | rust-analyzer
106 "eslint", -- javascript | eslint
107 'vimls', -- vimscript | vim-language-server
108 'html', -- html
109 'jsonls', -- jsonls
110 "pyright", -- python
111 "bashls", -- bash | bash-language-server
112 "gopls",
113 "emmet_ls",
114 "marksman"}) do
115 require("lspconfig")[server].setup({
116 capabilities = capabilities,
117 on_attach = on_attach
118 })
119 end
120
121 -- # specialized config for some LSPs which have non-ideal defaults
122 --
123 -- require('lspconfig')['java_language_server'].setup{ cmd = { "/usr/share/java/java-language-server/lang_server_linux.sh" }, root_dir = function () return vim.fn.getcwd() end }
124 -- configure html server
125 require('lspconfig')["html"].setup({
126 init_options = {
127 configurationSection = { "html", "css", "javascript" },
128 embeddedLanguages = {
129 css = true,
130 javascript = true,
131 },
132 provideFormatter = true,
133 },
134 })
135 require('lspconfig')['pylsp'].setup{
136 settings = {
137 pylsp = {
138 plugins = {
139 pycodestyle = {
140 ignore = {'W391'},
141 maxLineLength = 100
142 }
143 }
144 }
145 }
146 }
147 require("lspconfig").clangd.setup {
148 on_attach = on_attach,
149 capabilities = capabilities,
150 cmd = {
151 "clangd",
152 "--offset-encoding=utf-16",
153 },
154 }
155 end
156 }
157}
diff --git a/lua/plugins/colorizer.lua b/lua/plugins/colorizer.lua
new file mode 100644
index 0000000..416f2d1
--- /dev/null
+++ b/lua/plugins/colorizer.lua
@@ -0,0 +1,6 @@
1return {
2 'norcalli/nvim-colorizer.lua',
3 config = function()
4 require('colorizer').setup()
5 end,
6}
diff --git a/lua/plugins/colorscheme.lua b/lua/plugins/colorscheme.lua
new file mode 100644
index 0000000..a73b1e8
--- /dev/null
+++ b/lua/plugins/colorscheme.lua
@@ -0,0 +1,6 @@
1return {
2 'RRethy/base16-nvim',
3 config = function()
4 vim.cmd.colorscheme "base16-rebecca"
5 end,
6}
diff --git a/lua/plugins/devicons.lua b/lua/plugins/devicons.lua
new file mode 100644
index 0000000..9e69c5f
--- /dev/null
+++ b/lua/plugins/devicons.lua
@@ -0,0 +1,11 @@
1
2return {
3 'nvim-tree/nvim-web-devicons',
4 config = function()
5 require'nvim-web-devicons'.setup {
6 color_icons = true;
7 default = true;
8 strict = true;
9 }
10 end,
11}
diff --git a/lua/plugins/fzf.lua b/lua/plugins/fzf.lua
new file mode 100644
index 0000000..f3fc76b
--- /dev/null
+++ b/lua/plugins/fzf.lua
@@ -0,0 +1,4 @@
1return {
2 'junegunn/fzf',
3 'junegunn/fzf.vim',
4}
diff --git a/lua/plugins/gitsigns.lua b/lua/plugins/gitsigns.lua
new file mode 100644
index 0000000..d88bf68
--- /dev/null
+++ b/lua/plugins/gitsigns.lua
@@ -0,0 +1,6 @@
1return {
2 'lewis6991/gitsigns.nvim',
3 config = function()
4 require('gitsigns').setup()
5 end,
6}
diff --git a/lua/plugins/lspsaga.lua b/lua/plugins/lspsaga.lua
new file mode 100644
index 0000000..ff7867b
--- /dev/null
+++ b/lua/plugins/lspsaga.lua
@@ -0,0 +1,10 @@
1return {
2 'nvimdev/lspsaga.nvim',
3 config = function()
4 require('lspsaga').setup({})
5 end,
6 dependencies = {
7 'nvim-treesitter/nvim-treesitter', -- optional
8 'nvim-tree/nvim-web-devicons', -- optional
9 }
10}
diff --git a/lua/plugins/orgmode.lua b/lua/plugins/orgmode.lua
new file mode 100644
index 0000000..a9d6ea0
--- /dev/null
+++ b/lua/plugins/orgmode.lua
@@ -0,0 +1,11 @@
1return {
2 'nvim-orgmode/orgmode',
3 event = 'VeryLazy',
4 ft = { 'org' },
5 config = function()
6 require('orgmode').setup({
7 org_agenda_files = '~/orgfiles/**/*',
8 org_default_notes_file = '~/orgfiles/refile.org',
9 })
10 end,
11}
diff --git a/lua/plugins/popup.lua b/lua/plugins/popup.lua
new file mode 100644
index 0000000..0ff2e3a
--- /dev/null
+++ b/lua/plugins/popup.lua
@@ -0,0 +1,5 @@
1return {
2 'nvim-lua/plenary.nvim',
3 'nvim-lua/popup.nvim',
4}
5
diff --git a/lua/plugins/telescope.lua b/lua/plugins/telescope.lua
new file mode 100644
index 0000000..fee09df
--- /dev/null
+++ b/lua/plugins/telescope.lua
@@ -0,0 +1,15 @@
1return {
2 'nvim-telescope/telescope.nvim',
3 dependencies = {
4 'nvim-telescope/telescope-media-files.nvim'
5 },
6 config = function()
7 require('telescope').load_extension('media_files')
8
9 local builtin = require('telescope.builtin')
10 vim.keymap.set('n', '<leader>ff', builtin.find_files, {})
11 vim.keymap.set('n', '<leader>fg', builtin.live_grep, {})
12 vim.keymap.set('n', '<leader>fb', builtin.buffers, {})
13 vim.keymap.set('n', '<leader>fh', builtin.help_tags, {})
14 end,
15}
diff --git a/lua/plugins/treesitter.lua b/lua/plugins/treesitter.lua
new file mode 100644
index 0000000..9673f63
--- /dev/null
+++ b/lua/plugins/treesitter.lua
@@ -0,0 +1,20 @@
1return {
2 -- treesitter is experimental and breaks indentation on xml, html with `=`
3 -- treesitter is optional for orgmode, but without it syntax highlighting in
4 -- org files is broken
5 'nvim-treesitter/nvim-treesitter',
6 config = function()
7 require'nvim-treesitter.configs'.setup {
8 ensure_installed = {"c", "html", "css", "javascript", "org"},
9 sync_install = false,
10 auto_install = true,
11 ignore_install = {},
12 disable = { },
13 modules = { "all" },
14 highlight = {
15 enable = true,
16 }
17 }
18 end
19}
20
diff --git a/vimrc b/vimrc
index f3b1833..3d96799 100644
--- a/vimrc
+++ b/vimrc
@@ -1,6 +1,7 @@
1"======================================================================================================================= 1"=======================================================================================================================
2" GENERAL 2" GENERAL
3"======================================================================================================================= 3"=======================================================================================================================
4set termguicolors
4 5
5filetype on 6filetype on
6filetype plugin on 7filetype plugin on
@@ -24,9 +25,10 @@ set hlsearch incsearch | " highlight pattern while entering i
24" set cindent cinoptions+=(0 | " indents at the level of parentheses -- if desired 25" set cindent cinoptions+=(0 | " indents at the level of parentheses -- if desired
25set expandtab | " replace tabs with spaces 26set expandtab | " replace tabs with spaces
26set textwidth=0 | " should be set file type specific, colorcolumns is there to assist anyways 27set textwidth=0 | " should be set file type specific, colorcolumns is there to assist anyways
27set tabstop=4 28
28set shiftwidth=4 29set tabstop=2 | " I am sorry, but 2 is simply better
29set softtabstop=4 30set shiftwidth=2 | " .
31set softtabstop=2 | " .
30 32
31"======================================================================================================================= 33"=======================================================================================================================
32" PATH -- where to search for includes (e.g. `gf` or `:find`) 34" PATH -- where to search for includes (e.g. `gf` or `:find`)
@@ -386,4 +388,4 @@ augroup END
386 388
387"======================================================================================================================= 389"=======================================================================================================================
388" v modeline, do not chnage v 390" v modeline, do not chnage v
389" vim: noai:ts=2:sw=2:sts=2 iskeyword+=\:,\<,\>,\-,\& number 391" vim: noai:ts=2:sw=2:sts=2 iskeyword+=\:\<,\>,\-,\& number
..