init.lua 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. local utils = require('nv-utils')
  2. local auto_formatters = { }
  3. local python_autoformat = {'BufWritePre', '*.py', 'lua vim.lsp.buf.formatting_sync(nil, 1000)'}
  4. if O.python.autoformat then table.insert(auto_formatters, python_autoformat) end
  5. local javascript_autoformat = {'BufWritePre', '*.js', 'lua vim.lsp.buf.formatting_sync(nil, 1000)'}
  6. local javascriptreact_autoformat = {'BufWritePre', '*.jsx', 'lua vim.lsp.buf.formatting_sync(nil, 1000)'}
  7. if O.tsserver.autoformat then
  8. table.insert(auto_formatters, javascript_autoformat)
  9. table.insert(auto_formatters, javascriptreact_autoformat)
  10. end
  11. local lua_format = {'BufWritePre', '*.lua', 'lua vim.lsp.buf.formatting_sync(nil, 1000)'}
  12. if O.lua.autoformat then table.insert(auto_formatters, lua_format) end
  13. local json_format = {'BufWritePre', '*.json', 'lua vim.lsp.buf.formatting_sync(nil, 1000)'}
  14. if O.json.autoformat then table.insert(auto_formatters, json_format) end
  15. utils.define_augroups({
  16. _general_settings = {
  17. {'TextYankPost', '*', 'lua require(\'vim.highlight\').on_yank({higroup = \'Search\', timeout = 200})'},
  18. {'BufWinEnter', '*', 'setlocal formatoptions-=c formatoptions-=r formatoptions-=o'},
  19. {'BufRead', '*', 'setlocal formatoptions-=c formatoptions-=r formatoptions-=o'},
  20. {'BufNewFile', '*', 'setlocal formatoptions-=c formatoptions-=r formatoptions-=o'}
  21. -- {'User', 'GoyoLeave', 'lua require(\'galaxyline\').disable_galaxyline()'},
  22. -- {'User', 'GoyoEnter', 'lua require(\'galaxyline\').galaxyline_augroup()'},
  23. },
  24. _java = {
  25. {'FileType', 'java', 'luafile ~/.config/nvim/lua/lsp/java-ls.lua'},
  26. {'FileType', 'java', 'nnoremap ca <Cmd>lua require(\'jdtls\').code_action()<CR>'}
  27. },
  28. _dashboard = {
  29. -- seems to be nobuflisted that makes my stuff disapear will do more testing
  30. {
  31. 'FileType', 'dashboard',
  32. 'setlocal nocursorline noswapfile synmaxcol& signcolumn=no norelativenumber nocursorcolumn nospell nolist nonumber bufhidden=wipe colorcolumn= foldcolumn=0 matchpairs= '
  33. }, {'FileType', 'dashboard', 'set showtabline=0 | autocmd BufLeave <buffer> set showtabline=2'}
  34. },
  35. _markdown = {{'FileType', 'markdown', 'setlocal wrap'}, {'FileType', 'markdown', 'setlocal spell'}},
  36. _solidity = {
  37. {'BufWinEnter', '.sol', 'setlocal filetype=solidity'}, {'BufRead', '*.sol', 'setlocal filetype=solidity'},
  38. {'BufNewFile', '*.sol', 'setlocal filetype=solidity'}
  39. },
  40. _buffer_bindings = {
  41. {'FileType', 'dashboard', 'nnoremap <silent> <buffer> q :q<CR>'},
  42. {'FileType', 'lspinfo', 'nnoremap <silent> <buffer> q :q<CR>'},
  43. {'FileType', 'floaterm', 'nnoremap <silent> <buffer> q :q<CR>'},
  44. },
  45. _auto_formatters = auto_formatters
  46. })