Guest User

Untitled

a guest
Jan 19th, 2019
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.67 KB | None | 0 0
  1. """""""""""""""""""""""""
  2. "Set VIM default encoding
  3. set encoding=utf-8
  4.  
  5.  
  6. """""""""""""""""""""""""
  7. call plug#begin('~/.local/share/nvim/plugged')
  8.  
  9. Plug 'yuttie/comfortable-motion.vim'
  10. Plug 'scrooloose/nerdtree'
  11. Plug 'sjl/gundo.vim'
  12. Plug 'vim-syntastic/syntastic'
  13. Plug 'majutsushi/tagbar'
  14. Plug 'vim-airline/vim-airline'
  15. Plug 'vim-airline/vim-airline-themes'
  16. Plug 'will133/vim-dirdiff'
  17. Plug 'chriskempson/tomorrow-theme', {'rtp': 'vim'}
  18. Plug 'szw/vim-maximizer'
  19. Plug 'drmingdrmer/vim-syntax-markdown'
  20. Plug 'christoomey/vim-tmux-navigator'
  21. Plug 'google/vim-searchindex'
  22. Plug 'tpope/vim-fugitive'
  23. Plug 'junegunn/fzf.vim'
  24. Plug 'junegunn/gv.vim'
  25. Plug 'airblade/vim-gitgutter'
  26. Plug 'jistr/vim-nerdtree-tabs'
  27. Plug 'junegunn/goyo.vim'
  28. Plug 'junegunn/limelight.vim'
  29. Plug 'junegunn/rainbow_parentheses.vim'
  30. Plug 'junegunn/seoul256.vim'
  31.  
  32. Plug 'ncm2/ncm2'
  33. Plug 'roxma/nvim-yarp'
  34.  
  35.  
  36. Plug 'ncm2/ncm2-bufword'
  37. Plug 'ncm2/ncm2-path'
  38. Plug 'Shougo/neco-vim'
  39. Plug 'ncm2/ncm2-vim'
  40. Plug 'Shougo/neco-syntax'
  41. Plug 'ncm2/ncm2-syntax'
  42. Plug 'filipekiss/ncm2-look.vim'
  43. Plug 'ncm2/ncm2-jedi'
  44. Plug 'ncm2/ncm2-tern', {'do': 'npm install'}
  45. Plug 'ncm2/ncm2-pyclang'
  46. Plug 'HerringtonDarkholme/yats.vim'
  47. Plug 'mhartington/nvim-typescript', {'do': './install.sh'}
  48.  
  49. call plug#end()
  50.  
  51. """""""""""""""""""""""""
  52. "Get platfrom info.
  53. if has("unix")
  54. let s:uname = substitute(system('uname -s'), "\n", "", "")
  55. endif
  56.  
  57.  
  58. """""""""""""""""""""""""
  59. "General settings
  60.  
  61. "For OS X
  62. if s:uname == "Darwin"
  63. "Begin for OS X
  64. set guifont=Monaco\ for\ Powerline:h12
  65. if has('gui_running')
  66. set transparency=0
  67. endif
  68. "End for OS X
  69. endif
  70.  
  71. """""""""""""""""""""""""
  72. "fzf settings
  73. "fzf installed using Homebrew
  74. if s:uname == "Darwin"
  75. set rtp+=/usr/local/opt/fzf
  76. endif
  77. "fzf installed using Git under home
  78. set rtp+=~/.fzf
  79. "fzf layout
  80. let g:fzf_layout = { 'left': '~55%' }
  81.  
  82. "Platform independent
  83. set number
  84. set ruler
  85. set showcmd
  86. set showmatch
  87. set laststatus=2
  88. set showtabline=4
  89. set tabstop=4
  90. set shiftwidth=4
  91. set softtabstop=4
  92. syntax on
  93. set smartindent
  94. "Set search/line/column highlight
  95. set nohlsearch
  96. set nocursorline
  97. set nocursorcolumn
  98. set expandtab
  99. "Set indent guide
  100. "set list
  101. "set listchars=tab:┊\
  102.  
  103. "help window open on right
  104. autocmd FileType help wincmd L
  105.  
  106. "enable Rainbow Parentheses
  107. au VimEnter * RainbowParentheses
  108.  
  109. """""""""""""""""""""""""""
  110. "Set Themes
  111.  
  112. "Use light in GUI model, dark in CLI model
  113. if has('gui_running')
  114. colorscheme seoul256-light
  115. else
  116. colorscheme seoul256
  117. endif
  118. let g:airline_theme='zenburn'
  119.  
  120. """""""""""""""""""""""""""
  121. "Plugins' options
  122.  
  123.  
  124. """""""""""""""""""""""""""
  125. "Set customize functions
  126.  
  127. "Add spell check function
  128. let g:spell_check_opened = 0
  129. function! SpellCheckToggle()
  130. if g:spell_check_opened
  131. set nospell
  132. let g:spell_check_opened = 0
  133. else
  134. set spell spelllang=en_us
  135. let g:spell_check_opened = 1
  136. endif
  137. endfunction
  138.  
  139. "Add function for execute current line
  140. function! ExecuteCurrentLine()
  141. let current_line=getline(".")
  142. silent put='--------'
  143. "silent put=''
  144. "silent call setline(".", "> ".current_line)
  145. "silent put='----'
  146. silent execute("r!" . current_line)
  147. silent put='---- End of Output ----'
  148. silent put=''
  149. silent put=''
  150. endfunction
  151.  
  152. "Add function for searching certain word
  153. function! SearchWordInDirectory(word)
  154. echo 'Searching: ' . a:word
  155. let @/ =a:word
  156. let word="'" . a:word . "'"
  157. call fzf#run({
  158. \ 'source': 'ag -l ' . word,
  159. \ 'options': '--preview="pygmentize -g {} | ag --color --passthru ' . word . '"',
  160. \ 'sink': 'e',
  161. \ })
  162. endfunction
  163.  
  164. "Add function for searching current word
  165. function! SearchCurrentWord()
  166. let current_word=expand("<cword>")
  167. call SearchWordInDirectory(current_word)
  168. endfunction
  169.  
  170. "Add function for searching current word
  171. function! ShowAllBuffers()
  172. call fzf#run(fzf#wrap({
  173. \ 'source': map(range(1, bufnr('$')), 'bufname(v:val)'),
  174. \ }))
  175. endfunction
  176.  
  177. """""""""""""""""""""""""""
  178. "Set customize shortcuts
  179.  
  180. "Set leader
  181. let mapleader = ","
  182.  
  183. "Map shortcuts for highlight search and cursor
  184. map <leader><space> :set hlsearch! cursorcolumn! cursorline!<CR>
  185. "Map shortcuts for fzf search word
  186. map <leader>* :call SearchCurrentWord()<CR>
  187. "Map tab shortcuts
  188. map <leader>n :tabe<CR>
  189. map <leader>t :tabe<CR>
  190. "Map shortcuts for close opeations
  191. map <leader>q :qa<CR>
  192. map <leader>w :q<CR>
  193. map <leader>`q :qa!<CR>
  194. map <leader>`w :q!<CR>
  195. "Map shortcuts for Maxmize and restore a window
  196. map <leader>m :MaximizerToggle<CR>
  197. "Map shortcuts for Tagbar
  198. map <leader>g :TagbarToggle<CR>
  199. "Map 'Check Grammar'
  200. map <leader>ck :SyntasticCheck<CR>
  201. "Map 'Spell Checking'
  202. map <leader>sc :call SpellCheckToggle()<CR>
  203. "Map ctrl+p to search files
  204. map <C-p> :FZF<CR>
  205. "Map ctrl+b to search buffers
  206. map <C-b> :call ShowAllBuffers()<CR>
  207. "Map ctrl+e in insert mode to execute cmd
  208. imap <C-e> <esc>:call ExecuteCurrentLine()<CR>i
  209.  
  210. "Map shortcuts for NERDTree
  211. map <leader>ff :NERDTreeTabsToggle<CR>
  212. map <leader>f :NERDTreeTabsFind<CR>
  213.  
  214. "Map shortcuts for distraction free mode
  215. autocmd! User GoyoEnter Limelight
  216. autocmd! User GoyoLeave Limelight!
  217. map <leader>d :Goyo<CR>
  218. map <leader>l :Limelight!!<CR>
  219.  
  220. "Map ctrl+b/f in insert mode to navigate
  221. imap <C-b> <Left>
  222. imap <C-f> <Right>
  223.  
  224. "Map 'Undo Graphic'
  225. let g:gundo_prefer_python3 = 1
  226. map <leader>z :GundoToggle<CR>
  227.  
  228. "Map Run Current Script
  229. map <leader>e :call append(line(0), "#!/usr/bin/env " . &filetype)<CR>
  230. map <leader>r :!chmod a+x "%:p";"%:p"<CR>
  231. map <leader>cr :!chmod a+x "%:p";clear;"%:p"<CR>
  232.  
  233. "Map capital K to find system manual in a new window
  234. runtime! ftplugin/man.vim
  235. nnoremap K :Man 3 <cword><CR>
  236. if s:uname=="SunOS"
  237. nnoremap K :Man -s 3c <cword><CR>
  238. endif
  239.  
  240. "Set shortcuts for moving between window
  241. map <C-j> <C-w>j
  242. map <C-k> <C-w>k
  243. map <C-l> <C-w>l
  244. map <C-h> <C-w>h
  245.  
  246. "Set cmdline navigation shortcuts
  247. cnoremap <C-a> <Home>
  248. cnoremap <C-e> <End>
  249. cnoremap <C-d> <Delete>
  250. cnoremap <C-p> <Up>
  251. cnoremap <C-n> <Down>
  252. cnoremap <C-b> <Left>
  253. cnoremap <C-f> <Right>
  254.  
  255. "Set shortcut for moving between tab
  256. nnoremap _ :tabp<CR>
  257. nnoremap + :tabn<CR>
  258.  
  259.  
  260. """"""""""""""""""""""""""
  261. "Allow saving of files as sudo
  262. cmap w!! w !sudo tee % > /dev/null
  263.  
  264.  
  265. """"""""""""""""""""""""""
  266. "Searching word in workspace
  267. command -nargs=+ S :call SearchWordInDirectory(<q-args>)
  268.  
  269. """"""""""""""""""""""""""
  270. "comfortable-motion.vim configuration
  271. let g:comfortable_motion_no_default_key_mappings = 1
  272. let g:comfortable_motion_friction = 5000
  273. let g:comfortable_motion_air_drag = 5.0
  274. nnoremap <silent> <C-d> :call comfortable_motion#flick(800)<CR>
  275. nnoremap <silent> <C-u> :call comfortable_motion#flick(-800)<CR>
  276.  
  277. """"""""""""""""""""""""""
  278. "air-line
  279. let g:airline_powerline_fonts = 1
  280.  
  281. if !exists('g:airline_symbols')
  282. let g:airline_symbols = {}
  283. endif
  284.  
  285. "close nerdtree for gui
  286. let g:nerdtree_tabs_open_on_gui_startup = 0
  287.  
  288. let g:ncm2_pyclang#library_path = '/usr/lib/x86_64-linux-gnu/libclang-3.9.so.1'
  289. " enable ncm2 for all buffers
  290. autocmd BufEnter * call ncm2#enable_for_buffer()
  291. set completeopt=noinsert,menuone,noselect
Add Comment
Please, Sign In to add comment