summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/init.vim169
-rw-r--r--modules/neovim.nix34
2 files changed, 203 insertions, 0 deletions
diff --git a/modules/init.vim b/modules/init.vim
new file mode 100644
index 0000000..99b1938
--- /dev/null
+++ b/modules/init.vim
@@ -0,0 +1,169 @@
1let &t_ZM = "\e[3m"
2
3" augroups
4
5augroup plaintext
6 autocmd!
7 autocmd FileType text,markdown setlocal ts=2 sts=2 sw=2 expandtab textwidth=60
8augroup END
9
10augroup webdev
11 autocmd!
12 autocmd FileType less,css,html,js?,ts? setlocal ts=2 sts=2 sw=2 expandtab
13 autocmd FileType less,css,html nnoremap <Leader>s viB:sort<cr>
14augroup END
15
16augroup lisp_stuff
17 autocmd!
18 autocmd BufReadPost *.lisp set filetype=scheme
19augroup END
20
21augroup yankhl
22 autocmd!
23 autocmd TextYankPost * silent! lua require'vim.highlight'.on_yank()
24augroup END
25
26augroup restorecursor
27 autocmd BufReadPost *
28 \ if line("'\"") > 1 && line("'\"") <= line("$") |
29 \ execute "normal! g`\"" |
30 \ endif
31augroup END
32
33augroup fzfstatus
34 if has('nvim') && !exists('g:fzf_layout')
35 autocmd! FileType fzf
36 autocmd FileType fzf set laststatus=0 noshowmode noruler
37 \| autocmd BufLeave <buffer> set laststatus=2 showmode ruler
38 endif
39augroup END
40
41" general settings
42set nobackup
43set nowritebackup
44set noswapfile " get rid of swapfiles everywhere
45set dir=/tmp
46
47syntax on
48
49set omnifunc=syntaxcomplete#Complete
50set completefunc=LanguageClient#complete
51set list
52filetype off
53filetype plugin indent on
54set laststatus=2
55set nowrap
56set noshowmode
57set listchars=tab:┊\ ,nbsp:␣,trail:·,extends:>,precedes:<
58set fillchars=vert:\│,stl:\ ,stlnc:\
59set ignorecase
60set smartcase
61set sidescroll=40
62set incsearch
63set hlsearch
64set undofile
65set undodir=~/tmp
66set path+=**
67set backspace=indent,eol,start
68set hidden
69set wildmenu
70set complete=.,w,b,i,u,t,
71set background=dark
72set mouse=a
73set conceallevel=0
74set nonumber
75set grepprg=rg\ --vimgrep\ --no-heading
76set grepformat=%f:%l:%c:%m,%f:%l:%m
77set cmdheight=2
78set shortmess+=c
79set updatetime=300
80set signcolumn=yes
81set inccommand=split
82set showmatch
83set diffopt+=vertical
84set completeopt=menu,menuone,noselect
85set exrc
86
87let g:netrw_browsex_viewer= "xdg-open"
88
89colorscheme plain
90
91set shiftwidth=4 " indent = 4 spaces
92set expandtab
93set tabstop=4 " tab = 4 spaces
94set softtabstop=4 " backspace through spaces
95
96" Functions
97function! GetTabber() " a lil function that integrates well with Tabular.vim
98 let c = nr2char(getchar())
99 :execute 'Tabularize /' . c
100endfunction
101
102" Ugh
103command! WQ wq
104command! Wq wq
105command! Wqa wqa
106command! WQa wqa
107command! W w
108command! Q q
109
110" abbreviations
111abclear
112iab #i #include
113iab #d #define
114cab dst put =strftime('%d %a, %b %Y')<cr>
115cab vg vimgrep
116cab vga vimgrepadd
117cab bfd bufdo
118
119" man pages
120let g:ft_man_open_mode = 'tab'
121
122let g:gitgutter_override_sign_column_highlight = 0
123let g:gitgutter_sign_added = '+'
124let g:gitgutter_sign_modified = '~'
125let g:gitgutter_sign_removed = '-'
126let g:gitgutter_sign_removed_first_line = '-'
127let g:gitgutter_sign_modified_removed = '~'
128
129let g:fzf_colors =
130 \ { 'fg': ['fg', 'Noise'],
131 \ 'bg': ['bg', 'Noise'],
132 \ 'hl': ['fg', 'Statement'],
133 \ 'fg+': ['fg', 'CursorLine', 'CursorColumn', 'Normal'],
134 \ 'bg+': ['bg', 'CursorLine', 'CursorColumn'],
135 \ 'hl+': ['fg', 'Statement'],
136 \ 'info': ['fg', 'PreProc'],
137 \ 'border': ['fg', 'Ignore'],
138 \ 'prompt': ['fg', 'Conditional'],
139 \ 'pointer': ['fg', 'Exception'],
140 \ 'marker': ['fg', 'Keyword'],
141 \ 'spinner': ['fg', 'Label'],
142 \ 'header': ['fg', 'Comment'] }
143let g:fzf_layout = { 'down': '40%' }
144let g:fzf_preview_window = []
145
146highlight GitGutterAdd ctermfg=8
147highlight GitGutterChange ctermfg=8
148highlight GitGutterDelete ctermfg=8
149
150let g:rustfmt_autosave = 1
151
152let g:latex_view_general_viewer = "zathura"
153let g:vimtex_view_method = "zathura"
154let g:tex_flavor = 'latex'
155
156let g:elm_setup_keybindings = 0
157
158sign define LspDiagnosticsSignError text=× texthl=LspDiagnosticsSignError linehl= numhl=
159sign define LspDiagnosticsSignWarning text=\! texthl=LspDiagnosticsSignWarning linehl= numhl=
160sign define LspDiagnosticsSignInformation text=i texthl=LspDiagnosticsSignInformation linehl= numhl=
161sign define LspDiagnosticsSignHint text=\~ texthl=LspDiagnosticsSignHint linehl= numhl=
162
163let g:user_emmet_leader_key='<C-X>'
164
165lua << EOF
166require 'lspconfig'
167require 'treesitter'
168require 'completions'
169EOF
diff --git a/modules/neovim.nix b/modules/neovim.nix
new file mode 100644
index 0000000..1897223
--- /dev/null
+++ b/modules/neovim.nix
@@ -0,0 +1,34 @@
1{ config, pkgs, ... }:
2
3{
4 programs.neovim = {
5 enable = true;
6 defaultEditor = true;
7 viAlias = true;
8 vimAlias = true;
9 vimdiffAlias = true;
10 extraConfig = builtins.readFile ./init.vim;
11 plugins = with pkgs.vimPlugins; [
12 # lsp
13 nvim-lspconfig
14 nvim-cmp
15 (nvim-treesitter.withPlugins (_: pkgs.tree-sitter.allGrammars))
16 # autocompletion
17 cmp-nvim-lsp
18 cmp-buffer
19 cmp-path
20 cmp-cmdline
21 # tpope
22 vim-surround
23 vim-fugitive
24 # syntax
25 vim-nix
26 vimtex
27 # others
28 vim-gitgutter
29 tabular
30 vimwiki
31 fzf-vim
32 ];
33 };
34}