Skip to content

Instantly share code, notes, and snippets.

@rohan-molloy
Forked from albatrossflavour/init.vim
Created October 6, 2021 02:20
Show Gist options
  • Save rohan-molloy/437484c6ac907c1dea84856ad737aeb2 to your computer and use it in GitHub Desktop.
Save rohan-molloy/437484c6ac907c1dea84856ad737aeb2 to your computer and use it in GitHub Desktop.
call plug#begin()
Plug 'elzr/vim-json' " For metadata.json
Plug 'mrk21/yaml-vim' " For hieradata
"Plug 'neoclide/coc.nvim', {'do': { -> coc#util#install()}} " Language Server support
Plug 'rodjek/vim-puppet' " For Puppet syntax highlighting
Plug 'vim-ruby/vim-ruby' " For Facts, Ruby functions, and custom providers
Plug 'vimwiki/vimwiki'
Plug 'airblade/vim-gitgutter'
Plug 'ryanoasis/vim-devicons'
Plug 'vim-ruby/vim-ruby'
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'ii14/onedark.nvim'
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
Plug 'junegunn/fzf.vim'
Plug 'tiagofumo/vim-nerdtree-syntax-highlight'
Plug 'Xuyuanp/nerdtree-git-plugin'
Plug 'jreybert/vimagit'
Plug 'dense-analysis/ale'
Plug 'wakatime/vim-wakatime'
let g:onedark_color_overrides = { "black": {"gui": "#000000", "cterm": "0", "cterm16": "0" }, }
autocmd vimenter * ++nested colorscheme onedark
if has('nvim')
"Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
else
Plug 'Shougo/deoplete.nvim'
Plug 'roxma/nvim-yarp'
Plug 'roxma/vim-hug-neovim-rpc'
endif
let g:deoplete#enable_at_startup = 1
" Track the engine.
Plug 'SirVer/ultisnips'
" Snippets are separated from the engine. Add this if you want them:
Plug 'honza/vim-snippets'
" Trigger configuration. You need to change this to something other than <tab> if you use one of the following:
" - https://github.com/Valloric/YouCompleteMe
" - https://github.com/nvim-lua/completion-nvim
let g:UltiSnipsExpandTrigger="<tab>"
"let g:UltiSnipsJumpForwardTrigger="<c-b>"
let g:UltiSnipsJumpForwardTrigger="<tab>"
let g:UltiSnipsJumpBackwardTrigger="<c-b>"
" If you want :UltiSnipsEdit to split your window.
let g:UltiSnipsEditSplit="vertical"
let g:vimwiki_table_mappings = 0
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggleVCS' }
augroup nerd_loader
autocmd!
autocmd VimEnter * silent! autocmd! FileExplorer
autocmd BufEnter,BufNew *
\ if isdirectory(expand('<amatch>'))
\| call plug#load('nerdtree')
\| execute 'autocmd! nerd_loader'
\| endif
augroup END
"autocmd BufEnter * if &modifiable | NERDTreeFind | wincmd p | endif
nnoremap <Leader>diary i# <++><CR>## Worklog<ESC>
nnoremap <Leader>now i**<ESC>:r!date<CR>kJxA**<CR><CR>
nnoremap <Leader>tags :VimwikiGenerateTagLinks<cr>
nnoremap <C-r> :NERDTreeFind<cr><C-w><C-w>
nnoremap <C-n> :NERDTreeToggleVCS<CR>
"autocmd VimEnter * NERDTree | wincmd p
" Exit Vim if NERDTree is the only window left.
autocmd BufEnter * if tabpagenr('$') == 1 && winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() |
\ quit | endif
let NERDTreeShowHidden=1
" If another buffer tries to replace NERDTree, put it in the other window, and bring back NERDTree.
autocmd BufEnter * if bufname('#') =~ 'NERD_tree_\d\+' && bufname('%') !~ 'NERD_tree_\d\+' && winnr('$') > 1 |
\ let buf=bufnr() | buffer# | execute "normal! \<C-W>w" | execute 'buffer'.buf | endif
" Map \a to the Ag search from fzf
nmap <Leader>a :Ag
nmap <Leader>t :Tags<CR>
let g:indentLine_setConceal = 0
let g:vim_json_syntax_conceal = 0
call plug#end()
set background=dark
set undofile
set undolevels=1000
" Theme
colorscheme onedark
"Completion
autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o
set ofu=syntaxcomplete#Complete
"General
syntax on
" colorscheme jellybeans
set nu
set hlsearch
filetype plugin indent on
set nocp
set ruler
set wildmenu
"set mouse+=a
set mouse=nvc
set termguicolors
set t_Co=256
"Code folding
set nofoldenable
"Tabs and spacing
set encoding=UTF-8
set smartindent
set autoindent
set cindent
set tabstop=2
set expandtab
set shiftwidth=2
set smarttab
"Search
set hlsearch
set incsearch
set ignorecase
set smartcase
set diffopt +=iwhite
set formatoptions=cotqr
set clipboard+=unnamedplus
let g:airline_powerline_fonts = 1
"let g:airline_theme='base16'
set laststatus=2
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*
" Set this. Airline will handle the rest.
let g:airline#extensions#ale#enabled = 1
au BufNewFile,BufRead *.py
\ set tabstop=4 |
\ set softtabstop=4 |
\ set shiftwidth=4 |
\ set textwidth=79 |
au BufRead,BufNewFile *.md
\ set spell tabstop=4 |
\ set shiftwidth=4 |
\ set nofoldenable |
\ set concealcursor=v |
\ set conceallevel=2
au BufRead,BufNewFile *.taskpaper
\ set spell tabstop=4 shiftwidth=4 noexpandtab
" Set up puppet manifest and spec options
au BufRead,BufNewFile *.pp
\ set filetype=puppet iskeyword-=:
highlight LiteralTabs ctermbg=darkgreen guibg=darkgreen
match LiteralTabs /\s\ /
highlight ExtraWhitespace ctermbg=darkgreen guibg=darkgreen
match ExtraWhitespace /\s\+$/
if has('win32')
set guifont=Consolas:h14 " Win32.
elseif has('gui_macvim')
set guifont=Monaco:h14 " OSX.
set gfn=DejaVu\ Sans\ Mono\ for\ Powerline:h24
else
set guifont=Monospace\ 14 " Linux.
endif
"let g:wiki_root = '~/txt'
"let g:wiki_filetypes = ['md']
" Vimwiki
let g:vimwiki_list = [{'path': '~/txt/',
\ 'syntax': 'markdown',
\ 'ext': '.md',
\ 'auto_generate_tags': 1,
\ 'auto_toc': 1,
\ 'auto_tags': 1}]
" Uncomment the following to have Vim jump to the last position when
" reopening a file
if has("autocmd")
au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
endif
set number relativenumber
set rnu
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment