| Action | Notepad++ shortcut | Vim shortcut |
|---|---|---|
| Duplicate line | Ctrl+D |
yyp |
| Cut line | Ctrl+L |
dd |
| Move line up/down | Ctrl+Shift+<up/down> |
dd<k/j>p |
| Compare files | File compare plugin wizard | :vsplit <filename> or vimdiff file1 file2 (from command line) |
| Select all (from here to top/bottom of file) | Ctrl+Shift+<home/end> |
v<gg/G> |
| Select all (from here up/down one page) | Ctrl+Shift+ |
v Ctrl+ |
NOTE: Specific examples given for options, flags, commands variations, etc., are not comprehensive.
Vim has 2 main "modes", that chance the behavior of all your keys. The default mode of Vim is Normal Mode and is mostly used for moving the cursor and navigating the current file.
Some important (or longer) commands begin with ":" and you will see the text you enter next at the bottom left of the screen.
:q[uit] - quit (the current window of) Vim. ("Window" here is internal to Vim, not if you have multiple OS-level windows of Vim open at once.)
:q! - force quit (if the current buffer has been changed since the last save)
:e[dit] {filename} - read file {filename} into a new buffer.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| pbp_2016 <- read_csv("~/Downloads/pbp_2016.csv") | |
| a <- pbp_2016 %>% group_by(GameID, posteam) %>% summarize(top = sum(PlayTimeDiff), end_score = max(PosTeamScore, na.rm=TRUE), numplays = n()) %>% filter(posteam != "NA") %>% group_by(GameID) %>% mutate(teamNum = row_number()) %>% select(GameID, top, numplays, teamNum, end_score) | |
| score <- a %>% select(GameID, teamNum, end_score) %>% spread(teamNum, end_score, sep="_") | |
| numplays <- a %>% select(GameID, teamNum, numplays) %>% spread(teamNum, numplays, sep="_") | |
| top <- a %>% select(GameID, teamNum, top) %>% spread(teamNum, top, sep="_") | |
| colnames(top) <- c("GameID", "top_1", "top_2") | |
| colnames(score) <- c("GameID", "score_1", "score_2") | |
| colnames(numplays) <- c("GameID", "numplays_1", "numplays_2") | |
| final <- inner_join(numplays,score, by="GameID") %>% inner_join(top, by="GameID") %>% mutate(winner_1 = as.integer(score_1 > score_2)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # GNU Fortran (gfortran) compiler, OpenBLAS BLAS and LAPACK libraries | |
| gfortran -Wall -ffree-form -ffree-line-length-256 -o ~/ado/plus/r/rcr rcrlib_gnu.f90 rcrutil_gnu.f90 rcr.f90 -L/~/lib/OpenBLAS -lopenblas | |
| rm *.mod |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using JuMP | |
| using Ipopt | |
| function datagen(N::Int64,T::Int64) | |
| ## Generate data for a linear model to test optimization | |
| srand(1234) | |
| # N = convert(Int64,N) #inputs to functions such as -ones- need to be integers! | |
| # T = convert(Int64,T) #inputs to functions such as -ones- need to be integers! | |
| n = N*T |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| sysuse auto, clear | |
| logit foreign i.rep78 c.price c.mpg | |
| predict base if e(sample), pr | |
| preserve | |
| clonevar oldrep78 = rep78 | |
| replace rep78 = 4 | |
| predict new if e(sample), pr | |
| generat mfx = new-base | |
| replace rep78 = oldrep78 | |
| tab rep78 , sum(mfx) |
NewerOlder