dotfiles/neovim/init.vim

231 lines
5.1 KiB
VimL
Raw Normal View History

2016-04-21 22:38:34 +02:00
" vim-plug plugin manager
2016-07-15 10:37:06 +02:00
2017-07-19 14:30:20 +02:00
if filereadable(expand("~/.vim/autoload/plug.vim")) || filereadable(expand("~/.config/nvim/autoload/plug.vim")) || filereadable(expand("~\vimfiles\autoload\plug.vim")) || filereadable(expand("~/.local/share/nvim/site/autoload/plug.vim"))
2016-07-15 10:37:06 +02:00
call plug#begin('~/.vim/plugged')
Plug 'benekastah/neomake'
Plug 'SirVer/ultisnips' | Plug 'honza/vim-snippets'
Plug 'junegunn/vim-easy-align'
Plug 'Shougo/deoplete.nvim'
Plug 'vim-scripts/gitignore.vim'
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
Plug 'Xuyuanp/nerdtree-git-plugin'
Plug 'StanAngeloff/php.vim'
Plug 'majutsushi/tagbar'
Plug 'vim-scripts/taglist.vim'
2019-11-19 17:33:52 +01:00
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
2016-07-15 10:37:06 +02:00
Plug 'Townk/vim-autoclose'
Plug 'tpope/vim-fugitive'
Plug 'airblade/vim-gitgutter'
Plug 'vim-latex/vim-latex'
" Plug 'morhetz/gruvbox'
2016-07-15 10:37:06 +02:00
Plug 'dag/vim-fish'
Plug 'KabbAmine/gulp-vim'
Plug 'kovisoft/slimv'
Plug 'vim-php/vim-phpunit'
" Plug 'dracula/vim', {'as': 'dracula'}
Plug 'arcticicestudio/nord-vim'
2016-07-15 10:37:06 +02:00
call plug#end()
else
echom "Didn't find Plug"
endif
2015-12-05 15:31:00 +01:00
set nocompatible
filetype indent plugin on
set wildmenu
set showcmd
set hlsearch
set ignorecase
set smartcase
set backspace=indent,eol,start
set autoindent
set nostartofline
set ruler
set laststatus=2
set confirm
set mouse=a
set cmdheight=2
set number
set pastetoggle=<F11>
set softtabstop=4
set shiftwidth=4
set expandtab
set autoread
let mapleader = ","
let g:mapleader = ","
nmap <leader>w :w!<cr>
" Visual
set so=7
set wildignore=*.o,*~,*.pyc,*.jar
set hid
set whichwrap+=<,>,h,l
set incsearch
set lazyredraw
set magic
set showmatch
set mat=2
set noerrorbells
set novisualbell
set t_vb=
set tm=500
" Color
syntax on
" color dracula
colorscheme nord
" set background=light
2018-02-23 10:03:32 +01:00
" set termguicolors
2015-12-05 15:31:00 +01:00
set cursorline
if has("gui_running")
set guioptions-=T
set guioptions+=e
set t_Co=256
set guitablabel=%M\ %t
2016-04-21 22:38:34 +02:00
if has("gui_gtk2")
set guifont=Hermit\ 10
endif
2015-12-05 15:31:00 +01:00
endif
2016-07-15 10:37:06 +02:00
set t_Co=256
2015-12-05 15:31:00 +01:00
set encoding=utf-8
set ffs=unix,dos,mac
2016-04-21 22:38:34 +02:00
set textwidth=80
set colorcolumn=+1
hi ColorColumn guibg=#2d2d2d ctermbg=238
2015-12-05 15:31:00 +01:00
" Files, Backups and undo
set nobackup
set nowb
set noswapfile
set smarttab
set tabstop=4
set ai
set si
set wrap
map j gj
map k gk
map <space> /
map <c-space> ?
" Smart way to move between windows
map <C-j> <C-W>j
map <C-k> <C-W>k
map <C-h> <C-W>h
map <C-l> <C-W>lmap <leader>tn :tabnew<cr>
map <leader>to :tabonly<cr>
map <leader>tc :tabclose<cr>
map <leader>tm :tabmove
" Opens a new tab with the current buffer's path
" Super useful when editing files in the same directory
map <leader>te :tabedit <c-r>=expand("%:p:h")<cr>/
"
" " Switch CWD to the directory of the open buffer
map <leader>cd :cd %:p:h<cr>:pwd<cr>
"
2016-06-04 07:58:29 +02:00
map <leader>W :w
"
2015-12-05 15:31:00 +01:00
" " Specify the behavior when switching between buffers
try
set switchbuf=useopen,usetab,newtab
set stal=2
catch
endtry
"
" Return to last edit position when opening files (You want this!)
autocmd BufReadPost *
\ if line("'\"") > 0 && line("'\"") <= line("$") |
\ exe "normal! g`\"" |
\ endif
"Remember info about open buffers on close
set viminfo^=%
map 0 ^
" Move a line of text using ALT+[jk] or Comamnd+[jk] on mac
nmap <M-j> mz:m+<cr>`z
nmap <M-k> mz:m-2<cr>`z
vmap <M-j> :m'>+<cr>`<my`>mzgv`yo`z
vmap <M-k> :m'<-2<cr>`>my`<mzgv`yo`z
"
" Delete trailing white space on save, useful for Python and
" CoffeeScript ;)
func! DeleteTrailingWS()
exe "normal mz"
%s/\s\+$//ge
exe "normal `z"
endfunc
autocmd BufWrite *.py :call DeleteTrailingWS()
autocmd BufWrite *.coffee :call DeleteTrailingWS()
2016-04-21 22:38:34 +02:00
" Neomake lint
autocmd! BufWritePost,BufEnter * Neomake
2015-12-05 15:31:00 +01:00
map <leader>ss :setlocal spell!<cr>
" Shortcuts using <leader>
map <leader>sn ]s
map <leader>sp [s
map <leader>sa zg
map <leader>s? z=
"Remove the Windows ^M - when the encodings gets messed up
noremap <Leader>m mmHmt:%s/<C-V><cr>//ge<cr>'tzt'm
" Quickly open a buffer for scripbble
map <leader>q :e ~/buffer<cr>
" Toggle paste mode on and off
map <leader>pp :setlocal paste!<cr>
2016-06-04 07:58:29 +02:00
map <C-n> :NERDTreeToggle<CR>
2015-12-05 15:31:00 +01:00
" My Changes
2016-04-21 22:38:34 +02:00
inoremap jk <ESC>
2015-12-05 15:31:00 +01:00
set listchars=tab:>-,trail:-
set list
2016-04-21 22:38:34 +02:00
set clipboard+=unnamedplus
2015-12-05 15:31:00 +01:00
2016-04-21 22:38:34 +02:00
" Plugin settings
2016-07-15 10:37:06 +02:00
" airline
2015-12-05 15:31:00 +01:00
let g:airline_powerline_fonts = 1
let g:airline#extensions#tabline#enabled = 1
2019-11-19 17:33:52 +01:00
let g:airline_theme='luna'
2015-12-05 15:31:00 +01:00
2016-07-15 10:37:06 +02:00
" deoplete
2016-04-21 22:38:34 +02:00
let g:deoplete#enable_at_startup = 1
2016-07-15 10:37:06 +02:00
let g:deoplete#sources#clang#libclang_path='/usr/lib/llvm-3.6/lib/libclang.so.1'
let g:deoplete#sources#clang#clang_header='/usr/lib/llvm-3.6/lib/clang/3.6.2/include/'
2015-12-05 15:31:00 +01:00
set grepprg=grep\ -nH\ $*
2016-07-15 10:37:06 +02:00
" latexsuite
2015-12-05 15:31:00 +01:00
let g:tex_flavor='latex'
let g:tex_fold_enabled=1
let g:Tex_CompileRule_pdf = 'pdflatex --interaction=nonstopmode $*'
2016-06-04 07:58:29 +02:00
" slimv swank server
let g:slimv_swank_cmd = '! xterm -e sbcl --load /usr/share/common-lisp/source/slime/start-swank.lisp &'
2015-12-05 15:31:00 +01:00
" Filetype specific settings
autocmd Filetype html setlocal ts=2 sts=2 sw=2
autocmd Filetype javascript setlocal ts=2 sts=2 sw=2
autocmd Filetype coffee setlocal ts=2 sts=2 sw=2
2016-06-04 08:25:36 +02:00
autocmd Filetype dart setlocal ts=2 sts=2 sw=2
2016-04-21 22:38:34 +02:00
" Syntax highlighting for HtMd (Hypertext Markdown)
au BufRead,BufNewFile *.htmd set filetype=html