Advertisement
Lothering1

init.vim

Sep 10th, 2022 (edited)
2,207
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VIM 13.54 KB | None | 0 0
  1. :set number
  2. :set autoindent
  3. :set tabstop=2 expandtab
  4. :set shiftwidth=2 expandtab
  5. " :set smarttab
  6. :set softtabstop=2
  7. :set mouse=a
  8. :set cursorline
  9. :set wrap linebreak
  10. :set breakindent
  11.  
  12. " Highlight whitespaces
  13. :set listchars+=space:·
  14. :set list
  15.  
  16. set termguicolors
  17. set encoding=utf-8
  18. set noswapfile
  19.  
  20. " Hide empty lines ~
  21. set fillchars=eob:\
  22.  
  23. " Hide current mode (-- INSERT --/-- VISUAL -- etc)
  24. set noshowmode
  25.  
  26. " Hide separator line
  27. set fillchars+=vert:\
  28.  
  29. set nocompatible
  30.  
  31. " Disable quote concealing in JSON files
  32. let g:vim_json_conceal=0
  33.  
  34. " lightline
  35. let g:lightline = {}
  36. " let g:lightline.colorscheme = 'horizon'
  37.  
  38. " Highlight yank
  39. " augroup highlight_yank
  40. "     autocmd!
  41. "     autocmd TextYankPost * silent! lua vim.highlight.on_yank{higroup="IncSearch", timeout=150}
  42. " augroup END
  43. augroup highlight_yank
  44.   autocmd!
  45.   autocmd TextYankPost * silent! lua vim.highlight.on_yank{higroup="YankedText", timeout=150}
  46. augroup END
  47.  
  48. call plug#begin()
  49.  
  50. " Plug 'https://github.com/vim-airline/vim-airline' " Bottom line
  51. Plug 'nvim-lualine/lualine.nvim'                    " Bottom line
  52. Plug 'ryanoasis/vim-devicons'                       " Icons
  53. Plug 'kyazdani42/nvim-web-devicons'                 " Another icons
  54. Plug 'kyazdani42/nvim-tree.lua'                     " Explorer
  55. Plug 'romgrk/barbar.nvim'                           " Tabs
  56. Plug 'https://github.com/easymotion/vim-easymotion' " EasyMotion
  57. Plug 'mg979/vim-visual-multi', {'branch': 'master'} " Multi cursor
  58. Plug 'marko-cerovac/material.nvim'                  " FIRST Material theme
  59. Plug 'norcalli/nvim-colorizer.lua'                  " Color (hex/rgb) highlight
  60. Plug 'lukas-reineke/indent-blankline.nvim'          " Highlight indentations
  61. Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'}
  62. Plug 'mattn/emmet-vim'                " Emmet
  63. Plug 'nvim-lua/plenary.nvim'          " Required by Telescope
  64. Plug 'nvim-telescope/telescope.nvim'  " Telescope (git, explorer)
  65. Plug 'airblade/vim-gitgutter'         " Git changes file
  66. Plug 'neoclide/coc.nvim', {'branch': 'release'}
  67.  
  68. call plug#end()
  69.  
  70. " lua require('colorizer').setup()
  71.  
  72. lua << END
  73. require'colorizer'.setup()
  74. require('lualine').setup {
  75.   icons_enabled = false,
  76.   options = { globalstatus = true },
  77.   sections = {
  78.     lualine_c = {},
  79.     lualine_x = {'filetype'}
  80.   }
  81. }
  82. --FIRST Material
  83. local colors = {
  84.   -- Common colors
  85.  
  86.   white =    '#EEFFFF',
  87.   gray =     '#717CB4',
  88.   black =    '#000000',
  89.   red =      '#F07178',
  90.   green =    '#C3E88D',
  91.   yellow =   '#FFCB6B',
  92.   blue =     '#82AAFF',
  93.   paleblue = '#B0C9FF',
  94.   cyan =     '#89DDFF',
  95.   purple =   '#C792EA',
  96.   orange =   '#F78C6C',
  97.   pink =     '#FF9CAC',
  98.  
  99.   -- Dark colors
  100.   darkred =    '#DC6068',
  101.   darkgreen =  '#ABCF76',
  102.   darkyellow = '#E6B455',
  103.   darkblue =   '#6E98EB',
  104.   darkcyan =   '#71C6E7',
  105.   darkpurple = '#B480D6',
  106.   darkorange = '#E2795B',
  107.  
  108.   error =  '#FF5370',
  109.   link =   '#80CBC4',
  110.   cursor = '#FFCC00',
  111.   title =  '#EEFFFF',
  112.  
  113.   none =         'NONE',
  114.   bg =           '#0F111A',
  115.   bg_alt =       '#090B10',
  116.   fg =           '#A6ACCD',
  117.   text =         '#717CB4',
  118.   comments =     '#464B5D',
  119.   selection =    '#1F2233',
  120.   contrast =     '#090B10',
  121.   active =       '#1A1C25',
  122.   border =       '#232637',
  123.   line_numbers = '#3B3F51',
  124.   highlight =    '#1F2233',
  125.   disabled =     '#464B5D',
  126.   accent =       '#84FFFF'
  127. }
  128.  
  129. require('material').setup({
  130.   contrast = {
  131.     sidebars = true,
  132.     floating_windows = true,
  133.     non_current_windows = true,
  134.     cursor_line = true,
  135.     popup_menu = true
  136.   },
  137.   italics = {
  138.     comments = true
  139.   },
  140.   lualine_style = "default", -- can be "stealth" or "default"
  141.   custom_highlights = {
  142.     -- CursorLineNr = { fg = colors.accent, bg = colors.bg_alt },
  143.     CursorLineNr = { fg = colors.text, bg = colors.bg_alt },
  144.     -- Cursor = { fg = colors.bg, bg = colors.cursor },
  145.     Visual = { fg = colors.none, bg = "#2d324a" },
  146.     --[[Type = { fg = colors.yellow },
  147.     StorageClass = { fg = colors.yellow },
  148.     Structure = { fg = colors.purple },
  149.     Exception = { fg = colors.cyan },
  150.     Special = { fg = colors.purple },
  151.     SpecialChar = { fg = colors.cyan },
  152.     Tag = { fg = '#FF0000' },
  153.     Function = { fg = colors.purple }--]]
  154.  
  155.     TSKeyword = { fg = colors.purple },
  156.     TSKeywordFunction = { fg = colors.purple },
  157.     TSKeywordOperator = { fg = colors.cyan },
  158.     TSKeywordReturn = { fg = colors.purple },
  159.     TSParameter = { fg = colors.orange },
  160.     TSParameterReference = { fg = colors.orange },
  161.     TSType = { fg = colors.yellow },
  162.     TSTypeBuiltin = { fg = colors.yellow },
  163.     TSVariableBuiltin = { fg = colors.error },
  164.     TSException = { fg = colors.purple },
  165.     TSInclude = { fg = colors.purple },
  166.  
  167.     NvimTreeFolderName = { fg = colors.accent },
  168.     NvimTreeOpenedFolderName = { fg = colors.accent },
  169.  
  170.     TelescopeSelectionCaret = { fg = colors.accent },
  171.     TelescopeSelection = { fg = colors.accent, bg = colors.selection },
  172.  
  173.     IndentBlanklineChar = { fg = colors.border },
  174.     IndentBlanklineContextChar = { fg = colors.fg }
  175.   }
  176. })
  177.  
  178. require'nvim-treesitter.configs'.setup {
  179.   highlight = {
  180.     enable = true
  181.   },
  182.   indent = {
  183.     enable = true
  184.   },
  185.   autotag = {
  186.     enable = true
  187.   }
  188. }
  189. require('telescope').setup{
  190.   defaults = {
  191.     file_ignore_patterns = { "node_modules", "dist", ".git/" }
  192.   }
  193. }
  194.  
  195. require("nvim-tree").setup({
  196.   open_on_setup = true,
  197.   open_on_setup_file = true,
  198.   filters = {
  199.     dotfiles = true
  200.   },
  201.   view = {
  202.     width = 20,
  203.     hide_root_folder = true,
  204.     mappings = {
  205.       list = {
  206.         { key = "-", action = "" },
  207.       }
  208.     }
  209.   },
  210.   renderer = {
  211.     --[[ indent_markers = {
  212.       enable = true,
  213.       inline_arrows = true,
  214.       icons = {
  215.         corner = "└",
  216.         edge = "│",
  217.         item = "│",
  218.         bottom = "─",
  219.         none = "│",
  220.       },
  221.     }, --]]
  222.     indent_markers = {
  223.       enable = true,
  224.       inline_arrows = true,
  225.       icons = {
  226.         corner = "",
  227.         edge = "",
  228.         item = "",
  229.         bottom = "",
  230.         none = "",
  231.       },
  232.     },
  233.     icons = {
  234.       -- use one space as value if current font is full mono
  235.       padding = "  ",
  236.       glyphs = {
  237.         folder = {
  238.           arrow_closed = "",
  239.           arrow_open = "",
  240.           default = "",
  241.           open = "",
  242.           empty = "",
  243.           empty_open = "",
  244.           symlink = "",
  245.           symlink_open = "",
  246.         },
  247.         git = {
  248.           unstaged = "",
  249.           staged = "",
  250.           unmerged = "",
  251.           renamed = "",
  252.           untracked = "",
  253.           deleted = "",
  254.           ignored = "",
  255.         },
  256.       },
  257.     },
  258.   },
  259. })
  260.  
  261. require("indent_blankline").setup {
  262.   -- for example, context is off by default, use this to turn it on
  263.   show_current_context = true,
  264.   --[[ char_highlight_list = {
  265.     "IndentBlanklineIndent1",
  266.     "IndentBlanklineIndent2",
  267.     "IndentBlanklineIndent3"
  268.   } --]]
  269. }
  270.  
  271. -- Scopes for indentations highlighter
  272. vim.g.indent_blankline_context_patterns = {
  273.   'class',
  274.   'function',
  275.   'method',
  276.   '^if',
  277.   '^while',
  278.   '^for',
  279.   '^object',
  280.   '^table',
  281.   'block',
  282.   'arguments'
  283. }
  284.  
  285. -- BARBAR plugin, offset for tabs to 20 symbols if NvimTree is toggled
  286. vim.api.nvim_create_autocmd('BufWinEnter', {
  287.   pattern = '*',
  288.   callback = function()
  289.     if vim.bo.filetype == 'NvimTree' then
  290.       require'bufferline.api'.set_offset(20, 'FileTree')
  291.     end
  292.   end
  293. })
  294.  
  295. vim.api.nvim_create_autocmd('BufWinLeave', {
  296.   pattern = '*',
  297.   callback = function()
  298.     if vim.fn.expand('<afile>'):match('NvimTree') then
  299.       require'bufferline.api'.set_offset(0)
  300.     end
  301.   end
  302. })
  303.  
  304. -- NvimTree autoclose. WARNING: it can be cause of errors!
  305. vim.api.nvim_create_autocmd("BufEnter", {
  306.   nested = true,
  307.   callback = function()
  308.     if #vim.api.nvim_list_wins() == 1 and vim.api.nvim_buf_get_name(0):match("NvimTree_") ~= nil then
  309.       vim.cmd "quit"
  310.     end
  311.   end
  312. })
  313. END
  314.  
  315. " FIRST MATERIAL
  316. let g:material_style = "deep ocean" " darker / lighter / oceanic / palenight / deep ocean
  317. " SECOND MATERIAL
  318. " let g:material_theme_style = 'ocean-community'
  319. " let g:material_terminal_italics = 1
  320. " let g:airline_theme = 'nightfly'
  321.  
  322. " FIRST and SECOND
  323. colorscheme material
  324.  
  325. " let g:indentLine_char = ''
  326. " let g:indentLine_char = '|'
  327.  
  328. " CoC Server change colors
  329. highlight CocFloating guibg=#1F2233
  330. highlight FgCocErrorFloatBgCocFloating guifg=#FF5370
  331. highlight CocPumSearch guifg=#84FFFF
  332. " highlight CocFloatActive guifg=#F78C6C
  333. highlight CocFloatActive guifg=#84FFFF
  334.  
  335. " BARBAR plugin, changes color of left line (of active buffer/tab)
  336. " :hi BufferCurrentSign guifg='#84FFFF'
  337. :hi BufferCurrentSign guifg='#84FFFF'
  338. :hi BufferInactiveSign guifg='#0f111a' guibg='#090B10'
  339. " :hi BufferTabpageFill guifg='#1a1c25'
  340. :hi BufferTabpageFill guifg='#0F111A'
  341. :hi BufferCurrent guifg='#84FFFF'
  342. :hi BufferInactive guibg='#090B10'
  343. :hi BufferInactiveMod guibg='#090B10' guifg='#FFCB6B'
  344. :hi BufferOffset guifg='#090B10' guibg='#090B10'
  345. :hi BufferTabpageFill guibg='#090B10'
  346. " BARBAR, change symbol of unsaved (modified) file
  347. let bufferline = get(g:, 'bufferline', {})
  348. let bufferline.icon_close_tab_modified = '•'
  349. " BARBAR, change symbol of separators
  350. " let bufferline.icon_separator_active = ''
  351. " let bufferline.icon_separator_inactive = ''
  352.  
  353. " Settings for indentations highlighter
  354. let g:indent_blankline_use_treesitter = v:true
  355. " let g:indent_blankline_char_list = ['▏', '¦', '┆', '┊']
  356. let g:indent_blankline_char_list = ['│', '╎', '┆', '┊']
  357. " highlight IndentBlanklineIndent1 guifg=#84FFFF gui=nocombine
  358. " highlight IndentBlanklineIndent2 guifg=#C792EA gui=nocombine
  359. " highlight IndentBlanklineIndent3 guifg=#FFCB6B gui=nocombine
  360. " highlight IndentBlanklineContextChar guifg=#FF5370 gui=nocombine
  361. " From description: Turn this off if you want to use background highlighting instead of chars
  362. let g:indent_blankline_show_trailing_blankline_indent = v:false
  363.  
  364. " Highlight space char
  365. hi IndentBlanklineSpaceChar guifg=#232637 gui=nocombine
  366. hi IndentBlanklineContextSpaceChar guifg=#232637 gui=nocombine
  367. hi Whitespace guifg=#232637
  368.  
  369. " Set color to yanked text
  370. hi YankedText guifg=#0F111A guibg=#FFCB6B
  371.  
  372. " URxvt.keysym.S-space: \033[32;2u
  373. " inoremap <S-Space> <Esc>
  374. " au VimEnter * :silent !xmodmap -e 'clear Lock' -e 'keycode 0x42 = Escape'
  375. " au VimLeave * :silent !xmodmap -e 'clear Lock' -e 'keycode 0x42 = Caps_Lock'
  376.  
  377. " nnoremap <C-n> :NERDTree<CR>
  378. " nnoremap <C-t> :NERDTreeToggle<CR>
  379.  
  380. " let NERDTreeMinimalUI = 1
  381. " let NERDTreeDirArrows = 0
  382. " let NERDTreeWinSize = 20
  383. " let NERDTreeDirArrowExpandable = "\u00a0"
  384. " let NERDTreeDirArrowCollapsible = "\u00a0"
  385. " let g:NERDTreeStatusline = '%#NonText#'
  386.  
  387. " Start NERDTree and leave the cursor in it
  388. " autocmd VimEnter * NERDTree
  389. " Exit Vim if NERDTree is the only window remaining in the only tab.
  390. " autocmd BufEnter * if tabpagenr('$') == 1 && winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() | quit | endif
  391. " Open the existing NERDTree on each new tab.
  392. " autocmd BufWinEnter * if getcmdwintype() == '' | silent NERDTreeMirror | endif
  393.  
  394. " Hide slashes after each dir
  395. " augroup nerdtreehidetirslashes
  396. "   autocmd!
  397. "   autocmd FileType nerdtree syntax match NERDTreeDirSlash #/$# containedin=NERDTreeDir conceal contained
  398. " augroup end
  399.  
  400. " Hide path in the first line of the NERDTree
  401. " augroup nerdtreehidecwd
  402. "   autocmd!
  403. "   autocmd FileType nerdtree setlocal conceallevel=3 | syntax match NERDTreeHideCWD #^[</].*$# conceal
  404. " augroup end
  405.  
  406. " Git gutter lines
  407. let g:gitgutter_sign_added = '┃'
  408. let g:gitgutter_sign_modified = '┃'
  409. " let g:gitgutter_sign_removed = '┃'
  410. let g:gitgutter_sign_removed_first_line = '┃'
  411. let g:gitgutter_sign_removed_above_and_below = '┃'
  412. let g:gitgutter_sign_modified_removed = '┃'
  413.  
  414. " Emmet trigger
  415. imap <A-h> <C-y>,
  416.  
  417. " Go up/down on "next wrapped line" if current line is too long
  418. " noremap <expr> j v:count ? 'j' : 'gj'
  419. " noremap <expr> k v:count ? 'k' : 'gk'
  420.  
  421. " Auto close
  422. " FIRST VARIANT
  423. inoremap " ""<left>
  424. inoremap ' ''<left>
  425. inoremap ` ``<left>
  426. inoremap ( ()<left>
  427. inoremap [ []<left>
  428. inoremap { {}<left>
  429. " inoremap {<CR> {<CR>}<ESC>O
  430. " inoremap {;<CR> {<CR>};<ESC>O
  431.  
  432. " Switching between DEFAULT NEOVIM tabs
  433. " nnoremap <F7> :tabprevious<CR>
  434. " nnoremap <F8> :tabnext<CR>
  435.  
  436. " Switching between BARBAR tabs
  437. nnoremap <silent>    <A-,> :BufferPrevious<CR>
  438. nnoremap <silent>    <A-.> :BufferNext<CR>
  439.  
  440. " Close BARBAR tab
  441. nnoremap <silent>    <A-w> :BufferClose<CR>
  442.  
  443. " Find files using Telescope command-line sugar.
  444. " By file name
  445. nnoremap <A-f> <cmd>Telescope find_files hidden=true<cr>
  446. " By plain text
  447. nnoremap <A-r> <cmd>Telescope live_grep<cr>
  448.  
  449. map - <Plug>(easymotion-s)
  450.  
  451. " COC TS-Server keymaps
  452. " Jump to type definition
  453. nnoremap <A-t> <Plug>(coc-type-definition)
  454. " Jump to definition
  455. nnoremap <A-d> <Plug>(coc-definition)
  456. " Show suggestion window
  457. inoremap <silent><expr> <c-space> coc#refresh()
  458.  
  459. " default value: 'asdghklqwertyuiopzxcvbnmfj;'
  460. " also can use: 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
  461. let g:EasyMotion_keys = "aoeidtn',.pyfgcrl;qjkxbmuh-"
  462.  
  463. let g:VM_maps = {}
  464. let g:VM_maps['Find Under']         = '<C-e>'    " replace C-n
  465. let g:VM_maps['Find Subword Under'] = '<C-e>'    " replace visual C-n
  466.  
  467. " let g:NERDTreeDirArrowExpandable="📁"
  468. " let g:NERDTreeDirArrowCollapsible="📂"
  469. let g:coc_global_extensions = ['coc-tsserver']
  470.  
  471. " Cursor highlight
  472. " highlight Cursor guifg=white guibg=red
  473. " highlight iCursor guifg=white guibg=steelblue
  474. " set guicursor=n-v-c:block-Cursor
  475. " set guicursor+=i:ver100-iCursor
  476. " set guicursor+=n-v-c:blinkon0
  477. " set guicursor+=i:blinkwait10
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement