Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2017
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 14.53 KB | None | 0 0
  1. " Map Leader <Has to be first line>
  2. let mapleader = " "
  3. let g:mapleader = " "
  4.  
  5. """ Dein Config
  6.  
  7. " Specify runtimepath
  8.  
  9. if has ("win32")
  10. set runtimepath+=~/.vim/plugins/repos/github.com/Shougo/dein.vim
  11. else
  12. set runtimepath+=~/.config/nvim/plugins/repos/github.com/Shougo/dein.vim
  13. endif
  14.  
  15. " Add Plugins
  16. if has ("win32")
  17. call dein#begin("~/.vim/plugins")
  18. else
  19. call dein#begin("/home/strixx/.config/nvim/plugins")
  20. endif
  21.  
  22. call dein#add('Shougo/dein.vim')
  23. " Window Split Plugins
  24. call dein#add('simeji/winresizer', {'on_map' : {'nv' : '<c-w>r' }})
  25.  
  26. " Align Plugins
  27. call dein#add('junegunn/vim-easy-align')
  28.  
  29. " Interface Plugins
  30. " call dein#add('itchyny/lightline.vim')
  31. if has ('unix')
  32. call dein#add('junegunn/fzf', {'merged': 0})
  33. call dein#add('junegunn/fzf.vim', {'merged': 0})
  34. endif
  35. call dein#add('ap/vim-buftabline')
  36. if has ("win32")
  37. call dein#add("scrooloose/nerdtree", { 'on_cmd' : 'NERDTreeToggle',
  38. \ 'hook_add': 'nnoremap <leader>n
  39. \ :NERDTreeToggle<cr>'})
  40. endif
  41. call dein#add('mbbill/undotree', { 'on_cmd' : 'UndotreeToggle',
  42. \ 'hook_add': 'nnoremap <leader>u
  43. \ :UndotreeToggle<cr>'
  44. \})
  45.  
  46. " Local Win Plugins
  47. if has ('win32')
  48. call dein#add('~/.vim/plugins/local/restore_view')
  49. call dein#add('~/.vim\plugins\local\statusline')
  50. endif
  51.  
  52. " Local Unix Plugins
  53. if has ("unix")
  54. " Session Plugin Local
  55. call dein#local('/home/strixx/.config/nvim/plugins/repos/github.com/vim-scripts/')
  56. endif
  57.  
  58. " ColorScheme Plugin
  59. if has ("win32")
  60. endif
  61.  
  62. " Code Completion Plugin
  63. call dein#add('mattn/emmet-vim')
  64. call dein#add('Raimondi/delimitMate')
  65. call dein#add('jiangmiao/auto-pairs')
  66. call dein#add('maralla/completor.vim')
  67.  
  68. " Automaticly Features Plugin
  69. call dein#add('pgdouyon/vim-evanesco')
  70. " call dein#add('b4b4r07/vim-sunset')
  71.  
  72. " Benchmark Plugin
  73. call dein#add('tweekmonster/startuptime.vim')
  74.  
  75. " Commands Plugin
  76. call dein#add('sbdchd/neoformat')
  77. call dein#add('ntpeters/vim-better-whitespace')
  78. call dein#add('andrewradev/splitjoin.vim', { 'on_ft' : [ 'html', 'css', 'htm', 'php', 'sass', 'scss', 'js' ] })
  79. call dein#add('wellle/targets.vim')
  80. call dein#add('justinmk/vim-sneak')
  81. call dein#add('tpope/vim-surround', {'on_map': {'n' : ['cs', 'ds', 'ys'], 'x' : 'S'}})
  82. call dein#add('tpope/vim-abolish')
  83.  
  84. " Intergrations Plugin
  85. call dein#add('tpope/vim-commentary')
  86. call dein#add('mileszs/ack.vim')
  87. call dein#add('keith/gist.vim')
  88. call dein#add('javier-lopez/sprunge.vim')
  89.  
  90. " Language Plugin
  91. call dein#add('sheerun/vim-polyglot')
  92. call dein#add('2072/PHP-Indenting-for-VIm')
  93.  
  94. " Improvments Plugins
  95. call dein#add('bkad/camelcasemotion')
  96. call dein#add('kana/vim-smartword')
  97. call dein#add('tpope/vim-sensible')
  98. call dein#add('tpope/vim-ragtag')
  99.  
  100. " Syntax Check Plugin
  101. call dein#add('w0rp/ale')
  102.  
  103. " End Dein
  104. call dein#end()
  105.  
  106. " Automagically install new dein.vim plugins
  107. if dein#check_install()
  108. call dein#install()
  109. endif
  110.  
  111.  
  112. """ Dein Config End
  113.  
  114. """ Plugins Config
  115.  
  116. " Completor Plugin Config
  117.  
  118. inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
  119. inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"
  120. inoremap <expr> <cr> pumvisible() ? "\<C-y>\<cr>" : "\<cr>"
  121.  
  122. " BufTabline Config
  123.  
  124. let g:buftabline_show = 1
  125. let g:buftabline_numbers = 1
  126. let g:buftabline_indicators = 1
  127.  
  128. " ColorScheme Config
  129.  
  130.  
  131.  
  132. """ Code Linters
  133.  
  134. "" Ale Config
  135.  
  136. let g:ale_lint_on_text_changed = 'never'
  137. " if you don't want linters to run on opening a file
  138. let g:ale_lint_on_entEr = 0
  139.  
  140. " Choose linters you want to run for that specific FileType
  141.  
  142. let g:ale_linters = {
  143. \ 'html': ['tidy'],
  144. \}
  145.  
  146. let g:ale_set_signs=0
  147. let g:ale_open_list=1
  148. " Replace f and t with sneak plugin
  149.  
  150. nmap f <Plug>Sneak_f
  151. nmap F <Plug>Sneak_F
  152. nmap t <Plug>Sneak_t
  153. nmap T <Plug>Sneak_T
  154. let g:sneak#s_next = 1
  155.  
  156. let g:sneak#label = 1
  157. " NerdTree Configs
  158. if has ("win32")
  159. let NERDTreeQuitOnOpen = 1
  160. let NERDTreeAutoDeleteBuffer = 1
  161. let NERDTreeMinimalUI = 1
  162. let NERDTreeDirArrows = 1
  163. let NERDTreeHijackNetrw = 1
  164. let NERDTreeWinPos = "right"
  165. endif
  166.  
  167. " Lightline Plugin Config
  168.  
  169. let g:lightline = {
  170. \ 'colorscheme': 'PaperColor',
  171. \ 'active': {
  172. \ 'left': [ ['mode', 'paste'],
  173. \ ['fugitive', 'readonly', 'filename','bufnum', 'modified'] ],
  174. \ 'right': [ ['filetype'], [ 'lineinfo' ], ['percent'] ]
  175. \ },
  176. \ 'component': {
  177. \ 'readonly': '%{&filetype=="help"?"":&readonly?"??":""}',
  178. \ 'modified': '%{&filetype=="help"?"":&modified?"+":&modifiable?"":"-"}',
  179. \ 'fugitive': '%{exists("*fugitive#head")?fugitive#head():""}',
  180. \ 'ftString': "ft="
  181. \ },
  182. \ 'component_visible_condition': {
  183. \ 'readonly': '(&filetype!="help"&& &readonly)',
  184. \ 'modified': '(&filetype!="help"&&(&modified||!&modifiable))',
  185. \ 'fugitive': '(exists("*fugitive#head") && ""!=fugitive#head())'
  186. \ },
  187. \ 'separator': { 'left': ' ', 'right': ' ' },
  188. \ 'subseparator': { 'left': ' ', 'right': ' ' }
  189. \ }
  190.  
  191. let g:lightline.component = {'filetype': 'FileType: %{&ft!=#""?&ft:"Null"}'}
  192.  
  193. " UndoTree Plugin
  194.  
  195. let g:undotree_DiffAutoOpen = 0
  196.  
  197. " Winresizer Plugin Config
  198.  
  199. let g:winresizer_start_key = '<C-W>r'
  200.  
  201. if has ("unix")
  202. " FzF Plugin Config
  203. let g:fzf_layout = { 'down': '~30%' }
  204. endif
  205.  
  206. " Set Camelmotion default mappings
  207.  
  208. map <silent> w <Plug>CamelCaseMotion_w
  209. map <silent> b <Plug>CamelCaseMotion_b
  210. map <silent> e <Plug>CamelCaseMotion_e
  211. map <silent> ge <Plug>CamelCaseMotion_ge
  212. sunmap w
  213. sunmap b
  214. sunmap e
  215. sunmap ge
  216.  
  217. omap <silent> iw <Plug>CamelCaseMotion_iw
  218. xmap <silent> iw <Plug>CamelCaseMotion_iw
  219. omap <silent> ib <Plug>CamelCaseMotion_ib
  220. xmap <silent> ib <Plug>CamelCaseMotion_ib
  221. omap <silent> ie <Plug>CamelCaseMotion_ie
  222. xmap <silent> ie <Plug>CamelCaseMotion_ie
  223.  
  224. let g:wordmotion_spaces = '#'
  225.  
  226. """ Plugins Config End
  227.  
  228. """ Vim Config
  229.  
  230. " Add macro on visual
  231.  
  232. xnoremap @ :<C-u>call ExecuteMacroOverVisualRange()<CR>
  233.  
  234. " Set Fontsize
  235.  
  236. if has ("win32")
  237. set guifont=Monaco:h10:cDEFAULT
  238. endif
  239.  
  240. " Add Ctrl+w+hjkl to switch window
  241.  
  242. nnoremap <left> <c-w>h
  243. nnoremap <down> <c-w>j
  244. nnoremap <up> <c-w>k
  245. nnoremap <right> <c-w>l
  246.  
  247. " Map ctrl hjkl to buffer navigation, toggle readonly and delete buffer
  248.  
  249. nnoremap <C-h> :bp<cr>
  250. nnoremap <C-j> :bd!<cr> :echo 'Buffer Deleted'<cr>
  251. nnoremap <C-k> :set ro!<cr> :echo 'Set Readonly Toggle'<cr>
  252. nnoremap <C-l> :bn<cr> :echo 'Buffer Next'<cr>
  253.  
  254. " Access Buffers Faster With Numbers
  255.  
  256. nnoremap <F2> :buffers<CR>:buffer<space>
  257.  
  258.  
  259. " Map Shift-k to (split) a paragraph to complete shift j (join), also make J behave like gJ
  260.  
  261. nnoremap K i<cr><Esc>
  262. nnoremap J gJ
  263.  
  264. " Sane Defaults
  265.  
  266. filetype on
  267. filetype plugin on
  268. filetype indent on
  269. set splitbelow
  270. set splitright
  271. set autoindent
  272. set showcmd
  273. set hidden
  274. set history=5000
  275. set noswapfile
  276. set gdefault
  277. set nowrap
  278. set mouse=
  279. set viewdir=~/.vim/view/
  280. set viewoptions=cursor,folds,slash,unix
  281. set foldmethod=manual
  282. set ignorecase
  283. set linebreak
  284. set smartcase
  285. set noshowmode
  286. set nu
  287. let @/ = ""
  288.  
  289. " Clipboard Fix
  290.  
  291. if has ("nvim")
  292. set clipboard+=unnamedplus
  293. else
  294. set clipboard+=unnamed
  295. endif
  296.  
  297. " Vim Color Settings
  298.  
  299. set termguicolors
  300. syntax enable
  301. colorscheme base16-ocean
  302.  
  303. " Fix Syntax speed
  304.  
  305. syntax sync minlines=100
  306. syntax sync maxlines=240
  307. set synmaxcol=800
  308.  
  309. " GUI Vim , Make it look like terminal
  310.  
  311. if has ("gui")
  312. set guioptions-=m "remove menu bar
  313. set guioptions-=T "remove toolbar
  314. set guioptions-=r "remove right-hand scroll bar
  315. set guioptions-=L "remove left-hand scroll bar
  316. endif
  317.  
  318.  
  319. " Tabs
  320.  
  321. set softtabstop=0
  322. set noexpandtab
  323. set shiftwidth=4
  324.  
  325.  
  326. " Undo History Fixes
  327.  
  328. set undofile
  329. if has ("nvim") && has ('unix')
  330. set undodir=~/.config/nvim/undoHistory/
  331. else
  332. set undodir=~/.vim/undoHISTORY
  333. endif
  334.  
  335. set ul=1000
  336.  
  337. " Move Line up and down mapping
  338.  
  339. noremap <silent> <c-down> :m '>+1<cr>gv=gv
  340. noremap <silent> <c-up> :m '<-2<cr>gv=gv
  341.  
  342. " Better Search
  343.  
  344. set hlsearch
  345. nnoremap <silent> <Esc> :nohlsearch<Bar>:echo<CR>
  346.  
  347. " Fix for GUI ColorScheme
  348.  
  349. if !has('gui_running')
  350. set t_Co=256
  351. endif
  352.  
  353. " Re-Open Previously Opened File
  354.  
  355. nnoremap <Leader><Leader> :e#<CR>
  356.  
  357. " Set Working Directory to folder , like gf but for folders
  358.  
  359. nnoremap gF :cd <c-r><c-f><cr>
  360.  
  361. " Reload vim's config without having to exit vim
  362.  
  363. if has ("nvim")
  364. map <leader>r :source ~/.config/nvim/init.vim<cr>
  365. else
  366. map <leader>r :source ~/_vimrc<cr>
  367. endif
  368.  
  369. " Abbreviations
  370.  
  371. cnoreabbrev W! w!
  372. cnoreabbrev Q! q!
  373. cnoreabbrev Qall! qall!
  374. cnoreabbrev Wq wq
  375. cnoreabbrev Wa wa
  376. cnoreabbrev wQ wq
  377. cnoreabbrev WQ wq
  378. cnoreabbrev share Share
  379. cnoreabbrev w w
  380. cnoreabbrev Q q
  381. cnoreabbrev Qall qall
  382. cnoreabbrev tn tabnew
  383. cnoreabbrev tc tabclose
  384. cnoreabbrev sv vsplit
  385. cnoreabbrev Sv vsplit
  386.  
  387. """ Vim Config End
  388.  
  389. """ Functions Config
  390.  
  391. " Contrast Options
  392.  
  393. let g:contrastLevels = ['low', 'medium', 'high']
  394. let g:cc = g:contrastLevels[0]
  395. let g:contrastVar = 0
  396. function! ToggleContrast()
  397. let g:cc = g:contrastLevels[g:contrastVar]
  398. let g:contrastVar = (g:contrastVar + 1) % len(g:contrastLevels)
  399. let g:colorNumber = 0
  400. if g:cc == "high"
  401. let g:mylist = ["delek","desert","koehler","base16-ir-black", "base16-material", "base16-flat", "base16-phd", "base16-tomorrow-night", "base16-eighties", "base16-dracula", "base16-bright", "base16-macintosh", "base16-monokai", "base16-oceannext"]
  402. elseif g:cc == "medium"
  403. let g:mylist = ["base16-atelier-sulphurpool", "base16-harmonic16-dark", "base16-woodland", "base16-materia", "base16-material-palenight", "base16-bespin",]
  404. elseif g:cc == "low"
  405. let g:mylist = ["zenburn", "base16-atelier-savanna", "base16-codeschool", "base16-ocean", "base16-onedark", "base16-embers", ]
  406. endif
  407. endfunction
  408.  
  409. call ToggleContrast()
  410.  
  411. """ Color Switcher
  412.  
  413. " Set Variables
  414.  
  415. let g:contrast = g:contrastLevels[0]
  416. let g:colorNumber = 0
  417.  
  418.  
  419. function! ColorSchemeToggle()
  420.  
  421. if exists("g:colorNumber")
  422. execute 'colorscheme ' . g:mylist[g:colorNumber]
  423. let g:colorNumber = (g:colorNumber + 1) % len(g:mylist)
  424. endif
  425. endfunction
  426.  
  427. nnoremap <F8> :call ColorSchemeToggle()<cr>:execute "colo"<cr>
  428. nnoremap <S-F8> :call ToggleContrast()<cr>:execute 'colorscheme ' . g:mylist[g:colorNumber]<cr>:execute "echom g:cc"<cr>
  429.  
  430. command! ThemeSwitch :call ColorSchemeToggle()
  431.  
  432. function! DefaultColors()
  433.  
  434. "Sneak Plugins Colors
  435.  
  436. hi Sneak guifg=red guibg=NONE ctermfg=red ctermbg=NONE
  437. hi SneakScope guifg=red guibg=NONE ctermfg=red ctermbg=NONE
  438.  
  439. hi SneakLabel guifg=red guibg=NONE ctermfg=red ctermbg=NONE
  440. endfunction
  441.  
  442. " Buffer
  443.  
  444. function! s:buflist()
  445. redir => ls
  446. silent ls
  447. redir END
  448. return split(ls, '\n')
  449. endfunction
  450.  
  451. function! s:bufopen(e)
  452. execute 'buffer' matchstr(a:e, '^[ 0-9]*')
  453. endfunction
  454.  
  455. function! ReturnColorScheme()
  456. return g:colors_name
  457. endfunction
  458.  
  459.  
  460. " Call Macro On Visual
  461.  
  462. function! ExecuteMacroOverVisualRange()
  463. echo "@".getcmdline()
  464. execute ":'<,'>normal @".nr2char(getchar())
  465. endfunction
  466.  
  467. " UndoTree Custom Mappings
  468.  
  469. function! g:Undotree_CustomMap()
  470. nmap <buffer> J <plug>UndotreeGoNextState
  471. nmap <buffer> K <plug>UndotreeGoPreviousState
  472. nmap <buffer> o <plug>UndotreeEnter
  473. endfunc
  474.  
  475. imap jj <Esc>
  476.  
  477. " Call Functions First Time If Needed
  478.  
  479.  
  480. """ Functions Config End
  481.  
  482. """ Autocmd Configs
  483.  
  484.  
  485. augroup Colorscheme
  486. au!
  487. autocmd ColorScheme * call DefaultColors()
  488. augroup END
  489.  
  490. augroup Type
  491. au!
  492. autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o
  493. augroup END
  494.  
  495. augroup EnterVim
  496. au!
  497. autocmd VimEnter * call DefaultColors()
  498. augroup END
  499.  
  500. augroup LeavingVim
  501. au!
  502. autocmd VimLeave * call Sessioncheck()
  503. augroup END
  504.  
  505.  
  506. """ Autocmd End
  507.  
  508. """ Speed Config
  509.  
  510. " Toggle Numbers
  511. nnoremap <F3> :let [&nu, &rnu] = [!&rnu, &nu+&rnu==1]<cr>
  512.  
  513. " Disable Ruby
  514. let g:loaded_ruby_provider = 1
  515.  
  516. "" Fix Python settings
  517.  
  518. " Disable python 2
  519. let g:loaded_python_provider = 1
  520.  
  521. " Path to python 3
  522. if has ('win32')
  523. let g:python3_host_prog = 'C:\Program Files (x86)\Python36-32\python'
  524. elseif has ('unix')
  525. let g:python3_host_prog = 'usr/bin/python3'
  526. endif
  527.  
  528. """ Speed Config End
  529.  
  530. """ Custom Commands
  531.  
  532. if has ('unix')
  533.  
  534. command! -range=% Share exe <line1>. ','.<line2>.'w !vpaste ft='.&ft
  535.  
  536. command! FindAll call fzf#run(fzf#wrap({'source': 'cat ~/.vifm/fzf-read/locate-file', 'sink': 'e'}))
  537. command! FindSession call fzf#run(fzf#wrap({'source': 'cd ~/.config/nvim/session && readlink -f *', 'sink': 'source', 'options': '-m +s'}))
  538. command! ProjectFind call fzf#run(fzf#wrap({'source': 'find . -type f', 'sink': 'e'}))
  539. command! FindHome call fzf#run(fzf#wrap({'source': 'find . -type f ! \( -path "*cache*" -o -path "*fonts*" -o -path "*icons*" -o -path "*help*" -o -path "*log*" -o -path "afs" -o -path "var*" -o -path "lib*" -o -path "tmp*" -o -path "proc*" -o -path "*deps*" -o -path "*node*" -o -path "*/src/*" -o -path "*gem*" -o -path "*/ruby/*" \) -maxdepth 7', 'sink': 'e'}))
  540. command! FZFProject call fzf#run(fzf#wrap({'source': 'cat ~/.config/nvim/Project-Path ', 'sink': 'cd'}))
  541. command! FZFBookmark call fzf#run(fzf#wrap({'source': "cat ~/.config/nvim/bookmarks | cut -d ' ' -f 1", 'sink': 'e'}))
  542. command! Mru call fzf#run({
  543. \ 'source': v:oldfiles,
  544. \ 'sink': 'e',
  545. \ 'options': '-m -x +s',
  546. \ 'down': '40%'})
  547.  
  548. command! -range=% SP silent execute <line1> . "," . <line2> . "w !curl -F 'sprunge=<-' http://sprunge.us | tr -d '\\n' | pbcopy"
  549. command! -range=% CL silent execute <line1> . "," . <line2> . "w !curl -F 'clbin=<-' https://clbin.com | tr -d '\\n' | pbcopy"
  550. command! -range=% VP silent execute <line1> . "," . <line2> . "w !curl -F 'text=<-' http://vpaste.net | tr -d '\\n' | pbcopy"
  551. command! -range=% IX silent execute <line1> . "," . <line2> . "w !curl -F 'f:1=<-' ix.io | tr -d '\\n' | pbcopy"
  552. command! -range=% TB silent execute <line1> . "," . <line2> . "w !nc termbin 9999 | tr -d '\\n' | pbcopy"
  553.  
  554. " FZF Mappings
  555.  
  556. nnoremap <leader>fp :ProjectFind<cr>
  557. nnoremap <leader>fa :FindAll<cr>
  558. nnoremap <leader>fh :FindAll<cr>
  559. nnoremap <leader>fs :FindSession<cr>
  560. nnoremap <leader>fr :Mru<cr>
  561. nnoremap <leader>fb :FZFBookmark<cr>
  562. nnoremap <leader>p :FZFProject<cr>
  563. nnoremap <leader>B :!echo %:~ >> ~/.config/nvim/bookmarks<cr>
  564. nnoremap <leader>P :!pwd >> ~/.config/nvim/Project-Path<cr>
  565. nnoremap <silent> <Leader>b :call fzf#run({
  566. \ 'source': reverse(<sid>buflist()),
  567. \ 'sink': function('<sid>bufopen'),
  568. \ 'options': '+m',
  569. \ 'down': len(<sid>buflist()) + 2
  570. \ })<CR>
  571.  
  572. """ Custom Commands End
  573.  
  574. endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement