Browse Source

🎉 Initial commit

master
n0m1s 7 years ago
commit
c87f040e39
7 changed files with 285 additions and 0 deletions
  1. +5
    -0
      config/filetypes.vimrc
  2. +6
    -0
      config/functions.vimrc
  3. +67
    -0
      config/general.vimrc
  4. +51
    -0
      config/init.vimrc
  5. +29
    -0
      config/keys.vimrc
  6. +85
    -0
      config/plugins.vimrc
  7. +42
    -0
      init.vim

+ 5
- 0
config/filetypes.vimrc View File

@ -0,0 +1,5 @@
au BufNewFile,BufRead *.i set filetype=swig
au BufNewFile,BufRead *.swg set filetype=swig
au BufNewFile,BufRead *.g set filetype=antlr3
au BufNewFile,BufRead *.g4 set filetype=antlr4
au BufNewFile,BufRead *.gv set filetype=dot

+ 6
- 0
config/functions.vimrc View File

@ -0,0 +1,6 @@
function! ListDirectoryWithPattern(folder, pattern)
split(system("find '".a:folder."' -type f -name '".a:pattern."'"),'\n')
endfunction
com! FormatJSON %!python -m json.tool
com! JSONformat %!python -m json.tool

+ 67
- 0
config/general.vimrc View File

