daily pastebin goal
16%
SHARE
TWEET

Untitled

a guest May 16th, 2018 93 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. " This is added by the install script.
  2. set runtimepath+=~/.dotfiles/vim
  3.  
  4. """""""""""""""""""""""""""""""""""""""""""""
  5. " GENERAL
  6. """""""""""""""""""""""""""""""""""""""""""""
  7.  
  8. " Language
  9. set encoding=utf8
  10.  
  11. " Set history to remember.
  12. set history=1000
  13.  
  14. " Backspace behavior fix.
  15. set backspace=2
  16.  
  17. " Remove mode line
  18. set noshowmode
  19.  
  20. " Indentation.
  21. set sw=4 ts=4 sts=4
  22. autocmd Filetype javascript setlocal ts=2 sw=2 sts=0 expandtab
  23. set autoindent
  24. set smartindent
  25. set expandtab
  26. set cindent
  27. set smartcase
  28.  
  29. " Link break
  30. set lbr
  31. set tw=120
  32. set nowrap
  33.  
  34. " Backups and undo
  35. set nobackup
  36. set nowb
  37. set noswapfile
  38. set undodir=~/.dotfiles/vim/temp/undodir
  39. set undofile
  40.  
  41. " always yank to clipboard
  42. set clipboard=unnamedplus
  43.  
  44. " Map leader key.
  45. let mapleader=","
  46. let g:mapleader=","
  47.  
  48. let maplocalleader = ",,"
  49. let g:maplocalleader = ",,"
  50.  
  51. " Show current line.
  52. set ruler
  53.  
  54.  
  55. " Height of the command bar.
  56. set cmdheight=2
  57.  
  58. " Search optimization.
  59. set hlsearch
  60. set incsearch
  61. set ignorecase
  62.  
  63. " Enable syntax highlighting.
  64. syntax on
  65. filetype plugin indent on
  66.  
  67. " display indentation guides
  68. set list listchars=tab:·\ ,trail:·,extends:»,precedes:«,nbsp:×
  69.  
  70. " Color Scheme
  71. let &t_Co=256
  72. hi Normal guibg=NONE ctermbg=NONE
  73. " colorscheme despacio
  74.  
  75. " Status bar
  76. set laststatus=2                                " always show statusbar
  77. set statusline=%t                               "tail of the filename
  78. set statusline+=[%{strlen(&fenc)?&fenc:'none'}, "file encoding
  79. set statusline+=\ %{&ff}]                       "file format
  80. set statusline+=\ %h                            "help file flag
  81. set statusline+=\ %r                            "read only flag
  82. set statusline+=\ %y                            "filetype
  83. set statusline+=\ %m                            "modified flag
  84.  
  85. set statusline+=\ %=                            "left/right separator
  86. set statusline+=\ %c,                           "cursor column
  87. set statusline+=%l/%L                           "cursor line/total lines
  88. set statusline+=\ %P                            "percent through file
  89. " highlight statusline cterm=reverse
  90.  
  91.  
  92. " Seperator
  93. set fillchars+=vert:│
  94. set fillchars+=stl:─
  95. set fillchars+=stlnc:─
  96.  
  97.  
  98. " Fix humans.
  99. :command WQ wq
  100. :command Wq wq
  101. :command W w
  102. :command Q q
  103.  
  104. " NeoVim
  105. let g:python3_host_prog = '/home/necmttn/.pyenv/versions/3.6.5/bin/python'
  106. let g:python_host_prog = '/home/necmttn/.pyenv/versions/2.7.14/bin/python'
  107.  
  108. """""""""""""""""""""""""""""""""""""""""""""
  109. " KEYBINDINGS
  110. """""""""""""""""""""""""""""""""""""""""""""
  111.  
  112.  
  113. " Search
  114. map <space> /
  115.  
  116. " Buffer
  117. map <leader>l :bnext<cr>
  118. map <leader>h :bprevious<cr>
  119.  
  120. " Tabs
  121. map <c-t>l :tabnext<cr>
  122. map <c-t>h :tabprevious<cr>
  123. map <c-t>q :tabclose<cr>
  124. map <c-t>n :call LaunchNewTabWithNetrw()<cr>
  125.  
  126. " Netrw
  127. map <leader>nn :Explore<cr>
  128. map <leader>nh :Hex<cr>
  129. map <leader>nv :Vex<cr>
  130.  
  131. " CtrlP
  132. map <c-b> :CtrlPBuffer<cr>
  133.  
  134. " AG
  135. map <leader>g :Ag
  136.  
  137. """""""""""""""""""""""""""""""""""""""""""""
  138. " FILETYPES
  139. """""""""""""""""""""""""""""""""""""""""""""
  140.  
  141. """"""""""" PYTHON
  142. let python_highlight_all = 1
  143. au FileType python syn keyword pythonDecorator True None False self
  144. au BufNewFile,BufRead *.jinja set syntax=htmljinja
  145. au BufNewFile,BufRead *.mako set ft=mako
  146. au FileType python map <buffer> F :set foldmethod=indent<cr>
  147. au FileType python set cindent
  148. au FileType python set cinkeys-=0#
  149. au FileType python set indentkeys-=0#
  150.  
  151. " Highlight docstrings as comments, not string.
  152. syn region pythonDocstring  start=+^\s*[uU]\?[rR]\?"""+ end=+"""+ keepend excludenl contains=pythonEscape,@Spell,pythonDoctest,pythonDocTest2,pythonSpaceError
  153. syn region pythonDocstring  start=+^\s*[uU]\?[rR]\?'''+ end=+'''+ keepend excludenl contains=pythonEscape,@Spell,pythonDoctest,pythonDocTest2,pythonSpaceError
  154.  
  155. hi def link pythonDocstring pythonComment
  156.  
  157.  
  158. """"""""""" JAVASCRIPT
  159. au FileType javascript call JavaScriptFold()
  160. au FileType javascript setl fen
  161. au FileType javascript setl nocindent
  162.  
  163. function! JavaScriptFold()
  164.     setl foldmethod=syntax
  165.     setl foldlevelstart=1
  166.     syn region foldBraces start=/{/ end=/}/ transparent fold keepend extend
  167.  
  168.     function! FoldText()
  169.         return substitute(getline(v:foldstart), '{.*', '{...}', '')
  170.     endfunction
  171.     setl foldtext=FoldText()
  172. endfunction
  173.  
  174.  
  175. """"""""""" GOLANG
  176. au FileType go set noexpandtab
  177.  
  178.  
  179. """""""""""
  180. au BufNewFile,BufRead *.sls set syntax=yaml
  181. au BufNewFile,BufRead Dockerfile.* set syntax=dockerfile
  182.  
  183.  
  184.  
  185. """""""""""""""""""""""""""""""""""""""""""""
  186. " PLUGINS
  187. """""""""""""""""""""""""""""""""""""""""""""
  188.  
  189.  
  190. " Vim-plug
  191. call plug#begin('~/.dotfiles/vim/plugged')
  192.  
  193. Plug 'rking/ag.vim'
  194. Plug 'ctrlpvim/ctrlp.vim'
  195.  
  196. Plug 'jiangmiao/auto-pairs'
  197. Plug 'ntpeters/vim-better-whitespace'
  198. Plug 'tpope/vim-commentary'
  199. Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
  200. Plug 'lambdalisue/vim-pyenv', {'for': ['python']}
  201.  
  202. Plug 'honza/vim-snippets'
  203. Plug 'sheerun/vim-polyglot'
  204. Plug 'w0rp/ale'
  205. Plug 'sjl/gundo.vim'
  206.  
  207. Plug 'SirVer/ultisnips'
  208. Plug 'Shougo/deoplete.nvim', { 'do': 'UpdateRemotePlugins' }
  209. Plug 'zchee/deoplete-jedi'
  210. Plug 'carlitux/deoplete-ternjs', { 'do': 'npm install -g tern' }
  211. Plug 'mhartington/nvim-typescript'
  212. Plug 'zchee/deoplete-clang', { 'for': ['c', 'cpp'] }
  213. Plug 'Shougo/neoinclude.vim', { 'for': ['c', 'cpp'] }
  214. Plug 'zchee/deoplete-go', { 'do': 'make' }
  215. Plug 'nsf/gocode', { 'rtp': 'vim', 'do': '~/.vim/plugged/gocode/vim/symlink.sh' }
  216. Plug 'fatih/vim-go'
  217.  
  218. Plug 'dracula/vim', { 'as': 'dracula' }
  219.  
  220. call plug#end()
  221.  
  222.  
  223. " Ctrlp
  224. let g:ctrlp_working_path_mode = 0
  225. let g:ctrlp_map = '<c-f>'
  226. let g:ctrlp_max_height = 20
  227. let g:ctrlp_custom_ignore = 'node_modules\|^\.DS_Store\|^\.git\|^\.coffee'
  228.  
  229. " Netrw
  230. let g:netrw_liststyle = 3
  231.  
  232. " AG
  233. let g:ag_working_path_mode="r"
  234.  
  235. " UltiSnips
  236. let g:UltiSnipsExpandTrigger="<c-d>"
  237. let g:UltiSnipsJumpForwardTrigger="<c-b>"
  238. let g:UltiSnipsJumpBackwardTrigger="<c-z>"
  239.  
  240. " If you want :UltiSnipsEdit to split your window.
  241. let g:UltiSnipsEditSplit="vertical"
  242.  
  243. " ALE
  244. let g:ale_sign_column_always = 1
  245. let g:ale_fixers = {
  246. \   'javascript': ['eslint'],
  247. \   'python': ['yapf'],
  248. \}
  249.  
  250. " Deoplete
  251. let g:deoplete#enable_at_startup = 1
  252. autocmd FileType python nnoremap <leader>y :0,$!yapf<Cr>
  253. autocmd InsertLeave * if pumvisible() == 0 | pclose | endif "close preview window
  254.  
  255. let g:deoplete#enable_at_startup = 1
  256. let g:deoplete#sources#go#gocode_binary = '/home/osmanmesutozcan/dev/go/bin/gocode'
  257.  
  258. let g:deoplete#sources#clang#libclang_path = '/usr/lib/llvm-4.0/lib/libclang.so'
  259. let g:deoplete#sources#clang#clang_header = '/usr/lib/clang/4.0/include'
  260. let g:deoplete#sources#clang#std = { 'c': 'c11', 'cpp': 'c++1z' }
  261. let g:deoplete#sources#clang#flags = ['-std=c11']
  262.  
  263. let g:deoplete#sources#ternjs#depths = 1
  264. let g:deoplete#sources#ternjs#filter = 0
  265. let g:deoplete#sources#ternjs#case_insensitive = 1
  266. let g:tern#arguments = ['--persistent']
  267.  
  268. " deoplete-jedi
  269. inoremap <expr><tab> pumvisible() ? "\<c-n>" : "\<tab>"
  270.  
  271. " NERDTree
  272. " Close vim if the only buffer left is NERDTree
  273. autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
  274. " Start NERDTree when opening a directory
  275. autocmd StdinReadPre * let s:std_in=1
  276. autocmd VimEnter * if argc() == 1 && isdirectory(argv()[0]) && !exists("s:std_in") | exe 'NERDTree' argv()[0] | wincmd p | ene | endif
  277.  
  278. let g:NERDTreeWinPos = "right"
  279. map <C-n> :NERDTreeToggle<CR>
  280.  
  281. " Cursor Shape
  282. let $NVIM_TUI_ENABLE_CURSOR_SHAPE=1
  283.  
  284.  
  285. colorscheme dracula
  286.  
  287. """""""""""""""""""""""""""""""""""""""""""""
  288. " FUNCTIONS
  289. """""""""""""""""""""""""""""""""""""""""""""
  290.  
  291. function! LaunchNewTabWithNetrw()
  292.   :tabnew
  293.   :Explore
  294. endfunction
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top