My dotfiles
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.

151 lines
3.8 KiB

  1. call plug#begin('~/.vim/plugged')
  2. "{{ The Basics }}
  3. Plug 'joshdick/onedark.vim' " Colors
  4. Plug 'itchyny/lightline.vim' " Lightline statusbar
  5. "{{ File management }}
  6. Plug 'scrooloose/nerdtree' " Nerdtree
  7. Plug 'tiagofumo/vim-nerdtree-syntax-highlight' " Highlighting Nerdtree
  8. Plug 'ryanoasis/vim-devicons' " Icons for Nerdtree
  9. "{{ Syntax Highlighting and Colors }}
  10. Plug 'ap/vim-css-color' " Color previews for CSS
  11. "{{ Junegunn Choi Plugins }}
  12. Plug 'junegunn/limelight.vim' " Hyperfocus on a range
  13. Plug 'junegunn/fzf.vim'
  14. call plug#end()
  15. " for transparent background
  16. function! AdaptColorscheme()
  17. highlight clear CursorLine
  18. highlight Normal ctermbg=none
  19. highlight LineNr ctermbg=none
  20. highlight Folded ctermbg=none
  21. highlight NonText ctermbg=none
  22. highlight SpecialKey ctermbg=none
  23. highlight VertSplit ctermbg=none
  24. highlight SignColumn ctermbg=none
  25. endfunction
  26. autocmd ColorScheme * call AdaptColorscheme()
  27. set cursorline
  28. " colorscheme
  29. syntax on
  30. " brackets
  31. inoremap " ""<left>
  32. inoremap ' ''<left>
  33. inoremap ( ()<left>
  34. inoremap [ []<left>
  35. inoremap { {}<left>
  36. inoremap {<CR> {<CR>}<ESC>O
  37. inoremap {;<CR> {<CR>};<ESC>O
  38. filetype plugin on
  39. let g:instant_markdown_browser = "firefox --new-window"
  40. " Make Vim more useful
  41. set nocompatible
  42. " Long lines as one line
  43. set nowrap
  44. " Ruler
  45. set ruler
  46. " Horizontal splits will automatically be below
  47. set splitbelow
  48. " Vertical splits will automatically be to the right
  49. set splitright
  50. " Indent
  51. set smartindent
  52. set autoindent
  53. " Use the OS clipboard by default (on versions compiled with `+clipboard`)
  54. set clipboard+=unnamedplus
  55. " Enhance command-line completion
  56. set wildmenu
  57. " Disables automatic commenting on newline:
  58. autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o
  59. " Allow cursor keys in insert mode
  60. " Allow backspace in insert mode
  61. set backspace=indent,eol,start
  62. " Optimize for fast terminal connections
  63. set ttyfast
  64. " Add the g flag to search/replace by default
  65. set gdefault
  66. " Use UTF-8 without BOM
  67. set encoding=utf-8
  68. " Change mapleader
  69. let mapleader=","
  70. " Don’t add empty newlines at the end of files
  71. set binary
  72. set noeol
  73. " 256 colors
  74. set t_Co=256
  75. " Respect modeline in files
  76. set modeline
  77. set modelines=4
  78. " Enable per-directory .vimrc files and disable unsafe commands in them
  79. set exrc
  80. set secure
  81. " Enable line numbers
  82. set number
  83. " Make tabs as wide as two spaces
  84. set tabstop=4
  85. set shiftwidth=4
  86. set smarttab
  87. set expandtab
  88. " Highlight searches
  89. set hlsearch
  90. " Ignore case of searches
  91. set ignorecase
  92. " Highlight dynamically as pattern is typed
  93. set incsearch
  94. " Always show status line
  95. set laststatus=2
  96. " Enable mouse in all modes
  97. set mouse=a
  98. " Disable error bells
  99. set noerrorbells
  100. " Don’t reset cursor to start of line when moving around.
  101. set nostartofline
  102. " Show the cursor position
  103. set ruler
  104. " Don’t show the intro message when starting Vim
  105. set shortmess=atI
  106. " Show the current mode
  107. set showmode
  108. " Show the filename in the window titlebar
  109. set title
  110. " Show the (partial) command as it’s being typed
  111. set showcmd
  112. " Use relative line numbers
  113. if exists("&relativenumber")
  114. set relativenumber
  115. au BufReadPost * set relativenumber
  116. endif
  117. " Start scrolling three lines before the horizontal window border
  118. set scrolloff=3
  119. " Better tabbing
  120. vnoremap < <gv
  121. vnoremap > >gv
  122. " Better window navigation
  123. nnoremap <C-h> <C-w>h
  124. nnoremap <C-j> <C-w>j
  125. nnoremap <C-k> <C-w>k
  126. nnoremap <C-l> <C-w>l
  127. map <Leader>c :w! \| !make <CR>
  128. map <Leader>r <c-w>v <c-w>l :terminal ./run.sh <c-r>% <CR>a
  129. map <Leader>t :!st&<CR><CR>
  130. map <Leader>o :FZF<CR>
  131. " Insert mode completion
  132. imap <c-x><c-k> <plug>(fzf-complete-word)
  133. imap <c-x><c-f> <plug>(fzf-complete-path)
  134. imap <c-x><c-l> <plug>(fzf-complete-line)
  135. vnoremap <C-c> "+y