diff options
author | Adrian Kummerlaender | 2018-04-26 22:37:45 +0200 |
---|---|---|
committer | Adrian Kummerlaender | 2018-04-26 22:37:45 +0200 |
commit | ea4af5f29c5c28a85256fdd3691d4999169c2587 (patch) | |
tree | 0f7b114b2b576a9816bf44b7551691a3b7ad9a71 | |
parent | 22c86fd90682ee3964b85b10114f4e90663a14e0 (diff) | |
download | nixos_system-ea4af5f29c5c28a85256fdd3691d4999169c2587.tar nixos_system-ea4af5f29c5c28a85256fdd3691d4999169c2587.tar.gz nixos_system-ea4af5f29c5c28a85256fdd3691d4999169c2587.tar.bz2 nixos_system-ea4af5f29c5c28a85256fdd3691d4999169c2587.tar.lz nixos_system-ea4af5f29c5c28a85256fdd3691d4999169c2587.tar.xz nixos_system-ea4af5f29c5c28a85256fdd3691d4999169c2587.tar.zst nixos_system-ea4af5f29c5c28a85256fdd3691d4999169c2587.zip |
Update vim configuration
-rw-r--r-- | configuration.nix | 2 | ||||
-rw-r--r-- | pkgs/vim/conf/rc.vim | 41 | ||||
-rw-r--r-- | pkgs/vim/conf/vim-color-akr/autoload/airline/themes/akr.vim | 100 | ||||
-rw-r--r-- | pkgs/vim/custom.nix | 3 | ||||
-rw-r--r-- | pkgs/vim/plugins.nix | 10 |
5 files changed, 141 insertions, 15 deletions
diff --git a/configuration.nix b/configuration.nix index a066ac6..eba0215 100644 --- a/configuration.nix +++ b/configuration.nix @@ -82,7 +82,7 @@ systemPackages = let custom_vim = import ./pkgs/vim/vim.nix pkgs; in with pkgs; [ - ntfs3g htop fish custom_vim + ntfs3g htop fish git silver-searcher custom_vim ]; shellAliases = { diff --git a/pkgs/vim/conf/rc.vim b/pkgs/vim/conf/rc.vim index bc41351..090c08b 100644 --- a/pkgs/vim/conf/rc.vim +++ b/pkgs/vim/conf/rc.vim @@ -39,38 +39,52 @@ nmap <backspace> :e#<CR> nmap f za nmap F zA -autocmd InsertEnter * :setlocal nohlsearch -autocmd InsertLeave * :setlocal hlsearch +autocmd InsertEnter * :setlocal nohlsearch +autocmd InsertLeave * :setlocal hlsearch autocmd FileType scheme setlocal shiftwidth=2 tabstop=2 expandtab autocmd FileType lisp setlocal shiftwidth=2 tabstop=2 expandtab autocmd FileType racket setlocal shiftwidth=2 tabstop=2 expandtab autocmd FileType pandoc setlocal nonumber autoread +autocmd FileType pandoc let g:airline#extensions#whitespace#checks=['indent', 'trailing', 'long'] autocmd FileType tex set conceallevel=2 -vnoremap cc "+y -nnoremap cc "+p - -nnoremap <C-left> gT +nnoremap <C-left> gT nnoremap <C-right> gt nnoremap <space> @q nnoremap J } nnoremap K { -nmap <Left> << +nmap <Left> << nmap <Right> >> -vmap <Left> <gv +vmap <Left> <gv vmap <Right> >gv -nmap <Up> [e +nmap <Up> [e nmap <Down> ]e -vmap <Up> [egv +vmap <Up> [egv vmap <Down> ]egv -nnoremap <A-left> <C-W>h +nnoremap <A-left> <C-W>h nnoremap <A-right> <C-W>l -nnoremap <A-up> <C-W>k -nnoremap <A-down> <C-W>j +nnoremap <A-up> <C-W>k +nnoremap <A-down> <C-W>j + +set laststatus=2 +let g:airline#extensions#tabline#enabled = 1 +let g:airline#extensions#tabline#show_buffers = 0 +let g:airline#extensions#tabline#show_tab_type = 0 +let g:airline#extensions#tabline#formatter = 'unique_tail_improved' +let g:airline#extensions#tabline#buffer_idx_mode = 0 +let g:airline#extensions#tabline#left_sep = '' +let g:airline#extensions#tabline#left_alt_sep = '' +let g:airline#extensions#tabline#right_sep = '' +let g:airline#extensions#tabline#right_alt_sep = '' +let g:airline#extensions#tabline#show_close_button = 0 +let g:airline#extensions#tabline#show_splits = 0 +let g:airline#extensions#tabline#show_tab_nr = 0 +let g:airline#extensions#whitespace#mixed_indent_algo = 2 + let g:gitgutter_enabled = 0 let g:gitgutter_highlight_lines = 1 @@ -85,6 +99,7 @@ nnoremap <F8> :TagbarToggle<CR> nnoremap <F12> :Goyo<CR> nnoremap <c-b> :CtrlPBuffer<CR> +nnoremap <c-m> :CtrlPMixed<CR> nnoremap <c-t> :CtrlPTag<CR> nnoremap <a-t> :CtrlPBufTag<CR> diff --git a/pkgs/vim/conf/vim-color-akr/autoload/airline/themes/akr.vim b/pkgs/vim/conf/vim-color-akr/autoload/airline/themes/akr.vim new file mode 100644 index 0000000..32582c9 --- /dev/null +++ b/pkgs/vim/conf/vim-color-akr/autoload/airline/themes/akr.vim @@ -0,0 +1,100 @@ +" Each theme is contained in its own file and declares variables scoped to the +" file. These variables represent the possible "modes" that airline can +" detect. The mode is the return value of mode(), which gets converted to a +" readable string. The following is a list currently supported modes: normal, +" insert, replace, visual, and inactive. +" +" Each mode can also have overrides. These are small changes to the mode that +" don't require a completely different look. "modified" and "paste" are two +" such supported overrides. These are simply suffixed to the major mode, +" separated by an underscore. For example, "normal_modified" would be normal +" mode where the current buffer is modified. +" +" The theming algorithm is a 2-pass system where the mode will draw over all +" parts of the statusline, and then the override is applied after. This means +" it is possible to specify a subset of the theme in overrides, as it will +" simply overwrite the previous colors. If you want simultaneous overrides, +" then they will need to change different parts of the statusline so they do +" not conflict with each other. +" +" First, let's define an empty dictionary and assign it to the "palette" +" variable. The # is a separator that maps with the directory structure. If +" you get this wrong, Vim will complain loudly. +let g:airline#themes#akr#palette = {} + +" First let's define some arrays. The s: is just a VimL thing for scoping the +" variables to the current script. Without this, these variables would be +" declared globally. Now let's declare some colors for normal mode and add it +" to the dictionary. The array is in the format: +" [ guifg, guibg, ctermfg, ctermbg, opts ]. See "help attr-list" for valid +" values for the "opt" value. +let s:N1 = [ '#212121' , '#909636' , 0 , 10 ] +let s:N2 = [ '#909636' , '#212121' , 10 , 0 ] +let s:N3 = [ '#909636' , '#212121' , 10 , 0 ] +let g:airline#themes#akr#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3) + +" Here we define overrides for when the buffer is modified. This will be +" applied after g:airline#themes#akr#palette.normal, hence why only certain keys are +" declared. +let g:airline#themes#akr#palette.normal_modified = { + \ 'airline_c': [ '#212121' , '#352F6A' , 0 , 4 , '' ] , + \ } + +let s:I1 = [ '#E4E093' , '#352F6A' , 3 , 4 ] +let s:I2 = [ '#909636' , '#212121' , 10 , 0 ] +let s:I3 = [ '#909636' , '#212121' , 10 , 0 ] +let g:airline#themes#akr#palette.insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3) +let g:airline#themes#akr#palette.insert_modified = { + \ 'airline_c': [ '#212121' , '#352F6A' , 0 , 4 , '' ] , + \ } +let g:airline#themes#akr#palette.insert_paste = { + \ 'airline_a': [ s:I1[0] , '#352F6A' , s:I1[2] , 4 , '' ] , + \ } + +let g:airline#themes#akr#palette.replace = copy(g:airline#themes#akr#palette.insert) +let g:airline#themes#akr#palette.replace.airline_a = [ s:I2[0] , '#af0000' , s:I2[2] , 124 , '' ] +let g:airline#themes#akr#palette.replace_modified = g:airline#themes#akr#palette.insert_modified + + +let s:V1 = [ '#E4E093' , '#8C3346' , 3 , 1 ] +let s:V2 = [ '#909636' , '#212121' , 10 , 0 ] +let s:V3 = [ '#909636' , '#212121' , 10 , 0 ] +let g:airline#themes#akr#palette.visual = airline#themes#generate_color_map(s:V1, s:V2, s:V3) +let g:airline#themes#akr#palette.visual_modified = { + \ 'airline_c': [ '#212121' , '#8C3346' , 0 , 1 , '' ] , + \ } + + +let s:IA1 = [ '#605c5a' , '#212121' , 0 , 0 , '' ] +let s:IA2 = [ '#605c5a' , '#212121' , 0 , 0 , '' ] +let s:IA3 = [ '#605c5a' , '#212121' , 0 , 0 , '' ] +let g:airline#themes#akr#palette.inactive = airline#themes#generate_color_map(s:IA1, s:IA2, s:IA3) +let g:airline#themes#akr#palette.inactive_modified = { + \ 'airline_c': [ '' , '' , 97 , '' , '' ] , + \ } + + +" Accents are used to give parts within a section a slightly different look or +" color. Here we are defining a "red" accent, which is used by the 'readonly' +" part by default. Only the foreground colors are specified, so the background +" colors are automatically extracted from the underlying section colors. What +" this means is that regardless of which section the part is defined in, it +" will be red instead of the section's foreground color. You can also have +" multiple parts with accents within a section. +let g:airline#themes#akr#palette.accents = { + \ 'red': [ '#ff0000' , '' , 9 , '' ] + \ } + + +" Here we define the color map for ctrlp. We check for the g:loaded_ctrlp +" variable so that related functionality is loaded iff the user is using +" ctrlp. Note that this is optional, and if you do not define ctrlp colors +" they will be chosen automatically from the existing palette. +if !get(g:, 'loaded_ctrlp', 0) + finish +endif +let g:airline#themes#akr#palette.ctrlp = airline#extensions#ctrlp#generate_color_map( + \ [ '#909636' , '#212121' , 10 , 0 , '' ], + \ [ '#909636' , '#212121' , 10 , 0 , '' ], + \ [ '#212121' , '#909636' , 0 , 10 , 'bold' ]) + diff --git a/pkgs/vim/custom.nix b/pkgs/vim/custom.nix index 32700f6..0198ac7 100644 --- a/pkgs/vim/custom.nix +++ b/pkgs/vim/custom.nix @@ -11,12 +11,15 @@ in { names = [ "ctrlp" "undotree" + "vim-unimpaired" + "vim-airline" "vim-gitgutter" "goyo" "vim-localvimrc" "tagbar" "vim-addon-nix" "vim-autoformat" + "vim-polyglot" "vim-csexact" "vim-color-akr" ];} diff --git a/pkgs/vim/plugins.nix b/pkgs/vim/plugins.nix index 755ccf3..41360e3 100644 --- a/pkgs/vim/plugins.nix +++ b/pkgs/vim/plugins.nix @@ -11,8 +11,16 @@ in { sha256 = "1kwpxk68prdpzw4b7mpfwh2vq99gfymr544wzwcm072h2x89s1dv"; }; }; + "vim-unimpaired" = buildVimPlugin { + name = "vim-unimpaired"; + src = fetchgit { + url = "https://github.com/tpope/vim-unimpaired"; + rev = "bacf1543cc957d47aa70c1dc0bcf99392925b008"; + sha256 = "0jx9xybjswnaa6v7hhfqm2nyd5v54xjd02ikw56wm7h6sfgchllx"; + }; + }; "vim-color-akr" = buildVimPlugin { name = "vim-csexact"; - src = ./conf/vim-color-akr; + src = ./conf/vim-color-akr; }; } |