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.
 
 
 
dotfiles/nvim/init.vim

311 lines
7.4 KiB

call plug#begin('~/local/share/nvim/plugged')
" Lightline
Plug 'itchyny/lightline.vim'
let g:lightline ={
\ 'colorscheme' : 'dracula',
\ 'component_function': {
\ 'filetype': 'MyFiletype',
\ 'fileformat': 'MyFileformat',
\ }
\}
function! MyFiletype()
return winwidth(0) > 70 ? (strlen(&filetype) ? &filetype . ' ' . WebDevIconsGetFileTypeSymbol() : 'no ft') : ''
endfunction
function! MyFileformat()
return winwidth(0) > 70 ? (&fileformat . ' ' . WebDevIconsGetFileFormatSymbol()) : ''
endfunction
Plug 'editorconfig/editorconfig-vim'
" Fzf
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
Plug 'junegunn/fzf.vim'
" LimeLight
Plug 'junegunn/limelight.vim'
" NERDTree
Plug 'preservim/nerdtree'
" Improvements Plug 'terryma/vim-multiple-cursors'
Plug 'tpope/vim-eunuch'
Plug 'tpope/vim-surround'
Plug 'scrooloose/syntastic'
Plug 'jiangmiao/auto-pairs'
"Airline
"Plug 'vim-airline/vim-airline'
"Plug 'vim-airline/vim-airline-themes'
Plug 'prabirshrestha/vim-lsp'
" Themes
Plug 'tomasr/molokai'
Plug 'gko/vim-coloresque'
Plug 'dracula/vim', { 'as': 'dracula' }
Plug 'joshdick/onedark.vim'
Plug 'Mofiqul/dracula.nvim'
" Lang. Support
"""""""""""""""""""""""""""""""GO"""""""""""""""""""""""""""""""""""""""
Plug 'fatih/vim-go', { 'do': ':GoUpdateBinaries' }
Plug 'deoplete-plugins/deoplete-go', { 'do': 'make'}
set completeopt-=preview
" Go related keybinds
autocmd FileType go nmap <leader>r <Plug>(go-run)
" Move through errors easier!
map <C-n> :cnext<CR>
map <C-m> :cprevious<CR>
nnoremap <leader>a :cclose<CR>
" run :GoBuild or :GoTestCompile based on the go file
function! s:build_go_files()
let l:file = expand('%')
if l:file =~# '^\f\+_test\.go$'
call go#test#Test(0, 1)
elseif l:file =~# '^\f\+\.go$'
call go#cmd#Build(0)
endif
endfunction
autocmd FileType go nmap <leader>b :<C-u>call <SID>build_go_files()<CR>
let g:go_def_mode='gopls'
let g:go_info_mode='gopls'
let g:go_list_type = "quickfix"
let g:go_gopls_complete_unimported = 1
let g:go_gopls_use_placeholders = 1
set autowrite
""""""""""""""""""""""""""""""GO""""""""""""""""""""""""""""""""""""""""
" JAVA
Plug 'artur-shaik/vim-javacomplete2'
autocmd FileType java setlocal omnifunc=javacomplete#Complete
"Plug 'Valloric/YouCompleteMe', { 'do': './install.py' }
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
Plug 'zchee/deoplete-jedi'
Plug 'deoplete-plugins/deoplete-clang'
Plug 'davidhalter/jedi-vim'
" RUST
Plug 'rust-lang/rust.vim'
Plug 'simrat39/rust-tools.nvim'
Plug 'neovim/nvim-lspconfig'
Plug 'preservim/nerdcommenter'
Plug 'mattn/emmet-vim'
" Code Folding
Plug 'tmhedberg/SimpylFold'
" Code Formatting
Plug 'Chiel92/vim-autoformat'
noremap <F3> :Autoformat<CR>
" Indent Blanklines
Plug 'lukas-reineke/indent-blankline.nvim'
" Writing in LaTeX
Plug 'junegunn/goyo.vim'
Plug 'lervag/vimtex'
Plug 'xuhdev/vim-latex-live-preview', { 'for': 'tex' }
" Plug 'conornewton/vim-latex-preview'
let g:tex_flavor='latex'
let g:vimtex_view_method='zathura'
let g:vimtex_quickfix_mode=0
let g:livepreview_previewer = 'zathura'
let g:livepreview_engine = 'xelatex'
set conceallevel=1
let g:tex_conceal='abdmg'
" Ultisnips
Plug 'sirver/ultisnips'
Plug 'honza/vim-snippets'
let g:UltiSnipsExpandTrigger = '<tab>'
let g:UltiSnipsJumpForwardTrigger="<c-b>"
let g:UltiSnipsJumpBackwardTrigger="<c-z>"
let g:UltiSnipsListSnippets="<c-;>"
" Zoxide
Plug 'nanotee/zoxide.vim'
" Vim Wiki
Plug 'vimwiki/vimwiki'
Plug 'mattn/calendar-vim'
" Animate
" Plug 'camspiers/animate.vim'
" Lens
Plug 'camspiers/lens.vim'
" Better Syntax Support
Plug 'sheerun/vim-polyglot'
" Git
Plug 'airblade/vim-gitgutter'
Plug 'tpope/vim-fugitive'
" Icons
Plug 'ryanoasis/vim-devicons'
" Lightspeed
Plug 'ggandor/lightspeed.nvim'
" Markdown Preview
Plug 'iamcco/markdown-preview.nvim', { 'do': { -> mkdp#util#install() }, 'for': 'markdown' }
call plug#end()
"let g:molokai_original = 1
"let g:airline_theme='onedark'
"let g:airline_theme='dracula'
let g:ale_enable=0
let g:ale_linters = {
\ 'python': ['pylint'],
\ 'vim': ['vint'],
\ 'cpp': ['clang'],
\ 'c': ['clang'],
\ 'go': ['gopls'],
\}
syntax on
filetype plugin indent on
set shiftwidth=4
set softtabstop=4
set tabstop=4
set expandtab
set number relativenumber
colorscheme dracula
set nocompatible
set encoding=UTF-8
set clipboard+=unnamedplus
set mouse=a
set laststatus=3
set termguicolors
" Map Leader
let mapleader = ","
" Note taking (Mardown, Spelling)
let g:vimwiki_list = [{'path': '~/vimwiki/',
\ 'syntax': 'markdown', 'ext': '.md'}]
:map <F11> :setlocal spell! spelllang=en_gb<CR>
"Quick spellcheck
inoremap <F10> <c-g>u<Esc>[s1z=`]a<c-g>u
au BufNewFile ~/vimwiki/diary/*.md :silent 0r !~/.config/nvim/generate-vimwiki-diary-template '%'
" Insert Date
nnoremap <silent><leader>d :put=system('date +%d/%b/%Y')<CR>
" Tex
let g:vimtex_complete_enabled = 1
let g:livepreview_previewer = 'zathura'
autocmd Filetype tex setl updatetime=1
" Fzf
let g:fzf_nvim_statusline = 0 " disable statusline overwriting
"remaps for fzf
nnoremap <silent> <leader><space> :Files<CR>
nnoremap <silent> <leader>w :Windows<CR>
nnoremap <silent> <leader>h :History<CR>
nnoremap <silent> <leader>G :GFiles<CR>
" nnoremap <silent> <leader>GS :GFiles?<CR>
" Easy update and reload nvim init file
nnoremap <Leader>e :e $MYVIMRC<CR>
nnoremap <Leader>S :source $MYVIMRC<CR>
" Deoplete
let g:deoplete#enable_at_startup = 1
autocmd InsertLeave,CompleteDone * if pumvisible() == 0 | pclose | endif
let g:jedi#completions_enabled = 0
let g:jedi#use_splits_not_buffers = "right"
" g:deoplete#sources#jedi#python_path = 'python3'
let g:python3_host_prog = '/usr/bin/python3'
" Limeligt + Goyo Binds
nnoremap <Leader>l :Limelight!!<CR>
nnoremap <Leader>g :Goyo<CR>
let g:limelight_conceal_guifg = 'DarkGray'
let g:limelight_conceal_guifg = '#777777'
let g:limelight_conceal_ctermfg = 'gray'
let g:limelight_conceal_ctermfg = 240
autocmd! User GoyoEnter Limelight
autocmd! User GoyoLeave Limelight!
" <TAB>: completion.
inoremap <expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>"
" Switching windows
nnoremap <A-h> <C-w>h
nnoremap <A-j> <C-w>j
nnoremap <A-k> <C-w>k
nnoremap <A-l> <C-w>l
" Move tabs
nnoremap <A-Down> :tabp<CR>
nnoremap <A-Up> :tabn<CR>
" Basic cmd commands
nnoremap <A-n> :!touch<Space>
nnoremap <A-o> :e<Space>
nnoremap <A-O> :tabe<Space>
nnoremap <A-v> :vsplit<Space>
" Markdown Preview
nnoremap <leader>m :MarkdownPreviewToggle<CR>
" Screenshot command
nnoremap <silent> <leader>s :!bash /home/simon/.scripts/vscrnpaste<CR><CR>
" Terminal Maps
tnoremap <Esc> <C-\><C-n>
nnoremap <leader>t :tabedit term://bash<CR>
autocmd BufEnter * silent! lcd %:p:h
" Indents
vmap < <gv
vmap > >gv
" Open NERDTree
nnoremap <leader><enter> :NERDTreeToggle<CR>
" Vimwiki md2html
let g:vimwiki_list = [{
\ 'path': '~/vimwiki',
\ 'template_path': '~/vimwiki/templates/',
\ 'template_default': 'default',
\ 'syntax': 'markdown',
\ 'ext': '.md',
\ 'path_html': '~/vimwiki/site_html/',
\ 'custom_wiki2html': 'vimwiki_markdown',
\ 'template_ext': '.tpl'}]
" Vimwiki
nnoremap <leader>T :VimwikiTable<CR>
" Rust
let g:rustfmt_autosave = 1
" C
let g:clang_complete_auto = 0
let g:clang_auto_select = 0
let g:neoformat_cpp_clangformat = {
\ 'exe': 'clang-format',
\ 'args': ['--style="{IndentWidth: 4}"']
\}
let g:neoformat_enabled_cpp = ['clangformat']
let g:neoformat_enabled_c = ['clangformat']
" Fullscreen on nvim in kitty term
"autocmd VimLeave * :silent !kitty @ set-spacing padding=20 margin=20
"autocmd VimEnter * :silent !kitty @ set-spacing padding=0 margin=0