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.
 

153 lines
6.2 KiB

" (_)
" __ ___ _ __ ___ _ __ ___
" \ \ / / | '_ ` _ \| '__/ __|
" \ V /| | | | | | | | | (__
" \_/ |_|_| |_| |_|_| \___|
syntax on
" theme
set background=dark
colorscheme solarized
" plugins
call plug#begin('~/.vim/plugged')
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
Plug 'junegunn/fzf.vim'
Plug 'airblade/vim-gitgutter'
Plug 'godlygeek/tabular'
Plug 'itchyny/lightline.vim'
Plug 'jpalardy/vim-slime'
Plug 'justinmk/vim-dirvish'
Plug 'roginfarrer/vim-dirvish-dovish'
Plug 'tpope/vim-commentary'
Plug 'tpope/vim-fugitive'
Plug 'tpope/vim-surround'
Plug 'github/copilot.vim', {'branch': 'release'}
Plug 'roxma/nvim-yarp', { 'do': 'pip install -r requirements.txt' }
Plug 'ncm2/ncm2'
Plug 'ncm2/ncm2-bufword'
Plug 'ncm2/ncm2-path'
Plug 'ncm2/ncm2-jedi'
Plug 'dense-analysis/ale'
Plug 'dhruvasagar/vim-table-mode'
call plug#end()
" options
set autoindent " take indent for new line from previous line
set backspace=eol,start,indent " how backspace works at start of line
set breakindent " wrapped line repeats indent
set breakindentopt=shift:3,min:40,sbr " settings for 'breakindent'
set colorcolumn=80 " columns to highlight
set comments=b:# " patterns that can start a comment line
set completeopt=noinsert,menuone,noselect " options for Insert mode completion
set completeopt=noinsert,menuone,noselect " options for Insert mode completion
set cursorline " highlight the screen line of the cursor
set foldenable " set to display all folds open
set foldopen-=block " for which commands a fold will be opened
set foldmethod=marker
" set nofoldenable " disable folding at startup.
set foldtext=FoldText() " expression used to display for a closed fold
set formatoptions-=cro " how automatic formatting is to be done
set hlsearch " highlight matches with last search pattern
set ignorecase " ignore case in search patterns
set incsearch " highlight match while typing search pattern
set linebreak " wrap long lines at a blank
set listchars+=space:. " characters for displaying in list mode
set matchtime=2 " tenths of a second to show matching paren
set modeline " recognize modelines at start or end of file
set noexpandtab " (don't) use spaces when <Tab> is inserted
set number " print the line number in front of each line
set runtimepath+=~/.vim/after " list of directories used for runtime files
set runtimepath-=~/.vim/after " list of directories used for runtime files
set shiftwidth=4 " number of spaces to use for (auto)indent step
set shortmess+=c " list of flags, reduce length of messages
set smartcase " no ignore case when pattern has uppercase
set softtabstop=4 " number of spaces that <Tab> uses while editing
set splitbelow " new window from split is below the current one
set splitright " new window is put right of the current one
set tabstop=4 " number of spaces that <Tab> in file uses
set updatetime=300 " after this many milliseconds flush swap file
set visualbell " use visual bell instead of beeping
set whichwrap+=<,>,h,l " allow specified keys to cross line boundaries
set wrap " long lines wrap and continue on the next line
function! FoldText()
return repeat(" ", indent(v:foldstart)) . trim(getline(v:foldstart))[0:-1] . " +" . repeat(" ", winwidth(0))
endfunction
" variables
if exists('$VIRTUAL_ENV')
let g:python3_host_prog = $VIRTUAL_ENV . '/bin/python'
else
let g:python3_host_prog= $HOME . "/.env/bin/python"
endif
let g:lightline = {
\ 'colorscheme': 'solarized',
\ 'inactive': {
\ 'left': [ ['filename'] ],
\ 'right': []
\ }
\ }
let g:ale_lint_on_save = 1
let g:ale_fix_on_save = 0
let g:ale_python_auto_virtualenv = 1
let g:python_highlight_all = 1
let g:slime_target = "tmux"
" mappings
nnoremap <expr> x ((foldclosed('.')==-1)?('x'):('zo0x'))
nnoremap <Down> <C-\><C-n><C-W><C-J>
nnoremap <Up> <C-\><C-n><C-W><C-K>
nnoremap <Right> <C-\><C-n><C-W><C-L>
nnoremap <Left> <C-\><C-n><C-W><C-H>
nnoremap = <C-W>=
tnoremap <Esc> <C-\><C-n>
inoremap <expr> <down> pumvisible() ? "\<c-n>" : "\<down>"
inoremap <expr> <up> pumvisible() ? "\<c-p>" : "\<up>"
nmap <backspace> <Plug>(dirvish_up)
nmap <C-A> <nop>
vmap <C-A> <nop>
nmap <C-X> <nop>
vmap <C-X> <nop>
nnoremap <leader>gn :GitGutterNextHunk<CR>
nnoremap <leader>gp :GitGutterPrevHunk<CR>
nnoremap <leader>gv :Gvdiffsplit<CR>
nnoremap <leader>n :ALENext<CR>
nnoremap <leader>p :ALEPrevious<CR>
inoremap <expr> <CR> (pumvisible() ? "\<c-y>\<cr>" : "\<CR>")
nnoremap <Tab> n
nnoremap <S-Tab> N
nnoremap / :execute "normal! mf"<CR>/
nnoremap <Esc> <Esc>:noh<cr>
nnoremap go <Esc>:noh<cr>`f
vmap <C-c><C-c> <Plug>SendSelectionToTmux
nmap <C-c><C-c> <Plug>NormalModeSendToTmux
nmap <C-c>r <Plug>SetTmuxVars
" autocommands
augroup CursorLineOnlyInActiveWindow
autocmd!
autocmd VimEnter,WinEnter,BufWinEnter * setlocal cursorline
autocmd WinLeave * setlocal nocursorline
augroup END
augroup dirvish_config
autocmd!
autocmd FileType dirvish
\ nmap <silent><buffer> o <Plug>(dovish_create_file)
\ | nmap <silent><buffer> O <Plug>(dovish_create_file)
\ | nmap <silent><buffer> dd <Plug>(dovish_delete)
\ | nmap <silent><buffer> c <Plug>(dovish_rename)
\ | nmap <silent><buffer> yy <Plug>(dovish_yank)
\ | xmap <silent><buffer> yy <Plug>(dovish_yank)
\ | nmap <silent><buffer> p <Plug>(dovish_copy)
augroup END
" autocmd BufEnter * call ncm2#enable_for_buffer()
set completeopt=noinsert,menuone,noselect
let g:slime_target = "tmux"
let g:slime_default_config = {"socket_name": get(split($TMUX, ","), 0), "target_pane": ":.2"}