You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
229 lines
5.1 KiB
229 lines
5.1 KiB
|
|
let mapleader=" "
|
|
|
|
set mouse=
|
|
syntax on
|
|
|
|
set noerrorbells
|
|
set number
|
|
set relativenumber
|
|
set incsearch
|
|
set ignorecase
|
|
set ruler
|
|
set noswapfile
|
|
set splitright
|
|
set splitbelow
|
|
set tabstop=4 softtabstop=4
|
|
set shiftwidth=4
|
|
set expandtab
|
|
set smartindent
|
|
set noswapfile
|
|
set nobackup
|
|
set undodir=~/.vim/undodir
|
|
set undofile
|
|
set nohlsearch
|
|
|
|
|
|
call plug#begin('~/.config/nvim/autoload/plugged')
|
|
Plug 'scrooloose/nerdcommenter'
|
|
Plug 'preservim/nerdtree'
|
|
|
|
Plug 'morhetz/gruvbox' " themes
|
|
Plug 'sonph/onehalf'
|
|
|
|
" Plug 'ThePrimeagen/vim-be-good', {'do': './install.sh'} " vim training game
|
|
|
|
" Fuzzy file search
|
|
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } } " fuzzy file finder
|
|
Plug 'junegunn/fzf.vim'
|
|
Plug 'airblade/vim-rooter' " addon for fzf, for git projects
|
|
|
|
" Plug 'ycm-core/YouCompleteMe' " YEET!
|
|
Plug 'neoclide/coc.nvim', {'branch': 'release'}
|
|
|
|
" Python syntax highlight
|
|
Plug 'numirias/semshi', {'do': ':UpdateRemotePlugins'}
|
|
|
|
" Coc Snippets
|
|
Plug 'sirver/ultisnips'
|
|
Plug 'honza/vim-snippets'
|
|
|
|
" Show git modifications to file
|
|
Plug 'vim-scripts/vim-gitgutter'
|
|
|
|
Plug 'jremmen/vim-ripgrep' " Rg uses word under cursor
|
|
|
|
" run current file
|
|
Plug 'sbdchd/vim-run'
|
|
|
|
" HTTP
|
|
Plug 'nicwest/vim-http'
|
|
|
|
call plug#end()
|
|
|
|
" disable spacebar (don't move forward)
|
|
nnoremap <SPACE> <Nop>
|
|
|
|
" quickly move through panes
|
|
nnoremap <C-J> <C-W><C-J>
|
|
nnoremap <C-K> <C-W><C-K>
|
|
nnoremap <C-L> <C-W><C-L>
|
|
nnoremap <C-H> <C-W><C-H>
|
|
|
|
" resize panes
|
|
nnoremap <silent> <leader>+ :vertical resize +5<CR>
|
|
nnoremap <silent> <leader>- :vertical resize -5<CR>
|
|
|
|
nnoremap <silent> <leader>ff :GFiles<CR>
|
|
|
|
vnoremap <leader>p "_dP
|
|
|
|
" noremap <leader> gf :GitFiles
|
|
|
|
colorscheme gruvbox
|
|
"colorscheme onehalfdark let g:airline_theme='onehalfdark'
|
|
set background=dark
|
|
|
|
:set inccommand=nosplit " highlight substitude
|
|
|
|
|
|
" run current file plugin
|
|
let g:run_cmd_python = ['python3']
|
|
let g:run_split = 'right'
|
|
|
|
|
|
"fun! SetupYCM()
|
|
"nnoremap <buffer> <silent> <leader>gd :YcmCompleter GoTo<CR>
|
|
"nnoremap <buffer> <silent> <leader>gr :YcmCompleter GoToReferences<CR>
|
|
"nnoremap <buffer> <silent> <leader>rr :YcmCompleter RefactorRename<CR>
|
|
"let g:UltiSnipsExpandTrigger="<c-space>"
|
|
"endfun
|
|
|
|
|
|
|
|
|
|
" CoC
|
|
|
|
function! s:check_back_space() abort
|
|
let col = col('.') - 1
|
|
return !col || getline('.')[col - 1] =~# '\s'
|
|
endfunction
|
|
|
|
fun! SetupCoC()
|
|
inoremap <buffer> <silent><expr> <TAB>
|
|
\ pumvisible() ? "\<C-n>" :
|
|
\ <SID>check_back_space() ? "\<TAB>" :
|
|
\ coc#refresh()
|
|
inoremap <buffer> <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>"
|
|
inoremap <buffer> <silent><expr> <C-space> coc#refresh()
|
|
|
|
nmap <buffer> <leader>gd <Plug>(coc-definition)
|
|
nmap <buffer> <leader>gr <Plug>(coc-references)
|
|
nmap <buffer> <leader>gy <Plug>(coc-type-definition)
|
|
nmap <buffer> <leader>gi <Plug>(coc-implementation)
|
|
nmap <buffer> <leader>rn <Plug>(coc-rename)
|
|
endfun
|
|
|
|
let g:coc_global_extensions = [
|
|
\ 'coc-snippets',
|
|
\ 'coc-pairs',
|
|
\ 'coc-prettier',
|
|
\ 'coc-json',
|
|
\ 'coc-python',
|
|
\ 'coc-html',
|
|
\ 'coc-css',
|
|
\ 'coc-xml',
|
|
\ 'coc-yaml',
|
|
\ ]
|
|
|
|
autocmd BufNewFile,BufRead *.pde set syntax=java
|
|
autocmd BufNewFile,BufRead *.pde set filetype=java
|
|
autocmd BufNewFile,BufRead *.ino set syntax=arduino
|
|
autocmd BufNewFile,BufRead *.ino set filetype=arduino
|
|
" autocmd FileType java,typescript,go :call SetupYCM()
|
|
" autocmd FileType cpp,h,c :call SetupCoC()
|
|
|
|
" run python script
|
|
" autocmd BufNewFile,BufRead *.py nnoremap <C-S-R> :vs <CR> :term python % <CR>
|
|
|
|
nnoremap <leader>rr :Run <CR>
|
|
|
|
call SetupCoC()
|
|
|
|
|
|
|
|
" CoC snippet tab completion
|
|
inoremap <silent><expr> <TAB>
|
|
\ pumvisible() ? coc#_select_confirm() :
|
|
\ coc#expandableOrJumpable() ? "\<C-r>=coc#rpc#request('doKeymap', ['snippets-expand-jump',''])\<CR>" :
|
|
\ <SID>check_back_space() ? "\<TAB>" :
|
|
\ coc#refresh()
|
|
|
|
function! s:check_back_space() abort
|
|
let col = col('.') - 1
|
|
return !col || getline('.')[col - 1] =~# '\s'
|
|
endfunction
|
|
|
|
let g:coc_snippet_next = '<tab>'
|
|
"let g:UltiSnipsExpandTrigger="<tab>"
|
|
"let g:UltiSnipsJumpForwardTrigger="<tab>>"
|
|
"let g:UltiSnipsJumpBackwardTrigger="<s-tab>"
|
|
|
|
|
|
|
|
|
|
" Shebang line
|
|
function! Hashbang(portable, permission, RemExt)
|
|
let shells = {
|
|
\ 'awk': "awk",
|
|
\ 'sh': "bash",
|
|
\ 'hs': "runhaskell",
|
|
\ 'jl': "julia",
|
|
\ 'lua': "lua",
|
|
\ 'mak': "make",
|
|
\ 'js': "node",
|
|
\ 'm': "octave",
|
|
\ 'pl': "perl",
|
|
\ 'php': "php",
|
|
\ 'py': "python",
|
|
\ 'r': "Rscript",
|
|
\ 'rb': "ruby",
|
|
\ 'scala': "scala",
|
|
\ 'tcl': "tclsh",
|
|
\ 'tk': "wish"
|
|
\ }
|
|
|
|
let extension = expand("%:e")
|
|
|
|
if has_key(shells,extension)
|
|
let fileshell = shells[extension]
|
|
|
|
if a:portable
|
|
let line = "#! /usr/bin/env " . fileshell
|
|
else
|
|
let line = "#! " . system("which " . fileshell)
|
|
endif
|
|
|
|
0put = line
|
|
|
|
if a:permission
|
|
:autocmd BufWritePost * :autocmd VimLeave * :!chmod u+x %
|
|
endif
|
|
|
|
|
|
if a:RemExt
|
|
:autocmd BufWritePost * :autocmd VimLeave * :!mv % "%:p:r"
|
|
endif
|
|
|
|
endif
|
|
|
|
endfunction
|
|
|
|
:autocmd BufNewFile *.* :call Hashbang(1,1,0)
|
|
|
|
|
|
|
|
|
|
" HTTP
|
|
let g:vim_http_split_vertically = 1
|