Created
August 15, 2018 03:59
-
-
Save cfcosta/1f73e26f760815e7fe5c1c1a0e6a4334 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" Indent configuration | |
autocmd BufRead neomutt-* setf mail | |
autocmd BufRead *.tsx setf typescript | |
autocmd FileType bash,zsh setlocal ts=2 sts=2 sw=2 expandtab | |
autocmd FileType c,cpp setlocal ts=4 sts=4 sw=4 expandtab | |
autocmd FileType css,html setlocal ts=2 sts=2 sw=2 expandtab | |
autocmd FileType elm setlocal ts=2 sts=2 sw=2 expandtab | |
autocmd FileType go setlocal ts=2 sts=2 sw=2 noexpandtab list | |
autocmd FileType ruby setlocal ts=2 sts=2 sw=2 re=1 expandtab | |
autocmd FileType sql setlocal ts=2 sts=2 sw=2 expandtab | |
autocmd FileType vim setlocal ts=2 sts=2 sw=2 expandtab | |
autocmd FileType yaml setlocal ts=2 sts=2 sw=2 expandtab | |
autocmd FileType crystal setlocal ts=2 sts=2 sw=2 expandtab | |
autocmd FileType typescript setlocal ts=2 sts=2 sw=2 expandtab | |
autocmd FileType sh setlocal ts=2 sts=2 sw=2 expandtab | |
" Default indent config | |
set ts=2 sts=2 sw=2 expandtab | |
" Disable folds to avoid slowness | |
set foldmethod=manual | |
" Automatically expand tabs into spaces | |
set expandtab | |
" Keep our buffers open, even if we are not seeing them. | |
set hidden | |
set switchbuf=useopen | |
" Disable wrap | |
set nowrap | |
" Disable visual bell | |
set visualbell t_vb= | |
" Line numbers | |
if empty($MYVIMRC) | |
set number | |
else | |
set nonumber | |
endif | |
" Configure our completion mode | |
set wildmode=longest:full,full | |
call plug#begin('~/.config/nvim/plugged') | |
" Colorschemes | |
Plug 'chriskempson/base16-vim' | |
" Language Support | |
Plug 'ekalinin/Dockerfile.vim' | |
Plug 'vim-ruby/vim-ruby', {'for': 'ruby'} | |
Plug 'keith/rspec.vim', {'for': 'ruby'} | |
Plug 'rust-lang/rust.vim', {'for': 'rust'} | |
Plug 'chrisbra/csv.vim', {'for': 'csv'} | |
Plug 'cespare/vim-toml' | |
Plug 'PotatoesMaster/i3-vim-syntax' | |
Plug 'HerringtonDarkholme/yats.vim' | |
Plug 'fatih/vim-go', { 'do': ':GoUpdateBinaries', 'for': 'go' } | |
Plug 'rhysd/vim-crystal' | |
" Clang-based coloring for C/C++ | |
Plug 'arakashic/chromatica.nvim', { 'for': ['c', 'cpp'] } | |
let g:chromatica#libclang_path = "/usr/lib64/libclang.so" | |
let g:chromatica#responsive_mode = 1 | |
let g:chromatica#enable_at_startup = 1 | |
" Completion | |
Plug 'roxma/nvim-completion-manager' | |
Plug 'roxma/ncm-elm-oracle' " Elm | |
Plug 'roxma/clang_complete', { 'for': ['c', 'cpp'] } " C/C++ | |
Plug 'Shougo/neoinclude.vim' " Include Support | |
Plug 'Shougo/neco-vim', { 'for': 'vim' } " VimL | |
Plug 'othree/csscomplete.vim', { 'for': 'css' } " CSS | |
Plug 'mhartington/nvim-typescript', { 'do': './install.sh' } " Typescript | |
let g:clang_library_path="/usr/lib64/libclang.so" | |
" Text handling plugins | |
Plug 'tpope/vim-surround' | |
Plug 'scrooloose/nerdcommenter' | |
Plug 'bronson/vim-trailing-whitespace' | |
" Input plugins | |
Plug 'Raimondi/delimitMate' | |
Plug 'houtsnip/vim-emacscommandline' | |
Plug 'tpope/vim-endwise' | |
Plug 'lilydjwg/colorizer' | |
" Snippets | |
Plug 'Shougo/neosnippet.vim' | |
Plug 'cfcosta/neosnippet-snippets' | |
" Text Objects | |
Plug 'kana/vim-textobj-user' | |
Plug 'tek/vim-textobj-ruby', {'for': 'ruby'} | |
" Language Server Support | |
Plug 'Shougo/denite.nvim' | |
Plug 'Shougo/echodoc.vim' | |
Plug 'autozimu/LanguageClient-neovim', {'branch': 'next', 'do': 'make release'} | |
let g:LanguageClient_autoStart = 1 | |
let g:LanguageClient_serverCommands = { | |
\ 'rust': ['rustup', 'run', 'nightly', 'rls'], | |
\ 'go': ['go-langserver'], | |
\ 'cpp': ['clangd'], | |
\ 'typescript': ['javascript-typescript-stdio'], | |
\ 'typescriptreact': ['javascript-typescript-stdio'], | |
\ 'javascript': ['javascript-typescript-stdio'], | |
\ 'javascript.jsx': ['javascript-typescript-stdio'], | |
\ } | |
" Environment plugins | |
Plug 'jlanzarotta/bufexplorer' | |
Plug 'tpope/vim-vinegar' | |
Plug 'DataWraith/auto_mkdir' | |
Plug 'tpope/vim-fugitive' | |
Plug 'majutsushi/tagbar' | |
Plug 'vimwiki/vimwiki', {'branch': 'dev'} | |
let g:vimwiki_list = [{ 'path': '/media/data/Dropbox/Documents', 'path_html': '/media/data/Dropbox/Documents_html', 'ext': '.md' }] | |
" Services | |
Plug 'wakatime/vim-wakatime' | |
" FZF | |
Plug 'junegunn/fzf', { 'do': 'yes n \| ./install' } | |
let g:fzf_action = { 'ctrl-s': 'split', 'ctrl-v': 'vsplit' } | |
Plug 'kassio/neoterm' | |
let g:neoterm_default_mod = "vertical belowright" | |
let g:neoterm_shell = "zsh" | |
let g:neoterm_automap_keys = ",ss" | |
if empty($SSH_CONNECTION) | |
let g:neoterm_fixedsize = "1" | |
let g:neoterm_size = "112" | |
let g:neoterm_default_mod = "vertical belowright" | |
set splitbelow | |
set splitright | |
else | |
let g:neoterm_default_mod = "belowright" | |
endif | |
let g:neoterm_autoscroll = "1" | |
Plug 'sbdchd/neoformat' | |
let g:neoformat_enabled_javascript = ['js-beautify'] | |
let g:neoformat_enabled_ruby = [] | |
augroup fmt_lints | |
autocmd! | |
autocmd BufWritePre * Neoformat | |
augroup END | |
call plug#end() | |
" Set python paths for faster lookup | |
let g:python_host_prog = "/usr/bin/python2" | |
let g:python2_host_prog = "/usr/bin/python2" | |
let g:python3_host_prog = "/usr/bin/python3" | |
" Plugin configuration | |
" ============================================================================= | |
" Here we add all configuration for our plugins that need them to be | |
" enabled before they can be called. | |
" ============================================================================= | |
" Set our terminal background to dark | |
set background=dark | |
if isdirectory($HOME . "/.config/nvim/autoload") | |
set termguicolors | |
colorscheme base16-twilight | |
endif | |
" Completion configuration | |
set shortmess+=c " Remove completion-menu messages | |
noremap <expr> <CR> (pumvisible() ? "\<c-y>\<cr>" : "\<CR>") | |
inoremap <c-c> <ESC> | |
inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>" | |
inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>" | |
" Keymaps | |
" ============================================================================= | |
" Usually we're going to follow some conventions: | |
" - If a command opens a new pane/buffer, we're going to give it a PRIMARY, | |
" and that PRIMARY can be repeated or added a MODIFIER. | |
" | |
" Our MODIFIERS are always the same: | |
" * `s` for opening in a vertical split | |
" * `S` for opening in a horizontal split | |
" * `t` for opening in a new tab | |
" | |
" Our PRIMARIES are defined in a command by command basis. | |
" ============================================================================= | |
" Map our leader key to `,` | |
let g:mapleader="," | |
" Clean up search results | |
nnoremap <c-l> :nohlsearch<cr> | |
" Map window movement commands to terminal buffers | |
tnoremap <c-w>j <c-\><c-n><c-w>j | |
tnoremap <c-w>k <c-\><c-n><c-w>k | |
tnoremap <c-w>h <c-\><c-n><c-w>h | |
tnoremap <c-w>l <c-\><c-n><c-w>l | |
tnoremap <c-w>J <c-\><c-n><c-w>J | |
tnoremap <c-w>K <c-\><c-n><c-w>K | |
tnoremap <c-w>H <c-\><c-n><c-w>H | |
tnoremap <c-w>L <c-\><c-n><c-w>L | |
tnoremap <c-w>x <c-\><c-n><c-w>x | |
" Wiki Diary | |
nnoremap <silent> <leader>wd :VimwikiMakeDiaryNote<cr> | |
" Format the file | |
nnoremap <silent> <leader>ff :Neoformat<cr>:e<cr> | |
" Remove trailing whitespaces | |
nnoremap <silent> <leader><space> :FixWhitespace<cr> | |
" a.vim | |
nnoremap <silent> <leader>aa :A<cr> | |
nnoremap <silent> <leader>as :AV<cr> | |
nnoremap <silent> <leader>aS :AS<cr> | |
" fzf.vim - fuzzy file finder | |
nnoremap <silent> <leader>tt :FZF<cr> | |
" bufexplorer.vim | |
nnoremap <silent> <leader>bb :BufExplorer<cr> | |
" IDE-like hotkeys (base z) | |
" Language Client Shortcuts | |
nnoremap <silent> K :call LanguageClient#textDocument_hover()<CR> | |
nnoremap <silent> gd :call LanguageClient#textDocument_definition()<CR> | |
" Neosnippet | |
imap <expr><TAB> neosnippet#expandable_or_jumpable() ? | |
\ "\<Plug>(neosnippet_expand_or_jump)" | |
\: pumvisible() ? "\<C-n>" : "\<TAB>" | |
smap <expr><TAB> neosnippet#expandable_or_jumpable() ? | |
\ "\<Plug>(neosnippet_expand_or_jump)" | |
\: "\<TAB>" | |
" Commands for LanguageClient | |
command! Definition call LanguageClient#textDocument_definition() | |
command! Rename call LanguageClient#textDocument_rename() | |
command! ListSymbols call LanguageClient#workspace_symbol() | |
command! Hover call LanguageClient#textDocument_hover() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment