888 lines
26 KiB
Plaintext
888 lines
26 KiB
Plaintext
" Find the filepath to the currently active pyenv pythons and use these as the
|
|
" python programs.
|
|
" let g:python_host_prog=system("pyenv which python | xargs echo -n")
|
|
let g:python_host_prog="/usr/bin/python"
|
|
|
|
let g:python3_host_prog=system("pyenv which python3 | xargs echo -n")
|
|
filetype off " required
|
|
|
|
|
|
" set the runtime path to include Vundle and initialize
|
|
set rtp+=/usr/local/Cellar/fzf/HEAD
|
|
call plug#begin()
|
|
function! DoRemote(arg)
|
|
UpdateRemotePlugins
|
|
endfunction
|
|
" let Vundle manage Vundle, required
|
|
" Plug 'Valloric/YouCompleteMe'
|
|
Plug 'tpope/vim-unimpaired'
|
|
Plug 'sudar/vim-arduino-syntax'
|
|
Plug 'bling/vim-airline'
|
|
Plug 'docunext/closetag.vim'
|
|
Plug 'critiqjo/lldb.nvim'
|
|
" Plug 'rizzatti/dash.vim'
|
|
Plug 'terryma/vim-expand-region'
|
|
" Plug 'sophacles/vim-processing'
|
|
Plug 'tpope/vim-fugitive'
|
|
" Plug 'othree/html5.vim'
|
|
Plug 'klen/python-mode'
|
|
" Plug 'derekwyatt/vim-scala'
|
|
" Plug 'jplaut/vim-arduino-ino'
|
|
" Plug 'stevearc/vim-arduino'
|
|
" Plug 'altercation/vim-colors-solarized'
|
|
" Plug 'rstacruz/sparkup'
|
|
" Plug 'scrooloose/syntastic'
|
|
Plug 'majutsushi/tagbar'
|
|
Plug 'christoomey/vim-tmux-navigator'
|
|
" Plug 'jelera/vim-javascript-syntax'
|
|
Plug 'tpope/vim-obsession'
|
|
Plug 'nvie/vim-togglemouse'
|
|
Plug 'benmills/vimux'
|
|
Plug 'julienr/vimux-pyutils'
|
|
Plug 'embear/vim-localvimrc'
|
|
Plug 'tpope/vim-surround'
|
|
" Plug 'easymotion/vim-easymotion'
|
|
Plug 'Yggdroot/indentLine'
|
|
" Plug 'mindriot101/vim-yapf'
|
|
Plug 'scrooloose/nerdtree'
|
|
" Plug 'vim-scripts/TaskList.vim'
|
|
" Plug 'xolox/vim-notes'
|
|
" Plug 'xolox/vim-misc'
|
|
Plug 'tpope/vim-vinegar'
|
|
Plug 'vim-scripts/MatlabFilesEdition'
|
|
Plug 'lervag/vimtex'
|
|
" Plug 'bjoernd/vim-ycm-tex'
|
|
Plug 'mhinz/vim-startify'
|
|
" Plug 'Konfekt/FastFold'
|
|
"Plug 'Shougo/deoplete.nvim', { 'do': function('DoRemote') }
|
|
Plug 'roxma/nvim-completion-manager'
|
|
Plug 'tpope/vim-dispatch'
|
|
" Plug 'justmao945/vim-clang'
|
|
Plug 'zchee/deoplete-clang'
|
|
Plug 'zchee/deoplete-jedi'
|
|
" Plug 'benekastah/neomake'
|
|
Plug 'w0rp/ale'
|
|
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
|
|
Plug 'jlanzarotta/bufexplorer'
|
|
Plug 'chriskempson/base16-vim', { 'commit': '98aa775c5fd9156ada4f912a9af41f1c020da55d' }
|
|
Plug 'vim-airline/vim-airline-themes'
|
|
Plug 'danro/rename.vim'
|
|
Plug 'roxma/python-support.nvim'
|
|
"Plug 'Shougo/neco-syntax'
|
|
"Plug 'Shougo/neoinclude.vim'
|
|
" Plug 'vim-scripts/LanguageTool'
|
|
"Plug 'vim-latex/vim-latex'
|
|
Plug 'roman/golden-ratio'
|
|
Plug 'ludovicchabant/vim-gutentags'
|
|
"Plug 'SirVer/ultisnips'
|
|
Plug 'honza/vim-snippets'
|
|
call plug#end() " required
|
|
|
|
filetype on
|
|
filetype plugin on
|
|
filetype indent on
|
|
|
|
" backup files (~) in a common location if possible
|
|
" set backup
|
|
" set backupdir=~/.vim/_backup/,~/tmp
|
|
|
|
" turn on undo files, put them in a common location
|
|
set undofile
|
|
set undodir=~/.vim/_undo/
|
|
|
|
if filereadable(expand("~/.vimrc_background"))
|
|
let base16colorspace=256
|
|
source ~/.vimrc_background
|
|
endif
|
|
|
|
" ===================================
|
|
" General vim settings
|
|
" ====================================
|
|
" Set the default shell
|
|
set shell=zsh
|
|
|
|
" Set spell checker language
|
|
set spelllang=en_gb
|
|
|
|
" Allow the use of the mouse in vim
|
|
set mouse=a
|
|
|
|
"Disable .swp files
|
|
set noswapfile
|
|
|
|
" set the ruler to display cursor position on
|
|
set ruler
|
|
|
|
" set syntax highlighting on
|
|
syntax on
|
|
|
|
" set tabs to have 4 spaces
|
|
set ts=4
|
|
|
|
" Keep cursor near middle of page
|
|
set scrolloff=10
|
|
|
|
" indent when moving to the next line while writing code
|
|
set autoindent
|
|
|
|
" expand tabs into spaces
|
|
set expandtab
|
|
|
|
" when using the >> or << commands, shift lines by 4 spaces
|
|
set shiftwidth=4
|
|
|
|
" remove 4 spaces as if it were a tab
|
|
set softtabstop=4
|
|
|
|
" show a visual line under the cursor's current line
|
|
set cursorline
|
|
|
|
" enable all Python syntax highlighting features
|
|
let python_highlight_all = 1
|
|
|
|
" show the matching part of the pair for [] {} and ()
|
|
set showmatch
|
|
|
|
" Set number line?
|
|
set nu
|
|
|
|
" Turn off beeps when you do something wrong.
|
|
set noerrorbells
|
|
|
|
" Set numbers to display relative to current cursor position in the file
|
|
set relativenumber
|
|
|
|
" Ignore case when using search
|
|
set ignorecase
|
|
|
|
" Show search result before moving to it
|
|
set incsearch
|
|
|
|
" Visual autocomplete for command menu
|
|
set wildmenu
|
|
|
|
" Redraw only when we need to.
|
|
set lazyredraw
|
|
|
|
" Set line wrap to 79 charachters.
|
|
set tw=79
|
|
|
|
" Change directory to the directory of the current file.
|
|
" set autochdir
|
|
|
|
|
|
set list " Display unprintable characters f12 - switches
|
|
set showbreak=↪\
|
|
set listchars=tab:••,trail:•,extends:»,precedes:«,eol:⏎,nbsp:• " Unprintable chars mapping
|
|
" ====================================
|
|
" Indent highlighting settings
|
|
" ====================================
|
|
let g:indentLine_char = '•'
|
|
let g:indentLine_color_term = 19
|
|
let g:indentLine_enabled = 1
|
|
"let g:indentLine_leadingSpaceChar = '·'
|
|
"let g:indentLine_leadingSpaceEnabled = 1
|
|
let g:indentLine_faster = 1
|
|
" ====================================
|
|
" LaTeX Settings
|
|
" ====================================
|
|
" OPTIONAL: Starting with Vim 7, the filetype of empty .tex files defaults to
|
|
" 'plaintex' instead of 'tex', which results in vim-latex not being loaded.
|
|
" The following changes the default filetype back to 'tex':
|
|
let g:tex_flavor='latex'
|
|
let g:tex_conceal = ""
|
|
|
|
" autocmd BufWritePost *.tex Dispatch! latexmk -xelatex
|
|
|
|
" ====================================
|
|
" Startify Settings
|
|
" ====================================
|
|
|
|
nnoremap <silent> <leader>m :Startify<CR>
|
|
|
|
" ====================================
|
|
" Neomake Settings
|
|
" ====================================
|
|
set errorformat=%f:%l:%m
|
|
|
|
" if has('autocmd')
|
|
" autocmd! BufWritePost * Neomake
|
|
" autocmd! BufReadPost,FileReadPost * Neomake
|
|
" endif
|
|
"
|
|
" " Enable neomake debugging via :messages
|
|
" " let g:neomake_verbose = 3
|
|
"
|
|
"
|
|
"
|
|
" let g:neomake_java_javac_maker = {
|
|
" \ 'errorformat':
|
|
" \ '%E%f:%l: %trror: %m,' .
|
|
" \ '%W%f:%l: %tarning: %m,' .
|
|
" \ '%E%f:%l: %m,'.
|
|
" \ '%Z%p^,'.
|
|
" \ '%-G%.%#',
|
|
" \ }
|
|
" let g:neomake_java_enabled_makers = ['javac']
|
|
"
|
|
" let g:neomake_matlab_mlint_maker = {
|
|
" \ 'errorformat':
|
|
" \ 'L %l (C %c): %*[a-zA-Z0-9]: %m,'.
|
|
" \ 'L %l (C %c-%*[0-9]): %*[a-zA-Z0-9]: %m',
|
|
" \ 'args': ['%:p', '-id'],
|
|
" \ 'defaults': { 'type': 'W' },
|
|
" \}
|
|
"
|
|
" let g:neomake_matlab_enabled_makers = ['mlint']
|
|
"
|
|
" "let g:neomake_cpp_clang_args = ["-std=c++14"]
|
|
" "let g:neomake_open_list = 2
|
|
" "
|
|
" let g:neomake_python_enabled_makers = ['pep8', 'pylint']
|
|
" "
|
|
" " let g:neomake_warning_sign = {
|
|
" " \ 'text': '✹',
|
|
" " \ 'texthl': 'WarningMsg',
|
|
" " \ }
|
|
" "
|
|
" " let g:neomake_error_sign = {
|
|
" " \ 'text': '✖',
|
|
" " \ 'texthl': 'ErrorMsg',
|
|
" " \ }
|
|
" ====================================
|
|
" Easymotion Settings
|
|
" ====================================
|
|
"let g:EasyMotion_do_mapping = 0 " Disable default mappings
|
|
|
|
" Bi-directional find motion
|
|
" Jump to anywhere you want with minimal keystrokes, with just one key binding.
|
|
" `s{char}{label}`
|
|
" nmap s <Plug>(easymotion-s)
|
|
" or
|
|
" `s{char}{char}{label}`
|
|
" Need one more keystroke, but on average, it may be more comfortable.
|
|
" nmap s <Plug>(easymotion-s2)
|
|
|
|
" Turn on case insensitive feature
|
|
" let g:EasyMotion_smartcase = 1
|
|
|
|
" JK motions: Line motions
|
|
" map <Leader>j <Plug>(easymotion-j)
|
|
" map <Leader>k <Plug>(easymotion-k)
|
|
" Word jump
|
|
" map <Leader>w <Plug>(easymotion-w)
|
|
" map <Leader>e <Plug>(easymotion-e)
|
|
" map <Leader>bb <Plug>(easymotion-b)
|
|
" map <Leader>B <Plug>(easymotion-B)
|
|
|
|
" easymotion highlight colors
|
|
" hi link EasyMotionTarget Search
|
|
" hi link EasyMotionTarget2First Search
|
|
" hi link EasyMotionTarget2Second Search
|
|
" hi link EasyMotionShade Comment
|
|
|
|
|
|
" ====================================
|
|
" solarized settings
|
|
" ====================================
|
|
" Set to the dark solarized colour scheme
|
|
" colorscheme solarized
|
|
" set background=dark
|
|
" let g:solarized_termtrans = 1
|
|
"let g:solarized_termcolors=16
|
|
"let g:solarized_visibility="high"
|
|
"let g:solarized_contrast = "high"
|
|
" hi Visual term=reverse cterm=reverse guibg=Grey
|
|
|
|
" ====================================
|
|
" NerdTree Settings
|
|
" ====================================
|
|
" Fix nerdtree arrow problems
|
|
let g:NERDTreeDirArrows=0
|
|
|
|
" ====================================
|
|
" Bufexplorer Settings
|
|
" ====================================
|
|
let g:bufExplorerSortBy='name'
|
|
let g:bufExplorerShowRelativePath=1
|
|
let g:bufExplorerFindActive=0
|
|
|
|
" ====================================
|
|
" Netrw Settings
|
|
" ====================================
|
|
let g:netrw_liststyle=3
|
|
|
|
" ====================================
|
|
" LocalVimrc Settings
|
|
" ====================================
|
|
" Set events to check for local vimrcs on
|
|
let g:localvimrc_event = [ "BufWinEnter", "VimEnter" ]
|
|
" Save preferences for which lvimrc files to load so vim doesn't ask every
|
|
" time
|
|
let g:localvimrc_persistent = 2
|
|
|
|
" ====================================
|
|
" Airline settings
|
|
" ====================================
|
|
" Enable tabline
|
|
let g:airline#extensions#tabline#enabled = 1
|
|
" Set tabs to display the name of the currently active file
|
|
let g:airline#extensions#tabline#fnamemod = ':t'
|
|
let g:airline#extensions#tabline#show_tab_nr = 0
|
|
|
|
let g:airline#extensions#tabline#fnametruncate = 4
|
|
"let g:airline#extensions#tabline#buffer_nr_format = '%s:'
|
|
" Don't make a new tab for every buffer
|
|
let g:airline#extensions#tabline#show_buffers = 0
|
|
|
|
"Remove seperators and makes airline look cleaner
|
|
let g:airline_left_sep=''
|
|
let g:airline_right_sep=''
|
|
let g:airline_skip_empty_sections = 1
|
|
" let g:airline_section_z=''
|
|
" Show airline even when only one file is open
|
|
set laststatus=2
|
|
" This allows buffers to be hidden if you've modified a buffer.
|
|
" This is almost a must if you wish to use buffers in this way.
|
|
set hidden
|
|
|
|
set switchbuf=usetab,newtab
|
|
" Move to the next buffer
|
|
"nnoremap <nowait> <leader>l :tabnext<CR>
|
|
" Move to the previous buffer
|
|
"nnoremap :tabprev<CR>
|
|
|
|
"let g:airline#extensions#tabline#buffer_idx_mode = 1
|
|
nmap <leader>1 <Plug>AirlineSelectTab1
|
|
nmap <leader>2 <Plug>AirlineSelectTab2
|
|
nmap <leader>3 <Plug>AirlineSelectTab3
|
|
nmap <leader>4 <Plug>AirlineSelectTab4
|
|
nmap <leader>5 <Plug>AirlineSelectTab5
|
|
nmap <leader>6 <Plug>AirlineSelectTab6
|
|
nmap <leader>7 <Plug>AirlineSelectTab7
|
|
nmap <leader>8 <Plug>AirlineSelectTab8
|
|
nmap <leader>9 <Plug>AirlineSelectTab9
|
|
nmap <leader>h <Plug>AirlineSelectPrevTab
|
|
nmap <leader>l <Plug>AirlineSelectNextTab
|
|
|
|
let g:airline_theme = 'base16'
|
|
|
|
" ====================================
|
|
" Closetag for HTML settings...
|
|
" ====================================
|
|
|
|
autocmd FileType html,htmldjango,jinjahtml,eruby,mako let b:closetag_html_style=1
|
|
autocmd FileType html,xhtml,xml,htmldjango,jinjahtml,eruby,mako source ~/.vim/bundle/closetag.vim/plugin/closetag.vim
|
|
autocmd FileType html,xhtml,xml,htmldjango,jinjahtml,eruby,mako set smarttab
|
|
|
|
" ====================================
|
|
" Pymode setting
|
|
" ====================================
|
|
|
|
let g:pymode_options = 1
|
|
|
|
" Disable automatic folding of classes and functions
|
|
let g:pymode_folding = 0
|
|
|
|
" Set the maximum line length before wrapping text
|
|
let g:pymode_options_max_line_length = 79
|
|
|
|
" Set the display of a coloured column to represent the maximum line length
|
|
" location
|
|
let g:pymode_options_colorcolumn = 1
|
|
|
|
" Turn indenting on
|
|
let g:pymode_indent = 1
|
|
|
|
" Don't check for errors every time a file is written
|
|
let g:pymode_lint_on_write = 0
|
|
|
|
" Turn linting off
|
|
let g:pymode_lint = 0
|
|
|
|
" Turn syntax highlighting on
|
|
let g:pymode_syntax = 1
|
|
|
|
" Disable rope due to hanging bug
|
|
let g:pymode_rope = 0
|
|
|
|
" Enable all extra syntax highlighting options
|
|
let g:pymode_syntax_all = 1
|
|
|
|
let g:pymode_run = 0
|
|
let g:pymode_run_bind = ''
|
|
" Disable adding breakpoints with leader b
|
|
let g:pymode_breakpoint = 0
|
|
|
|
" ====================================
|
|
" ProSession Settings
|
|
" ====================================
|
|
let g:prosession_tmux_title = 1
|
|
let g:prosession_load_on_startup = 1
|
|
|
|
" ====================================
|
|
" Syntastic
|
|
" ====================================
|
|
" set statusline+=%#warningmsg#
|
|
" set statusline+=%{SyntasticStatuslineFlag()}
|
|
" set statusline+=%*
|
|
|
|
" let g:syntastic_mode_map = {
|
|
" \ "mode": "passive",
|
|
" \ "active_filetypes": [],
|
|
" \ "passive_filetypes": [] }
|
|
" let g:syntastic_always_populate_loc_list = 1
|
|
"
|
|
" " Check for errors when opening a new file
|
|
" let g:syntastic_check_on_open = 1
|
|
"
|
|
" " Don't check for errors if quiting after writing
|
|
" let g:syntastic_check_on_wq = 0
|
|
"
|
|
" let g:syntastic_check_on_w = 0
|
|
"
|
|
" map <leader>c :SyntasticCheck<CR>
|
|
"
|
|
" " Set the checkers to be used for finding syntax errors
|
|
" let g:syntastic_python_checkers = ['pylint', 'pep8']
|
|
"
|
|
" let g:syntastic_matlab_checkers = ['mlint']
|
|
"
|
|
" function! TogglePep257()
|
|
" let c = 0
|
|
" let found = 0
|
|
" for i in g:syntastic_python_checkers
|
|
" if i == 'pep257'
|
|
" call remove(g:syntastic_python_checkers, c)
|
|
" let found = 1
|
|
" endif
|
|
" let c += 1
|
|
" endfor
|
|
" if found == 0
|
|
" call add(g:syntastic_python_checkers, 'pep257')
|
|
" endif
|
|
" :SyntasticCheck
|
|
" endfunction
|
|
"
|
|
" " Function for toggling the error window
|
|
" function! ToggleErrors()
|
|
" let old_last_winnr = winnr('$')
|
|
" lclose
|
|
" if old_last_winnr == winnr('$')
|
|
" " Nothing was closed, open syntastic error location panel
|
|
" Errors
|
|
" endif
|
|
" endfunction
|
|
"
|
|
" let g:syntastic_auto_loc_list = 0
|
|
"
|
|
" " Run all checkers and then create list of errors rather than showing error
|
|
" " lists individually
|
|
" let g:syntastic_aggregate_errors = 1
|
|
" "
|
|
" " Set JavaScript syntax checkers
|
|
" let g:syntastic_javascript_checkers = ['jshint']
|
|
|
|
autocmd CursorMovedI * if pumvisible() == 0|pclose|endif
|
|
autocmd InsertLeave * if pumvisible() == 0|pclose|endif
|
|
|
|
set conceallevel=0
|
|
set concealcursor=vin
|
|
|
|
" Complete options (disable preview scratch window, longest removed to aways
|
|
" show menu)
|
|
set completeopt=longest,menuone
|
|
|
|
" Limit popup menu height
|
|
set pumheight=40"
|
|
|
|
" for python completions
|
|
let g:python_support_python3_requirements = add(get(g:,'python_support_python3_requirements',[]),'jedi')
|
|
" language specific completions on markdown file
|
|
let g:python_support_python3_requirements = add(get(g:,'python_support_python3_requirements',[]),'mistune')
|
|
|
|
" utils, optional
|
|
let g:python_support_python3_requirements = add(get(g:,'python_support_python3_requirements',[]),'psutil')
|
|
let g:python_support_python3_requirements = add(get(g:,'python_support_python3_requirements',[]),'setproctitle')
|
|
|
|
" ====================================
|
|
" DeoPlete Settings
|
|
" ====================================
|
|
" Use deoplete.
|
|
" let g:deoplete#enable_at_startup = 1
|
|
" " Unsure what these do but things seem to work so not touching... took from here: https://github.com/zchee/deoplete-clang/issues/15
|
|
" set completeopt+=noinsert
|
|
" set completeopt-=preview
|
|
" let g:deoplete#enable_smart_case = 1
|
|
" let g:deoplete#auto_completion_start_length = 0
|
|
" let g:min_pattern_length = 0
|
|
|
|
" Allow navigation through auto-completions using tab.
|
|
" deoplete tab-complete
|
|
inoremap <expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>"
|
|
inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<TAB>"
|
|
|
|
" ====================================
|
|
" UltiSnips Settings
|
|
" ====================================
|
|
"let g:UltiSnipsExpandTrigger = "<Plug>(ultisnips_expand)"
|
|
"let g:UltiSnipsJumpForwardTrigger="<c-b>"
|
|
"let g:UltiSnipsJumpBackwardTrigger="<s-tab>"
|
|
"let g:UltiSnipsRemoveSelectModeMappings = 0
|
|
"imap <expr> <Plug>(expand_or_nl) (has_key(v:completed_item,'snippet')?"\<C-U>":"\<CR>")
|
|
"imap <expr> <CR> (pumvisible() ? "\<c-y>\<Plug>(cm_inject_snippet)\<Plug>(expand_or_nl)" : "\<CR>")
|
|
"" optional
|
|
"inoremap <silent> <c-u> <c-r>=cm#sources#ultisnips#trigger_or_popup("\<Plug>(ultisnips_expand)")<cr>
|
|
|
|
" inoremap <expr> <CR> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"
|
|
"inoremap <silent> <CR> <C-r>=<SID>my_cr_function()<CR>
|
|
"inoremap <expr><BS> deoplete#mappings#smart_close_popup()."\<C-h>"
|
|
"
|
|
"function! s:my_cr_function() abort
|
|
" return pumvisible() ? deoplete#mappings#close_popup() : "\<CR>"
|
|
"endfunction
|
|
|
|
" Set paths to homebrew clang library and executable for deoplete clang
|
|
"let g:deoplete#sources#clang#libclang_path = "/usr/local/Cellar/llvm/HEAD/lib/libclang.dylib"
|
|
"let g:deoplete#sources#clang#clang_header = "/usr/local/Cellar/llvm/HEAD/lib/clang"
|
|
|
|
" Disable vim-clang diagnostic window
|
|
let g:clang_diagsopt = ''
|
|
|
|
|
|
" Ensure buffer based completion is shown alongside plugin completions such as
|
|
" clang or jedi.
|
|
" call deoplete#custom#set('buffer', 'rank', 9999)
|
|
|
|
" ====================================
|
|
" YouCompleteMe Settings (Deprecated as of DeoPlete)
|
|
" ====================================
|
|
" let g:ycm_path_to_python_interpreter ='/usr/bin/python'
|
|
|
|
" ====================================
|
|
" Bufexplorer Settings
|
|
" ====================================
|
|
|
|
imap <F3> <ESC>:ToggleBufExplorer<CR>
|
|
map <F3> :ToggleBufExplorer<CR>
|
|
|
|
" ====================================
|
|
" VIMUX Commands
|
|
" ====================================
|
|
" Prompt for a command to run
|
|
map <Leader>vp :VimuxPromptCommand<CR>
|
|
|
|
" Run last command executed by RunVimTmuxCommand
|
|
map <Leader>vl :VimuxRunLastCommand<CR>
|
|
|
|
" Inspect runner pane
|
|
map <Leader>vi :VimuxInspectRunner<CR>
|
|
|
|
" Close all other tmux panes in current window
|
|
map <Leader>vq :VimuxCloseRunner<CR>
|
|
|
|
" Interrupt any command running in the runner pane
|
|
map <Leader>vs :VimuxInterruptRunner<CR>
|
|
|
|
" ====================================
|
|
" Tagbar Settings
|
|
" ====================================
|
|
" Focus on tagbar when it is opened
|
|
let g:tagbar_autofocus = 1
|
|
|
|
" ====================================
|
|
" LLDB Settings
|
|
" ====================================
|
|
nmap <M-b> <Plug>LLBreakSwitch
|
|
vmap <F2> <Plug>LLStdInSelected
|
|
nnoremap <F4> :LLstdin<CR>
|
|
nnoremap <F5> :LLmode debug<CR>
|
|
nnoremap <S-F5> :LLmode code<CR>
|
|
nnoremap <F8> :LL continue<CR>
|
|
nnoremap <S-F8> :LL process interrupt<CR>
|
|
nnoremap <F9> :LL print <C-R>=expand('<cword>')<CR>
|
|
vnoremap <F9> :<C-U>LL print <C-R>=lldb#util#get_selection()<CR><CR>
|
|
|
|
" ====================================
|
|
" LanguageTool Settings
|
|
" ====================================
|
|
let g:languagetool_jar=system("find $(brew --prefix)/Cellar -name \"languagetool-commandline.jar\" -print -quit | xargs echo -n")
|
|
|
|
" ====================================
|
|
" Golden Ratio settings
|
|
" ====================================
|
|
let g:golden_ratio_exclude_nonmodifiable = 1
|
|
|
|
" ====================================
|
|
" Custom key bindings
|
|
" ====================================
|
|
" Disable arrow keys
|
|
map <Up> <nop>
|
|
map <Down> <nop>
|
|
map <Left> <nop>
|
|
map <Right> <nop>
|
|
|
|
" Set space as leader key
|
|
map <Space> <Leader>
|
|
|
|
" Backspace over tabs properly (I think...)
|
|
set backspace=indent,eol,start
|
|
|
|
" Show commands used in the botom right
|
|
set showcmd
|
|
|
|
" Activate/deactivate the Tagbar
|
|
nmap <F8> :TagbarToggle<CR>
|
|
|
|
" Map the error window toggle to <F6>
|
|
nmap <F6> :call ToggleErrors()<CR><CR>
|
|
|
|
" To open a new empty tab
|
|
nmap <leader>n :enew<CR>
|
|
|
|
" Move to the next buffer
|
|
nmap <leader>bl :bnext<CR>
|
|
|
|
" Move to the previous buffer
|
|
nmap <leader>bh :bprevious<CR>
|
|
|
|
" Close the current buffer and move to the previous one
|
|
" This replicates the idea of closing a tab
|
|
nmap <leader>bq :bp<BAR>sp<BAR>bn<BAR>bd<CR>
|
|
nmap <leader>tq :close<CR>
|
|
|
|
" Toggle the NerdTree file browser menu
|
|
nnoremap <F4> :NERDTreeToggle<CR>
|
|
|
|
" Toggle session monitoring
|
|
nmap <leader>o :Obsess<CR>
|
|
|
|
"Remove all trailing whitespace by pressing F5
|
|
fun! TrimWhitespace()
|
|
let l:save = winsaveview()
|
|
%s/\s\+$//e
|
|
call winrestview(l:save)
|
|
endfun
|
|
command! TrimWhitespace call TrimWhitespace()
|
|
noremap <Leader>tw :call TrimWhitespace()<CR>
|
|
|
|
" Copy too and from the system clipboard with standard yank and paste commands
|
|
" but with leader
|
|
vmap <Leader>y "+y
|
|
vmap <Leader>d "+d
|
|
nmap <Leader>p "+p
|
|
nmap <Leader>P "+P
|
|
vmap <Leader>p "+p
|
|
vmap <Leader>P "+P
|
|
|
|
" Set clipboard to system clipboard
|
|
set clipboard=unnamed
|
|
function! ClipboardYank()
|
|
call system('pbcopy', @@)
|
|
endfunction
|
|
function! ClipboardPaste()
|
|
let @@ = system('pbpaste')
|
|
endfunction
|
|
|
|
vnoremap <silent> y y:call ClipboardYank()<cr>
|
|
vnoremap <silent> d d:call ClipboardYank()<cr>
|
|
nnoremap <silent> p :call ClipboardPaste()<cr>p
|
|
|
|
" Enter visual line by hitting leader twice
|
|
"nmap <Leader><Leader> V
|
|
|
|
" Map v to use expand-region plugin for selecting char, then word, then
|
|
" paragraph
|
|
vmap v <Plug>(expand_region_expand)
|
|
vmap <C-v> <Plug>(expand_region_shrink)
|
|
|
|
" Stop strange window from popping up when accidentally press q:
|
|
map q: :q
|
|
map Q: :q
|
|
map Q; :q
|
|
map q; :q
|
|
|
|
" nmap <silent> <C-h> :wincmd h<BAR>call Splitresize()<CR>
|
|
" nmap <silent> <C-j> :wincmd j<BAR>call Splitresize()<CR>
|
|
" nmap <silent> <C-k> :wincmd k<BAR>call Splitresize()<CR>
|
|
" nmap <silent> <C-l> :wincmd l<BAR>call Splitresize()<CR>
|
|
" Navigate from terminal windows whilst in terminal mode
|
|
tnoremap <C-h> <C-\><C-n>:wincmd h<CR>
|
|
tnoremap <C-j> <C-\><C-n>:wincmd j<CR>
|
|
tnoremap <C-k> <C-\><C-n>:wincmd k<CR>
|
|
tnoremap <C-l> <C-\><C-n>:wincmd l<CR>
|
|
inoremap <C-h> <ESC>:wincmd h<CR>
|
|
inoremap <C-j> <ESC>:wincmd j<CR>
|
|
inoremap <C-k> <ESC>:wincmd k<CR>
|
|
inoremap <C-l> <ESC>:wincmd l<CR>
|
|
|
|
" Clear search highlighting
|
|
nnoremap <silent> <esc> :noh<cr><esc>
|
|
|
|
" Always enter terminal windows in terminal mode
|
|
autocmd BufWinEnter,WinEnter term://* startinsert
|
|
|
|
" Window resizing mappings /*{{{*/
|
|
" if bufwinnr(1)
|
|
" noremap <silent> <S-H> :vertical resize +1<CR>
|
|
" noremap <silent> <S-L> :vertical resize -1<CR>
|
|
" noremap <silent> <S-J> :resize +1<CR>
|
|
" noremap <silent> <S-K> :resize -1<CR>
|
|
" endif
|
|
|
|
nmap <leader>r <C-w>R
|
|
|
|
" window navigation/manipulation
|
|
"nmap <leader>h :topleft vnew<CR>
|
|
"nmap <leader>l :botright vnew<CR>
|
|
"nmap <leader>k :topleft new<CR>
|
|
"nmap <leader>j :botright new<CR>
|
|
|
|
" Quickly open a terminal
|
|
nmap <leader>t :tabedit<CR>
|
|
tnoremap <Esc> <C-\><C-n>
|
|
|
|
" Quickly edit/reload the vimrc file
|
|
nmap <silent> <leader>ev :e $MYVIMRC<CR>
|
|
"nmap <silent> <leader>sv :so $MYVIMRC<CR>
|
|
nnoremap <leader>er :vsp ~/.zshrc<CR>
|
|
|
|
" Call yapf formatting
|
|
" nnoremap <leader>y :call Yapf()<cr>
|
|
|
|
" move vertically by visual line. If lines are wrapped due to lack of screen
|
|
" space they are still navigated as expected
|
|
nnoremap j gj
|
|
nnoremap k gk
|
|
" ====================================
|
|
|
|
function! s:ag_to_qf(line)
|
|
let parts = split(a:line, ':')
|
|
return {'filename': parts[0], 'lnum': parts[1], 'col': parts[2],
|
|
\ 'text': join(parts[3:], ':')}
|
|
endfunction
|
|
|
|
function! s:ag_handler(lines)
|
|
if len(a:lines) < 2 | return | endif
|
|
|
|
let cmd = get({'ctrl-x': 'split',
|
|
\ 'ctrl-v': 'vertical split',
|
|
\ 'ctrl-t': 'tabe'}, a:lines[0], 'e')
|
|
let list = map(a:lines[1:], 's:ag_to_qf(v:val)')
|
|
|
|
let first = list[0]
|
|
execute cmd escape(first.filename, ' %#\')
|
|
execute first.lnum
|
|
execute 'normal!' first.col.'|zz'
|
|
|
|
if len(list) > 1
|
|
call setqflist(list)
|
|
copen
|
|
wincmd p
|
|
endif
|
|
endfunction
|
|
|
|
command! -nargs=* Ag call fzf#run({
|
|
\ 'source': printf('ag --nogroup --column --color "%s"',
|
|
\ escape(empty(<q-args>) ? '^(?=.)' : <q-args>, '"\')),
|
|
\ 'sink*': function('<sid>ag_handler'),
|
|
\ 'options': '--ansi --expect=ctrl-t,ctrl-v,ctrl-x --delimiter : --nth 4.. '.
|
|
\ '--multi --bind=ctrl-a:select-all,ctrl-d:deselect-all '.
|
|
\ '--color hl:68,hl+:110',
|
|
\ 'down': '50%'
|
|
\ })
|
|
" Source local vim script for the current machine
|
|
" (Keep this at bottom to overwrite configs above with system specific
|
|
" configs)
|
|
"if filereadable(expand("./vimrc.local"))
|
|
" source ./vimrc.local
|
|
"endif
|
|
|
|
|
|
" Be aware of whether you are right or left vertical split
|
|
" so you can use arrows more naturally.
|
|
" Inspired by https://github.com/ethagnawl.
|
|
function! g:IntelligentVerticalResize(direction) abort
|
|
let l:window_resize_count = 5
|
|
let l:current_window_is_last_window = (winnr() == winnr('$'))
|
|
|
|
if (a:direction ==# 'left')
|
|
let [l:modifier_1, l:modifier_2] = ['+', '-']
|
|
else
|
|
let [l:modifier_1, l:modifier_2] = ['-', '+']
|
|
endif
|
|
|
|
let l:modifier = l:current_window_is_last_window ? l:modifier_1 : l:modifier_2
|
|
let l:command = 'vertical resize ' . l:modifier . l:window_resize_count . '<CR>'
|
|
execute l:command
|
|
endfunction
|
|
|
|
nnoremap <silent> <Right> :call IntelligentVerticalResize('right')<CR>
|
|
nnoremap <silent> <Left> :call IntelligentVerticalResize('left')<CR>
|
|
|
|
function! s:buflist()
|
|
redir => ls
|
|
silent ls
|
|
redir END
|
|
return split(ls, '\n')
|
|
endfunction
|
|
|
|
function! s:bufopen(e)
|
|
execute 'buffer' matchstr(a:e, '^[ 0-9]*')
|
|
endfunction
|
|
|
|
nnoremap <silent> <Leader><Enter> :call fzf#run({
|
|
\ 'source': reverse(<sid>buflist()),
|
|
\ 'sink': function('<sid>bufopen'),
|
|
\ 'options': '+m',
|
|
\ 'down': len(<sid>buflist()) + 2
|
|
\ })<CR>
|
|
|
|
" When switching colorscheme in terminal vim change the profile in iTerm as well.
|
|
"if !has('gui_running')
|
|
" function! s:change_iterm2_profile()
|
|
" let dual_colorschemes = ["solarized"]
|
|
" if exists('g:colors_name')
|
|
" let profile = g:colors_name
|
|
" if index(dual_colorschemes, g:colors_name) >= 0
|
|
" let profile .= '_'.&background
|
|
" endif
|
|
" let escape = '\033]50;SetProfile='.profile.'\x7'
|
|
" if exists('$TMUX')
|
|
" let escape = '\033Ptmux;'.substitute(escape, '\\033', '\\033\\033', 'g').'\033\\'
|
|
" endif
|
|
" silent call system("printf '".escape."' > /dev/tty")
|
|
" endif
|
|
" endfunction
|
|
"
|
|
" autocmd VimEnter,ColorScheme * call s:change_iterm2_profile()
|
|
"endif
|
|
|
|
" if $TERM_PROGRAM == 'iTerm.app'
|
|
" if exists('$ITERM_PROFILE')
|
|
" if ($ITERM_PROFILE == 'solarized_dark')
|
|
" set t_Co=16
|
|
" let g:solarized_termcolors=16
|
|
" let g:solarized_termtrans=1
|
|
" set background=dark
|
|
" colorscheme solarized
|
|
" elseif ($ITERM_PROFILE == 'solarized_light')
|
|
" set t_Co=16
|
|
" let g:solarized_termcolors=16
|
|
" let g:solarized_termtrans=1
|
|
" set background=light
|
|
" colorscheme solarized
|
|
" endif
|
|
" endif
|
|
" endif
|
|
"
|
|
|
|
if (v:version >= 700)
|
|
highlight SpellBad ctermfg=126 term=Reverse guisp=126 gui=undercurl ctermbg=None
|
|
highlight SpellCap ctermfg=Green term=Reverse guisp=Green gui=undercurl ctermbg=None
|
|
highlight SpellLocal ctermfg=Cyan term=Underline guisp=Cyan gui=undercurl ctermbg=None
|
|
highlight SpellRare ctermfg=Magenta term=underline guisp=Magenta gui=undercurl ctermbg=None
|
|
endif " version 7+
|
|
|
|
hi NonText ctermfg=19 guifg=gray
|