nix-config/home/neovim/init_macos.vim

270 lines
7.8 KiB
VimL
Raw Normal View History

2022-01-18 09:32:55 +01:00
set nowrap
set nocompatible
syntax on
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 g:python_host_prog = '/usr/bin/python2'
"let g:python3_host_prog = '/usr/local/bin/python3'
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 Comment cterm=italic gui=italic
" 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
call plug#begin('~/.config/nvim/plugged')
Plug 'LaTeX-Box-Team/LaTeX-Box'
Plug 'APZelos/blamer.nvim'
Plug 'vito-c/jq.vim'
Plug 'tpope/vim-haml'
Plug 'tpope/vim-surround'
Plug 'junegunn/goyo.vim'
" Plug 'vim-pandoc/vim-pandoc'
" Plug 'vim-pandoc/vim-pandoc-syntax'
Plug 'lambdalisue/nerdfont.vim'
Plug 'lambdalisue/fern-renderer-nerdfont.vim'
Plug 'lambdalisue/glyph-palette.vim'
Plug 'lambdalisue/fern-git-status.vim'
Plug 'lambdalisue/fern-mapping-git.vim' " to check
Plug 'lambdalisue/fern-hijack.vim'
" Plug 'voldikss/vim-floaterm'
" Plug 'camspiers/animate.vim'
" Plug 'camspiers/lens.vim'
Plug 'psf/black', { 'branch': 'stable' }
Plug 'elzr/vim-json'
Plug 'https://tildegit.org/sloum/gemini-vim-syntax.git'
Plug 'maksimr/vim-jsbeautify'
Plug 'glacambre/firenvim'
Plug 'hashivim/vim-terraform'
Plug 'martinda/Jenkinsfile-vim-syntax'
Plug 'z0mbix/vim-shfmt', { 'for': 'sh' }
Plug 'LnL7/vim-nix'
call plug#end()
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'
colorscheme gruvbox
" colorscheme gruvbox8_hard
set background=dark
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)
nmap <buffer> <Space> <Plug>(fern-action-mark:toggle)
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
let g:ale_lint_on_text_changed = 'never'
let g:ale_lint_on_insert_leave = 0
let g:ale_lint_on_enter = 0
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:black_linelength=79
let g:shfmt_extra_args = '-i 4'
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>
"set formatoptions+=w
"set tw=80
"nnoremap Q gqip
"set textwidth=79
" set wrap linebreak
" 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 sql nnoremap <buffer> <C-f> :%!sqlformat --reindent --keywords upper --identifiers lower -<CR>
" autocmd FileType sql nnoremap <buffer> <C-f> :%!sqlformat --reindent --keywords upper -<CR>
autocmd FileType sql nnoremap <buffer> <C-f> :%!sqlfluff fix -<CR>
autocmd FileType python nnoremap <buffer> <C-f> :Black<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>
let g:vimwiki_list = [{'path': '~/notes/', 'syntax': 'markdown', 'ext': '.md'}]