Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@facchettos
Last active February 19, 2020 13:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save facchettos/1e17083419b72904840918ab1219ca9f to your computer and use it in GitHub Desktop.
Save facchettos/1e17083419b72904840918ab1219ca9f to your computer and use it in GitHub Desktop.
set nocompatible
set number
" Attempt to determine the type of a file based on its name and possibly its
" contents. Use this to allow intelligent auto-indenting for each filetype,
" and for plugins that are filetype specific.
filetype indent plugin on
" Enable syntax highlighting
syntax on
set nocompatible " be iMproved, required
nnoremap <Leader>f :FZF
filetype off " required
autocmd Filetype go setlocal tabstop=4
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
map <s-f> :FZF<CR>
map <s-p> :CocSearch
map <C-J> :bnext<CR>
map <C-K> :bprev<CR>
"map <f12> :let &background = ( &background == "dark"? "light" : "dark" ) <CR>
imap <C-Del> <C-o>diw
let g:go_highlight_types = 1
let g:go_highlight_methods = 1
let g:go_highlight_functions = 1
let g:go_highlight_operators = 1
let g:go_highlight_function_calls = 1
let g:go_highlight_fields = 1
let g:airline#extensions#tabline#enabled = 1
let g:signify_vcs_list = [ 'git']
let g:signify_realtime = 1
set splitright
set splitbelow
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
if has('python3')
endif
" let Vundle manage Vundle, required
" Snippets are separated from the engine. Add this if you want them:
"Plugin 'honza/vim-snippets'
" Trigger configuration. Do not use <tab> if you use https://github.com/Valloric/YouCompleteMe.
let g:UltiSnipsExpandTrigger = '<C-j>'
let g:UltiSnipsJumpForwardTrigger = '<C-j>'
let g:UltiSnipsJumpBackwardTrigger = '<C-k>'
" If you want :UltiSnipsEdit to split your window.
let g:UltiSnipsEditSplit="vertical"
"let g:ycm_autoclose_preview_window_after_completion=1
filetype plugin indent on " required
set hidden
set wildmenu
" Show partial commands in the last line of the screen
set showcmd
" Highlight searches (use <C-L> to temporarily turn off highlighting; see the
" mapping of <C-L> below)
set hlsearch
set ignorecase
set smartcase
set relativenumber
set backspace=indent,eol,start
set autoindent
" Stop certain movements from always going to the first character of a line.
" While this behaviour deviates from that of Vi, it does what most users
" coming from other editors would expect.
set nostartofline
" Display the cursor position on the last line of the screen or in the status
" line of a window
set ruler
" Always display the status line, even if only one window is displayed
set laststatus=2
" Instead of failing a command because of unsaved changes, instead raise a
" dialogue asking if you wish to save changed files.
set confirm
" Use visual bell instead of beeping when doing something wrong
set visualbell
" And reset the terminal code for the visual bell. If visualbell is set, and
" this line is also included, vim will neither flash nor beep. If visualbell
" is unset, this does nothing.
set t_vb=
" Enable use of the mouse for all modes
""set mouse=a
" Set the command window height to 2 lines, to avoid many cases of having to
" "press <Enter> to continue"
set cmdheight=2
" Display line numbers on the left
set number
" Quickly time out on keycodes, but never time out on mappings
set notimeout ttimeout ttimeoutlen=200
" Use <F11> to toggle between 'paste' and 'nopaste'
set pastetoggle=<F10>
"------------------------------------------------------------
" Indentation options {{{1
"
" Indentation settings according to personal preference.
" Indentation settings for using 4 spaces instead of tabs.
" Do not change 'tabstop' from its default value of 8 with this setup.
set shiftwidth=4
set rtp+=/usr/bin/fzf
set softtabstop=4
set expandtab
" Indentation settings for using hard tabs for indent. Display tabs as
" four characters wide.
"set shiftwidth=4
"set tabstop=4
"------------------------------------------------------------
" Mappings {{{1
"
" Useful mappings
" Map Y to act like D and C, i.e. to yank until EOL, rather than act as yy,
" which is the default
map Y y$
" Map <C-L> (redraw screen) to also turn off search highlighting until the
" next search
nnoremap <C-L> :nohl<CR><C-L>
call plug#begin('~/.vim/plugged')
Plug 'VundleVim/Vundle.vim'
Plug 'google/vim-maktaba'
Plug 'google/vim-codefmt'
Plug 'google/vim-glaive'
"Plug 'Valloric/YouCompleteMe'
Plug 'rstacruz/sparkup', {'rtp': 'vim/'}
Plug 'SirVer/ultisnips'
Plug 'neoclide/coc.nvim', {'do': 'yarn install --frozen-lockfile'}
Plug 'rust-lang/rust.vim'
Plug 'junegunn/vim-easy-align'
Plug 'SirVer/ultisnips' | Plug 'honza/vim-snippets'
Plug 'tpope/vim-fireplace', { 'for': 'clojure' }
Plug 'dracula/vim', { 'as': 'dracula' }
"Plug 'rdnetto/YCM-Generator', { 'branch': 'stable' }
Plug 'lifepillar/vim-solarized8'
Plug 'fatih/vim-go', { 'tag': '*' }
Plug 'terryma/vim-multiple-cursors'
Plug 'liuchengxu/space-vim-theme'
Plug 'nsf/gocode', { 'tag': 'v.20150303', 'rtp': 'vim' }
Plug 'jiangmiao/auto-pairs'
Plug 'vim-airline/vim-airline'
Plug 'tpope/vim-fugitive'
Plug 'fatih/vim-go', { 'do': ':GoUpdateBinaries' }
Plug 'whzup/greent.vim'
Plug 'fatih/molokai'
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
Plug 'mhinz/vim-signify'
Plug 'hashivim/vim-terraform'
call plug#end()
set background=dark
colorscheme space_vim_theme
"let g:ycm_global_ycm_extra_conf = "~/.vim/.ycm_extra_conf.py"
let g:terraform_fmt_on_save=1
function! Formatonsave()
execute "FormatCode"
endfunction
function! Formatonsavee()
let l:formatdiff = 1
pyf ~/clang-format.py
endfunction
"autocmd BufWritePre *.h,*.cc,*.cpp call Formatonsave()
function! ToggleColor()
let &background = ( &background == "dark"? "light" : "dark" )
execute "colorscheme " .(&background=="dark"? "space_vim_theme" : "greent")
endfunction
map <f12> :execute ToggleColor() <CR>
autocmd InsertEnter,InsertLeave * set cul!
autocmd BufWritePre *.h,*.cc,*.cpp,*.java call Formatonsave()
autocmd BufWritePre *.go :GoImports
inoremap <silent><expr> <TAB>
\ pumvisible() ? "\<C-n>" :
\ <SID>check_back_space() ? "\<TAB>" :
\ coc#refresh()
inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>"
function! s:check_back_space() abort
let col = col('.') - 1
return !col || getline('.')[col - 1] =~# '\s'
endfunction
"autocmd BufWritePre *.h,*.cc,*.cpp call Formatonsave()
inoremap <expr> <cr> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"
" Remap keys for gotos
nmap <silent> gd <Plug>(coc-definition)
nmap <silent> gy <Plug>(coc-type-definition)
nmap <silent> gi <Plug>(coc-implementation)
nmap <silent> gr <Plug>(coc-references)
nmap <leader>rn <Plug>(coc-rename)
nnoremap <C-c> :bp\|bd #<CR>
inoremap <silent><expr> <c-space> coc#refresh()
nnoremap <silent> K :call <SID>show_documentation()<CR>
nmap <expr> <silent> <C-d> <SID>select_current_word()
function! s:select_current_word()
if !get(g:, 'coc_cursors_activated', 0)
return "\<Plug>(coc-cursors-word)"
endif
return "*\<Plug>(coc-cursors-word):nohlsearch\<CR>"
endfunc
inoremap <silent><expr> <C-_> coc#refresh()
inoremap <expr> <cr> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"
command! -nargs=0 Format :call CocAction('format')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment