summaryrefslogtreecommitdiff
path: root/vim.nix
blob: b72c9424ea44253cb5b572bb11e2949083cf795c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
{ pkgs, vimUtils, fetchFromGitHub }:

let
  vim-sexp = vimUtils.buildVimPluginFrom2Nix {
    name = "elm.vim-2017-07-09";
    src = fetchFromGitHub {
      owner = "guns";
      repo = "vim-sexp";
      rev = "12292941903d9ac8151513189d2007e1ccfc95f0";
      sha256 = "1mfqbmrbqgnsc34pmcsrc0c5zvgxhhnw4hx4g5wbssfk1ddyx6y0";
    };
    dependencies = [];
  };
in
{
  enable = true;
  plugins = [
    "sensible"
    "colors-solarized"
    "fugitive"
    "editorconfig-vim"
  ];
  settings = {
    ignorecase = true;
    expandtab = true;
    history = 1000;
    tabstop = 4;
  };
  extraConfig = ''
    set cuc cul        " Crosshair
    set cc=80          " 80 column lines
    set linebreak      " Break lines at word (requires Wrap lines)
    set textwidth=80   " Line wrap (number of cols)
    set showmatch      " Highlight matching brace
    set visualbell     " Use visual bell (no beeping)
    set hlsearch       " Highlight all search results
    set smartcase      " Enable smart-case search
    set shiftwidth=4   " Number of auto-indent spaces
    set smartindent    " Enable smart-indent
    imap fd <Esc>
    set mouse=a
    ""
    "" https://github.com/lifepillar/vim-solarized8#troubleshooting
    let &t_8f = "\<Esc>[38:2:%lu:%lu:%lum"
    let &t_8b = "\<Esc>[48:2:%lu:%lu:%lum"
    set termguicolors
    "" Auto-switch theme
    let hour = strftime("%H")
    if 6 <= hour && hour < 18
      set background=light
    else
      set background=dark
    endif
    let g:solarized_termcolors=256
    colorscheme solarized8
  '';
}