diff options
Diffstat (limited to '.config')
-rw-r--r-- | .config/nvim/lua/autocmds.lua | 2 | ||||
-rw-r--r-- | .config/nvim/lua/functions.lua | 24 | ||||
-rw-r--r-- | .config/nvim/lua/mappings.lua | 15 | ||||
-rw-r--r-- | .config/nvim/lua/plugin_settings.lua | 135 | ||||
-rw-r--r-- | .config/nvim/lua/plugins.lua | 40 | ||||
-rw-r--r-- | .config/nvim/lua/settings.lua | 1 |
6 files changed, 184 insertions, 33 deletions
diff --git a/.config/nvim/lua/autocmds.lua b/.config/nvim/lua/autocmds.lua index 6b3279e..90915db 100644 --- a/.config/nvim/lua/autocmds.lua +++ b/.config/nvim/lua/autocmds.lua | |||
@@ -51,6 +51,7 @@ au.FileType = { | |||
51 | end, | 51 | end, |
52 | } | 52 | } |
53 | 53 | ||
54 | -- gf plugins | ||
54 | au.BufEnter = { | 55 | au.BufEnter = { |
55 | 'init.lua', | 56 | 'init.lua', |
56 | function() | 57 | function() |
@@ -64,4 +65,3 @@ au.BufLeave = { | |||
64 | vim.opt.path:remove("./lua") | 65 | vim.opt.path:remove("./lua") |
65 | end | 66 | end |
66 | } | 67 | } |
67 | |||
diff --git a/.config/nvim/lua/functions.lua b/.config/nvim/lua/functions.lua new file mode 100644 index 0000000..daee597 --- /dev/null +++ b/.config/nvim/lua/functions.lua | |||
@@ -0,0 +1,24 @@ | |||
1 | -- ┌──────────────────────────┐ | ||
2 | -- │▗▀▖ ▐ ▗ │ | ||
3 | -- │▐ ▌ ▌▛▀▖▞▀▖▜▀ ▄ ▞▀▖▛▀▖▞▀▘│ | ||
4 | -- │▜▀ ▌ ▌▌ ▌▌ ▖▐ ▖▐ ▌ ▌▌ ▌▝▀▖│ | ||
5 | -- │▐ ▝▀▘▘ ▘▝▀ ▀ ▀▘▝▀ ▘ ▘▀▀ │ | ||
6 | -- └──────────────────────────┘ | ||
7 | -- 2021-10-10 21:50 WIP, I don't know how to integrate these functions to init.lua and honestly, everything is a nvim_command or something anyway | ||
8 | |||
9 | local random = math.random | ||
10 | |||
11 | local function random_filename() | ||
12 | uuid = '' | ||
13 | for i=0,6 do | ||
14 | uuid = uuid .. (string.format('%x', random(0, 0xf))) | ||
15 | end | ||
16 | return uuid | ||
17 | end | ||
18 | |||
19 | function create_note() | ||
20 | nvim_command("e! " .. nvim_call_function('fnameescape', '~/nextcloud/personal_wiki/text/box/' .. random_filename() .. ".wiki")) | ||
21 | local text = "= up =\n\n= down =\n\n= keywords =\n\n" | ||
22 | nvim_command("put! " .. text) | ||
23 | nvim_command("normal gg") | ||
24 | end | ||
diff --git a/.config/nvim/lua/mappings.lua b/.config/nvim/lua/mappings.lua index 6633134..ffd8610 100644 --- a/.config/nvim/lua/mappings.lua +++ b/.config/nvim/lua/mappings.lua | |||
@@ -93,7 +93,7 @@ map('n', '<leader>nr', ':call CreateReference(expand("<cword>"))<CR>') | |||
93 | -- create a new note | 93 | -- create a new note |
94 | map('n', '<leader>nn', ':call CreateNote()<CR>') | 94 | map('n', '<leader>nn', ':call CreateNote()<CR>') |
95 | 95 | ||
96 | -- plug mappings {{{1 -- | 96 | -- plug mappings {{{ -- |
97 | 97 | ||
98 | -- <Plug> mappings should not be noremap | 98 | -- <Plug> mappings should not be noremap |
99 | -- https://www.reddit.com/r/vim/comments/78izt4/please_help_understand_how_to_use_plug_mapping/ | 99 | -- https://www.reddit.com/r/vim/comments/78izt4/please_help_understand_how_to_use_plug_mapping/ |
@@ -135,11 +135,6 @@ plugmap('n', '<Leader><Leader>ss', '<plug>(SubversiveSubvertWordRange)') | |||
135 | plugmap('n', '<c-n>', '<Plug>(YoinkPostPasteSwapBack)') | 135 | plugmap('n', '<c-n>', '<Plug>(YoinkPostPasteSwapBack)') |
136 | plugmap('n', '<c-p>', '<Plug>(YoinkPostPasteSwapForward)') | 136 | plugmap('n', '<c-p>', '<Plug>(YoinkPostPasteSwapForward)') |
137 | 137 | ||
138 | -- insert mode completion | ||
139 | plugmap('i', '<c-x><c-k>', '<plug>(fzf-complete-word)') | ||
140 | plugmap('i', '<c-x><c-f>', '<plug>(fzf-complete-path)') | ||
141 | plugmap('i', '<c-x><c-l>', '<plug>(fzf-complete-line)') | ||
142 | |||
143 | -- checkmarks on vimwiki | 138 | -- checkmarks on vimwiki |
144 | plugmap('n', '<leader>v', '<Plug>VimwikiToggleListItem') | 139 | plugmap('n', '<leader>v', '<Plug>VimwikiToggleListItem') |
145 | -- add/increase header level | 140 | -- add/increase header level |
@@ -152,4 +147,10 @@ map('n', 't<C-s>', ':TestSuite<CR>') | |||
152 | map('n', 't<C-l>', ':TestLast<CR>') | 147 | map('n', 't<C-l>', ':TestLast<CR>') |
153 | map('n', 't<C-g>', ':TestVisit<CR>') | 148 | map('n', 't<C-g>', ':TestVisit<CR>') |
154 | 149 | ||
155 | -- 1}}} -- | 150 | -- telescope bindings |
151 | map('n', '<leader>ff', "<cmd>lua require('telescope.builtin').find_files()<cr>") | ||
152 | map('n', '<leader>fg', "<cmd>lua require('telescope.builtin').live_grep()<cr>") | ||
153 | map('n', '<leader>fb', "<cmd>lua require('telescope.builtin').buffers()<cr>") | ||
154 | map('n', '<leader>fh', "<cmd>lua require('telescope.builtin').help_tags()<cr>") | ||
155 | |||
156 | -- }}} plug mappings -- | ||
diff --git a/.config/nvim/lua/plugin_settings.lua b/.config/nvim/lua/plugin_settings.lua index 60bbbe1..e9c4cd4 100644 --- a/.config/nvim/lua/plugin_settings.lua +++ b/.config/nvim/lua/plugin_settings.lua | |||
@@ -66,7 +66,7 @@ require'lualine'.setup { | |||
66 | } | 66 | } |
67 | -- }}} requi -- | 67 | -- }}} requi -- |
68 | 68 | ||
69 | -- Cutlass suite {{{1 -- | 69 | -- cutlass suite {{{ -- |
70 | 70 | ||
71 | -- cutlass/yoink/subverse suite | 71 | -- cutlass/yoink/subverse suite |
72 | g.yoinkIncludeDeleteOperations = 1 | 72 | g.yoinkIncludeDeleteOperations = 1 |
@@ -85,7 +85,7 @@ g.clipboard = { | |||
85 | cache_enabled = 1, | 85 | cache_enabled = 1, |
86 | } | 86 | } |
87 | 87 | ||
88 | -- 1}}} -- | 88 | -- }}} cutlass suite -- |
89 | 89 | ||
90 | -- UltiSnips {{{ -- | 90 | -- UltiSnips {{{ -- |
91 | opt.runtimepath:append('/home/yigit/.vim/my-snippets/') | 91 | opt.runtimepath:append('/home/yigit/.vim/my-snippets/') |
@@ -101,12 +101,6 @@ g.beacon_shrink = 1 | |||
101 | cmd('highlight Beacon guibg=red ctermbg=15') | 101 | cmd('highlight Beacon guibg=red ctermbg=15') |
102 | -- }}} beacon -- | 102 | -- }}} beacon -- |
103 | 103 | ||
104 | -- vim-slime {{{ -- | ||
105 | g.slime_target = "tmux" | ||
106 | g.slime_paste_file = "/home/yigit/.slime_paste" | ||
107 | -- g.slime_default_config = {socket_name = get(split($TMUX, ","), 0), target_pane = "{last}"} | ||
108 | -- }}} vim-slime -- | ||
109 | |||
110 | -- vimtex {{{ -- | 104 | -- vimtex {{{ -- |
111 | g.vimtex_view_method = 'zathura' | 105 | g.vimtex_view_method = 'zathura' |
112 | g.vimtex_quickfix_mode = 0 | 106 | g.vimtex_quickfix_mode = 0 |
@@ -138,15 +132,20 @@ g.ledger_fillstring = ' -' | |||
138 | require'nvim-web-devicons'.setup { | 132 | require'nvim-web-devicons'.setup { |
139 | override = { | 133 | override = { |
140 | wiki = { | 134 | wiki = { |
141 | icon = "", | 135 | icon = "", |
142 | color = "#D7827E", | 136 | color = "#D7827E", |
143 | name = "vimwiki" | 137 | name = "vimwiki" |
144 | }, | 138 | }, |
145 | rem = { | 139 | rem = { |
146 | icon = "", | 140 | icon = "", |
147 | color = "#B4637A", | 141 | color = "#B4637A", |
148 | name = "remind" | 142 | name = "remind" |
149 | } | 143 | }, |
144 | mail = { | ||
145 | icon = "", | ||
146 | color = "#907AA9", | ||
147 | name = "mail" | ||
148 | }, | ||
150 | }; | 149 | }; |
151 | 150 | ||
152 | default = true | 151 | default = true |
@@ -193,7 +192,115 @@ g.gutentags_ctags_exclude = { | |||
193 | } | 192 | } |
194 | -- }}} gutentags -- | 193 | -- }}} gutentags -- |
195 | 194 | ||
196 | -- float preview | 195 | -- telescope {{{ -- |
196 | require('telescope').setup { | ||
197 | extensions = { | ||
198 | fzf = { | ||
199 | fuzzy = true, -- false will only do exact matching | ||
200 | override_generic_sorter = true, -- override the generic sorter | ||
201 | override_file_sorter = true, -- override the file sorter | ||
202 | case_mode = "smart_case", -- or "ignore_case" or "respect_case" | ||
203 | -- the default case_mode is "smart_case" | ||
204 | } | ||
205 | } | ||
206 | } | ||
207 | |||
208 | require('telescope').load_extension('fzf') | ||
209 | -- }}} telescope -- | ||
210 | |||
211 | -- dashboard {{{ -- | ||
212 | g.dashboard_default_executive = 'telescope' | ||
213 | g.dashboard_preview_command = 'cat' | ||
214 | g.dashboard_preview_pipeline = 'lolcat' | ||
215 | g.dashboard_preview_file = '~/.config/nvim/neovim.cat' | ||
216 | g.dashboard_preview_file_height = 14 | ||
217 | g.dashboard_preview_file_width = 90 | ||
218 | -- }}} dashboard -- | ||
219 | |||
220 | -- treesitter {{{ -- | ||
221 | |||
222 | require'nvim-treesitter.configs'.setup { | ||
223 | ensure_installed = "maintained", | ||
224 | ignore_install = { "javascript" }, | ||
225 | highlight = { | ||
226 | enable = true, | ||
227 | additional_vim_regex_highlighting = false, | ||
228 | }, | ||
229 | } | ||
230 | -- }}} treesitter -- | ||
231 | |||
232 | -- nvim-cmp {{{ -- | ||
233 | local cmp = require'cmp' | ||
234 | |||
235 | cmp.setup({ | ||
236 | snippet = { | ||
237 | expand = function(args) | ||
238 | vim.fn["UltiSnips#Anon"](args.body) | ||
239 | end, | ||
240 | }, | ||
241 | mapping = { | ||
242 | ['<C-d>'] = cmp.mapping.scroll_docs(-4), | ||
243 | ['<C-f>'] = cmp.mapping.scroll_docs(4), | ||
244 | ['<C-Space>'] = cmp.mapping.complete(), | ||
245 | ['<C-e>'] = cmp.mapping.close(), | ||
246 | ['<C-l>'] = cmp.mapping.confirm({ select = true }), | ||
247 | }, | ||
248 | sources = { | ||
249 | { name = 'nvim_lsp' }, | ||
250 | { name = 'ultisnips' }, | ||
251 | { name = 'buffer' }, | ||
252 | { name = "latex_symbols" }, | ||
253 | } | ||
254 | }) | ||
255 | |||
256 | -- }}} nvim-cmp -- | ||
257 | |||
258 | -- nvim-lsp {{{ -- | ||
259 | local nvim_lsp = require('lspconfig') | ||
260 | |||
261 | local on_attach = function(client, bufnr) | ||
262 | local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end | ||
263 | local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end | ||
264 | |||
265 | -- Enable completion triggered by <c-x><c-o> | ||
266 | buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc') | ||
267 | |||
268 | -- Mappings. | ||
269 | local opts = { noremap=true, silent=true } | ||
270 | |||
271 | -- See `:help vim.lsp.*` for documentation on any of the below functions | ||
272 | buf_set_keymap('n', 'gD', '<cmd>lua vim.lsp.buf.declaration()<CR>', opts) | ||
273 | buf_set_keymap('n', 'gd', '<cmd>lua vim.lsp.buf.definition()<CR>', opts) | ||
274 | buf_set_keymap('n', 'vh', '<cmd>lua vim.lsp.buf.hover()<CR>', opts) | ||
275 | buf_set_keymap('n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<CR>', opts) | ||
276 | buf_set_keymap('n', 'vs', '<cmd>lua vim.lsp.buf.signature_help()<CR>', opts) | ||
277 | buf_set_keymap('n', '<leader>wa', '<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>', opts) | ||
278 | buf_set_keymap('n', '<leader>wd', '<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>', opts) | ||
279 | buf_set_keymap('n', '<leader>wl', '<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>', opts) | ||
280 | buf_set_keymap('n', '<leader>D', '<cmd>lua vim.lsp.buf.type_definition()<CR>', opts) | ||
281 | buf_set_keymap('n', '<leader>rn', '<cmd>lua vim.lsp.buf.rename()<CR>', opts) | ||
282 | buf_set_keymap('n', '<leader>ca', '<cmd>lua vim.lsp.buf.code_action()<CR>', opts) | ||
283 | buf_set_keymap('n', 'gr', '<cmd>lua vim.lsp.buf.references()<CR>', opts) | ||
284 | buf_set_keymap('n', '<leader>d', '<cmd>lua vim.lsp.diagnostic.show_line_diagnostics()<CR>', opts) | ||
285 | buf_set_keymap('n', '[d', '<cmd>lua vim.lsp.diagnostic.goto_prev()<CR>', opts) | ||
286 | buf_set_keymap('n', ']d', '<cmd>lua vim.lsp.diagnostic.goto_next()<CR>', opts) | ||
287 | buf_set_keymap('n', '<leader>q', '<cmd>lua vim.lsp.diagnostic.set_loclist()<CR>', opts) | ||
288 | buf_set_keymap('n', '<leader>f', '<cmd>lua vim.lsp.buf.formatting()<CR>', opts) | ||
289 | end | ||
290 | |||
291 | local servers = { 'rust_analyzer', 'jedi_language_server', 'texlab' } | ||
292 | for _, lsp in ipairs(servers) do | ||
293 | nvim_lsp[lsp].setup { | ||
294 | on_attach = on_attach, | ||
295 | flags = { | ||
296 | debounce_text_changes = 150, | ||
297 | }, | ||
298 | capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities()) | ||
299 | } | ||
300 | end | ||
301 | |||
302 | -- }}} nvim-lsp -- | ||
303 | |||
197 | g["float_preview#docked"] = 0 | 304 | g["float_preview#docked"] = 0 |
198 | 305 | ||
199 | -- highlight on yank | 306 | -- highlight on yank |
diff --git a/.config/nvim/lua/plugins.lua b/.config/nvim/lua/plugins.lua index 8233e44..35750e9 100644 --- a/.config/nvim/lua/plugins.lua +++ b/.config/nvim/lua/plugins.lua | |||
@@ -8,12 +8,36 @@ | |||
8 | return require('packer').startup(function() | 8 | return require('packer').startup(function() |
9 | -- packer can manage itself | 9 | -- packer can manage itself |
10 | use 'wbthomason/packer.nvim' | 10 | use 'wbthomason/packer.nvim' |
11 | |||
12 | -- latex suite | 11 | -- latex suite |
13 | use {'lervag/vimtex', ft = {'tex', 'latex', 'plaintext'}} | 12 | use {'lervag/vimtex', ft = {'tex', 'latex', 'plaintext'}} |
14 | 13 | ||
15 | -- still here, going away soon say bye bye | 14 | -- treesitter... |
16 | use 'dense-analysis/ale' | 15 | use { |
16 | 'nvim-treesitter/nvim-treesitter', | ||
17 | run = ':TSUpdate' | ||
18 | } | ||
19 | use 'nvim-treesitter/playground' | ||
20 | |||
21 | -- quickstart lsp config | ||
22 | use 'neovim/nvim-lspconfig' | ||
23 | |||
24 | -- dashboard | ||
25 | use 'glepnir/dashboard-nvim' | ||
26 | |||
27 | -- completion suite | ||
28 | use 'hrsh7th/cmp-nvim-lsp' | ||
29 | use 'hrsh7th/cmp-buffer' | ||
30 | use 'hrsh7th/nvim-cmp' | ||
31 | use 'kdheepak/cmp-latex-symbols' | ||
32 | use 'quangnguyen30192/cmp-nvim-ultisnips' | ||
33 | |||
34 | -- find, filter, preview, pick | ||
35 | use { | ||
36 | 'nvim-telescope/telescope.nvim', | ||
37 | requires = { {'nvim-lua/plenary.nvim'} } | ||
38 | } | ||
39 | use {'nvim-telescope/telescope-fzf-native.nvim', run = 'make' } | ||
40 | |||
17 | -- manages tag files | 41 | -- manages tag files |
18 | use 'ludovicchabant/vim-gutentags' | 42 | use 'ludovicchabant/vim-gutentags' |
19 | -- run tests (todo: write tests) | 43 | -- run tests (todo: write tests) |
@@ -22,7 +46,6 @@ return require('packer').startup(function() | |||
22 | use 'jpalardy/vim-slime' | 46 | use 'jpalardy/vim-slime' |
23 | -- snippets to expand | 47 | -- snippets to expand |
24 | use {'SirVer/ultisnips', 'honza/vim-snippets'} | 48 | use {'SirVer/ultisnips', 'honza/vim-snippets'} |
25 | |||
26 | -- auto pair plugin, people hate these | 49 | -- auto pair plugin, people hate these |
27 | use 'tmsvg/pear-tree' | 50 | use 'tmsvg/pear-tree' |
28 | -- git diff in the sign column | 51 | -- git diff in the sign column |
@@ -30,6 +53,7 @@ return require('packer').startup(function() | |||
30 | -- completion preview of floating window | 53 | -- completion preview of floating window |
31 | use 'ncm2/float-preview.nvim' | 54 | use 'ncm2/float-preview.nvim' |
32 | 55 | ||
56 | |||
33 | -- language packs | 57 | -- language packs |
34 | use "nathom/filetype.nvim" | 58 | use "nathom/filetype.nvim" |
35 | -- i3 config filetype | 59 | -- i3 config filetype |
@@ -39,9 +63,6 @@ return require('packer').startup(function() | |||
39 | -- ledger filetype | 63 | -- ledger filetype |
40 | use 'ledger/vim-ledger' | 64 | use 'ledger/vim-ledger' |
41 | 65 | ||
42 | use {'junegunn/fzf', dir = '~/.fzf'} | ||
43 | use 'junegunn/fzf.vim' | ||
44 | |||
45 | -- file explorer | 66 | -- file explorer |
46 | use 'lambdalisue/fern.vim' | 67 | use 'lambdalisue/fern.vim' |
47 | -- bug in neovim, so required for now | 68 | -- bug in neovim, so required for now |
@@ -59,7 +80,7 @@ return require('packer').startup(function() | |||
59 | -- highlight colors | 80 | -- highlight colors |
60 | use { | 81 | use { |
61 | 'norcalli/nvim-colorizer.lua', | 82 | 'norcalli/nvim-colorizer.lua', |
62 | ft = { 'css', 'javascript', 'vim', 'html' }, | 83 | ft = {'css', 'javascript', 'vim', 'html'}, |
63 | config = [[require('colorizer').setup {'css', 'javascript', 'vim', 'html'}]], | 84 | config = [[require('colorizer').setup {'css', 'javascript', 'vim', 'html'}]], |
64 | } | 85 | } |
65 | 86 | ||
@@ -130,7 +151,4 @@ return require('packer').startup(function() | |||
130 | use 'tpope/vim-commentary' | 151 | use 'tpope/vim-commentary' |
131 | -- asynchronous build and test dispatcher | 152 | -- asynchronous build and test dispatcher |
132 | use {'tpope/vim-dispatch', opt = true, cmd = {'Dispatch', 'Make', 'Focus', 'Start'}} | 153 | use {'tpope/vim-dispatch', opt = true, cmd = {'Dispatch', 'Make', 'Focus', 'Start'}} |
133 | |||
134 | -- fancy start screen | ||
135 | use 'mhinz/vim-startify' | ||
136 | end) | 154 | end) |
diff --git a/.config/nvim/lua/settings.lua b/.config/nvim/lua/settings.lua index 5931e5d..7276b0e 100644 --- a/.config/nvim/lua/settings.lua +++ b/.config/nvim/lua/settings.lua | |||
@@ -95,3 +95,4 @@ opt.diffopt = { | |||
95 | -- menu: use a popup menu to show the possible completions | 95 | -- menu: use a popup menu to show the possible completions |
96 | -- preview: show extra information | 96 | -- preview: show extra information |
97 | opt.completeopt = {"menu", "preview"} | 97 | opt.completeopt = {"menu", "preview"} |
98 | |||