nix-config/home/neovim/init.vim

231 lines
6.5 KiB
VimL
Raw Normal View History

2022-01-18 09:32:55 +01:00
set nowrap
set nocompatible
syntax enable
filetype plugin on
set number
set mouse=a " mouse support
set showcmd " show incomplete cmds down the bottom
set showmode " show current mode
set visualbell " no sounds
set autoread " reload files changed outside vim
"set gcr=a:blinkon0 " disable cursor blink
set backspace=indent,eol,start " allow backspacing over everything in insert
mode
set shiftround " use multiple of shiftwidth when indenting with '<' and '>'
set showmatch " set show matching parenthesis
set ignorecase " ignore case when searching
set smartcase " ignore case if search pattern is all lowercase, case-sensitive otherwise
set smarttab " insert tabs on the start of a line according to shiftwidth, not tabstop
set hlsearch " highlight search terms
set incsearch " show search matches as you type
set hidden
set ruler
set clipboard=unnamed " system clipboard
set list listchars=tab:\ \ ,trail" display tabs and trailing spaces visually
set colorcolumn=80
set splitbelow
set splitright
nmap <A-r> <C-w>r
let mapleader=","
let maplocalleader="\\"
" use alt-x to go to a specific tab
nnoremap <A-1> 1gt
nnoremap <A-2> 2gt
nnoremap <A-3> 3gt
nnoremap <A-4> 4gt
nnoremap <A-5> 5gt
nnoremap <A-6> 6gt
nnoremap <A-7> 7gt
nnoremap <A-8> 8gt
nnoremap <A-9> :tablast<cr>
" clean highlights when C-l
nnoremap <silent> <C-l> :nohl<CR><C-l>
" HIGHLIGHT LINE WHEN IN INSERT MODE
hi CursorLine cterm=NONE,underline ctermbg=NONE
set timeoutlen=1000 ttimeoutlen=0 " eliminate annoying delay
autocmd InsertEnter * :set cursorline
autocmd InsertLeave * :set nocursorline
" INDENTATION:
filetype indent on
set softtabstop=4
set expandtab
set shiftwidth=4 " number of spaces to use for autoindenting
set tabstop=4 " a tab is four spaces
set autoindent " always set autoindenting on
set copyindent " copy the previous indentation on autoindenting
" TAG JUMPING:
command! MakeTags !ctags -R .
" - ^] to jump to tag under cursor
" - g^] for ambiguous tags
" - ^t to jump back up the tag stack
" TURN OF SWAP FILES:
set noswapfile
set nobackup
set nowb
"FOLDS:
set foldmethod=indent " fold based on indent
set foldnestmax=3 " deepest fold is 3 levels
set nofoldenable " don't fold by default
" FINDING FILES:
set path+=**
set wildmenu
" - Hit tab to find for partial match
" - Use * to make it fuzzy
let g:markdown_syntax_conceal = 0
set updatetime=100 " reduce vim update time so magke gitgutter more responsive
set termguicolors
"set fillchars+=vert:\ " cleaner vertical line
"let g:gruvbox_contrast_dark="hard"
"let g:gruvbox_contrast_light="hard"
"let g:gruvbox_italic=1
"let g:gruvbox_invert_indent_guides=1
"let g:gruvbox_vert_split='bg1'
let g:gruvbox_contrast_dark="hard"
set background=dark
colorscheme gruvbox
let g:fern#renderer = "nerdfont"
function! s:init_fern() abort
nmap <buffer> T <Plug>(fern-action-open:tab)
nmap <buffer> S <Plug>(fern-action-open:split)
nmap <buffer> V <Plug>(fern-action-open:vsplit)
endfunction
augroup fern-custom
autocmd! *
autocmd FileType fern call s:init_fern()
augroup END
augroup my-glyph-palette
autocmd! *
autocmd FileType fern call glyph_palette#apply()
autocmd FileType nerdtree,startify call glyph_palette#apply()
augroup END
nnoremap <leader>t :Fern . -drawer -toggle<cr>
nnoremap <leader>f :Files<cr>
nnoremap <leader>rg :Rg<cr>
nnoremap <leader><Bs> :cd ..<cr>
nnoremap <Leader>b :Buffers<cr>
"let g:NERDTreeIndicatorMapCustom = {
"\ "Modified" : "✹",
"\ "Staged" : "✚",
"\ "Untracked" : "✭",
"\ "Renamed" : "➜",
"\ "Unmerged" : "═",
"\ "Deleted" : "✖",
"\ "Dirty" : "✗",
"\ "Clean" : "✔︎",
"\ 'Ignored' : '☒',
"\ "Unknown" : "?"
"\ }
let g:indentLine_char = '▏'
"let g:indentLine_color_term = 2854
let g:indentLine_setConceal = 0
"let g:indentLine_concealcursor=""
let g:slime_target="tmux"
let g:slime_python_ipython=1
let g:tmux_navigator_no_mappings = 1
nnoremap <silent> <A-h> :TmuxNavigateLeft<cr>
nnoremap <silent> <A-j> :TmuxNavigateDown<cr>
nnoremap <silent> <A-k> :TmuxNavigateUp<cr>
nnoremap <silent> <A-l> :TmuxNavigateRight<cr>
"let g:lightline = {'colorscheme': 'gruvbox'}
let g:limelight_conceal_ctermfg = 'DarkGray'
" let g:vim_json_syntax_conceal = 0
let g:airline_theme='base16_gruvbox_dark_hard'
let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#ale#enabled = 1
let g:ale_linters ={
\ 'haskell': ['hlint', 'hdevtools', 'hfmt'],
\}
let g:ale_python_auto_pipenv=1 " see ale-integrations-local-executables
"let g:ale_python_pylint_auto_pipenv=1
let g:ale_python_pylint_executable="pipenv"
let g:ale_python_pylint_change_directory=1
autocmd! User GoyoEnter Limelight
autocmd! User GoyoLeave Limelight!!
" function LoadBraces (except)
" if (&ft != a:except)
" RainbowParenthesesLoadBraces
" endif
" endfunction
"
" " For rainbow parenhteses
" au VimEnter * RainbowParenthesesToggle
" au Syntax * RainbowParenthesesLoadRound
" au Syntax * RainbowParenthesesLoadSquare
" au Syntax * call LoadBraces('haskell')
"autocmd! BufWritePost,BufEnter * Neomake
let g:deoplete#enable_at_startup = 1
let g:rainbow_active = 1
let g:black_linelength=79
let g:NERDDefaultAlign = 'left'
nnoremap <silent> <F6> i
inoremap <silent> <F6> <Nop>
nnoremap <silent> <F18> a
inoremap <silent> <F18> <Nop>
nnoremap <leader>p "=system('xsel')<cr>p
nnoremap <leader>m :!make<cr>
" CLOJURE
let g:clj_fmt_autosave = 0
"autocmd FileType clojure nnoremap <c-t> :hi Normal ctermbg=none<cr>
autocmd FileType clojure nnoremap <F5> :Eval<cr>
autocmd FileType clojure vnoremap <F5> :Eval<cr>
autocmd FileType clojure nnoremap <F12> :Eval (stop)<cr>
autocmd FileType clojure nnoremap <c-f> :Cljfmt<cr>
"set formatoptions+=w
"set tw=80
"nnoremap Q gqip
" au BufNewFile,BufRead *.go setlocal noet ts=4 sw=4 sts=4
let g:UltiSnipsExpandTrigger="<tab>"
let g:UltiSnipsJumpForwardTrigger="<c-b>"
let g:UltiSnipsJumpBackwardTrigger="<c-z>"
autocmd FileType python nnoremap <buffer> <C-f> :Black<CR>
autocmd FileType sql nnoremap <buffer> <C-f> :%!sqlfluff fix -<CR>
autocmd FileType sh nnoremap <buffer> <C-f> :Shfmt<CR>
autocmd FileType json nnoremap <buffer> <C-f> :%!jq --indent 4 .<CR>
autocmd FileType terraform nnoremap <buffer> <C-f> :TerraformFmt<CR>
autocmd FileType nix nnoremap <buffer> <C-f> :%!nixfmt < %<CR>