@ -0,0 +1,67 @@
set nocompatible
filetype off
filetype plugin on
filetype indent on
if &t_Co >= 256 || has("gui_running")
colorscheme mustang
endif
if &t_Co > 2 || has("gui_runnig")
syntax on
endif
autocmd BufEnter *.cls set syntax=tex
" must-have
" {
set hidden
set wildmenu
set showcmd
set hlsearch
" }
" usability
" {
set ignorecase
set smartcase
set backspace=indent,eol,start
set autoindent
set nostartofline
set ruler
set laststatus=2
set confirm
set visualbell
set t_vb=
set mouse=a
set cmdheight=2
set number
set notimeout nottimeout
set list
set scrolloff=5
set listchars=tab:>.,trail:!,extends:#,nbsp:‿
set wildignore+=*/.git/*,*/tmp/*,*.so,*.swp,*.zip
" }
" indentation
" {
set shiftwidth=4
set softtabstop=4
set tabstop=4
set expandtab
" }
" fold
" {
set foldmethod=indent
set foldnestmax=10
set nofoldenable
nnoremap <silent> <Space> @=(foldlevel('.')?'za':"\<Space>")<CR>
vnoremap <Space> zf
cabbrev h vert h
" }

+ 51
- 0
config/init.vimrc View File

@ -0,0 +1,51 @@
" loading vim-plug
if empty(glob(g:home."/.vim/autoload/plug.vim"))
execute '!curl -fLo '.g:home.'/.vim/autoload/plug.vim https://raw.github.com/junegunn/vim-plug/master/plug.vim'
endif
call plug#begin(g:home.'/.vim/plugged')
" colors
Plug 'altercation/vim-colors-solarized'
Plug 'TheMrNomis/mustang-vim'
" syntax
Plug 'dpelle/vim-Grammalecte' " French
Plug 'martinda/Jenkinsfile-vim-syntax' " Jenkins
Plug 'vim-scripts/SWIG-syntax' " SWIG
Plug 'cespare/vim-toml' " TOML
Plug 'dylon/vim-antlr' " ANTLR
Plug 'rust-lang/rust.vim' " rust
" must-have
Plug 'vim-airline/vim-airline' " awesome bar
Plug 'ctrlpvim/ctrlp.vim' " fuzzy file-finder
Plug 'bkad/CamelCaseMotion' " move inside words
" IDE-like plugins
Plug 'vim-scripts/a.vim' " quickly change between .h & .c
Plug 'bitc/vim-bad-whitespace' " show whitespace at end of lines
if has('nvim')
" autocomplete
Plug 'shougo/deoplete.nvim', {'do': ':UpdateRemotePlugins'}
Plug 'shougo/deoplete-clangx'
endif
Plug 'jiangmiao/auto-pairs' " pair parenthesis
Plug 'kien/rainbow_parentheses.vim' " color parentheses
Plug 'terryma/vim-multiple-cursors' " multiple cursors
Plug 'vim-scripts/DoxygenToolkit.vim' " creates doxygen blocks
Plug 'tacahiroy/ctrlp-funky' " fuzzy function-finder (CTRLp plugin)
Plug 'mhinz/vim-startify' " landing page & session manager
Plug 'scrooloose/nerdcommenter' " auto comment blocks
Plug 'jaxbot/semantic-highlight.vim' " semantic highlight
Plug 'mhinz/vim-signify' " VCS differences
"Plug 'vim-syntastic/syntastic' " syntax checker
"Plug 'neomake/neomake' " syntax checker (asynchoneous)
Plug 'w0rp/ale' " syntax checker
" others
Plug 'tpope/vim-fugitive' " git wrapper
Plug 'easymotion/vim-easymotion'
call plug#end()

+ 29
- 0
config/keys.vimrc View File

@ -0,0 +1,29 @@
" bepo
nnoremap . :
nnoremap <F4> .
let mapleader=","
imap <A-,> <Esc>
" usability
map Y y$
map <F1> <nop>
map Q <nop>
nnoremap <C-L> :nohl<CR><C-L>
nnoremap <C-S> :w<CR>
vnoremap // y/<C-R>"<CR>
" buffers
map <C-Right> <C-w>l
map <C-Left> <C-w>h
map <C-Up> <C-w>k
map <C-Down> <C-w>j
" plugins
nmap /** :Dox<CR>
"nmap <silent> <tab> :CtrlPMixed<CR>
nmap <silent> <tab> :FZF<CR>
nmap <silent> <space><tab> :CtrlPFunky<CR>
noremap <silent> <F5> :SemanticHighlightToggle<CR>
inoremap <expr><tab> pumvisible() ? "\<c-n>" : "\<tab>"

+ 85
- 0
config/plugins.vimrc View File

@ -0,0 +1,85 @@
let g:airline_powerline_fonts = 1
let g:session_autosave = 'no'
let g:ycm_server_python_interpreter = '/usr/bin/python3'
let g:grammalecte_cli_py='/usr/share/grammalecte-fr/grammalecte-cli.py'
let g:deoplete#enable_at_startup = 1
let g:ctrlp_funky_syntax_highlight = 1
let g:ctrlp_working_path_mode = 'rwa'
let g:ctrlp_cache_dir = $XDG_CACHE_DIR . '/ctrlp'
let g:semanticTermColors = [28,1,2,3,4,5,6,7,25,9,10,34,12,13,14,15,125,124,19]
let g:EasyMotion_keys = 'auie,ctsrnmbépoèvdljzwàyx.kqghfç'
call camelcasemotion#CreateMotionMappings('')
" code search
if executable('ag')
" Use Ag over Grep
set grepprg=ag\ --nogroup\ --nocolor
" Use ag in CtrlP for listing files. Lightning fast and respects .gitignore
let g:ctrlp_user_command = 'ag %s -l --nocolor -g ""'
let g:ctrlp_use_caching=1
endif
if executable('rg')
set grepprg=rg\ --color=never
"let g:ctrlp_user_command = 'rg %s --files --color=never --glob ""'
let g:ctrlp_use_caching=1
endif
" ALE
let g:ale_linters = {
\ 'cpp': ['clang']
\}
let g:ale_cpp_clang_includes = [
\ getcwd(),
\ getcwd().'/third-party'
\ ] +
\ split(system("find '/usr/include/qt' -maxdepth 1 -type d"), '\n') +
\ split(system("[[ " . getcwd() . " == *'workspace'* ]] && find " . getcwd() . " -type d -name 'include'"), '\n')
let g:ale_cpp_clang_options = '-std=c++17 -Wall -Wno-pragma-once-outside-header'
if len(g:ale_cpp_clang_includes)
let g:ale_cpp_clang_options = g:ale_cpp_clang_options . ' -I' . join(g:ale_cpp_clang_includes, " -I")
endif
let g:ale_cs_mcsc_source = getcwd()
let g:ale_cs_mcsc_assemblies =
\ split(system("find '/opt/Unity/Editor/Data/' -type f -name 'Unity*.dll'"),'\n') "+
"\ split(system("find " . getcwd() . " -type f -name '*.dll'"))
" startify
let g:startify_fortune_use_unicode = 1
let g:startify_session_persistence = 1
let g:startify_lists = [
\ { 'type': 'sessions', 'header': [' Sessions'] },
\ { 'type': 'files', 'header': [' MRU'] },
\ { 'type': 'dir', 'header': [' MRU '. getcwd()] },
\ { 'type': 'bookmarks', 'header': [' Bookmarks'] },
\ { 'type': 'commands', 'header': [' Commands'] },
\ ]
let g:startify_session_before_save = []
" You can set up fzf window using a Vim command (Neovim or latest Vim 8 required)
let g:fzf_layout = { 'window': 'belowright 10split enew' }
" Customize fzf colors to match your color scheme
let g:fzf_colors =
\ { 'fg': ['fg', 'Normal'],
\ 'bg': ['bg', 'Normal'],
\ 'hl': ['fg', 'Comment'],
\ 'fg+': ['fg', 'CursorLine', 'CursorColumn', 'Normal'],
\ 'bg+': ['bg', 'CursorLine', 'CursorColumn'],
\ 'hl+': ['fg', 'Statement'],
\ 'info': ['fg', 'PreProc'],
\ 'border': ['fg', 'Ignore'],
\ 'prompt': ['fg', 'Conditional'],
\ 'pointer': ['fg', 'Exception'],
\ 'marker': ['fg', 'Keyword'],
\ 'spinner': ['fg', 'Label'],
\ 'header': ['fg', 'Comment'] }

+ 42
- 0
init.vim View File

@ -0,0 +1,42 @@
if(!exists('g:home'))
let g:home=$HOME
let g:config_dir=g:home.'/.config/nvim'
endif
execute 'source '.g:config_dir.'/config/init.vimrc'
execute 'source '.g:config_dir.'/config/general.vimrc'
execute 'source '.g:config_dir.'/config/functions.vimrc'
execute 'source '.g:config_dir.'/config/filetypes.vimrc'
execute 'source '.g:config_dir.'/config/plugins.vimrc'
execute 'source '.g:config_dir.'/config/keys.vimrc'
" functions
" {
fun! StripTrailingWhitespaces()
let _s=@/
let l = line(".")
let c = col(".")
%s/\s\+$//e
call cursor(l,c)
let @/=_s
endfun
nmap <silent> <F3> :call StripTrailingWhitespaces()<CR>
augroup CursorLine
au!
au VimEnter,WinEnter,BufWinEnter * setlocal cursorline
au WinLeave * setlocal nocursorline
augroup END
augroup AutoComment
autocmd!
autocmd FileType c,cpp,java,scala let b:comment_leader = '// '
autocmd FileType sh,ruby,python,conf,fstab let b:comment_leader = '# '
autocmd FileType tex let b:comment_leader = '% '
autocmd FileType mail let b:comment_leader = '> '
autocmd FileType vim let b:comment_leader = '" '
augroup END
nnoremap <silent> <leader>cc :<C-B>silent <C-E>s/^/<C-R>=escape(b:comment_leader,'\/')<CR>/<CR>:nohlsearch<CR>
nnoremap <silent> <leader>cu :<C-B>silent <C-E>s/^\V<C-R>=escape(b:comment_leader,'\/')<CR>//e<CR>:nohlsearch<CR>
" }

Loading…
Cancel
Save